Commit graph

31 commits

Author SHA1 Message Date
刘皓
28fb36af98
Capitalize /Dist, /Game, /Save and /System in libretro builds for consistency 2025-05-13 17:53:59 -04:00
刘皓
36075a5add
Load RTPs from mkxp.json as well in libretro builds 2025-05-13 17:26:30 -04:00
刘皓
714c583b9f
Allow RTPs to be loaded from archives as well in libretro builds 2025-05-13 16:17:04 -04:00
刘皓
d71cd242c7
Improve save directory creation algorithm in libretro builds
Before, if the game tried to create a save file, missing parent
directories would always be created because they could possibly exist
only in the game directory and not in the save directory, and we
wouldn't know due to the union mounting of the save and game
directories. But this is inconsistent with the behaviour of file
creation, where it should fail if parent directories don't exist.

The behaviour has been changed to only create parent directories if the
parent directories already exist. I know that sounds strange, but if the
parent directories exist, it could be that they only exist in the game
directory but not the save directory due to the union mounting, so we
need to create the parent directories, which will be created in the save
directory due to it being set as the write directory in PhysFS.
2025-05-07 22:13:45 -04:00
刘皓
c85e9554ec
Implement writing to filesystem (i.e. game saving) in libretro builds
Files are written to the libretro save directory, which is mounted at
/save in PhysFS. All filesystem calls made from Ruby in libretro builds
are routed through PhysFS, so the game can just use any ordinary
filesystem function provided by Ruby to interact with /save.

It's also union mounted on top of the game directory (located at /game
in PhysFS) so that games that write their save files to the current
working directory will have their save files saved to the libretro save
directory instead of the game directory.

For security and portability reasons, nothing outside of the libretro
save directory can be written to, and nothing outside of the libretro
save directory, the libretro game directory and the various embedded
files used by the runtime can be read from.
2025-05-07 16:01:41 -04:00
刘皓
3e3df818aa
Use C getcwd() instead of Ruby Dir.pwd() to get CWD in libretro builds 2025-05-06 18:02:03 -04:00
刘皓
13c0657691
Handle current working directory properly in libretro builds
Any relative paths that the game tries to access in libretro builds will
now be relative to whatever is the current working directory in the Ruby
sandbox, which will also now be initialized to the game directory during
initialization. Before, all of the bindings that took paths were
hardcoded to prepend the path with the game directory.
2025-05-06 16:55:28 -04:00
刘皓
74f4c0e714
Downgrade OpenAL Soft from 1.24.2 to 1.23.1 in libretro builds
OpenAL Soft 1.24 introduces a lot of code that doesn't work well with
the PlayStation 3 homebrew toolchain, and also the old version of the
Wii U homebrew toolchain currently used by the libretro buildbot.
Instead of maintaining a bunch of patches to get 1.24 to work on these
toolchains, I think it'd be easier to just use 1.23.
2025-04-08 14:27:20 -04:00
刘皓
6bbe58378d
Don't normalize game path in libretro builds
Reverts commit d6ede8bcc6 and changes the
game path parser in libretro builds to not normalize the game path as it
causes problems on consoles with weird path formats.
2025-04-06 12:11:23 -04:00
刘皓
81b94d1498
Remove dependency on SDL headers in libretro builds
I'd already removed the SDL static libraries from libretro builds for
portability, but kept the headers to make it easier to port the codebase
to libretro. Eventually it was time to stop using the SDL headers as a
crutch.
2025-03-29 12:37:07 -04:00
刘皓
d6ede8bcc6
Don't add leading slash to native paths in libretro Windows build 2025-03-01 18:02:13 -05:00
刘皓
9ed11ecffa
Use libretro's PlayStation 3 Docker image instead of ScummVM's 2025-02-22 16:04:51 -05:00
刘皓
37a7559e38
Remove dependency on ghc::filesystem in libretro builds 2025-02-01 13:03:13 -05:00
刘皓
b249ad0d98
Add Ogg, Vorbis and libsndfile to libretro builds 2025-01-28 23:25:17 -05:00
刘皓
c42949713d
Start integrating the audio code into libretro builds 2025-01-27 00:34:52 -05:00
刘皓
84ca884f84
Reimplement WASI filesystem on top of existing mkxp-z filesystem implementation
This allows more flexibility when loading games in libretro builds,
since we can now load games either from a directory or from a ZIP or 7Z
archive. Also, the path cache is now active for all filesystem calls
made from inside Ruby.
2025-01-25 22:03:52 -05:00
Splendide Imaginarius
b42c13a8ca
Merge pull request #163 from WaywardHeart/hang-on-close
Don't hang if the user closes the game while it's still initializing
2024-04-29 20:53:00 +00:00
Splendide Imaginarius
325a49666d Log expensive optional operations
Path caching and atlas dumping incur a nontrivial performance hit, so it's
useful to log that they're happening so that users are reminded to disable
them if they were enabled accidentally.
2024-04-10 22:48:49 +00:00
Wayward Heart
9e8132ba25 Don't hang if the user closes the game while it's still initializing 2024-01-22 08:16:32 -06:00
Amaryllis Kulla
fae7fa9c4e
Update ancurio's copyright notice (#29) 2023-10-04 15:07:34 -04:00
Struma
eb300a9ef1 Adjust PhysFS and OpenAL errors a bit 2023-05-08 00:18:26 -04:00
Struma
3da0f4c948 fix files sometimes not loading properly
Namely, when the path cache is off and the file closely matches the name
of another file, apparently.
2021-11-27 22:51:13 -05:00
Struma
e666590563 Use old SDL_sound again... again 2021-06-17 18:14:47 -04:00
Struma
95e17244fd Remove Windows API emulation 2021-06-08 19:02:15 -04:00
Struma
ca596cbaf9 cleanup 2021-05-23 21:55:02 -04:00
Struma
44dda759a4 freeze version string 2021-03-27 23:17:20 -04:00
Struma
48a2393bb8 Speed up load_data & remove encryptedGraphics setting 2021-02-26 08:33:27 -05:00
Struma
94657eaed5 Add Ruby functions for mounting/unmounting paths 2021-01-09 00:49:31 -05:00
Struma
182389ba1d Fix paths with backslashes in Game.ini 2020-12-25 21:32:53 -05:00
Struma
aaae11b67d Normalize paths during calls to FileSystem::openReadRaw 2020-12-25 20:20:17 -05:00
Struma
0e278c3e5c Drop ObjFW as a dependency 2020-11-22 03:48:03 -05:00
Renamed from src/filesystem/filesystem.mm (Browse further)