RSP: User crc32 for crc of imem

This commit is contained in:
zilmar 2024-06-27 16:25:13 +09:30
parent 96a4c2c926
commit 661ec98bb3
4 changed files with 14 additions and 13 deletions

View File

@ -46,6 +46,9 @@
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\3rdParty\zlib\zlib.vcxproj">
<Project>{731bd205-2826-4631-b7af-117658e88dbc}</Project>
</ProjectReference>
<ProjectReference Include="..\..\Common\Common.vcxproj"> <ProjectReference Include="..\..\Common\Common.vcxproj">
<Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project> <Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project>
</ProjectReference> </ProjectReference>

View File

@ -38,7 +38,7 @@ void InitializeRspSetting(void)
RegisterSetting(Set_Flags, Data_DWORD_General, "Check Flag Usage", NULL, Compiler.bFlags, NULL); 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_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_Mfc0Count, Data_DWORD_Game, "Mfc0Count", NULL, 0x0, NULL);
RegisterSetting(Set_SemaphoreExit, Data_DWORD_Game, "SemaphoreExit", NULL, 0x0, NULL); RegisterSetting(Set_SemaphoreExit, Data_DWORD_Game, "SemaphoreExit", NULL, 0x0, NULL);

View File

@ -5,6 +5,7 @@
#include <Settings/Settings.h> #include <Settings/Settings.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <zlib/zlib.h>
enum enum
{ {
@ -78,9 +79,7 @@ void ResetJumpTables(void)
void SetJumpTable(uint32_t End) void SetJumpTable(uint32_t End)
{ {
uint32_t CRC, count; uint32_t CRC = crc32(0L, Z_NULL, 0);
CRC = 0;
if (End < 0x800) if (End < 0x800)
{ {
End = 0x800; End = 0x800;
@ -91,17 +90,13 @@ void SetJumpTable(uint32_t End)
End = 0x800; 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); if (CRC == MapsCRC[i])
}
for (count = 0; count < NoOfMaps; count++)
{
if (CRC == MapsCRC[count])
{ {
JumpTable = (void **)(JumpTables + count * 0x1000); JumpTable = (void **)(JumpTables + i * 0x1000);
Table = count; Table = i;
return; return;
} }
} }

View File

@ -58,6 +58,9 @@
<ClInclude Include="Rsp.h" /> <ClInclude Include="Rsp.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\3rdParty\zlib\zlib.vcxproj">
<Project>{731bd205-2826-4631-b7af-117658e88dbc}</Project>
</ProjectReference>
<ProjectReference Include="..\Common\Common.vcxproj"> <ProjectReference Include="..\Common\Common.vcxproj">
<Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project> <Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project>
</ProjectReference> </ProjectReference>