From 08ca56eec7f53f6f8849f667c2137666162ca585 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 23 May 2020 00:05:43 +0300 Subject: [PATCH] Cleanup --- Core/gb.h | 2 +- Core/memory.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/gb.h b/Core/gb.h index f5f7df5..426a3ef 100644 --- a/Core/gb.h +++ b/Core/gb.h @@ -418,7 +418,7 @@ struct GB_gameboy_internal_s { struct { uint8_t bank_low:6; uint8_t bank_high:3; - uint8_t mode:1; + bool mode:1; } huc1; struct { diff --git a/Core/memory.c b/Core/memory.c index 474eda6..61a397a 100644 --- a/Core/memory.c +++ b/Core/memory.c @@ -174,13 +174,16 @@ static uint8_t read_mbc_ram(GB_gameboy_t *gb, uint16_t addr) if ((!gb->mbc_ram_enable || !gb->mbc_ram_size) && gb->cartridge_type->mbc_subtype != GB_CAMERA && gb->cartridge_type->mbc_type != GB_HUC1 && - gb->cartridge_type->mbc_type != GB_HUC3) return 0xFF; + gb->cartridge_type->mbc_type != GB_HUC3) { + return 0xFF; + } if (gb->cartridge_type->mbc_type == GB_HUC1 && gb->huc1.mode) { return 0xc0 | effective_ir_input(gb); } - if (gb->cartridge_type->has_rtc && gb->mbc_ram_bank >= 8 && gb->mbc_ram_bank <= 0xC) { + if (gb->cartridge_type->has_rtc && gb->cartridge_type->mbc_type != GB_HUC3 && + gb->mbc_ram_bank >= 8 && gb->mbc_ram_bank <= 0xC) { /* RTC read */ gb->rtc_latched.high |= ~0xC1; /* Not all bytes in RTC high are used. */ return gb->rtc_latched.data[gb->mbc_ram_bank - 8];