Skip to content

Commit

Permalink
DD IPL ROM check in CN64Rom instead
Browse files Browse the repository at this point in the history
  • Loading branch information
LuigiBlood committed Jan 27, 2019
1 parent 3e52ff7 commit 0a347f5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Source/Project64-core/N64System/N64Class.cpp
Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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, "");
Expand Down
14 changes: 13 additions & 1 deletion Source/Project64-core/N64System/N64RomClass.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Source/Project64-core/N64System/N64RomClass.h
Expand Up @@ -24,6 +24,7 @@ class CN64Rom :
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();
Expand Down
2 changes: 1 addition & 1 deletion Source/Project64-core/Plugins/AudioPlugin.cpp
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Source/Project64-core/Plugins/GFXPlugin.cpp
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Source/Project64-core/Plugins/RSPPlugin.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 0a347f5

Please sign in to comment.