diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index 47b5dcbc6..95f9bed71 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -51,6 +51,7 @@ #include "render3D.h" #include "GPU_osd.h" #include "debug.h" +#include "NDSSystem.h" //#define CHECKSPRITES @@ -430,7 +431,8 @@ u16 GPU::blend(u16 colA, u16 colB) void GPU_setMasterBrightness (GPU *gpu, u16 val) { - gpu->MasterBrightFactor = (val & 0x1F); + if(!nds.isInVblank()) PROGINFO("Changing master brightness outside of vblank\n"); + gpu->MasterBrightFactor = (val & 0x1F); gpu->MasterBrightMode = (val>>14); } diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 5562e37b9..3f21c915e 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -597,6 +597,8 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) u32 vram_map_addr = 0xFFFFFFFF; u8 *LCD_addr = LCDdst[block]; + + bool changingTexOrTexPalette = false; switch (VRAMBankCnt & 0x07) { @@ -674,6 +676,7 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) case 3: // D // Textures { + changingTexOrTexPalette = true; int slot_index = (VRAMBankCnt >> 3) & 0x3; ARM9Mem.textureSlotAddr[slot_index] = LCD_addr; gpu3D->NDS_3D_VramReconfigureSignal(); @@ -682,6 +685,7 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) } break; case 4: // E + changingTexOrTexPalette = true; ARM9Mem.texPalSlot[0] = LCD_addr; ARM9Mem.texPalSlot[1] = LCD_addr+0x4000; ARM9Mem.texPalSlot[2] = LCD_addr+0x8000; @@ -691,6 +695,7 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) case 5: // F case 6: // G { + changingTexOrTexPalette = true; u8 tmp_slot = ((VRAMBankCnt >> 3) & 0x01) + (((VRAMBankCnt >> 4) & 0x01)*4); ARM9Mem.texPalSlot[tmp_slot] = LCD_addr; gpu3D->NDS_3D_VramReconfigureSignal(); @@ -746,6 +751,11 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt) break; } + if(changingTexOrTexPalette && !nds.isIn3dVblank()) + { + PROGINFO("Changing texture or texture palette mappings outside of 3d vblank\n"); + } + if (vram_map_addr != 0xFFFFFFFF) { u8 engine = (vram_map_addr >> 21); diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 70654f2b7..07dfeefec 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -131,6 +131,9 @@ typedef struct s32 idleCycles; s32 runCycleCollector[16]; s32 idleFrameCounter; + + bool isInVblank() const { return VCount >= 192; } + bool isIn3dVblank() const { return VCount >= 192 && VCount<215; } } NDSSystem; /** /brief A touchscreen calibration point.