hle bios: fix SF rush, jeremy mc grath and the grinch

protection checksum and game bugs
This commit is contained in:
Flyinghead 2023-02-06 15:15:44 +01:00
parent 5020a267af
commit 98531e07ea
2 changed files with 27 additions and 6 deletions

View File

@ -199,11 +199,7 @@ static void loadSpecialSettings()
NOTICE_LOG(BOOT, "Game doesn't support RGB. Using TV Composite instead");
config::Cable.override(3);
}
if (prod_id == "T9512N" // The Grinch (US)
|| prod_id == "T9503D" // The Grinch (EU)
|| prod_id == "T-9707N" // San Francisco Rush 2049 (US)
|| prod_id == "T-9709D-50" // San Francisco Rush 2049 (EU)
|| prod_id == "T7001D 50" // Jimmy White's 2 Cueball
if (prod_id == "T7001D 50" // Jimmy White's 2 Cueball
|| prod_id == "T40505D 50" // Railroad Tycoon 2 (EU)
|| prod_id == "T18702M" // Miss Moonlight
|| prod_id == "T0019M" // KenJu Atomiswave DC Conversion

View File

@ -373,7 +373,8 @@ static void reios_sys_misc()
typedef void hook_fp();
static void setup_syscall(u32 hook_addr, u32 syscall_addr) {
static void setup_syscall(u32 hook_addr, u32 syscall_addr)
{
WriteMem32(syscall_addr, hook_addr);
WriteMem16(hook_addr, REIOS_OPCODE);
@ -383,6 +384,25 @@ static void setup_syscall(u32 hook_addr, u32 syscall_addr) {
static void reios_setup_state(u32 boot_addr)
{
// San Francisco Rush checksum
short *p = (short *)GetMemPtr(0x8c0010f0, 2);
int chksum = (int)0xFFF937D1;
for (int i = 0; i < 10; i++)
chksum -= *p++;
p += 0xee - 1;
for (int i = 0; i < 3; i++)
chksum += *p++;
p += 0x347 - 1;
for (int i = 0; i < 11; i++)
chksum -= *p++;
p += 0xbf8 - 1;
for (int i = 0; i < 98; i++)
{
short v = chksum < 0 ? std::min(-chksum, 32767) : std::max(-chksum, -32768);
*p = v;
chksum += *p++;
}
// Set up AICA interrupt masks
aicaWriteReg(SCIEB_addr, (u16)0x48);
aicaWriteReg(SCILV0_addr, (u8)0x18);
@ -711,6 +731,11 @@ void reios_reset(u8* rom)
rom16[0] = REIOS_OPCODE;
// The Grinch game bug
*(u32 *)&rom[0x44c] = 0xe303d463;
// Jeremy McGrath game bug
*(u32 *)&rom[0x1c] = 0x71294118;
u8 *pFont = rom + (FONT_TABLE_ADDR % BIOS_SIZE);
// 288 12 × 24 pixels (36 bytes) characters