git.y1.nz

SameBoy

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

commit a52302f2f682c7713fd44a783b151433e37523b1
parent 75bc1e9a863b316bdb8575ce46eaf3555713e09b
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Wed, 24 Mar 2021 23:22:24 +0200

Make NAME come before CORE

Diffstat:
MCore/save_state.c27+++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/Core/save_state.c b/Core/save_state.c @@ -418,6 +418,18 @@ static int save_state_internal(GB_gameboy_t *gb, virtual_file_t *file) .magic = htonl('BESS'), }; + /* BESS NAME */ + + static const BESS_block_t bess_name = {htonl('NAME'), BESS32(sizeof(BESS_NAME) - 1)}; + + if (file->write(file, &bess_name, sizeof(bess_name)) != sizeof(bess_name)) { + goto error; + } + + if (file->write(file, BESS_NAME, sizeof(BESS_NAME) - 1) != sizeof(BESS_NAME) - 1) { + goto error; + } + /* BESS CORE */ bess_core.header = (BESS_block_t){htonl('CORE'), BESS32(sizeof(bess_core) - sizeof(bess_core.header))}; @@ -472,19 +484,7 @@ static int save_state_internal(GB_gameboy_t *gb, virtual_file_t *file) if (file->write(file, &bess_core, sizeof(bess_core)) != sizeof(bess_core)) { goto error; } - - /* BESS NAME */ - - static const BESS_block_t bess_name = {htonl('NAME'), BESS32(sizeof(BESS_NAME) - 1)}; - - if (file->write(file, &bess_name, sizeof(bess_name)) != sizeof(bess_name)) { - goto error; - } - - if (file->write(file, BESS_NAME, sizeof(BESS_NAME) - 1) != sizeof(BESS_NAME) - 1) { - goto error; - } - + /* BESS OAM */ BESS_OAM_t bess_oam; @@ -743,7 +743,6 @@ static int load_bess_save(GB_gameboy_t *gb, virtual_file_t *file, bool is_samebo break; case htonl('NAME'): - if (!found_core) goto parse_error; if (BESS32(block.size) > sizeof(emulator_name) - 1) { file->seek(file, BESS32(block.size), SEEK_CUR); }

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