project64/Source/Project64-core/N64System/N64RomClass.h

64 lines
2.6 KiB
C
Raw Normal View History

2012-12-19 09:30:18 +00:00
/****************************************************************************
* *
2015-11-10 05:21:49 +00:00
* Project64 - A Nintendo 64 emulator. *
2012-12-19 09:30:18 +00:00
* 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
2015-12-06 09:59:58 +00:00
#include <Project64-core/N64System/N64Types.h>
#include <Project64-core/Settings/DebugSettings.h>
class CN64Rom :
2015-11-15 09:56:34 +00:00
protected CDebugSettings
{
public:
2015-11-15 09:56:34 +00:00
CN64Rom();
~CN64Rom();
2015-11-15 09:56:34 +00:00
bool LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly = false);
2016-01-25 19:58:57 +00:00
bool LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly = false);
static bool IsValidRomImage(uint8_t Test[4]);
2015-11-15 09:56:34 +00:00
void SaveRomSettingID(bool temp);
void ClearRomSettingID();
CICChip CicChipID();
uint8_t * GetRomAddress() { return m_ROMImage; }
uint32_t GetRomSize() const { return m_RomFileSize; }
2015-11-15 09:56:34 +00:00
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();
2015-11-15 09:56:34 +00:00
//Get a message id for the reason that you failed to load the rom
LanguageStringID GetError() const { return m_ErrorMsg; }
private:
bool AllocateRomImage(uint32_t RomFileSize);
bool AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnly);
bool AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly);
void ByteSwapRom();
void SetError(LanguageStringID ErrorMsg);
static void NotificationCB(const char * Status, CN64Rom * _this);
void CalculateCicChip();
void CalculateRomCrc();
//constant values
enum { ReadFromRomSection = 0x400000 };
//class variables
CFile m_RomFile;
void *m_hRomFileMapping;
uint8_t * m_ROMImage;
uint8_t * m_ROMImageBase;
uint32_t m_RomFileSize;
Country m_Country;
CICChip m_CicChip;
LanguageStringID m_ErrorMsg;
stdstr m_RomName, m_FileName, m_MD5, m_RomIdent;
};