Project64: Some clean up of the N64RomClass
This commit is contained in:
parent
185c6586b4
commit
fdc1a51f28
|
@ -23,11 +23,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CN64Rom::CN64Rom() :
|
CN64Rom::CN64Rom() :
|
||||||
m_ROMImage(NULL),
|
m_ROMImage(NULL),
|
||||||
m_ROMImageBase(NULL),
|
m_ROMImageBase(NULL),
|
||||||
m_ErrorMsg(EMPTY_STRING),
|
m_RomFileSize(0),
|
||||||
m_Country(UnknownCountry),
|
m_ErrorMsg(EMPTY_STRING),
|
||||||
m_CicChip(CIC_UNKNOWN)
|
m_Country(UnknownCountry),
|
||||||
|
m_CicChip(CIC_UNKNOWN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ CN64Rom::~CN64Rom()
|
||||||
bool CN64Rom::AllocateRomImage(uint32_t RomFileSize)
|
bool CN64Rom::AllocateRomImage(uint32_t RomFileSize)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom");
|
||||||
AUTO_PTR<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x1000]);
|
AUTO_PTR<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x2000]);
|
||||||
if (ImageBase.get() == NULL)
|
if (ImageBase.get() == NULL)
|
||||||
{
|
{
|
||||||
SetError(MSG_MEM_ALLOC_ERROR);
|
SetError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
@ -652,16 +653,20 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
||||||
CRC2 = *(uint32_t *)(&m_ROMImage[0x14]);
|
CRC2 = *(uint32_t *)(&m_ROMImage[0x14]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_RomIdent.Format("%08X-%08X-C:%X", CRC1, CRC2, m_ROMImage[0x3D]);
|
m_RomIdent = stdstr_f("%08X-%08X-C:%X", CRC1, CRC2, m_ROMImage[0x3D]);
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
|
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
|
||||||
|
|
||||||
if (!LoadBootCodeOnly && g_Rom == this)
|
if (!LoadBootCodeOnly && g_Rom == this)
|
||||||
{
|
{
|
||||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||||
if (!g_Disk)
|
if (!g_Disk)
|
||||||
|
{
|
||||||
SaveRomSettingID(false);
|
SaveRomSettingID(false);
|
||||||
|
}
|
||||||
else if (!IsLoadedRomDDIPL())
|
else if (!IsLoadedRomDDIPL())
|
||||||
|
{
|
||||||
g_Settings->SaveString(Game_GameName, m_RomName.c_str()); //Use Base Game's Save File if loaded in combo
|
g_Settings->SaveString(Game_GameName, m_RomName.c_str()); //Use Base Game's Save File if loaded in combo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Settings->LoadBool(Game_CRC_Recalc))
|
if (g_Settings->LoadBool(Game_CRC_Recalc))
|
||||||
|
@ -813,7 +818,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
||||||
CRC2 = *(uint32_t *)(&m_ROMImage[0x14]);
|
CRC2 = *(uint32_t *)(&m_ROMImage[0x14]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_RomIdent.Format("%08X-%08X-C:%X", CRC1, CRC2, m_ROMImage[0x3D]);
|
m_RomIdent = stdstr_f("%08X-%08X-C:%X", CRC1, CRC2, m_ROMImage[0x3D]);
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
|
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
|
||||||
|
|
||||||
if (!IsLoadedRomDDIPL())
|
if (!IsLoadedRomDDIPL())
|
||||||
|
|
|
@ -56,12 +56,11 @@ private:
|
||||||
|
|
||||||
//class variables
|
//class variables
|
||||||
CFile m_RomFile;
|
CFile m_RomFile;
|
||||||
void *m_hRomFileMapping;
|
|
||||||
uint8_t * m_ROMImage;
|
uint8_t * m_ROMImage;
|
||||||
uint8_t * m_ROMImageBase;
|
uint8_t * m_ROMImageBase;
|
||||||
uint32_t m_RomFileSize;
|
uint32_t m_RomFileSize;
|
||||||
Country m_Country;
|
Country m_Country;
|
||||||
CICChip m_CicChip;
|
CICChip m_CicChip;
|
||||||
LanguageStringID m_ErrorMsg;
|
LanguageStringID m_ErrorMsg;
|
||||||
stdstr m_RomName, m_FileName, m_MD5, m_RomIdent;
|
std::string m_RomName, m_FileName, m_MD5, m_RomIdent;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue