From 661ec98bb311f87b7e5e281175ebf06fd5baa9f3 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 27 Jun 2024 16:25:13 +0930 Subject: [PATCH] RSP: User crc32 for crc of imem --- Source/Android/PluginRSP/PluginRSP.vcxproj | 3 +++ .../Settings/RspSettings.cpp | 2 +- Source/Project64-rsp-core/cpu/RspMemory.cpp | 19 +++++++------------ Source/Project64-rsp/Project64-rsp.vcxproj | 3 +++ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Source/Android/PluginRSP/PluginRSP.vcxproj b/Source/Android/PluginRSP/PluginRSP.vcxproj index 0b22ff741..106f65975 100644 --- a/Source/Android/PluginRSP/PluginRSP.vcxproj +++ b/Source/Android/PluginRSP/PluginRSP.vcxproj @@ -46,6 +46,9 @@ + + {731bd205-2826-4631-b7af-117658e88dbc} + {b4a4b994-9111-42b1-93c2-6f1ca8bc4421} diff --git a/Source/Project64-rsp-core/Settings/RspSettings.cpp b/Source/Project64-rsp-core/Settings/RspSettings.cpp index 44ee7ba32..e87b537a4 100644 --- a/Source/Project64-rsp-core/Settings/RspSettings.cpp +++ b/Source/Project64-rsp-core/Settings/RspSettings.cpp @@ -38,7 +38,7 @@ void InitializeRspSetting(void) RegisterSetting(Set_Flags, Data_DWORD_General, "Check Flag Usage", NULL, Compiler.bFlags, NULL); RegisterSetting(Set_AlignVector, Data_DWORD_General, "Assume Vector loads align", NULL, Compiler.bAlignVector, NULL); - RegisterSetting(Set_JumpTableSize, Data_DWORD_Game, "JumpTableSize", NULL, 0x800, NULL); + RegisterSetting(Set_JumpTableSize, Data_DWORD_Game, "JumpTableSize", NULL, 0x1000, NULL); RegisterSetting(Set_Mfc0Count, Data_DWORD_Game, "Mfc0Count", NULL, 0x0, NULL); RegisterSetting(Set_SemaphoreExit, Data_DWORD_Game, "SemaphoreExit", NULL, 0x0, NULL); diff --git a/Source/Project64-rsp-core/cpu/RspMemory.cpp b/Source/Project64-rsp-core/cpu/RspMemory.cpp index dbdb05d9f..1c465ed37 100644 --- a/Source/Project64-rsp-core/cpu/RspMemory.cpp +++ b/Source/Project64-rsp-core/cpu/RspMemory.cpp @@ -5,6 +5,7 @@ #include #include #include +#include enum { @@ -78,9 +79,7 @@ void ResetJumpTables(void) void SetJumpTable(uint32_t End) { - uint32_t CRC, count; - - CRC = 0; + uint32_t CRC = crc32(0L, Z_NULL, 0); if (End < 0x800) { End = 0x800; @@ -91,17 +90,13 @@ void SetJumpTable(uint32_t End) End = 0x800; } - for (count = 0; count < End; count += 0x40) + CRC = crc32(CRC, RSPInfo.IMEM, End); + for (uint32_t i = 0; i < NoOfMaps; i++) { - CRC += *(uint32_t *)(RSPInfo.IMEM + count); - } - - for (count = 0; count < NoOfMaps; count++) - { - if (CRC == MapsCRC[count]) + if (CRC == MapsCRC[i]) { - JumpTable = (void **)(JumpTables + count * 0x1000); - Table = count; + JumpTable = (void **)(JumpTables + i * 0x1000); + Table = i; return; } } diff --git a/Source/Project64-rsp/Project64-rsp.vcxproj b/Source/Project64-rsp/Project64-rsp.vcxproj index be4958f68..4663e58b3 100644 --- a/Source/Project64-rsp/Project64-rsp.vcxproj +++ b/Source/Project64-rsp/Project64-rsp.vcxproj @@ -58,6 +58,9 @@ + + {731bd205-2826-4631-b7af-117658e88dbc} + {b4a4b994-9111-42b1-93c2-6f1ca8bc4421}