ps2homebrew / hdl-dump

Install games in HDLoader format to APA-formatted hard drive
122 stars 25 forks source link

[ISSUE]: ZSO Installation on the HDD becomes corrupted #71

Open BloodRaynare opened 1 year ago

BloodRaynare commented 1 year ago

Checks

Describe the issue

This issue report started from me trying to troubleshoot the problem with one of my installed games, Freestyle Metal X, which was compressed to ZSO when I installed it.

The problem was when I tried to doing Race events to beat Nate Adams on the Seaside Smash level. Everytime the races start the game would freeze. Compatibility modes didn't even help either. So, I figured how about I extract the ZSO off my HDD the decompress it and copy my savefile as well and see what's the problem is by booting it on the PCSX2. Which bring us to the point of this issue.

When I attempted to extract and then decompress it back to ISO, as soon it about to reach 100% (or 99%), this happens:

2022-12-21 13_29_50-Administrator_  PFS BatchKit Manager v1 1 5 By GDX

I also tried to extract my earlier game installation, Moto GP 3, also compressed to ZSO.

2022-12-21 13_58_55-Administrator_  PFS BatchKit Manager v1 1 5 By GDX

And when comparing the decompressed ISO size to the originals, you can see that it loses a few KBs due to the errors above.

2022-12-21 13_30_41-DVD 2022-12-21 13_59_17-DVD

And as I'm writing this, I also tried to compare the extracted ZSO with the one I just made from the originals.

2022-12-21 14_10_56-DVD

You can see that even the extracted ZSO already losing few KBs.

I don't really know what's the cause but I bet something happened during the ZSO installation or rather the ZSO extraction was incomplete which causes the corruption. Haven't tested the failed decompressed ISO on PCSX2 yet but I bet the same problem would happen there or even crash the emulator.

Games Tested: Freestyle Metal X: http://redump.org/disc/31737/ MotoGP 3: http://redump.org/disc/30928/

Both game hashes matches with my dump.

image image

hdl_dump version is 9cd71a4458db2b2f3921880004857b6602c6c0c3

Also an unrelated issue: For some reason hdl_dump has a "stopped working" error when installing an uncompressed ISO and happens when the installation is complete though the game installs fine.

Console model

SCPH-50000

BloodRaynare commented 1 year ago

I think I might have found a workaround for the ZSO files to be installed correctly. Pad the end with zeroes (or even 0xff or any random bytes) and make sure the resulting size is divisible by 2048 bytes (CD/DVD sector size, like regular ISOs). By doing this, hdl_dump no longer truncates the ZSOs during installations and I was able to extract and then decompress it without errors (maxcso handles the padded ZSOs just fine).

Danixu commented 10 months ago

Hello,

I have done some tests and I have the same problem. All the resulting ZSO are corrupted and of course the ISO file doesn't matches the original file. Also some CDROM ZSO files that I have decompressed have the same problem. I expected that the bug affecting the CDROM files will do the same but with 2352 bytes multiples, but is doing it with the 2048 multiples instead. That makes me think that maybe even the CDROM ISO files are affected by this problem.

Best regards