Fix / Optimize RSP Accumulator Analysis

the & 0xFFC was missing, which caused it to return true when it should
have returned false. This means that LLE audio should be more optimized
now.

I also made it do delay slot, incase the delay slot instruction writes
to accumulator. Minor optimization here.

As for JAL, I made it do break instead of return FALSE because in Battle
For Naboo, it actually does come back and continue an existing
calculation. I think it is only an issue if you do a separate analysis
for the Low Accumulator and Mid/High Accumulators. It's still better to
be safe, just incase I or someone else actually implement a separate
analysis for the Accumulators later down the road.
This commit is contained in:
LegendOfDragoon 2015-04-19 20:56:36 -07:00
parent f22e5125c5
commit 82f614ff2d
1 changed files with 11 additions and 3 deletions

View File

@ -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: