libretro / geolith-libretro

Highly accurate emulator for the Neo Geo AES and MVS Cartridge Systems
BSD 3-Clause "New" or "Revised" License
14 stars 4 forks source link

Added VFS support #8

Closed albertofustinoni closed 2 months ago

albertofustinoni commented 3 months ago

Core loads BIOS from files. Added support to do so via libretro VFS

albertofustinoni commented 3 months ago

Reverted the changes in geo.c

Would it be possible to implement retro_get_memory_data for RETRO_MEMORY_SAVE_RAM?

With the changes in libretro.c the core can get ingame (rom passed as buffer and BIOS loaded via VFS), but as is there's no way around stdio save game data.

carmiker commented 3 months ago

Reverted the changes in geo.c

Would it be possible to implement retro_get_memory_data for RETRO_MEMORY_SAVE_RAM?

With the changes in libretro.c the core can get ingame (rom passed as buffer and BIOS loaded via VFS), but as is there's no way around stdio save game data.

This is what I tried when I started writing the port, but it gets complicated because there are 3 different types of save data. Arguably the NVRAM could fall under RETRO_MEMORY_RTC as it does contain RTC data, but it also includes a lot more than that. Actual SRAM is only used by two titles, the gambling titles from Brezzasoft (vliner and jockeygp), and the main purpose is to make sure if the power goes out, you don't lose your score. Then there are memory cards. I think trying to work this int retro_get_memory_data is going to just result in ugly hacks.

Probably the best way to do it is to create something based on geo_mem_ptr. What I am envisioning is 2 possible codepaths: the current one, and the VFS one, chosen in libretro.c based on whether the frontend has a VFS implementation or not. This way it continues to work as it does now for simpler frontends, but for RA it always uses VFS.

For example, taking the code in retro_unload_game and turning most of that into its own function, then creating a similar function that uses VFS, and calling the correct one based on frontend capabilities.

@albertofustinoni if you are okay with it, I can take this to the finish line from where it is now, but I don't want to step on your toes if you'd like to do it.

carmiker commented 2 months ago

@albertofustinoni I have rewritten the implementation in this PR, but it still lacks VFS support for save data. I'll do that a bit later. Thanks for getting the ball rolling here.