From 1965e45448f334d3309afb66156010bd788dd4be Mon Sep 17 00:00:00 2001 From: mightymax Date: Thu, 11 Jan 2007 16:06:06 +0000 Subject: [PATCH] fixed affineMode switch for extRot BGs --- desmume/src/GPU.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/desmume/src/GPU.c b/desmume/src/GPU.c index 087977e2c..b40d02d4d 100644 --- a/desmume/src/GPU.c +++ b/desmume/src/GPU.c @@ -270,15 +270,16 @@ void GPU_setBGProp(GPU * gpu, u16 num, u16 p) GPU_resortBGs(gpu) ; - if(gpu->core == GPU_SUB) { + if(gpu->core == GPU_SUB) { gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_BBG); gpu->BG_bmp_ram[num] = ((u8 *)ARM9Mem.ARM9_BBG); gpu->BG_map_ram[num] = ARM9Mem.ARM9_BBG; } else { - gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + gpu->dispCnt.bits.CharacBase_Block * ADDRESS_STEP_64kB ; - gpu->BG_bmp_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG); - gpu->BG_map_ram[num] = ARM9Mem.ARM9_ABG + gpu->dispCnt.bits.ScreenBase_Block * ADDRESS_STEP_64kB; + gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + gpu->dispCnt.bits.CharacBase_Block * ADDRESS_STEP_64kB ; + gpu->BG_bmp_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG); + gpu->BG_map_ram[num] = ARM9Mem.ARM9_ABG + gpu->dispCnt.bits.ScreenBase_Block * ADDRESS_STEP_64kB; } + /* the charac base block has a differenet meaning in rotscale BGs */ gpu->BG_tile_ram[num] += (cnt->CharacBase_Block * ADDRESS_STEP_16KB); gpu->BG_bmp_ram[num] += (cnt->ScreenBase_Block * ADDRESS_STEP_16KB); gpu->BG_map_ram[num] += (cnt->ScreenBase_Block * ADDRESS_STEP_2KB); @@ -1096,13 +1097,14 @@ INLINE void extRotBG2(GPU * gpu, u8 num, u8 * DST, u16 H, s32 X, s32 Y, s16 PA, u8 affineModeSelection ; /* see: http://nocash.emubase.de/gbatek.htm#dsvideobgmodescontrol */ - affineModeSelection = (bgCnt.Palette_256) | ((bgCnt.CharacBase_Block & 1) << 1) ; + affineModeSelection = (bgCnt.Palette_256 << 1) | ((bgCnt.CharacBase_Block & 1)) ; switch(affineModeSelection) { case 0 : case 1 : { u8 * pal = ARM9Mem.ExtPal[gpu->core][gpu->BGExtPalSlot[num]]; + if(!pal) return; #define LOOP(c) \