From 12ebf83665aad8ae238bdaf4720e552f9433d4bc Mon Sep 17 00:00:00 2001 From: StapleButter Date: Tue, 31 Jan 2017 04:06:05 +0100 Subject: keep the GPU from crashing if there's no VRAM mapped, I guess. noting that the way it's accessing VRAM is grossly inaccurate. --- GPU2D.cpp | 2 ++ NDS.cpp | 2 +- melonDS.depend | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/GPU2D.cpp b/GPU2D.cpp index 8233c4a..fc68f39 100644 --- a/GPU2D.cpp +++ b/GPU2D.cpp @@ -239,6 +239,7 @@ void GPU2D::DrawBG_Text_4bpp(u32 line, u16* dst, u32 bgnum) { tileset = (u8*)GPU::VRAM_BBG[((bgcnt & 0x003C) >> 2)]; tilemap = (u16*)GPU::VRAM_BBG[((bgcnt & 0x1800) >> 11)]; + if (!tileset || !tilemap) return; tilemap += ((bgcnt & 0x0700) << 2); pal = (u16*)&GPU::Palette[0x400]; @@ -247,6 +248,7 @@ void GPU2D::DrawBG_Text_4bpp(u32 line, u16* dst, u32 bgnum) { tileset = (u8*)GPU::VRAM_ABG[((DispCnt & 0x07000000) >> 22) + ((bgcnt & 0x003C) >> 2)]; tilemap = (u16*)GPU::VRAM_ABG[((DispCnt & 0x38000000) >> 27) + ((bgcnt & 0x1800) >> 11)]; + if (!tileset || !tilemap) return; tilemap += ((bgcnt & 0x0700) << 2); pal = (u16*)&GPU::Palette[0]; diff --git a/NDS.cpp b/NDS.cpp index 8e3c20d..c38c90f 100644 --- a/NDS.cpp +++ b/NDS.cpp @@ -1697,7 +1697,7 @@ void ARM9IOWrite32(u32 addr, u32 val) else { bool wasempty = IPCFIFO9->IsEmpty(); - IPCFIFO9->Write(val);printf("IPC FIFO %08X %08X\n", val, ARM9->R[6]+0x114); + IPCFIFO9->Write(val); if ((IPCFIFOCnt7 & 0x0400) && wasempty) TriggerIRQ(1, IRQ_IPCRecv); } diff --git a/melonDS.depend b/melonDS.depend index 8f08bab..2b34459 100644 --- a/melonDS.depend +++ b/melonDS.depend @@ -41,7 +41,7 @@ "types.h" "ARM.h" -1485817127 source:c:\documents\sources\melonds\arminterpreter.cpp +1485831103 source:c:\documents\sources\melonds\arminterpreter.cpp "NDS.h" "CP15.h" @@ -117,7 +117,7 @@ 1484698068 c:\documents\sources\melonds\dma.h "types.h" -1485809857 source:c:\documents\sources\melonds\gpu.cpp +1485831589 source:c:\documents\sources\melonds\gpu.cpp "NDS.h" -- cgit v1.2.3