Lameguy64 / mkpsxiso

ISO disc image maker written specifically for PlayStation homebrew development
GNU General Public License v2.0
214 stars 33 forks source link

Regression (?) in v2 .bin generation #39

Open jbreckmckye opened 1 year ago

jbreckmckye commented 1 year ago

Hello - thanks for this tool, it's going to be completely invaluable for my work on FFVII modding. The traditional workflow of manually updating files in CDMage (a beta app written for Win9X) and juggling disc images was a major pain for mod development. Now with mkpsxiso, I can simply keep files in git and script .cue/.bin generation for emulator playtesting.

Issue

However, I have noticed an issue: when building my projects with the latest release of mkpsxiso, the games boot as PlayStation titles but promptly crash. Builds do however work with the v1.26 release.

When I do a hex diff of the .bin files I see changes appearing around the 0x7650 mark - these values are zeroed out in my broken_build.bin but nonzero in my working_build. I am not really au fait with CD archive formats, but if I understand correctly and the .bin is just a set of mode2 2352 byte sectors packed end to end, then 0x7650 -> 30288 decimal -> 2064 bytes into the 12th sector.

My understanding of the PSX format is that these sectors are zeroed, but must still have the appropriate ECC data. According to #24 emulators can be sensitive to the encoding on these sectors, so perhaps that's the issue.

That said, there are other differences - I can dig further into the diff if needs be. But those may be non-functional differences.

Please let me know if there's any other info I can provide

marco-calautti commented 1 year ago

If there is an issue with the ECC data, scanning the bin with eccregen should tell you whether there are sectors with wrong error correction codes. Can you verify this?

invadermonks commented 1 year ago

I can confirm this regression. A simple dump and rebuild of Final Fantasy Tactics fails on v2.03

fft.bin md5: b156ba386436d20fd5ed8d37bab6b624

Command to dump: dumpsxiso.exe fft.bin -x root -s map.xml

Command to rebuild: mkpsxiso.exe map.xml

The resulting mkpsxiso.bin/cue doesn't load past the squaresoft logo in the latest duckstation. I've checked the file with eccregen and the ECC data appears to be correct. Doing the same command to rebuild in 1.26 works.

jbreckmckye commented 1 year ago

Sorry, I meant to get back to this. If I recall correctly, I was able to get my workflow operational by using just the default project.xml name for the project file. Then it seemed like things worked with v2.

But I'd have to dig into this to verify exactly what fixed it. I haven't worked on my modding project for a little while