diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index bc335bbf04..77c59fd96f 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -259,7 +259,6 @@ bool __RunOnePendingInterrupt() __KernelSwitchOffThread("interrupt"); PendingInterrupt pend = pendingInterrupts.front(); - pendingInterrupts.pop_front(); intState.save(); pend.handler->copyArgsToCPU(pend); @@ -294,6 +293,12 @@ void __KernelReturnFromInterrupt() { DEBUG_LOG(CPU, "Left interrupt handler at %08x", currentMIPS->pc); inInterrupt = false; + + // This is what we just ran. + PendingInterrupt pend = pendingInterrupts.front(); + pendingInterrupts.pop_front(); + pend.handler->handleResult(currentMIPS->r[MIPS_REG_V0]); + // Restore context after running the interrupt. intState.restore(); // All should now be back to normal, including PC. diff --git a/Core/HLE/sceKernelInterrupt.h b/Core/HLE/sceKernelInterrupt.h index 87228f4d55..adf0f4399b 100644 --- a/Core/HLE/sceKernelInterrupt.h +++ b/Core/HLE/sceKernelInterrupt.h @@ -70,6 +70,7 @@ public: virtual void copyArgsToCPU(const PendingInterrupt &pend) = 0; virtual void queueUp() = 0; virtual void queueUpWithArg(int arg) = 0; + virtual void handleResult(int result) = 0; }; class SubIntrHandler : public AllegrexInterruptHandler @@ -79,6 +80,7 @@ public: virtual void queueUp(); virtual void queueUpWithArg(int arg); virtual void copyArgsToCPU(const PendingInterrupt &pend); + virtual void handleResult(int result) {} bool enabled; int number;