diff --git a/source/arm11/hardware/gfx.c b/source/arm11/hardware/gfx.c index 8b1c0d4..fd0bf9a 100644 --- a/source/arm11/hardware/gfx.c +++ b/source/arm11/hardware/gfx.c @@ -121,9 +121,10 @@ *((vu32*)0x10140140) = 0; // REG_CFG11_GPUPROT - // Reset - REG_PDN_GPU_CNT = 0x10000; - wait(12); + // Reset. + // TODO: The reset destroys bootrom and OTP data. Move it elsewhere. + //REG_PDN_GPU_CNT = 0x10000; + //wait(12); REG_PDN_GPU_CNT = 0x1007F; REG_GX_GPU_CLK = 0x100; REG_GX_PSC_UNK = 0; @@ -155,10 +156,12 @@ IRQ_registerHandler(IRQ_PPF, 14, 0, true, gfxIrqHandler); IRQ_registerHandler(IRQ_P3D, 14, 0, true, gfxIrqHandler); - // Clear first half of VRAM. - // The bootrom dumps are stored in the other half. + // Clear first half of VRAM + half of the second half. + // The bootrom dumps are stored at the end of the second half. + // Writing at least one byte to the second half is needed + // to "wake" the VRAM up (will read as zeros otherwise). GX_memoryFill((u32*)VRAM_BANK0, 1u<<9, VRAM_SIZE / 2, 0, - NULL, 0, 0, 0); + (u32*)VRAM_BANK1, 1u<<9, VRAM_SIZE / 4, 0); // Backlight and other stuff. REG_LCD_ABL0_LIGHT = 0; @@ -189,6 +192,7 @@ // Make sure the fills finished. GFX_waitForEvent(GFX_EVENT_PSC0, false); + GFX_waitForEvent(GFX_EVENT_PSC1, false); REG_LCD_ABL0_FILL = 0; REG_LCD_ABL1_FILL = 0;