diff --git a/Cocoa/Document.m b/Cocoa/Document.m index ed52efb..6eb9c2f 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -650,6 +650,8 @@ static void audioCallback(GB_gameboy_t *gb, GB_sample_t *sample) GB_debugger_clear_symbols(&gb); if ([[self.fileType pathExtension] isEqualToString:@"isx"]) { GB_load_isx(&gb, [self.fileName UTF8String]); + GB_load_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"ram"] UTF8String]); + } else { GB_load_rom(&gb, [self.fileName UTF8String]); diff --git a/SDL/main.c b/SDL/main.c index e09630b..9a358d0 100644 --- a/SDL/main.c +++ b/SDL/main.c @@ -540,6 +540,11 @@ restart: } if (strcmp(extension, "isx") == 0) { error = GB_load_isx(&gb, filename); + /* Try loading .ram file if available */ + char battery_save_path[path_length + 5]; /* At the worst case, size is strlen(path) + 4 bytes for .sav + NULL */ + replace_extension(filename, path_length, battery_save_path, ".ram"); + battery_save_path_ptr = battery_save_path; + GB_load_battery(&gb, battery_save_path); } else { GB_load_rom(&gb, filename);