m35 / jpsxdec

jPSXdec: cross-platform PlayStation 1 audio and video converter
http://jpsxdec.blogspot.com/
459 stars 24 forks source link

Doesn't handle games with multiple tracks #44

Open Meerkov opened 2 years ago

Meerkov commented 2 years ago

Environment

jPSXdec version: 1.00 Operating system: Windows Java runtime environment : JRE 8u297

PlayStation Game (if applicable):

Name: Air Combat Region code (e.g. SLUS-1234):

Description

It creates empty 0 byte files, instead of extracting the files correctly.

To Repro: 1) Open Air Combat in jPSXdec, using the UI. 2) Select "All Files" and click "Save All Selected" 3) Find the ouput folder DA/BGM1.DA 4) Notice the file is 0 bytes (as is every other file in this folder). 5) Check jPSX dec again. Find BGM1.DA and see that it says: "31,682,560 bytes"

Meerkov commented 2 years ago

I found this error when I try to do only one file.

jPSXdec: PSX media decoder (non-commercial) v1.00
Windows 10 10.0
Java 1.8.0_291
Sep 26, 2021 5:25:24 PM
[INFO] Filename:C:\Users\admin\Desktop\jpsxdec\Isos\Air Combat (USA)\Air Combat (USA) (Track 01).bin|Sector size:2352|Sector count:45174|First sector offset:0
[INFO] #:1003|ID:DA/BGM2.DA|Sectors:60944-72975|Type:File|Size:24641536|Path:DA/BGM2.DA|Has mode 2 form 2:No|Has CD audio:No
[INFO] Saving with normal 2048 bytes/sector
[SEVERE] DA/BGM2.DA is not completely in the bounds of the CD/file, extracting it will cause errors.
Meerkov commented 2 years ago

I'm assuming it's because this game is split into 63 .bin files. So a lot of the data isn't loaded.

Edit: Yes, rebundling the disk as a single .img file allowed those files to be extracted without errors. But the music still is not recovered.

Edit 2: I was able to recover the files by running it through DiscoHawk. Each of the tracks 2-62 are audio tracks.

m35 commented 2 years ago

I've thought about this issue of a disc split into multiple files (tracks) for some time, but haven't found any easy solutions. How will jPSXdec know that a disc is split into multiple files? The proper way would be to require a CUE file to be present. However I've been reluctant to support CUE files because I've seen strange variations in the wild. ISOBuster specifically notes in the CUE files it generates that there's features not all programs support. There's also TOC files that I believe serve the same purpose, but I know even less about those.

I've wanted to limit the scope of jPSXdec to things that you can't really find any other software can do. There are tools to combine the tracks into 1 file using the CUE, so have preferred to let them deal with strange CUE files. And I've never seen a case where you couldn't simply concatenate the binary files together. I've also never seen a case where a game had more than 1 data track, so jPSXdec really only needs the first track to do what it's best at. And for comparison, the pSX emulator also requires the disc to be a single file.

But I think it might be helpful to at least update that error message to ask if the disc has been split up into multiple tracks and to instruct the user to combine them.

Meerkov commented 2 years ago

Yeah, just an updated error is fine. Once I realized what the issue was, like you said, there are a number of work-arounds to combine it into a single file.