diff --git a/Source/Project64-core/N64System/N64Class.cpp b/Source/Project64-core/N64System/N64Class.cpp index cb7f48580..b063599ac 100644 --- a/Source/Project64-core/N64System/N64Class.cpp +++ b/Source/Project64-core/N64System/N64Class.cpp @@ -328,7 +328,7 @@ bool CN64System::LoadFileImage(const char * FileLoc) WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", 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 if (g_DDRom == NULL) @@ -341,7 +341,7 @@ bool CN64System::LoadFileImage(const char * FileLoc) 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); } @@ -390,7 +390,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc) WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", 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 WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc); @@ -504,7 +504,7 @@ bool CN64System::RunDiskImage(const char * FileLoc) } 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_Settings->SaveString(File_DiskIPLPath, ""); diff --git a/Source/Project64-core/N64System/N64RomClass.cpp b/Source/Project64-core/N64System/N64RomClass.cpp index c1a7fcd09..867db420b 100644 --- a/Source/Project64-core/N64System/N64RomClass.cpp +++ b/Source/Project64-core/N64System/N64RomClass.cpp @@ -416,6 +416,18 @@ bool CN64Rom::IsValidRomImage(uint8_t Test[4]) 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) { if (byteswap) @@ -748,7 +760,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly) WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str()); CalculateCicChip(); - if (CicChipID() != CIC_NUS_8303 && CicChipID() != CIC_NUS_DDUS) + if (!IsLoadedRomDDIPL()) { SetError(MSG_FAIL_IMAGE_IPL); return false; diff --git a/Source/Project64-core/N64System/N64RomClass.h b/Source/Project64-core/N64System/N64RomClass.h index 2efa815b4..85cdff972 100644 --- a/Source/Project64-core/N64System/N64RomClass.h +++ b/Source/Project64-core/N64System/N64RomClass.h @@ -24,6 +24,7 @@ public: bool LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly = false); bool LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly = false); static bool IsValidRomImage(uint8_t Test[4]); + bool IsLoadedRomDDIPL(); void SaveRomSettingID(bool temp); void ClearRomSettingID(); CICChip CicChipID(); diff --git a/Source/Project64-core/Plugins/AudioPlugin.cpp b/Source/Project64-core/Plugins/AudioPlugin.cpp index 5aa150774..16ca7aa8f 100644 --- a/Source/Project64-core/Plugins/AudioPlugin.cpp +++ b/Source/Project64-core/Plugins/AudioPlugin.cpp @@ -135,7 +135,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window) CMipsMemoryVM & MMU = System->m_MMU_VM; 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(); else Info.HEADER = g_Rom->GetRomAddress(); diff --git a/Source/Project64-core/Plugins/GFXPlugin.cpp b/Source/Project64-core/Plugins/GFXPlugin.cpp index 46ea12fb0..b026deb3e 100644 --- a/Source/Project64-core/Plugins/GFXPlugin.cpp +++ b/Source/Project64-core/Plugins/GFXPlugin.cpp @@ -229,7 +229,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window) CMipsMemoryVM & MMU = System->m_MMU_VM; 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(); else Info.HEADER = g_Rom->GetRomAddress(); diff --git a/Source/Project64-core/Plugins/RSPPlugin.cpp b/Source/Project64-core/Plugins/RSPPlugin.cpp index f75bcc9d8..9d15d3a65 100644 --- a/Source/Project64-core/Plugins/RSPPlugin.cpp +++ b/Source/Project64-core/Plugins/RSPPlugin.cpp @@ -186,7 +186,7 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System) CMipsMemoryVM & MMU = System->m_MMU_VM; 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(); else Info.HEADER = g_Rom->GetRomAddress();