notaz / pcsx_rearmed

ARM optimized PCSX fork
GNU General Public License v2.0
383 stars 207 forks source link

Is it possible to add Real CD-Rom support? #335

Closed shoddydev closed 3 months ago

shoddydev commented 3 months ago

Hello I'm on a PlayStation Classic and one of my goals is to convert the case into the a flip top cover and add a mini disc drive into it. I was wondering if it's possible to get real disc support? I've tried it with the Retroarch Disc Project using the Beetle PSX core but it's way too slow. I've also tried launching the /dev/sr0 with the pcsx rearmed core and it works on some games but not all.

I've used pcsx reloaded before and it has support for real discs, but I couldn't get it working on the PSC mainly due to it using gdk and xdg-shell. I much prefer pcsx rearmed as it's faster.

shoddydev commented 3 months ago

I figured it out. I just needed to add USE_LIBRETRO_VFS = 1 in during the build process and it worked with the Retroarch Disc Project.. I'm one step closer to achieving my goal of cramming a mini optical disc drive into the psc

notaz commented 3 months ago

I've added some code which should work better for FMVs and audio streaming than USE_LIBRETRO_VFS, give it a try.

shoddydev commented 3 months ago

thanks. i'll give it a try tomorrow and record a video on it. i was testing it earlier with retroarch's disc project and it's working great, however my only gripe is i dont think retroarch detects when we eject a disc, i can still swap a different cd in like for ridge racer and vib ribbon and it'll play the music from the disc, however for some games like MTV Music Generator when I want to sample audio cds, it'll just say to insert a disc and I would have to goto to Disc Control options and manually eject it. But even when I insert it back i don't hear any sound

it's just a minor gripe but i would really like to be able to replicate the original PlayStaion experience. even just getting to the bios menu requires a workaround. I basically have to launch a game with the core, then in the disc control options i eject the disc and wait for it to go to the bios menu. I can't launch with a audio cd either. though i assume that's more of a retroarch issue. I know with the beetle psx core i can launch music cds to the Bios menu

I'm interested in the standalone EMU too. The stock psc uses it and I like the simplicity. if there's a way to get the standalone pcsx emu working with real cds too that'll be awesome

notaz commented 3 months ago

The eject stuff needs special emu handling so things like USE_LIBRETRO_VFS can't do it transparently. I've just added some code to try to handle it. Booting into CDDA disks should also work now as long as HLE is off and slowboot is on.

As for standalone, doesn't PSC use use some fork with different GUI and stuff? Is anyone maintaining it? I was completely uninvolved with the fork that's shipped with the device.

shoddydev commented 3 months ago

Wow the new updated commit works soo much better than before. Like I've tried different optical drives, and with certain drives that don't have it's own power source, it wouldn't load games like Ridge Racer, Vib Ribbon, or MTV Music Generator. It would either show a blank screen or it won't reach the title screen, but this new update does. And with the drives I've tested that uses its own power source, it would take longer to load the disc information for some reason. like I have to wait a second for it to load the disc or load disc information, but now it's going smooth.

And yeah it read audio discs now too. Oh i found a way to refresh the TOC. basically I have to eject the disc, then in the Disc Control option I have to select "Currect Disc Index" and choose drive0, then when I insert the disc it refreshes the Toc. Interestingly enough, this method doesn't work with Beetle PSX.

as for the standalone pcsx rearmed that comes included with the PlayStation Classic, it looks identical to the one here. The Emu is hidden though, so originally we couldn't access the emu without a special keyboard to toggle the menu. But after it was hacked, we can access the menu by pressing select+start or start+triangle depending on which hack was used. Your name is in the credits also. I would be thrilled if it was me, that Sony used a emu that I created in their official product but maybe that's just me lol

I'm a beginner at this stuff but it appears that the frontend GUI runs separate from pcsx. Sony provided the source code for their build here, I think they mainly added SDL2 support https://doc.dl.playstation.net/doc/psclassic-oss/PCSX_ReARMed.html

I don't think anyone is currently maintaining it but I recall Autobleem updating it also. https://github.com/autobleem/PSC-pcsx-rearmed

I tried to compile the standalone pcsx rearmed from your repository years ago but I failed. I think I tried to use SDL 1 and had to use a compatibility layer. It would just pop up and disappear. Does it support SDL2 and wayland now? I might give it another go now that I've gain more experience at compiling.

Edit: i forgot to mention, I'm getting undefined reference errors if I don't build it with USE_LIBRETRO_VFS = 1

deps/libchdr/src/libchdr_chd.o: In function core_stdio_fseek': libchdr_chd.c:(.text.core_stdio_fseek+0x14): undefined reference torfseek' deps/libchdr/src/libchdr_chd.o: In function core_stdio_fread': libchdr_chd.c:(.text.core_stdio_fread+0x8): undefined reference torfread' deps/libchdr/src/libchdr_chd.o: In function core_stdio_fsize': libchdr_chd.c:(.text.core_stdio_fsize+0x10): undefined reference torftell' libchdr_chd.c:(.text.core_stdio_fsize+0x30): undefined reference to rfseek' libchdr_chd.c:(.text.core_stdio_fsize+0x38): undefined reference torftell' libchdr_chd.c:(.text.core_stdio_fsize+0x58): undefined reference to rfseek' deps/libchdr/src/libchdr_chd.o: In functioncore_stdio_fopen': libchdr_chd.c:(.text.core_stdio_fopen+0x24): undefined reference to rfopen' deps/libchdr/src/libchdr_chd.o: In functioncore_stdio_fclose': libchdr_chd.c:(.text.core_stdio_fclose+0xc): undefined reference to `rfclose' collect2: error: ld returned 1 exit status Makefile:433: recipe for target 'pcsx_rearmed_libretro.so' failed make: *** [pcsx_rearmed_libretro.so] Error 1

I tried adding HAVE_PHYSICAL_CDROM=1 and it's still the same. I imagine most users won't be aware of the change

shoddydev commented 3 months ago

Oh and the refresh TOC workaround I mentioned previously was in the old build. I notice in this new commit it automatically does it when we eject and insert a new disc which is awesome. Though I am concerned that this may cause a potential problem when I try to modify my psc case to have the cd/dvd rom's eject button share with the PSC's eject button. Because if I manually press eject on the PSC, it'll show a notification that the tray is opened, then if I press the eject on the DVD player it'll assume it's inserting a disc while my dvd tray is open.

I tried pressing it simultaneously and it seem to work like how i want it to as long as it's pressed at the same time. other than that, maybe there are instances where one may need the lid closed to do some swapping? I can't think of any instances where one would need that though lol

shoddydev commented 3 months ago

I'm probably overthinking the Eject button because I can just unmap the hotkey in the retroarch's input menu lol anyway this is kind of a unrelated issue but I'm playing MTV music generator and when I try to sample a audio cd, it shows this screen: mtv

it's supposed to show a progress bar of the recording. in pcsx rearmed it doesn't budge so it doesn't actually record anything. It works properly in Beetle PSX. I assume it's like that with ISO loading too.

notaz commented 3 months ago

Edit: i forgot to mention, I'm getting undefined reference errors if I don't build it with USE_LIBRETRO_VFS = 1 deps/libchdr/src/libchdr_chd.o: In function core_stdio_fseek': libchdr_chd.c:(.text.core_stdio_fseek+0x14): undefined reference to rfseek'

You need to clean or do a fresh clone when you build with different parameters. The build system is too basic to handle that for you.

I tried pressing it simultaneously and it seem to work like how i want it to as long as it's pressed at the same time

The code should be able to detect when you open/close the physical cdrom alone and forward it to the game. It won't show a notification though.

https://github.com/autobleem/PSC-pcsx-rearmed

Looks like this hasn't been updated for more than 4 years.

MTV music generator and when I try to sample a audio cd, it shows this screen

Looks like an unrelated thing so opening another issue might help so that this doesn't get lost.

shoddydev commented 3 months ago

It's working now. I actually did do a fresh git clone into a new directory yesterday, not sure why it had those errors. Maybe I did it too early where it wasn't pushed fully in github? i'm not really familiar with how github work honestly. Other than cloning open source projects and reporting issues.

I take it that the cdrom functionality is included by default now? because I tried compiling without HAVE_PHYSICAL_CDROM=1 and with it and the builds came out identical.

I've uploaded a video of me demonstrating it with disc project. However this is with the older build that used USE_LIBRETRO_VFS = 1. I did some testing with the new build and it seems to be working great. https://www.youtube.com/watch?v=i0kzkb9p6WQ

One thing I notice is that games with redbook audio typically takes longer to load. Like most discs only take 2 seconds for me to load once I close the lid. But games like NBA Jam TE, Ridge Racer, and Vib Ribbon take significantly longer to load. Not sure why that is.

and sure I'll open another issue regarding MTV music generator