DD IPL ROM check in CN64Rom instead

This commit is contained in:
LuigiBlood 2019-01-27 13:06:36 +01:00
parent 3e52ff7b48
commit 0a347f59f1
6 changed files with 21 additions and 8 deletions

View File

@ -328,7 +328,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc); WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc);
if (g_Rom->LoadN64Image(FileLoc)) if (g_Rom->LoadN64Image(FileLoc))
{ {
if (g_Rom->CicChipID() == CIC_NUS_8303 || g_Rom->CicChipID() == CIC_NUS_DDUS) if (g_Rom->IsLoadedRomDDIPL())
{ {
//64DD IPL //64DD IPL
if (g_DDRom == NULL) if (g_DDRom == NULL)
@ -341,7 +341,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
g_System->RefreshGameSettings(); g_System->RefreshGameSettings();
if (g_Rom->CicChipID() != CIC_NUS_8303 && g_Rom->CicChipID() != CIC_NUS_DDUS) if (!g_Rom->IsLoadedRomDDIPL())
{ {
g_Settings->SaveString(Game_File, FileLoc); g_Settings->SaveString(Game_File, FileLoc);
} }
@ -390,7 +390,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc); WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc);
if (g_DDRom->LoadN64ImageIPL(FileLoc)) if (g_DDRom->LoadN64ImageIPL(FileLoc))
{ {
if (g_DDRom->CicChipID() != CIC_NUS_8303 && g_DDRom->CicChipID() != CIC_NUS_DDUS) if (!g_DDRom->IsLoadedRomDDIPL())
{ {
//If not 64DD IPL then it's wrong //If not 64DD IPL then it's wrong
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc); WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
@ -504,7 +504,7 @@ bool CN64System::RunDiskImage(const char * FileLoc)
} }
else else
{ {
if (g_Rom->CicChipID() != CIC_NUS_8303 && g_Rom->CicChipID() != CIC_NUS_DDUS) if (!g_Rom->IsLoadedRomDDIPL())
{ {
g_Notify->DisplayError(MSG_FAIL_IMAGE_IPL); g_Notify->DisplayError(MSG_FAIL_IMAGE_IPL);
g_Settings->SaveString(File_DiskIPLPath, ""); g_Settings->SaveString(File_DiskIPLPath, "");

View File

@ -416,6 +416,18 @@ bool CN64Rom::IsValidRomImage(uint8_t Test[4])
return false; return false;
} }
bool CN64Rom::IsLoadedRomDDIPL()
{
switch (CicChipID())
{
case CIC_NUS_8303:
case CIC_NUS_DDUS:
return true;
default:
return false;
}
}
void CN64Rom::CleanRomName(char * RomName, bool byteswap) void CN64Rom::CleanRomName(char * RomName, bool byteswap)
{ {
if (byteswap) if (byteswap)
@ -748,7 +760,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str()); WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
CalculateCicChip(); CalculateCicChip();
if (CicChipID() != CIC_NUS_8303 && CicChipID() != CIC_NUS_DDUS) if (!IsLoadedRomDDIPL())
{ {
SetError(MSG_FAIL_IMAGE_IPL); SetError(MSG_FAIL_IMAGE_IPL);
return false; return false;

View File

@ -24,6 +24,7 @@ public:
bool LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly = false); bool LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly = false);
bool LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly = false); bool LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly = false);
static bool IsValidRomImage(uint8_t Test[4]); static bool IsValidRomImage(uint8_t Test[4]);
bool IsLoadedRomDDIPL();
void SaveRomSettingID(bool temp); void SaveRomSettingID(bool temp);
void ClearRomSettingID(); void ClearRomSettingID();
CICChip CicChipID(); CICChip CicChipID();

View File

@ -135,7 +135,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
CMipsMemoryVM & MMU = System->m_MMU_VM; CMipsMemoryVM & MMU = System->m_MMU_VM;
CRegisters & Reg = System->m_Reg; CRegisters & Reg = System->m_Reg;
if ((g_Rom->CicChipID() == CIC_NUS_8303 || g_Rom->CicChipID() == CIC_NUS_DDUS) && g_Disk != NULL) if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
Info.HEADER = g_Disk->GetDiskHeader(); Info.HEADER = g_Disk->GetDiskHeader();
else else
Info.HEADER = g_Rom->GetRomAddress(); Info.HEADER = g_Rom->GetRomAddress();

View File

@ -229,7 +229,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
CMipsMemoryVM & MMU = System->m_MMU_VM; CMipsMemoryVM & MMU = System->m_MMU_VM;
CRegisters & Reg = System->m_Reg; CRegisters & Reg = System->m_Reg;
if ((g_Rom->CicChipID() == CIC_NUS_8303 || g_Rom->CicChipID() == CIC_NUS_DDUS) && g_Disk != NULL) if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
Info.HEADER = g_Disk->GetDiskHeader(); Info.HEADER = g_Disk->GetDiskHeader();
else else
Info.HEADER = g_Rom->GetRomAddress(); Info.HEADER = g_Rom->GetRomAddress();

View File

@ -186,7 +186,7 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
CMipsMemoryVM & MMU = System->m_MMU_VM; CMipsMemoryVM & MMU = System->m_MMU_VM;
CRegisters & Reg = System->m_Reg; CRegisters & Reg = System->m_Reg;
if ((g_Rom->CicChipID() == CIC_NUS_8303 || g_Rom->CicChipID() == CIC_NUS_DDUS) && g_Disk != NULL) if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
Info.HEADER = g_Disk->GetDiskHeader(); Info.HEADER = g_Disk->GetDiskHeader();
else else
Info.HEADER = g_Rom->GetRomAddress(); Info.HEADER = g_Rom->GetRomAddress();