From b9b8762a6351cfa648e6a65f76fdf6922fc73f8f Mon Sep 17 00:00:00 2001 From: "Dr. Flarp" Date: Sun, 1 Mar 2026 10:20:22 -0500 Subject: [PATCH 1/2] feat: SRAM_read load gamesave even if compress/raw file does not match user setting --- workspace/all/minarch/minarch.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/workspace/all/minarch/minarch.c b/workspace/all/minarch/minarch.c index e6f1d47fb..e3c8fb586 100644 --- a/workspace/all/minarch/minarch.c +++ b/workspace/all/minarch/minarch.c @@ -825,32 +825,19 @@ static void SRAM_read(void) { void* sram = core.get_memory_data(RETRO_MEMORY_SAVE_RAM); #ifdef HAS_SRM - // TODO: rzipstream_open can also handle uncompressed, else branch is probably unnecessary // srm, potentially compressed - if (CFG_getSaveFormat() == SAVE_FORMAT_SRM) { - rzipstream_t* sram_file = rzipstream_open(filename, RETRO_VFS_FILE_ACCESS_READ); - if(!sram_file) return; - - if (!sram || rzipstream_read(sram_file, sram, sram_size) < 0) - LOG_error("rzipstream: Error reading SRAM data\n"); - - rzipstream_close(sram_file); - } - // uncompressed - else { - RFILE* sram_file = filestream_open(filename, RETRO_VFS_FILE_ACCESS_READ, 0); - if(!sram_file) return; + rzipstream_t* sram_file = rzipstream_open(filename, RETRO_VFS_FILE_ACCESS_READ); + if(!sram_file) return; - if (!sram || filestream_read(sram_file, sram, sram_size) < 0) - LOG_error("filestream: Error reading SRAM data\n"); + if (!sram || rzipstream_read(sram_file, sram, sram_size) < 0) + LOG_error("rzipstream: Error reading SRAM data\n"); - filestream_close(sram_file); - } + rzipstream_close(sram_file); #else FILE *sram_file = fopen(filename, "r"); if (!sram_file) return; if (!sram || !fread(sram, 1, sram_size, sram_file)) { - LOG_error("Error reading SRAM data\n"); + LOG_error("Error reading SRAM data\n"); } fclose(sram_file); #endif From eee709fa5bee292f39ee2b3bd8cab8f7cb6e8298 Mon Sep 17 00:00:00 2001 From: "Dr. Flarp" Date: Sun, 1 Mar 2026 18:46:36 -0500 Subject: [PATCH 2/2] indentation --- workspace/all/minarch/minarch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workspace/all/minarch/minarch.c b/workspace/all/minarch/minarch.c index e3c8fb586..81fc45db0 100644 --- a/workspace/all/minarch/minarch.c +++ b/workspace/all/minarch/minarch.c @@ -830,14 +830,14 @@ static void SRAM_read(void) { if(!sram_file) return; if (!sram || rzipstream_read(sram_file, sram, sram_size) < 0) - LOG_error("rzipstream: Error reading SRAM data\n"); + LOG_error("rzipstream: Error reading SRAM data\n"); rzipstream_close(sram_file); #else FILE *sram_file = fopen(filename, "r"); if (!sram_file) return; if (!sram || !fread(sram, 1, sram_size, sram_file)) { - LOG_error("Error reading SRAM data\n"); + LOG_error("Error reading SRAM data\n"); } fclose(sram_file); #endif