RSDKModding / RSDKv3-Decompilation

A Full Decompilation of Sonic CD (2011) & Retro Engine (v3)
Other
591 stars 122 forks source link

Fix flatpak builds and some other Linux fixes #172

Closed ArclightMat closed 2 years ago

ArclightMat commented 2 years ago

This pull request brings in a few fixes for Linux users. They are mostly related to making flatpaks work, but they are bringing in a proper RETRO_PLATFORM for Linux and XDG support.

The changes consist of the following:

The first two are the most important ones, the former actually makes the flatpak work (after fixing the recipes) and the latter fixes saving under flatpak, while standardizing saves under Linux. I've tested them out and everything seems to be working out OK. I don't believe this will bring in a regression for any other platform, but I haven't tested them. If needed, I can revert the "chmod -x" change and manually re-add the execute bit in the flatpak build process itself, but I don't see why it was there in the first place.

For testing, you just need to change the "url": "https://github.com/Rubberduckycooly/Sonic-CD-11-Decompilation.git", to "path": ".." in the .json files under flatpak/ or change the URL to my repo.

TheAgamer554 commented 2 years ago

thank you for this, finally fixing flatpak. just as a quick question, what do RETRO_PLATFORM and XDG support actually do for the decomp? it sounds super interesting but i have no idea what it could be (besides XDG portals maybe????)

ArclightMat commented 2 years ago

@TheAgamer554 RETRO_PLATFORM is used to define engine behavior according to an OS/platform. By including a platform for Linux, we can set specific behavior (like handling game files or UI) for it without affecting other code paths, which are skipped by the compiler. So if someone wants to change something just for Linux, they can pop in an #if RETRO_PLATFORM == RETRO_LINUX macro and do what they need.

XDG support here means the XDG Base Directory specification which sets standard paths for configuration files, data files, cache, etc. If you have used Windows before, think of it as something similar to %APPDATA%. They can be overridden by setting environment variables. For the decomp, we are using XDG_DATA_HOME, which is set to $HOME/.local/share/ by default, to store config and save data. If XDG is not available (which mostly applies to esoteric desktops setups), it'll fall back to the default path of $HOME/.local/share/.

As an additional note, XDG means "Cross-Desktop Group", which are a set of specifications by freedesktop.org, a project for interoperability between free desktops platforms (GNOME, KDE, XFCE, etc). XDG Base Dir and XDG Portals are under the same umbrella, but not necessarily part of the same specification.