From 24915e41eb02735771f28de424af71175234530e Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Tue, 13 Apr 2021 20:56:09 +0300 Subject: [PATCH] TPP1 in BESS --- Core/save_state.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Core/save_state.c b/Core/save_state.c index 6aa4f37..f97251a 100644 --- a/Core/save_state.c +++ b/Core/save_state.c @@ -215,6 +215,8 @@ static size_t bess_size_for_cartridge(const GB_cartridge_t *cart) return sizeof(BESS_block_t) + 4 * sizeof(BESS_MBC_pair_t); case GB_HUC3: return sizeof(BESS_block_t) + 3 * sizeof(BESS_MBC_pair_t) + sizeof(BESS_HUC3_t); + case GB_TPP1: + return sizeof(BESS_block_t) + 4 * sizeof(BESS_MBC_pair_t) + sizeof(BESS_RTC_t); } } @@ -443,6 +445,14 @@ static int save_bess_mbc_block(GB_gameboy_t *gb, virtual_file_t *file) pairs[2] = (BESS_MBC_pair_t){LE16(0x4000), gb->huc3.ram_bank}; mbc_block.size = 3 * sizeof(pairs[0]); break; + + case GB_TPP1: + pairs[0] = (BESS_MBC_pair_t){LE16(0x0000), gb->tpp1_rom_bank}; + pairs[1] = (BESS_MBC_pair_t){LE16(0x0001), gb->tpp1_rom_bank >> 8}; + pairs[2] = (BESS_MBC_pair_t){LE16(0x0002), gb->tpp1_rom_bank}; + pairs[3] = (BESS_MBC_pair_t){LE16(0x0003), gb->tpp1_mode}; + mbc_block.size = 4 * sizeof(pairs[0]); + break; } mbc_block.size = LE32(mbc_block.size);