Skip to content

Commit

Permalink
More Fixes
Browse files Browse the repository at this point in the history
The possibility of the RSP instruction at address 0xFFC being JR was
never accounted for. This fixes Wave Race and Star Wars - Shadow of the
Empire.

The accumulator analysis was wrong, which broke games like Mario No
Photopie.
  • Loading branch information
LegendOfDragoon committed Jan 12, 2015
1 parent 43c6017 commit 02fe2e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Source/RSP/Recompiler Analysis.c
Expand Up @@ -247,20 +247,25 @@ DWORD WriteToAccum2 (int Location, int PC, BOOL RecursiveCall) {
case RSP_VECTOR_VMADL:
case RSP_VECTOR_VMADM:
case RSP_VECTOR_VMADN:
return TRUE;
case RSP_VECTOR_VMADH:
if (Location == Low16BitAccum) { break; }
return TRUE;

case RSP_VECTOR_VABS:
case RSP_VECTOR_VADD:
case RSP_VECTOR_VADDC:
case RSP_VECTOR_VSUB:
case RSP_VECTOR_VSUBC:
case RSP_VECTOR_VAND:
case RSP_VECTOR_VNAND:
case RSP_VECTOR_VOR:
case RSP_VECTOR_VNOR:
case RSP_VECTOR_VXOR:
case RSP_VECTOR_VNXOR:
/* since these modify the accumulator lower-16 bits we can */
/* safely assume these 'reset' the accumulator no matter what */
return FALSE;
// return FALSE;
case RSP_VECTOR_VCR:
case RSP_VECTOR_VCH:
case RSP_VECTOR_VCL:
Expand All @@ -272,11 +277,11 @@ DWORD WriteToAccum2 (int Location, int PC, BOOL RecursiveCall) {
case RSP_VECTOR_VLT:
case RSP_VECTOR_VEQ:
case RSP_VECTOR_VGE:
case RSP_VECTOR_VMRG:
if (Location == Low16BitAccum) { return FALSE; }
break;

case RSP_VECTOR_VMOV:
case RSP_VECTOR_VMRG:
break;
case RSP_VECTOR_VSAW:
return TRUE;
Expand Down
2 changes: 1 addition & 1 deletion Source/RSP/Recompiler CPU.c
Expand Up @@ -878,7 +878,7 @@ void CompilerRSPBlock ( void ) {
CompilePC += 4;
break;
}
} while ( NextInstruction != FINISH_BLOCK && CompilePC < 0x1000);
} while (NextInstruction != FINISH_BLOCK && (CompilePC < 0x1000 || NextInstruction == DELAY_SLOT));
CPU_Message("==== end of recompiled code ====");

if (Compiler.bReOrdering == TRUE) {
Expand Down

0 comments on commit 02fe2e7

Please sign in to comment.