socram8888 / tonyhax

PS1 savegame exploit
Do What The F*ck You Want To Public License
437 stars 24 forks source link

BIOS v2.0 (Extremely 'Early' SCPH-1001) Needs Different Offset For BIOS_DEVELOPER, bios_is_ps1 returns false #139

Closed alex-free closed 1 year ago

alex-free commented 1 year ago

This was a fun one. I own an extremely early SCPH-1001 console manufactured in July of '95. It indeed has BIOS v2.0 A. My other October '95 SCPH-1001 console is BIOS v2.1 A for reference to how rare this actually is...

Right now, in your bios_is_ps1() function you are checking offset 0xBFC0012C for the 'CEX-' string. This string is actually at 0xBFC00129 in BIOS v2.0 and below. BIOS v1.0 and BIOS v1.1 where only found on the SCPH-1000 and 'early' SCPH-3000 Japanese consoles specifically though, so only BIOS v2.0 affects the original Tonyhax here. BIOS v2.0 is therefore treated as a PS2 in the current code which is obviously very bad and breaks many things now.

My fix is here https://github.com/alex-free/tonyhax/commit/4161869997b766eeab725d2dfef3433d27f8fe5b . Tested and working on real hardware, I was loosing my mind debugging this.

These images below show the different offset for BIOS v2.0 and below, and BIOS v2.1 and above in the DuckStation emulator CPU debugger:

bios-2 0

bios-2 1

socram8888 commented 1 year ago

Thanks for the tip! I'm thinking I might reverse the condition and instead check for the PS2 "PS compatible mode by M.T", which is consistent through all the PS2 consoles at the same offset. Or even easier, check if the first byte of the BIOS version is '5'.

socram8888 commented 1 year ago

I've fixed it in commit 80f80e9d52bfd66423f9e8d1df15ef9d0fd3e2a8, by checking the console BIOS version which is consistent through all PS2 models. Also added a log before the BIOS version to see the detected console model.