From 75e749ecf9e1162f112d33d5ccf488da2646333f Mon Sep 17 00:00:00 2001 From: matusz Date: Tue, 28 Apr 2009 10:49:41 +0000 Subject: [PATCH] move 'FORCEINLINE mmu_gpu_map()' to MMU.h, because gcc does not like it in .cpp --- desmume/src/MMU.cpp | 24 ------------------------ desmume/src/MMU.h | 27 ++++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index bada17171..a3f0b1cce 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -289,7 +289,6 @@ u8 vram_lcdc_map[VRAM_LCDC_PAGES]; //in the range of 0x06000000 - 0x06800000 in 16KB pages (the ARM9 vram mappable area) //this maps to 16KB pages in the LCDC buffer which is what will actually contain the data -#define VRAM_ARM9_PAGES 512 u8 vram_arm9_map[VRAM_ARM9_PAGES]; //this chooses which banks are mapped in the 128K banks starting at 0x06000000 in ARM7 @@ -420,29 +419,6 @@ u8 *MMU_RenderMapToLCD(u32 vram_addr) } -FORCEINLINE void* MMU_gpu_map(u32 vram_addr) -{ - //THIS FUNCTION IS NOT AS DANGEROUS! - //as an alternative to the above, use this: - //it is supposed to map a single gpu vram address to emulator host memory - //but it returns a pointer to some zero memory in case of accesses to unmapped memory. - //this correctly handles the case with tile accesses to unmapped memory. - //it could also potentially go through a different LUT than vram_arm9_map in case we discover - //that it needs to be set up with different or no mirroring - //(I think it is a reasonable possibility that only the cpu has the nutty mirroring rules) - // - //if this system isn't used, Fantasy Aquarium displays garbage in the first ingame screen - //due to it storing 0x0F0F or somesuch in screen memory which points to a ridiculously big tile - //which should contain all 0 pixels - - u32 vram_page = (vram_addr>>14)&(VRAM_ARM9_PAGES-1); - u32 ofs = vram_addr & 0x3FFF; - vram_page = vram_arm9_map[vram_page]; - //blank pages are handled by the extra 16KB of blank memory at the end of ARM9_LCD - //and the fact that blank pages are mapped to appear at that location - return ARM9Mem.ARM9_LCD + (vram_page<<14) + ofs; -} - template void DMAtoVRAMmapping() { diff --git a/desmume/src/MMU.h b/desmume/src/MMU.h index 63cc5f33c..d4e987951 100644 --- a/desmume/src/MMU.h +++ b/desmume/src/MMU.h @@ -181,7 +181,32 @@ extern struct armcpu_memory_iface arm7_base_memory_iface; extern struct armcpu_memory_iface arm9_direct_memory_iface; extern u8 *MMU_RenderMapToLCD(u32 vram_addr); -extern void* MMU_gpu_map(u32 vram_addr); + +#define VRAM_ARM9_PAGES 512 +extern u8 vram_arm9_map[VRAM_ARM9_PAGES]; +FORCEINLINE void* MMU_gpu_map(u32 vram_addr) +{ + //THIS FUNCTION IS NOT AS DANGEROUS! + //as an alternative to the above, use this: + //it is supposed to map a single gpu vram address to emulator host memory + //but it returns a pointer to some zero memory in case of accesses to unmapped memory. + //this correctly handles the case with tile accesses to unmapped memory. + //it could also potentially go through a different LUT than vram_arm9_map in case we discover + //that it needs to be set up with different or no mirroring + //(I think it is a reasonable possibility that only the cpu has the nutty mirroring rules) + // + //if this system isn't used, Fantasy Aquarium displays garbage in the first ingame screen + //due to it storing 0x0F0F or somesuch in screen memory which points to a ridiculously big tile + //which should contain all 0 pixels + + u32 vram_page = (vram_addr>>14)&(VRAM_ARM9_PAGES-1); + u32 ofs = vram_addr & 0x3FFF; + vram_page = vram_arm9_map[vram_page]; + //blank pages are handled by the extra 16KB of blank memory at the end of ARM9_LCD + //and the fact that blank pages are mapped to appear at that location + return ARM9Mem.ARM9_LCD + (vram_page<<14) + ofs; +} + enum MMU_ACCESS_TYPE {