From 3d5e3661fbf105b881fd31dbfcd2d14a6cfe7343 Mon Sep 17 00:00:00 2001 From: CrashOveride95 Date: Mon, 11 Jan 2021 01:16:49 -0500 Subject: [PATCH] Align size for SRAM to fix issue with a certain crap emu --- src/game/save_file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/game/save_file.c b/src/game/save_file.c index 7e4c7a63..43659400 100644 --- a/src/game/save_file.c +++ b/src/game/save_file.c @@ -15,6 +15,8 @@ #include "sram.h" #endif +#define ALIGN4(val) (((val) + 0x3) & ~0x3) + #define MENU_DATA_MAGIC 0x4849 #define SAVE_FILE_MAGIC 0x4441 @@ -122,7 +124,7 @@ static s32 read_eeprom_data(void *buffer, s32 size) { block_until_rumble_pak_free(); #endif triesLeft--; - status = nuPiReadSram(offset, buffer, size); + status = nuPiReadSram(offset, buffer, ALIGN4(size)); #if ENABLE_RUMBLE release_rumble_pak_control(); #endif @@ -150,7 +152,7 @@ static s32 write_eeprom_data(void *buffer, s32 size) { block_until_rumble_pak_free(); #endif triesLeft--; - status = nuPiWriteSram(offset, buffer, size); + status = nuPiWriteSram(offset, buffer, ALIGN4(size)); #if ENABLE_RUMBLE release_rumble_pak_control(); #endif