From f41d634d5ab12c1f7d7f329d981f6ec005838550 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Mon, 8 Dec 2008 13:11:05 +0000 Subject: [PATCH] core: - some fixes; --- desmume/src/MMU.cpp | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 32b393746..2c21c59f6 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -416,22 +416,7 @@ u8 *MMU_RenderMapToLCD(u32 vram_addr) vram_addr &= 0x01FFFFF; u8 engine_offset = (vram_addr >> 14); u8 block = MMU.VRAM_MAP[engine][engine_offset]; - if (block == 7) - { - switch (engine) - { - case 0: // Engine ABG - return (ARM9Mem.ARM9_ABG + vram_addr); - case 1: // Engine BBG - return (ARM9Mem.ARM9_BBG + vram_addr); - case 2: // Engine AOBJ - return (ARM9Mem.ARM9_AOBJ + vram_addr); - case 3: // Engine BOBJ - return (ARM9Mem.ARM9_BOBJ + vram_addr); - } - LOG("render: VRAM not mapped to LCD\n"); - return NULL; - } + if (block == 7) return (EngineAddr[engine] + vram_addr); vram_addr -= MMU.LCD_VRAM_ADDR[block]; return (LCDdst[block] + vram_addr); } @@ -462,6 +447,13 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) { if (!(VRAMBankCnt & 0x80)) return; if (!(VRAMBankCnt & 0x07)) return; + + for (int i = 0; i < 4; i++) + { + for (int t = 0; t < 32; t++) + if (MMU.VRAM_MAP[i][t] == block) + MMU.VRAM_MAP[i][t] = 7; + } u32 vram_map_addr = 0xFFFFFFFF; u8 *LCD_addr = LCDdst[block]; @@ -586,13 +578,6 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) break; } - for (int i = 0; i < 4; i++) - { - for (int t = 0; t < 32; t++) - if (MMU.VRAM_MAP[i][t] == block) - MMU.VRAM_MAP[i][t] = 7; - } - if (vram_map_addr != 0xFFFFFFFF) { u8 engine = (vram_map_addr >> 21);