From 3e1498ef8e693a67c55382af3c279e49c5f1c685 Mon Sep 17 00:00:00 2001 From: Emmet Young Date: Sat, 14 Feb 2015 14:10:05 +1100 Subject: [PATCH] Make CIC_UNKOWN behave like CIC_NUS_6102. If debugger is enabled, it will display an error message with the missing CIC CRC. --- Source/Project64/N64 System/Mips/Dma.cpp | 1 + Source/Project64/N64 System/N64 Class.cpp | 4 ++++ Source/Project64/N64 System/N64 Rom Class.cpp | 2 ++ Source/Project64/N64 System/N64 Rom Class.h | 3 ++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/Project64/N64 System/Mips/Dma.cpp b/Source/Project64/N64 System/Mips/Dma.cpp index ac0029726..956cf9274 100644 --- a/Source/Project64/N64 System/Mips/Dma.cpp +++ b/Source/Project64/N64 System/Mips/Dma.cpp @@ -19,6 +19,7 @@ CDMA::CDMA(CFlashram & FlashRam, CSram & Sram) : void CDMA::OnFirstDMA (void) { switch (g_Rom->CicChipID()) { case CIC_NUS_6101: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; + case CIC_UNKNOWN: case CIC_NUS_6102: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; case CIC_NUS_6103: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; case CIC_NUS_6105: *(DWORD *)&((g_MMU->Rdram())[0x3F0]) = g_MMU->RdramSize(); break; diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index cf2a3d30c..b8ce6a37d 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -734,6 +734,7 @@ void CN64System::InitRegisters( bool bPostPif, CMipsMemory & MMU ) case Europe: case Spanish: case Australia: case X_PAL: case Y_PAL: switch (g_Rom->CicChipID()) { + case CIC_UNKNOWN: case CIC_NUS_6102: m_Reg.m_GPR[5].DW=0xFFFFFFFFC0F1D859; m_Reg.m_GPR[14].DW=0x000000002DE108EA; @@ -764,6 +765,7 @@ void CN64System::InitRegisters( bool bPostPif, CMipsMemory & MMU ) case NTSC_BETA: case X_NTSC: case USA: case Japan: default: switch (g_Rom->CicChipID()) { + case CIC_UNKNOWN: case CIC_NUS_6102: m_Reg.m_GPR[5].DW=0xFFFFFFFFC95973D5; m_Reg.m_GPR[14].DW=0x000000002449A366; @@ -791,6 +793,7 @@ void CN64System::InitRegisters( bool bPostPif, CMipsMemory & MMU ) case CIC_NUS_6101: m_Reg.m_GPR[22].DW=0x000000000000003F; break; + case CIC_UNKNOWN: case CIC_NUS_6102: m_Reg.m_GPR[1].DW=0x0000000000000001; m_Reg.m_GPR[2].DW=0x000000000EBDA536; @@ -849,6 +852,7 @@ void CN64System::InitRegisters( bool bPostPif, CMipsMemory & MMU ) switch (g_Rom->CicChipID()) { case CIC_NUS_6101: PIF_Ram[37] = 0x06; PIF_Ram[38] = 0x3F; break; + case CIC_UNKNOWN: case CIC_NUS_6102: PIF_Ram[37] = 0x02; PIF_Ram[38] = 0x3F; break; case CIC_NUS_6103: PIF_Ram[37] = 0x02; PIF_Ram[38] = 0x78; break; case CIC_NUS_6105: PIF_Ram[37] = 0x02; PIF_Ram[38] = 0x91; break; diff --git a/Source/Project64/N64 System/N64 Rom Class.cpp b/Source/Project64/N64 System/N64 Rom Class.cpp index 97d0f57cf..aeb8a7502 100644 --- a/Source/Project64/N64 System/N64 Rom Class.cpp +++ b/Source/Project64/N64 System/N64 Rom Class.cpp @@ -244,6 +244,8 @@ void CN64Rom::CalculateCicChip ( void ) case 0x0000011A49F60E96: m_CicChip = CIC_NUS_6105; break; case 0x000000D6D5BE5580: m_CicChip = CIC_NUS_6106; break; default: + if (bHaveDebugger()) + g_Notify->DisplayError("Unknown CIC checksum:\n%I64d.", CRC); m_CicChip = CIC_UNKNOWN; break; } diff --git a/Source/Project64/N64 System/N64 Rom Class.h b/Source/Project64/N64 System/N64 Rom Class.h index 6ca9925b7..be8827f02 100644 --- a/Source/Project64/N64 System/N64 Rom Class.h +++ b/Source/Project64/N64 System/N64 Rom Class.h @@ -12,7 +12,8 @@ #include "N64 Types.h" -class CN64Rom +class CN64Rom : + protected CDebugSettings { //constant values enum { ReadFromRomSection = 0x400000 };