Fill initial RAM with garbage so PalmOS is much more likely to find it invalid; Add RetroArch run command if it exists in PATH.

This commit is contained in:
Stephanie Gawroriski
2024-06-14 18:49:21 -04:00
parent 865acf3a28
commit dee65d0d1a
3 changed files with 52 additions and 19 deletions

View File

@@ -32,6 +32,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
set(MU_LIBRETRO_DIR "$ENV{APPDATA}/RetroArch")
endif()
else()
find_program(RETROARCH_APP retroarch)
if(RETROARCH_APP)
get_filename_component(MU_LIBRETRO_DIR "${RETROARCH_APP}" DIRECTORY)
endif()
set(MU_LIBRETRO_EXTENSION "")
endif()

View File

@@ -712,12 +712,16 @@ bool retro_load_game(const struct retro_game_info *info){
strlcat(saveRamPath, osVersion, PATH_MAX_LENGTH);
strlcat(saveRamPath, ".ram", PATH_MAX_LENGTH);
saveRamFile = filestream_open(saveRamPath, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
if(saveRamFile){
hasSram = true;
// There is now always SRAM because it gets initialized to garbage
hasSram = true;
if(saveRamFile) {
if(filestream_get_size(saveRamFile) == emulatorGetRamSize()){
filestream_read(saveRamFile, palmRam, emulatorGetRamSize());
swap16BufferIfLittle(palmRam, emulatorGetRamSize() / sizeof(uint16_t));
}
filestream_close(saveRamFile);
}