git.y1.nz

SameBoy

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

commit e13048d07b90c81f5ac07e99f76cc89fafac6935
parent 6eeba2f6f677b0ad966a46bac780b4547edd4e45
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Thu,  3 Oct 2024 16:21:10 +0300

Improve ISX compatibility

Diffstat:
MCore/gb.c18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/Core/gb.c b/Core/gb.c @@ -559,7 +559,12 @@ int GB_load_isx(GB_gameboy_t *gb, const char *path) READ(address); address = LE16(address); - address &= 0x3FFF; + if (bank) { + address &= 0x3FFF; + } + else { + address &= 0x7FFF; + } READ(length); length = LE16(length); @@ -710,6 +715,17 @@ done:; } } + // Inject a correct checksum, the official linker doesn't always fix it, which breaks the official boot ROMs + uint8_t original_checksum = gb->rom[0x14d]; + gb->rom[0x14d] = 0; + for (unsigned addr = 0x0134; addr <= 0x014C; addr++) { + gb->rom[0x14d] -= gb->rom[addr] + 1; + } + + if (original_checksum != gb->rom[0x14d]) { + GB_log(gb, "This ROM's header checksum has been automatically corrected\n"); + } + if (old_rom) { free(old_rom); }

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