git.y1.nz

SameBoy

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

commit e69f6b85794e87730aded713919c535e634add45
parent cfbc7b481a8159a60b0270e8441b8eac2ee0df32
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Mon, 21 Jul 2025 23:53:54 +0300

Bug fix: GB_save_state always returned success

Diffstat:
MCore/save_state.c5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Core/save_state.c b/Core/save_state.c @@ -551,6 +551,7 @@ static const uint8_t *get_header_bank(GB_gameboy_t *gb) static int save_state_internal(GB_gameboy_t *gb, virtual_file_t *file, bool append_bess) { + errno = 0; if (file->write(file, GB_GET_SECTION(gb, header), GB_SECTION_SIZE(header)) != GB_SECTION_SIZE(header)) goto error; if (!DUMP_SECTION(gb, file, core_state)) goto error; if (!DUMP_SECTION(gb, file, dma )) goto error; @@ -838,8 +839,10 @@ static int save_state_internal(GB_gameboy_t *gb, virtual_file_t *file, bool appe goto error; } + return 0;; error: - return 0; + if (errno == 0) return EIO; + return errno; } int GB_save_state(GB_gameboy_t *gb, const char *path)

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