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()