sahlberg / pop-fe

Python script to automate the process of fetching boxart and installing PS1 games (onto your PSP/VITA/PS2/PS3)
161 stars 15 forks source link

Compatibility with PSX Disc Combining Kits #45

Closed wad11656 closed 12 months ago

wad11656 commented 1 year ago

This is a long-shot, and probably unrealistic since these "disc combining kits" are very-much unofficial...but there are disc combining kits to combine some multi-disc ps1 games into 1 disc, but I never got them to work with PSX2PSP--the EBOOTs just showed a black screen. I'm specifically interested in getting the combined "Brain Dead 13" to work, because the disc swap function doesn't work in the PSP's emulator for that game. (So using the combined ISO would avoid that issue.) I thought I'd give pop-fe a shot in case it used an alternative method to build the EBOOT that makes the combined-disc ISO work. When I tried creating the EBOOT from the combined-disc ISO (.bin/.cue), I got this error: image Probably an unrealistic request but thought I might as well ask

sahlberg commented 1 year ago

Looks like the CUE file is broken. Check the cue file and fix any obvious issues.

wad11656 commented 1 year ago

The cue that the disc combining kit makes looks standard:

FILE "braindead13.bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00

And the temp one pop-fe creates when you select the .bin looks to be formatted the same way:

FILE "TMPIMGd1.bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00

Both .cues throw the same error. I'm guessing it's just something wonky about the nature of these combined disc images that cue2cu2 doesn't like

sahlberg commented 1 year ago

Yeah, quite likely. Try to reproduce it running cue2cu2 from the command line and if it reproduces open a bug with upstream cu22cu2

wad11656 commented 1 year ago

I actually created an issue with them first before I made one with you. They seemed extra confused. I saw on the PSX-Planet thread that in May 2021 you added the cue2cu2 package, or at least made it required. Do you have a (Linux) release somewhere before implementing the requirement for cue2cu2 that I could try? (Or let me know some other way to bypass the cue2cu2 process? Should I create the image with a CCD+img instead of cue+bin?) Hehe sorry. I understand if you don't want to look at this anymore.

sahlberg commented 1 year ago

This is the program I download and use for the cue to cu2 conversion: https://github.com/NRGDEAD/Cue2cu2

It is not that I don't want to look at it, it is that I am downstream from it so any fix should go into the upstream version of cue2cu2, which will then trickle down into pop-fe when I sync with them.

You can try converting to ccd/img too. pop-fe can read ccd files. But it is better to get upstream cue2cu2 to fix the issue as that will fix it for every user of the tool.

wad11656 commented 1 year ago

Yeah I meant they seemed confused and I was too embarrassed to elaborate:

https://github.com/NRGDEAD/Cue2cu2/issues/4

Thanks--I'll maybe mess around with the Linux version and CCD/IMG for a bit. I appreciate your patient replies

sahlberg commented 1 year ago

You should be able to reproduce the issue by running cue2cu2 manually from the command-line. This is what pop-fe does : subprocess.call(['python3', './cue2cu2.py', '-n', cu2_file, '--size', str(os.stat(img_file).st_size), cue_file])

It basically just runs it like : python3 ./cue2cu2.py -n game.cu2 --size game.cue

sahlberg commented 12 months ago

It the cue2cu2 folks are unresponsive email me the cue file that it is having trouble with and I can have a look over the weekend

Goatman13 commented 12 months ago

Most likely combined image size exceed 870MB. This will be more than 99:59:74 in MSF. Since convert_timecode_to_sectors operate on string, it will try to convert ":" to int because minutes occupy [0:3] for this image, corrupting expected seconds position in string. All that during disc size calculation for A0/A1/A2 TOC part.

Solution can be using something like:

colon = timecode.find(":")
minutes = int(timecode[0:colon])
seconds = int(timecode[colon+1:colon+3])
sectors = int(timecode[colon+4:colon+6])

in MSF, SF are guaranteed to be valid at this point, only minutes need size check. Anyway, that opens pandora box. Now timecode_addition need to be modified to not clamp to 449999 sectors, which I'm guessing is actually that 99:59:74 limit. Probably need more modifications on both cue2cu2 and pop-fe side. So if only point of that is to fix Brain Dead 13 game, then it's just better to fix disc switch in game itself.

sahlberg commented 12 months ago

That sounds plausible. The only hard dependency on cue2cu2 is for PSIO since that is the only platform that strictly need them. I do convert to cu2 for all platforms though since a cu2 file is a lot easier to parse unambigously than a cue file if there are cdda tracks present.

I would assume that these combined disks will never have cdda track and only consist of a single data track. Is that a correct assumption?

This is a very special use-case but if this is correct I can add a new flag to pop-fe to ignore any cuue2cu2 failures and just create the EBOOT.PBP assuming it is all just one single track. Is that worth trying? It would not be all that much work.

sahlberg commented 12 months ago

To test and verify I need you to send me the cue/bin files for the combined image.

Goatman13 commented 12 months ago

I think ignoring errors from cue2cu2 at this point will make game unplayable due to bad toc, especially bad lead-out info. Issue probably starts here: https://github.com/NRGDEAD/Cue2cu2/blob/b88a780b4877bdcae5f33f3bc7bd00b8fff72a55/cue2cu2.py#L270

wad11656 commented 12 months ago

Small correction to my original comment: People have reportedly successfully created EBOOTs with some of the disc combining kits (using PSX2PSP)...but I think Brain Dead 13 is just a special case because of its size like goatman said.

Disc: https://pastebin.com/xBtTwndt

Thank you It's exciting to have some techy people helping with longstanding PSP PSX compatibility issues I've spent a lot of my life troubleshooting. (If this community knows magical ways to trigger the PSP emulator's disc switch function when the game calls for it, I think there's 1 or 2 more ntsc-u games in my list with a broken disc-switch functionality on the psp emu that would be cool to get fixed)

AnnoyinglyInterestingly (if memory serves), EBOOTs of the JAP version of the game (at least made w/ PSX2PSP, so probably pop-fe too) have a working disc-switch function.

sahlberg commented 12 months ago

For the PSP emulator it seems we now know a config setting that allows to swap discs even if the game does not prompt for it. This may solve the original issue for BrainDead specifically and avoid having to combine it into a single disc completely.

If that is the case I will add that config to pop-fe once the config developers produce a config file and finish testing it.

If that is the case we do not need to spend more time on the disc-combine issue with the cue file.

sahlberg commented 12 months ago

I have checked in a config by Webardo that should fix the issue with switching disk. So no need to combine the disks. Just build it as a normal 2 disc EBOOT and it should work.

Please test once the build completes.

wad11656 commented 12 months ago

MAGIC! Thank you, my wizard gods.

If it's not much trouble, can you add the same fix for these games too? These are the ntsc-u ones I know of where the PSP emulator's disc swap isn't working when the game prompts for it, but i imagine PAL/JAP have some with the same issue too:

Fear Effect and Fear Effect 2 both have a disc swap problem too, but it's different: It recognizes the new disc, but gives an "Unknown disc format" error when the disc is swapped in. So that'd probably require an entirely different fix. (SONY released official EBOOTs for Fear Effect 1&2 on PSN, but they're the PAL versions...which obviously run at the slower 50hz and have the squished PAL resolution. As a workaround, I tried converting the PAL ISOs to NTSC with Zapper2K, which fixed the speed & resolution, but the game crashed early on.)

At this point I think if you integrate a PAL<->NTSC patcher (for 50hz->60hz + resolution conversion a la Zapper2K [or I think PSX2PSP has a built-in NTSC/PAL converter too]), and a Region Sector patcher, pop-fe could probably be considered the gold standard for PSP PS1 EBOOTs (well I suppose "Main Game ID", "Icon Animation (ICON1.PMF)", and "Boot image (BOOT.PNG)" fields could be added too, like in PSX2PSP, but those don't matter as much)...

BTW, (at least for me,) after creating a first EBOOT with pop-fe-psp GUI, then trying to create a second one immediately afterward, when you select Disc1, it doesn't automatically pull in the images/metadata, and doesn't allow you to select a Disc 2/3/4--you need to restart the app if you want to proceed to making a second EBOOT.

sahlberg commented 12 months ago

Nice that it works.

Those other might need other fixes as well so it is best to ask at https://gbatemp.net/threads/new-mode-to-fix-ps1-games-for-psp-and-psvita.607286 about them. The people on that thread are knowledgeable about creating configs. I am pretty ignorant about it myself and just add what they tell me to add to pop-fe :-) Probably start reading that thread at around page 17 or so. that is where the config action starts.

The people there can check if there are additional configs needed ontop of just "make swap-disk always available".

I know, the pop-fe-psp GUI (and the pop-fe-ps3 one as well) is quite dodgy so it will have issues like that, but it is easy to workaround. Just restart it. .

Closing this now as Brain Dead 13 works. Please do go to gba-temp and join the discussions there. Once the folks there create configs they send them to me and I add them to pop-fe. I think it would be enormously useful if you help identify games that need a config and also help test the configs. Every time they create a new config and it is tested and verified to work we get one more game working!

wad11656 commented 12 months ago

Yes, I already mentioned restarting fixes it. I don't like to be annoying so I only mentioned because I thought you'd appreciate knowing.

Oh, the_ho's thread is developing into more technical realms, eh? I disabled notifs for that thread. I guess I might jump in there again

sahlberg commented 12 months ago

There is a lot of action in that thread now, so do enable notifs again :-)

I think what we need is people that report games that don't work and also test configs and update the compatibility database. mrjaredbeta did post a link, I think, for people on how to create and test configs. And once the configs are tested they notify me and I add them to pop-fe.

I would like woork on configs myself but I don't have the cycles. Fortunately there are a bunch of people there that know a lot more about this than I and they do a great job with the configs. Also, do note that with pop-fe it can create a SoftwareManual and I have added links to ~600 games that had scans etc available on the internet.

But there are a lot of games still missing manuals. Finding scans of manuals for the missing games is also appreciated!