mirror of https://github.com/bsnes-emu/bsnes.git
Make NAME come before CORE
This commit is contained in:
parent
75bc1e9a86
commit
a52302f2f6
|
@ -418,6 +418,18 @@ static int save_state_internal(GB_gameboy_t *gb, virtual_file_t *file)
|
||||||
.magic = htonl('BESS'),
|
.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 */
|
||||||
|
|
||||||
bess_core.header = (BESS_block_t){htonl('CORE'), BESS32(sizeof(bess_core) - sizeof(bess_core.header))};
|
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)) {
|
if (file->write(file, &bess_core, sizeof(bess_core)) != sizeof(bess_core)) {
|
||||||
goto error;
|
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 */
|
||||||
|
|
||||||
BESS_OAM_t 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;
|
break;
|
||||||
case htonl('NAME'):
|
case htonl('NAME'):
|
||||||
if (!found_core) goto parse_error;
|
|
||||||
if (BESS32(block.size) > sizeof(emulator_name) - 1) {
|
if (BESS32(block.size) > sizeof(emulator_name) - 1) {
|
||||||
file->seek(file, BESS32(block.size), SEEK_CUR);
|
file->seek(file, BESS32(block.size), SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue