RetroAchievements / RALibretro

RALibretro is a multi-emulator used to develop RetroAchievements.
https://retroachievements.org
GNU General Public License v3.0
177 stars 35 forks source link

RAHasher - Failing against some CHD titles, either with errors or no output #368

Closed retroNUC closed 1 year ago

retroNUC commented 1 year ago

This may be the case of the problems I reported over here - https://github.com/RetroAchievements/rcheevos/issues/225. After further discussion, LaunchBox wasn't integrating rcheevos library directly, but instead just bundling and calling rahasher.exe, then using the result.

May need to check/update the libchdr implementation? Did a quick check against retroarch implementation, and it did seem to be missing a few functions like the 'special track' detection.

Examples of some valid PS2 CHD files that can't be parsed through RAHasher:

7 Blades (Europe) (En,Fr,De) - No output

PS C:\Emulation\tools\rahasher> .\chdman info -i "C:\Emulation\tools\rahasher\7 Blades (Europe) (En,Fr,De).chd"
chdman - MAME Compressed Hunks of Data (CHD) manager 0.239 (mame0239)
Input file:   C:\Emulation\tools\rahasher\7 Blades (Europe) (En,Fr,De).chd
File Version: 5
Logical size: 5,532,793,344 bytes
Hunk Size:    19,584 bytes
Total Hunks:  282,516
Unit Size:    2,448 bytes
Total Units:  2,260,128
Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)
CHD size:     3,558,970,955 bytes
Ratio:        64.3%
SHA1:         c1f9fd984ea6e10b7fbcd2ecf8a3a7011b49dd1b
Data SHA1:    21908d2fdbc310039914b4e15b892fd6e5a08545
Metadata:     Tag='CHT2'  Index=0  Length=90 bytes
              TRACK:1 TYPE:MODE1 SUBTYPE:NONE FRAMES:2260128 PREGAP:0 PGTY

PS C:\Emulation\tools\rahasher> .\chdman verify -i "C:\Emulation\tools\rahasher\7 Blades (Europe) (En,Fr,De).chd"
chdman - MAME Compressed Hunks of Data (CHD) manager 0.239 (mame0239)
Raw SHA1 verification successful!
Overall SHA1 verification successful!

PS C:\Emulation\tools\rahasher> .\rahasher 21 "C:\Emulation\tools\rahasher\7 Blades (Europe) (En,Fr,De).chd"

PS C:\Emulation\tools\rahasher>

AND 1 Streetball (USA) (En,Fr,Es) (v2.00) - Error

PS C:\Emulation\tools\rahasher> .\chdman info -i "C:\Emulation\tools\rahasher\AND 1 Streetball (USA) (En,Fr,Es) (v2.00).chd"
chdman - MAME Compressed Hunks of Data (CHD) manager 0.239 (mame0239)
Input file:   C:\Emulation\tools\rahasher\AND 1 Streetball (USA) (En,Fr,Es) (v2.00).chd
File Version: 5
Logical size: 5,485,047,552 bytes
Hunk Size:    19,584 bytes
Total Hunks:  280,078
Unit Size:    2,448 bytes
Total Units:  2,240,624
Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)
CHD size:     3,566,406,951 bytes
Ratio:        65.0%
SHA1:         0634125ea2017bf16e7eef9174ca757dbbe164b4
Data SHA1:    e9acb619834d7339f8c2338f7b8385b9d860d0e1
Metadata:     Tag='CHT2'  Index=0  Length=90 bytes
              TRACK:1 TYPE:MODE1 SUBTYPE:NONE FRAMES:2240624 PREGAP:0 PGTY

PS C:\Emulation\tools\rahasher> .\chdman verify -i "C:\Emulation\tools\rahasher\AND 1 Streetball (USA) (En,Fr,Es) (v2.00).chd"
chdman - MAME Compressed Hunks of Data (CHD) manager 0.239 (mame0239)
Raw SHA1 verification successful!
Overall SHA1 verification successful!

PS C:\Emulation\tools\rahasher> .\rahasher 21 "C:\Emulation\tools\rahasher\AND 1 Streetball (USA) (En,Fr,Es) (v2.00).chd"
Could not open track

PS C:\Emulation\tools\rahasher>
retroNUC commented 1 year ago

Looked into this myself. Something wrong with latest versions of libchdr?

Downgrading the submodule to an earlier version (same version that PCSX2 uses) fixes everything.

image

retroNUC commented 1 year ago

I've got a branch here where I downgraded libchdr to the same one as PCSX2, which fixes most issues:

I won't submit a PR on it, because the correct thing to do would probably be to open an issue over at libchdr then upgrade it once fixed. Do you mind being the one to do that?

Jamiras commented 1 year ago

I finally found a chd I could reproduce with. It seems like the problem was fixed here: https://github.com/rtissera/libchdr/commit/678434c447298e396d08d14bafd5e8793f123fbe

I'm going to look at upgrading to latest, as there's a couple other error-handling fixes since then.