diff --git a/Config/Project64.rdb b/Config/Project64.rdb index 40c2a472e..47915a769 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -1661,6 +1661,8 @@ Good Name=Duck Dodgers Starring Daffy Duck (U) (M3) Internal Name=LT DUCK DODGERS Status=Compatible Counter Factor=1 +Dsound-SyncAudio=1 +Sync Audio=0 [DC36626A-3F3770CB-C:50] Good Name=Duke Nukem - ZER0 H0UR (E) @@ -3161,6 +3163,8 @@ ViRefresh=1400 Good Name=Looney Tunes - Duck Dodgers (E) (M6) Internal Name=DAFFY DUCK STARRING Status=Compatible +Dsound-SyncAudio=1 +Sync Audio=0 RDRAM Size=8 [2483F22B-136E025E-C:55] diff --git a/Source/RSP/Recompiler Analysis.c b/Source/RSP/Recompiler Analysis.c index 63141c71c..dc65196b6 100644 --- a/Source/RSP/Recompiler Analysis.c +++ b/Source/RSP/Recompiler Analysis.c @@ -199,16 +199,24 @@ DWORD WriteToAccum2 (int Location, int PC, BOOL RecursiveCall) { break; case RSP_J: /* there is no way a loopback is going to use accumulator */ - if (Compiler.bAudioUcode && ((int)(RspOp.target << 2) < PC)) { + if (Compiler.bAudioUcode && (((int)(RspOp.target << 2) & 0xFFC) < PC)) { return FALSE; } /* rarely occurs let them have their way */ - return TRUE; + else { + Instruction_State = DO_DELAY_SLOT; + break; + } case RSP_JAL: /* there is no way calling a subroutine is going to use accum */ /* or come back and continue an existing calculation */ - return (Compiler.bAudioUcode) ? FALSE : TRUE; + if(Compiler.bAudioUcode) { + break; + } else { + Instruction_State = DO_DELAY_SLOT; + break; + } case RSP_BEQ: case RSP_BNE: diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index 5334b95a1..3c2f7070b 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -1554,6 +1554,14 @@ void Compile_Cop0_MF ( void ) { return; #else switch (RSPOpC.rd) { + case 0: + MoveVariableToX86reg(RSPInfo.SP_MEM_ADDR_REG, "SP_MEM_ADDR_REG", x86_EAX); + MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); + break; + case 1: + MoveVariableToX86reg(RSPInfo.SP_DRAM_ADDR_REG, "SP_DRAM_ADDR_REG", x86_EAX); + MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); + break; case 5: MoveVariableToX86reg(RSPInfo.SP_DMA_FULL_REG, "SP_DMA_FULL_REG", x86_EAX); MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); @@ -1600,7 +1608,7 @@ void Compile_Cop0_MF ( void ) { break; default: - CompilerWarning("have not implemented RSP MF CP0 reg %s (%d)",COP0_Name(RSPOpC.rd),RSPOpC.rd); + DisplayError("have not implemented RSP MF CP0 reg %s (%d)",COP0_Name(RSPOpC.rd),RSPOpC.rd); } #endif } diff --git a/Source/RSP/memory.c b/Source/RSP/memory.c index 6d1e5f4f6..a6cf3c026 100644 --- a/Source/RSP/memory.c +++ b/Source/RSP/memory.c @@ -35,24 +35,30 @@ BYTE * RecompCode, * RecompCodeSecondary, * RecompPos, *JumpTables; void ** JumpTable; int AllocateMemory (void) { - RecompCode=(BYTE *) VirtualAlloc( NULL, 0x00400004, MEM_RESERVE, PAGE_EXECUTE_READWRITE); - RecompCode=(BYTE *) VirtualAlloc( RecompCode, 0x00400000, MEM_COMMIT, PAGE_EXECUTE_READWRITE); - - if(RecompCode == NULL) { - DisplayError("Not enough memory for RSP RecompCode!"); - return FALSE; + if (RecompCode == NULL){ + RecompCode=(BYTE *) VirtualAlloc( NULL, 0x00400004, MEM_RESERVE, PAGE_EXECUTE_READWRITE); + RecompCode=(BYTE *) VirtualAlloc( RecompCode, 0x00400000, MEM_COMMIT, PAGE_EXECUTE_READWRITE); + + if(RecompCode == NULL) { + DisplayError("Not enough memory for RSP RecompCode!"); + return FALSE; + } } - RecompCodeSecondary = (BYTE *)VirtualAlloc( NULL, 0x00200000, MEM_COMMIT, PAGE_EXECUTE_READWRITE ); - if(RecompCodeSecondary == NULL) { - DisplayError("Not enough memory for RSP RecompCode Secondary!"); - return FALSE; + if (RecompCodeSecondary == NULL){ + RecompCodeSecondary = (BYTE *)VirtualAlloc( NULL, 0x00200000, MEM_COMMIT, PAGE_EXECUTE_READWRITE ); + if(RecompCodeSecondary == NULL) { + DisplayError("Not enough memory for RSP RecompCode Secondary!"); + return FALSE; + } } - JumpTables = (BYTE *)VirtualAlloc( NULL, 0x1000 * MaxMaps, MEM_COMMIT, PAGE_READWRITE ); - if( JumpTables == NULL ) { - DisplayError("Not enough memory for Jump Table!"); - return FALSE; + if (JumpTables == NULL){ + JumpTables = (BYTE *)VirtualAlloc( NULL, 0x1000 * MaxMaps, MEM_COMMIT, PAGE_READWRITE ); + if( JumpTables == NULL ) { + DisplayError("Not enough memory for Jump Table!"); + return FALSE; + } } JumpTable = (void **)JumpTables; @@ -65,6 +71,10 @@ void FreeMemory (void) { VirtualFree( RecompCode, 0 , MEM_RELEASE); VirtualFree( JumpTable, 0 , MEM_RELEASE); VirtualFree( RecompCodeSecondary, 0 , MEM_RELEASE); + + RecompCode = NULL; + JumpTables = NULL; + RecompCodeSecondary = NULL; } void ResetJumpTables ( void )