libretro / beetle-psx-libretro

Standalone port/fork of Mednafen PSX to the Libretro API.
GNU General Public License v2.0
309 stars 131 forks source link

Core crash when loading chd with subchannels (LibCrypt) #811

Open Sanaki opened 3 years ago

Sanaki commented 3 years ago

Description

Attempts to load a chd with subchannels will crash the core immediately. The same data used to produce it can be loaded and successfully utilized in both ccd and toc format.

Expected behavior

Game loads, core does not crash, subchannels are read from the chd as well.

Actual behavior

Core crashes immediately on attempted load with the following:

[libretro INFO] Loading /home/ccrowley/ROMs/Sony - PlayStation/Ape Escape (Europe).chd...
[libretro INFO] chd_load '/home/ccrowley/ROMs/Sony - PlayStation/Ape Escape (Europe).chd' hunkbytes=19584
[libretro ERROR] chd_parse track subtype RW_RAW unsupported
[libretro INFO] chd_read_toc: finished
[libretro ERROR] TOC first(99)/last(0) track numbers bad.
terminate called after throwing an instance of 'MDFN_Error'
Aborted (core dumped)

Steps to reproduce the bug

  1. Load a chd with subchannel data present

Steps to produce the chd in question

  1. Get a Redump-verified bin+cue dump of a LibCrypt protected game. I used Ape Escape (Europe) due to the ability to quickly validate functionality (cursor won't move on title screen if subchannel read fails). Get the sbi from Redump as well.
  2. Use SBITools on a Windows system (wine is not sufficient for this tool) with the -cue2ccd flag to produce a ccd+img+sub.
  3. Use Aaru to convert the ccd to toc via aaru i convert -f game.ccd game.toc
  4. Use chdman to convert the toc to chd via chdman createcd -i game.toc -o game.chd

Version/Commit

Beetle PSX HW: 4312194

Environment information

i30817 commented 2 years ago

This is out of topic, but is there any tool for linux to do the same thing as SBITools?

edit: never mind, i found your comment on the Aaru bugreport and i'm watching it.

Crazy that redump never bothered with this. Hopefully they make a chd release soon.

Sanaki commented 2 years ago

The issue referenced in the prior comment, in case others want to watch it: aaru-dps/Aaru#330

Sanaki commented 2 years ago

This has now been implemented in PCSX ReARMed. In case the specific commit is of value in helping with the implementation here: libretro/pcsx_rearmed@75d5614bce62f7c2b3ca196574cf28bc9d050cdb