mmatyas / pegasus-frontend

A cross platform, customizable graphical frontend for launching emulators and managing your game collection.
http://pegasus-frontend.org
Other
1.24k stars 112 forks source link

Reloading the game cache automatically. #1075

Closed Midnite59 closed 11 months ago

Midnite59 commented 1 year ago

So I am making this console with Pegasus as a front end. I want to have it dynamically update when a cartridge is connected. How would I be able to do this if I can?

mmatyas commented 1 year ago

Hi! I assume you're making some custom controller chip or an USB device based solution. When you plug the cartridge into the device, your operating system probably generates some system event, which should be captured by Pegasus. You probably have to modify Pegasus' source code to listen to the system event your device generates, add the cartridge's drive to the list of game directories, and refresh the game list. I've never tried doing this, but these links seem to be useful: https://stackoverflow.com/questions/29414329/is-there-a-qt-solution-for-detecting-usb-events-insertion-and-removal

(Not sure if this is the kind of answer you were looking for.)

Midnite59 commented 1 year ago

Guess I have to wait so someone PRs it for me. (Kinda dumb)

Midnite59 commented 1 year ago

What I really wanted to do was find a bash command or such to reload the game cache with a script. I know you can make scripts for certain events, but I was wondering if there was a command, directory to delete, or some flag that would reload the games. I would love to know if there was a way to do it without modifying the source (Since I am dumb as heck)

mmatyas commented 1 year ago

Pegasus calls external scripts based on actions done inside Pegasus, but it doesn't monitor external files or commands for changes. I think the closest you could do is to just restart Pegasus: If you can write a script that detects the connection/disconnection of the cartridge, then there you can quit Pegasus, modify its config file that stores the game directories (which is a plain text file), and then restart Pegasus.

mmatyas commented 11 months ago

I think I'll close this issue, as it sounds very specific to the device you're building, but the workaround mentioned above could be used.