From b76fc6277bafaec00e9767115d7a1dffef7f9c96 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Sun, 18 Jan 2009 15:25:57 +0000 Subject: [PATCH] core: -fix VRAM mapping for textures (broke in rev 1459, zeromus check it) --- desmume/src/MMU.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index fdd25d5ea..c25e61e00 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -579,20 +579,6 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) u32 vram_map_addr = 0xFFFFFFFF; u8 *LCD_addr = LCDdst[block]; - //unmap texmem - for(int i=0;i<4;i++) - if(ARM9Mem.textureSlotAddr[i] == LCD_addr) - ARM9Mem.textureSlotAddr[i] = ARM9Mem.blank_memory; - - //unmap texpal mem. This is not a straightforward way to do it, - //but it is the only place we have this information stored. - for(int i=0;i<4;i++) - if(ARM9Mem.texPalSlot[i] == LCD_addr + 0x4000*i || ARM9Mem.texPalSlot[i] == LCD_addr) - ARM9Mem.texPalSlot[i] = ARM9Mem.blank_memory; - for(int i=4;i<6;i++) - if(ARM9Mem.texPalSlot[i] == LCD_addr) - ARM9Mem.texPalSlot[i] = ARM9Mem.blank_memory; - switch (VRAMBankCnt & 0x07) { @@ -756,6 +742,20 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) //INFO("VRAM %i mapping: eng=%i (offs=%i, size=%i), addr = 0x%X, MST=%i\n", // block, engine, engine_offset, LCDdata[block][1]*0x4000, MMU.LCD_VRAM_ADDR[block], VRAMBankCnt & 0x07); VRAM_blockEnabled[block] = 1; + + //unmap texmem + for(int i=0;i<4;i++) + if(ARM9Mem.textureSlotAddr[i] == LCD_addr) + ARM9Mem.textureSlotAddr[i] = ARM9Mem.blank_memory; + + //unmap texpal mem. This is not a straightforward way to do it, + //but it is the only place we have this information stored. + for(int i=0;i<4;i++) + if( (ARM9Mem.texPalSlot[i] == LCD_addr + 0x4000*i) || (ARM9Mem.texPalSlot[i] == LCD_addr) ) + ARM9Mem.texPalSlot[i] = ARM9Mem.blank_memory; + for(int i=4;i<6;i++) + if(ARM9Mem.texPalSlot[i] == LCD_addr) + ARM9Mem.texPalSlot[i] = ARM9Mem.blank_memory; return; }