2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project 64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
#include "N64 Types.h"
|
|
|
|
|
2015-02-14 03:10:05 +00:00
|
|
|
class CN64Rom :
|
|
|
|
protected CDebugSettings
|
2015-04-28 22:19:02 +00:00
|
|
|
{
|
2008-09-18 03:15:49 +00:00
|
|
|
//constant values
|
|
|
|
enum { ReadFromRomSection = 0x400000 };
|
|
|
|
|
|
|
|
//class variables
|
|
|
|
HANDLE m_hRomFile, m_hRomFileMapping;
|
|
|
|
BYTE * m_ROMImage;
|
|
|
|
DWORD m_RomFileSize;
|
|
|
|
Country m_Country;
|
|
|
|
CICChip m_CicChip;
|
|
|
|
LanguageStringID m_ErrorMsg;
|
|
|
|
stdstr m_RomName, m_FileName, m_MD5, m_RomIdent;
|
|
|
|
|
|
|
|
bool AllocateAndLoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly );
|
|
|
|
bool AllocateAndLoadZipImage ( const char * FileLoc, bool LoadBootCodeOnly );
|
2015-04-28 22:19:02 +00:00
|
|
|
void ByteSwapRom ();
|
|
|
|
void SetError ( LanguageStringID ErrorMsg );
|
2015-03-05 06:09:58 +00:00
|
|
|
static void __stdcall NotificationCB ( LPCWSTR Status, CN64Rom * _this );
|
2015-04-28 22:19:02 +00:00
|
|
|
void CalculateCicChip ();
|
2015-06-15 13:05:04 +00:00
|
|
|
void CalculateRomCrc ();
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
public:
|
2015-04-28 22:19:02 +00:00
|
|
|
CN64Rom();
|
|
|
|
~CN64Rom();
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
bool LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly = false );
|
2012-09-26 14:42:28 +00:00
|
|
|
static bool IsValidRomImage( BYTE Test[4] );
|
2015-02-24 21:44:06 +00:00
|
|
|
void SaveRomSettingID ( bool temp );
|
2015-04-28 22:19:02 +00:00
|
|
|
void ClearRomSettingID ();
|
|
|
|
CICChip CicChipID ();
|
|
|
|
BYTE * GetRomAddress () { return m_ROMImage; }
|
|
|
|
DWORD GetRomSize () const { return m_RomFileSize; }
|
|
|
|
stdstr GetRomMD5 () const { return m_MD5; }
|
|
|
|
stdstr GetRomName () const { return m_RomName; }
|
|
|
|
stdstr GetFileName () const { return m_FileName; }
|
|
|
|
Country GetCountry () const { return m_Country; }
|
|
|
|
void UnallocateRomImage ();
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
//Get a message id for the reason that you failed to load the rom
|
2015-04-28 22:19:02 +00:00
|
|
|
LanguageStringID GetError () const { return m_ErrorMsg; }
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|