From fef718b8d26b86c1a00edeb4b9c7d972bfc30a60 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Fri, 7 Sep 2018 21:07:48 +0700 Subject: [PATCH] Do not reject tile loading when tile end address is out of RDRAM bound. Try to load as much as possible instead. Fixed Bust-A-Move 2 wrong 2D during intro #870 --- src/gDP.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gDP.cpp b/src/gDP.cpp index 9d23e4fa..e9a04834 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -466,20 +466,22 @@ void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt) if (CheckForFrameBufferTexture(address, bpl2*height2)) return; - if ((address + height * gDP.textureImage.bpl) > RDRAMSize) - return; - if (gDP.loadTile->size == G_IM_SIZ_32b) gDPLoadTile32b(gDP.loadTile->uls, gDP.loadTile->ult, gDP.loadTile->lrs, gDP.loadTile->lrt); else { u32 tmemAddr = gDP.loadTile->tmem; const u32 line = gDP.loadTile->line; for (u32 y = 0; y < height; ++y) { - UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, bpl); + if (address + bpl > RDRAMSize) + UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, RDRAMSize - address); + else + UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, bpl); if (y & 1) DWordInterleaveWrap((u32*)TMEM, tmemAddr << 1, 0x3FF, line); address += gDP.textureImage.bpl; + if (address >= RDRAMSize) + break; tmemAddr += line; } }