zerojay / RetroPie-Extra

A collection of unofficial scripts for adding more emulators/ports/games to RetroPie.
MIT License
309 stars 101 forks source link

Added Gnash - SWF player for Flash games #294

Closed SuperFromND closed 5 years ago

SuperFromND commented 6 years ago

Added Gnash script. I couldn't quite figure out the proper way to write the addEmulator command while adhering to the Script Style Guide used by RetroPie, so feel free to rewrite that portion of the script.

This isn't really an emulator per-se (calling it one would be like calling VLC an MP4 emulator), but it doesn't quite fit into ports either since you have to supply your own games.

Terminology aside, I've tested this on my Pi 3 non-overclocked and it runs older games pretty well all things considered; however it can't properly run games made past SWF 10 (which rougly covers everything made after 2009 or so), and performace is pretty spotty on more intensive games such as Mario 63.

I should also note that there's a Github repository available, if you want to write a source-build version of this script (though commits seem to be few and far between, so it's not exactly going to be very practical).

SuperFromND commented 6 years ago

I've also considered running addEmulator multiple times, to allow additional video modes (such as one mode for 480p, one for 720p, one for 1080p, etc.; similar to the Moonlight script). It probably wouldn't end up benefitting the Pi all that much, given that even 480p is fairly hit-or-miss performance-wise, but it would be nice to have the option.

I should also note that reading through the documentation, it appears that a file called .gnashrc could be theoretically made to set Gnash to low quality by default, boosting performance somewhat. I couldn't find exactly where Gnash tries to look for this file (adding it to /home/pi/ didn't seem to affect anything), but as soon as I figure out where, I'll add an extra echo command to account for it.

Addendum: So it turns out the config file (as well as the Shared Objects folder; basically the Flash version of saves) gets installed into the /root/ directory. I'll add a sed to set the quality to low, as well as add a --hwaccel param to increase speed a little bit.

zerojay commented 6 years ago

First off, thanks for sending this my way. I do appreciate it.

If the only way that .gnashrc affects anything is if it is placed into /root, that means that the application is running as root. This is bad. Everything should be running under the pi user. Try logging into your Pi while gnash is running and use ps aux to see what user it is running under.

SuperFromND commented 6 years ago

Here's a few examples of some games that run more-or-less perfectly under Gnash (by no means an exhaustive list obviously, but just the ones I've tested and can confirm run at full-speed with no issues):

I'll remove the hardcoded resolution and specify instructions on how to set it manually in the help section in my next commit, however I can't really find a proper fix for running xinit as sudo; trying to run it without sudo always results in an error due to /dev/tty0 not being accessible (permission denied). Maybe you're using a different version of xinit, or there's some kind of command argument I haven't tried?

SuperFromND commented 6 years ago

Progress Report: I tried chmod 666 /dev/tty0 which did fix that error, but then I got another error about being unable to open virtual console 2, also for permission reasons. Couldn't find much on this error besides some methods involving xserver-xorg-legacy, which I refuse to resort to since you recently pushed a commit stating it's no longer needed.

I feel like I'm missing something really obvious...

SuperFromND commented 6 years ago

Progress Report: Solved it! Turns out the reason it didn't work was because apparently installing X on Stretch doesn't properly set the permissions. Running chmod ug+s /usr/lib/xorg/Xorg fixes this problem, and the script now works without sudo.

Of course, you have to run that chmod as sudo, but given that it's merely a permission change it shouldn't be too big of a problem; the application itself runs without it. Pushing a commit shortly!

zerojay commented 6 years ago

Still awaiting your new changes.

SuperFromND commented 6 years ago

The changes should be present by now...? Unless I'm completely missing something...

zerojay commented 6 years ago

I'll take a look as soon as I have time.