From ab7c20492ba66537e40fb7e1f787c6184b21431e Mon Sep 17 00:00:00 2001 From: luigi__ Date: Thu, 4 Dec 2008 18:46:02 +0000 Subject: [PATCH] Fixed a few 3D function mismatches (for example setting light direction through reg at 0x040004C8 would assign the value as light color) --- desmume/src/MMU.cpp | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 6fc6429ed..7e66753f2 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -37,18 +37,18 @@ #include "rtc.h" #include "GPU_osd.h" #include "zero_private.h" -#include "mc.h" - -static const int save_types[7][2] = { - {MC_TYPE_AUTODETECT,1}, - {MC_TYPE_EEPROM1,MC_SIZE_4KBITS}, - {MC_TYPE_EEPROM2,MC_SIZE_64KBITS}, - {MC_TYPE_EEPROM2,MC_SIZE_512KBITS}, - {MC_TYPE_FRAM,MC_SIZE_256KBITS}, - {MC_TYPE_FLASH,MC_SIZE_2MBITS}, - {MC_TYPE_FLASH,MC_SIZE_4MBITS} -}; - +#include "mc.h" + +static const int save_types[7][2] = { + {MC_TYPE_AUTODETECT,1}, + {MC_TYPE_EEPROM1,MC_SIZE_4KBITS}, + {MC_TYPE_EEPROM2,MC_SIZE_64KBITS}, + {MC_TYPE_EEPROM2,MC_SIZE_512KBITS}, + {MC_TYPE_FRAM,MC_SIZE_256KBITS}, + {MC_TYPE_FLASH,MC_SIZE_2MBITS}, + {MC_TYPE_FLASH,MC_SIZE_4MBITS} +}; + #define ROM_MASK 3 @@ -2001,11 +2001,11 @@ void FASTCALL _MMU_write32(u32 adr, u32 val) ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x460>>2] = val; if(proc == ARMCPU_ARM9) { - gfx3d_glLoadMatrix4x4(val); + gfx3d_glMultMatrix4x4(val); } return; } - // Multiply 4x4 matrix - Parameters:12 + // Multiply 4x3 matrix - Parameters:12 case 0x04000464: { ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x464>>2] = val; @@ -2191,7 +2191,7 @@ void FASTCALL _MMU_write32(u32 adr, u32 val) ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4C8>>2] = val; if(proc == ARMCPU_ARM9) { - gfx3d_glLightColor (val); + gfx3d_glLightDirection(val); } return; } @@ -2904,8 +2904,8 @@ void FASTCALL MMU_doDMA(u32 proc, u32 num) case 1 : dstinc = -sz; break; case 2 : dstinc = 0; break; case 3 : dstinc = sz; break; //reload - default: - return; + default: + return; } switch((u >> 2)&0x3) { case 0 : srcinc = sz; break; @@ -2913,8 +2913,8 @@ void FASTCALL MMU_doDMA(u32 proc, u32 num) case 2 : srcinc = 0; break; case 3 : // reserved return; - default: - return; + default: + return; } if ((MMU.DMACrt[proc][num]>>26)&1) for(; i < taille; ++i) @@ -3486,11 +3486,11 @@ void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val) { if(proc==0) _MMU_write8<0ul>(adr,val); else _MMU_write8<1ul>(adr,val); -} - -void mmu_select_savetype(int type, int *bmemtype, u32 *bmemsize) { - if (type<0 || type > 5) return; - *bmemtype=save_types[type][0]; - *bmemsize=save_types[type][1]; - mc_realloc(&MMU.bupmem, *bmemtype, *bmemsize); -} +} + +void mmu_select_savetype(int type, int *bmemtype, u32 *bmemsize) { + if (type<0 || type > 5) return; + *bmemtype=save_types[type][0]; + *bmemsize=save_types[type][1]; + mc_realloc(&MMU.bupmem, *bmemtype, *bmemsize); +}