(Solved) How to generate a RAW save file from scratch without the PSX?

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
alexfree
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 221
Joined: Oct 21, 2021
I am a: Programmer, Gamer
PlayStation Model: SCPH-1000
Location: USA
Contact:

(Solved) How to generate a RAW save file from scratch without the PSX?

Post by alexfree » May 6th, 2023, 7:00 pm

I think I’m doing something seriously wrong with my memory card generator program. I have a program here: https://github.com/alex-free/tonyhax/tr ... /gameshark which is supposed to generate a save game file with user supplied custom input from 0x100 onward. I must be missing something, because the resulting save file only works on one console with BIOS v3.0 (SCPH-5501). Numerous other consoles are not reading this save on any card correctly apparently. Is there anything I can determine from this method of generating a save file before ruling other issues out?
Last edited by alexfree on May 8th, 2023, 5:59 am, edited 2 times in total.

alexfree
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 221
Joined: Oct 21, 2021
I am a: Programmer, Gamer
PlayStation Model: SCPH-1000
Location: USA
Contact:

Post by alexfree » May 6th, 2023, 8:47 pm

Ive done a bit more testing and it really does seem to be the memory card file format I am generating is somehow incorrect.

User avatar
nocash
Verified
PSX Aficionado
PSX Aficionado
Posts: 548
Joined: Nov 12, 2012
Contact:

Post by nocash » May 7th, 2023, 1:38 am

Are you trying to make a raw memory card file, or a whole memory card disc image?
Did you read the "memory card data format" chapter in psxspx, and is there anything missing in particular?
I thought that it's quite complete... except for that mysterious "icon block count" entry, that... I'd like to know what that it is good for myself.

alexfree
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 221
Joined: Oct 21, 2021
I am a: Programmer, Gamer
PlayStation Model: SCPH-1000
Location: USA
Contact:

Post by alexfree » May 8th, 2023, 1:35 am

nocash wrote: May 7th, 2023, 1:38 am Are you trying to make a raw memory card file, or a whole memory card disc image?
Did you read the "memory card data format" chapter in psxspx, and is there anything missing in particular?
I thought that it's quite complete... except for that mysterious "icon block count" entry, that... I'd like to know what that it is good for myself.
Your spx are great for the MC actually. My issue did not even have to do with the save file format (and yes I did actually want the RAW save file format).

Basically what I am doing is:
1) Read the entire RAW save file containing a very basic format to store gameshark codes.
2) Parse the basic format and load the codes to 0xD000-0xE000 range in RAM (reserved BIOS memory range)
3) Install a cheat engine which uses a custom exception handler to apply codes based on specific data in the 0xD000 range.

The entire problem is that, apparently, 0xD000-0xE000 is NOT guaranteed to be all 0x00 bytes like I assumed. Depending on the BIOS version using real hardware there are different values possible here in this range. BIOS v3.0 apparently was 'clean enough' to work. Like every other BIOS version however is not 'clean enough' and it would screw up the cheat engine so it wouldn't apply the codes correctly.

I added all these checksums to my program to check the state of the mem card buffer, the cheat engine upload, and the 0xD000-0xE0000 range and I finally figured it out. Just bzero from 0xD000 to 0xDF78 and finally it works. Matching checksum on this range for all BIOS versions now.

What were the chances that only BIOS v3.0 would work, and that's what I tested this all on at first thinking it was good to go.

Anyways, maybe you'll find that interesting no $ :)

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests