alucryd / oxyromon

Rusty ROM OrgaNizer
Other
114 stars 14 forks source link

CHD validation fails if multiple tracks exist #45

Closed humantree closed 1 year ago

humantree commented 1 year ago

I've been testing this with PSX images against the Redump DAT.

To show some references from this DAT, here is one that validates correctly, when stores as a CHD:

<game name="007 - The World Is Not Enough (USA)">
  <category>Games</category>
  <description>007 - The World Is Not Enough (USA)</description>
  <rom name="007 - The World Is Not Enough (USA).cue" size="101" crc="adc163bd" md5="860e004327b681cf5fd9df3bfe48e840" sha1="1e4a0731b245ab3419a5e0f23cb1001e1f1e7613"/>
  <rom name="007 - The World Is Not Enough (USA).bin" size="726429312" crc="6e91b75f" md5="7b1e0d16d3fb734a15f8d861d8f2ee06" sha1="0d6f886485318959b9a86209a91228840b61fbad"/>
</game>

However this one fails to be matched, as it seems only the first track is being extracted from the CHD before being validated:

<game name="Asteroids (USA)">
  <category>Games</category>
  <description>Asteroids (USA)</description>
  <rom name="Asteroids (USA).cue" size="200" crc="76ccf0e5" md5="8edd19005968879e3b40b686793b5f3a" sha1="57e3276a9c53b651b845db1327f346e2bbce78c3"/>
  <rom name="Asteroids (USA) (Track 1).bin" size="117712896" crc="06ed5e2b" md5="30471c2929700297133e61fed86ce095" sha1="f577f9f77a65686e94fd4717b2b657a0698da51c"/>
  <rom name="Asteroids (USA) (Track 2).bin" size="52249680" crc="2a6e4f43" md5="992a1291b567d8319bfbf22401bedd58" sha1="47ade8eeae8b2d23431e2256aaad46122cd81cb0"/>
</game>
alucryd commented 1 year ago

Thanks for the report, probably a regression, I'll look into it over the weekend.

alucryd commented 1 year ago

Forgot to ask, do you have the cue file alongside the chd file? It should be named the same as the chd file, AFAICT there is no way to extract a chd file back to split bin files without the TOC information, so you can't verify a standalone chd that was originally split.

You probably already know that, but you can get thu cue files from redump: http://redump.org/cues/psx/

Edit: This is the relevant code: https://github.com/alucryd/oxyromon/blob/ce096d69f320f7de61c6b0360767957518bc89f2/src/import_roms.rs#L599 If it works, you should see a line starting with CUE file found, and hopefully your CHD will be verified.

humantree commented 1 year ago

@alucryd Ah, my bad, I'd misunderstood that. I thought it was able to use chdman to determine how to split it, but I see now that there doesn't seem to be a way to do that.

I'll test it out with the cue files and see how it goes, but I'm sure that will work.

A slightly unrelated question, but not sure where else to ask it, but how can I reset/remove a system from my Oxyromon database? Trying to reset my PlayStation directory so I can load up these to test again. I was hoping I could simple remove the existing files and run check-roms but that just results in errors.

alucryd commented 1 year ago

I'm working on a purge-systems subcommand that I have yet to commit to develop, but it's already working quite well for me. In the meantime, the only way to do that with the current stable release would be to remove the files like you did, but run purge-roms -m to remove missing files from the database.

You're absolutely right though, check-roms should be able to do the same if the rom is missing, will add that to my todo list.

humantree commented 1 year ago

Okay, I understand now. Because purge-roms used the option --missing I wasn't sure if this was going to be targeting the same set that would be output by sort-roms --missing, which I wouldn't have wanted removed from the database. Might be worth considering a different word for one of those options? (Though maybe I just overthought it.)

But anyway, after purging them and adding the cue files, these all imported perfectly! Thanks so much for your help, and for this great tool!

alucryd commented 1 year ago

Glad I could be of help!

I see how that could be confusing, I think I'll change the sort-roms flag to --wanted instead. Thanks for the feedback :)