Save the base address in signal calls.

It's not saved in regular calls but it is in signal ones.
This commit is contained in:
Unknown W. Brackets 2013-09-21 00:07:49 -07:00
parent a7f60afecb
commit 3c954ea0e4
2 changed files with 4 additions and 0 deletions

View File

@ -683,6 +683,7 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) {
auto &stackEntry = currentList->stack[currentList->stackptr++];
stackEntry.pc = retval;
stackEntry.offsetAddr = gstate_c.offsetAddr;
// The base address is NOT saved/restored for a regular call.
UpdatePC(currentList->pc, target - 4);
currentList->pc = target - 4; // pc will be increased after we return, counteract that
}
@ -777,6 +778,7 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) {
auto &stackEntry = currentList->stack[currentList->stackptr++];
stackEntry.pc = currentList->pc;
stackEntry.offsetAddr = gstate_c.offsetAddr;
stackEntry.baseAddr = gstate.base;
UpdatePC(currentList->pc, target);
currentList->pc = target;
DEBUG_LOG(G3D, "Signal with Call. signal/end: %04x %04x", signal, enddata);
@ -793,6 +795,7 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) {
// TODO: This might save/restore other state...
auto &stackEntry = currentList->stack[--currentList->stackptr];
gstate_c.offsetAddr = stackEntry.offsetAddr;
gstate.base = stackEntry.baseAddr;
UpdatePC(currentList->pc, stackEntry.pc);
currentList->pc = stackEntry.pc;
DEBUG_LOG(G3D, "Signal with Return. signal/end: %04x %04x", signal, enddata);

View File

@ -113,6 +113,7 @@ struct DisplayListStackEntry
{
u32 pc;
u32 offsetAddr;
u32 baseAddr;
};
struct DisplayList