git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 5cd65f845de7115ae520b21b2623abc8f69056ec
parent 4b03cc05c1ab5b94cebf50b90bb8b187875b91b6
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sun, 24 Jul 2022 13:23:50 +0300

Warn when progress can't be saved

Diffstat:
MCocoa/Document.m5+++++
MSDL/main.c19++++++++++++-------
2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/Cocoa/Document.m b/Cocoa/Document.m @@ -1071,6 +1071,11 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency) else { ret = GB_load_rom(&gb, [fileName UTF8String]); } + if (GB_save_battery_size(&gb)) { + if (access(self.savPath.UTF8String, W_OK)) { + GB_log(&gb, "The save path for this ROM is not writeable, progress will not be saved.\n"); + } + } GB_load_battery(&gb, self.savPath.UTF8String); GB_load_cheats(&gb, self.chtPath.UTF8String); [self.cheatWindowController cheatsUpdated]; diff --git a/SDL/main.c b/SDL/main.c @@ -737,6 +737,18 @@ restart: else { GB_load_rom(&gb, filename); } + + /* Configure battery */ + 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, ".sav"); + battery_save_path_ptr = battery_save_path; + GB_load_battery(&gb, battery_save_path); + if (GB_save_battery_size(&gb)) { + if (access(battery_save_path, W_OK)) { + GB_log(&gb, "The save path for this ROM is not writeable, progress will not be saved.\n"); + } + } + end_capturing_logs(true, error, SDL_MESSAGEBOX_WARNING, "Warning"); static char start_text[64]; @@ -745,13 +757,6 @@ restart: sprintf(start_text, "SameBoy v" GB_VERSION "\n%s\n%08X", title, GB_get_rom_crc32(&gb)); show_osd_text(start_text); - - /* Configure battery */ - 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, ".sav"); - battery_save_path_ptr = battery_save_path; - GB_load_battery(&gb, battery_save_path); - /* Configure symbols */ GB_debugger_load_symbol_file(&gb, resource_path("registers.sym"));

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.