this post was submitted on 30 Aug 2024
21 points (92.0% liked)

Programming

17494 readers
37 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

Apologies if this is the wrong community, happy to remove and post elsewhere.

I'm essentially a beginner to programming. I know some python (made a game of hangman with ASCII art for example) but nothing more complicated than that.

I've been wanting to learn some programming, whether it's python or something else, and I think I've decided on a project I want to make (if possible?).

I aiming to make an emulation front end/GUI selector. I know there are things like RetroArch that are great, but it doesn't have access to all emulation tools (e.g. doesn't have Xbox/PS2/switch).

I'd picture just opening one program GUI that can select the "system" you want to use, then it provides a list of games.

The complexity that I can see is that even if I can run the actual emulator in a container or use a custom GUI to open the emulator it won't 1) be able to show a games list within the same GUI and 2) it won't be an easy back and forth to change emulators.

Not looking for anyone to solve the problem for me, just hoping for some advice on where to start like languages and what I should be trying to learn etc. or if it's even possible. I'm aware there's a high chance it's not!

I've got years to learn and build before my kid might use it, not in a rush.

Thanks!

top 6 comments
sorted by: hot top controversial new old
[–] LainTrain@lemmy.dbzer0.com 11 points 2 months ago* (last edited 2 months ago)

So you want to make a frontend for emulators like emulationstation?

[–] e0qdk@reddthat.com 8 points 2 months ago

I wrote something like this before for academic researchers to load data sets on display walls by using their cellphones. I approached it by building a simple website. When the user logs in, they'd see a table of entries (from a directory listing on a shared file server that they could drop their data sets onto) and could click a button that made a form post to the server which caused it to run whichever programs were needed to load the data set they wanted (or run a couple of other handy commands -- like turning the monitors on/off, etc).

You can do something like that too in Python if you want:

  1. Learn how to start and stop programs from Python scripts. This can be done with the built-in subprocess library. If you know how to launch the programs you want from the command line, it shouldn't be too hard to figure out how to do it from Python by reading the documentation. It will take some more effort to figure out how to interact with it (e.g. to stop it from user input) without blocking your script, but this can be done.
  2. Learn how to write a simple program that can respond to HTTP requests in Python. There are a number of libraries like tornado, flask, cherrypy, etc. that can do this. Pick one, read the documentation, and write a tiny page that allows you to submit a form and then trigger an action on the server in response to an HTTP POST. You should be able to interact with it by pointing the browser on your computer to localhost (possibly plus a port) or from on your LAN by putting the IP of your computer into the address bar.
  3. Figure out how you're going to organize the entries you want to be able to load. You could just do something trivial like putting the files in known folders and running os.listdir, or something more involved like tracking the entries with a spreadsheet or database or JSON file that lets you associate custom metadata with each entry (like a custom name to show or an icon to display or when it was last launched, etc.)
  4. Generate a web page based on that data collection. I recommend using templating -- e.g. with mustache, or jinja, etc. Basically you write some HTML-like text that lets you indicate places to fill in data from your program and it will do the conversion of symbols like < into &lt; that are needed for HTML output and also repeat patterns using entries from lists you provide to build the rows of tables and such for you.
  5. Set up some security (e.g. a simple log in system) and polish it up as much as you care to do.

Good luck and have fun!

[–] GetOffMyLan@programming.dev 6 points 2 months ago* (last edited 2 months ago)

I imagine most of the emulators have a way to pass it a rom to open on launch.

So the game library etc. could just be a list of files in a directory that you manage in your UI. When one is selected you launch the emulator with that file.

This will likely be different for each emulator but should be achievable. So you'll need some way to configure what to launch and which args to use. Or just hard ode it tbh.

As for getting back to the menu you could likely use some global hot key to signal your application to kill the emulator and return to the menu.

What language you use shouldn't make a huge difference here. Any with a GUI framework should allow you to do it.

[–] houseofleft 5 points 2 months ago

Take a look at retropi, which is more or less what you're talking about!

Depending what you're wanting to get out the project:

  • You might be happy just using retropi
  • You might be happy working on top of retropi
  • You might want to build something from scratch and just use retropi as a refence

Anywag, I'll stop being a shill now and just give you the link: https://retropie.org.uk/

[–] MalReynolds 3 points 2 months ago* (last edited 2 months ago)

RetroArch doesn’t have Xbox/PS2/switch

No, but EmuDeck does, along with RetroArch... Best have a look before starting.

More power to you if you want to strike out on your own, but you may find it quicker going to join a larger project at this stage, you'll have people to ask questions to, if you choose well you'll learn best (or good) practices, etc. Maybe EmuDeck itself? In the end the language doesn't matter much (maybe avoid Perl, PHP and JavaScript at the start), once you get the concepts down it's easy to switch to another. You've got time, take some to skill up.

[–] datavoid@lemmy.ml 1 points 2 months ago

Launchbox is decent