From 662077bb31d425ccfb3fee463243c864ddc378b4 Mon Sep 17 00:00:00 2001 From: shashClp Date: Fri, 26 Dec 2008 21:38:43 +0000 Subject: [PATCH] - Fix for the Dead'n'furious "black screen" bug. --- desmume/ChangeLog | 1 + desmume/src/thumb_instructions.cpp | 35 +++++++++++++++++------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/desmume/ChangeLog b/desmume/ChangeLog index e15323790..8e08c1c0c 100644 --- a/desmume/ChangeLog +++ b/desmume/ChangeLog @@ -21,6 +21,7 @@ - Added a bunch of crazy templates to the cpu and mmu for minor speed boosts [zeromus] - Add secure area decryption from ndstool [zeromus] - change backupmem autodetection to catch more cases of unusual usage patterns [zeromus] + - Fixed Thumb LDMIA (fixes ingame Dead'n'Furious) [shash] Graphics: - Added gfx3d module which emulates the whole GE as part of the core emu. [zeromus] - Moved the windows/cocoa OGLRender to the emu core and replace ogl_collector. diff --git a/desmume/src/thumb_instructions.cpp b/desmume/src/thumb_instructions.cpp index 8a275d0af..45f60b2d4 100644 --- a/desmume/src/thumb_instructions.cpp +++ b/desmume/src/thumb_instructions.cpp @@ -856,21 +856,26 @@ TEMPLATE static u32 FASTCALL OP_STMIA_THUMB() return c + 2; } -TEMPLATE static u32 FASTCALL OP_LDMIA_THUMB() -{ - const u32 &i = cpu->instruction; - u32 adr = cpu->R[REG_NUM(i, 8)]; - u32 c = 0, j; - - for(j = 0; j<8; ++j) - if(BIT_N(i, j)) - { - cpu->R[j] = READ32(cpu->mem_if->data, adr); - c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF]; - adr += 4; - } - cpu->R[REG_NUM(i, 8)] = adr; - return c + 3; +TEMPLATE static u32 FASTCALL OP_LDMIA_THUMB() +{ + const u32 &i = cpu->instruction; + u32 regIndex = REG_NUM(i, 8); + u32 adr = cpu->R[regIndex]; + u32 c = 0, j; + + for(j = 0; j<8; ++j) + if(BIT_N(i, j)) + { + cpu->R[j] = READ32(cpu->mem_if->data, adr); + c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF]; + adr += 4; + } + + // Only over-write if not on the read list + if(!BIT_N(i, regIndex)) + cpu->R[regIndex] = adr; + + return c + 3; } TEMPLATE static u32 FASTCALL OP_B_COND()