Allow mipscalls to change the return value.

At least, seems like mpeg needs this.
This commit is contained in:
Unknown W. Brackets 2013-01-06 10:54:33 -08:00
parent a1bf5a2a10
commit 0d8bdfe989
4 changed files with 13 additions and 12 deletions

View File

@ -10,14 +10,14 @@
// Unlike CoreTiming events, these are not timed in any way and do not care about the time.
// This code also doesn't depend on anything in PPSSPP so it can live in Common.
struct MipsCall;
// Pretty much a Runnable. Similar to Action from JPCSP.
class Action
{
public:
virtual ~Action() {}
virtual void run() = 0;
virtual void run(MipsCall &call) = 0;
virtual void DoState(PointerWrap &p) = 0;
int actionTypeID;
};

View File

@ -161,7 +161,7 @@ public:
AfterModuleEntryCall() {}
SceUID moduleID_;
u32 retValAddr;
virtual void run();
virtual void run(MipsCall &call);
virtual void DoState(PointerWrap &p) {
p.Do(moduleID_);
p.Do(retValAddr);
@ -172,7 +172,7 @@ public:
}
};
void AfterModuleEntryCall::run() {
void AfterModuleEntryCall::run(MipsCall &call) {
Memory::Write_U32(retValAddr, currentMIPS->r[2]);
}

View File

@ -251,7 +251,7 @@ private:
class ActionAfterMipsCall : public Action
{
public:
virtual void run();
virtual void run(MipsCall &call);
static Action *Create()
{
@ -298,7 +298,7 @@ class ActionAfterCallback : public Action
{
public:
ActionAfterCallback() {}
virtual void run();
virtual void run(MipsCall &call);
static Action *Create()
{
@ -1968,7 +1968,7 @@ void sceKernelReferCallbackStatus()
}
}
void ActionAfterMipsCall::run() {
void ActionAfterMipsCall::run(MipsCall &call) {
u32 error;
Thread *thread = kernelObjects.Get<Thread>(threadID, error);
if (thread) {
@ -1980,7 +1980,7 @@ void ActionAfterMipsCall::run() {
}
if (chainedAction) {
chainedAction->run();
chainedAction->run(call);
delete chainedAction;
}
}
@ -2271,7 +2271,7 @@ void __KernelReturnFromMipsCall()
// Should also save/restore wait state here.
if (call->doAfter)
{
call->doAfter->run();
call->doAfter->run(*call);
delete call->doAfter;
}
@ -2350,7 +2350,7 @@ void __KernelRunCallbackOnThread(SceUID cbId, Thread *thread, bool reschedAfter)
__KernelCallAddress(thread, cb->nc.entrypoint, action, false, args, reschedAfter);
}
void ActionAfterCallback::run() {
void ActionAfterCallback::run(MipsCall &call) {
if (cbId != -1) {
u32 error;
Callback *cb = kernelObjects.Get<Callback>(cbId, error);

View File

@ -262,7 +262,7 @@ public:
void setRingAddr(u32 ringAddr) { ringAddr_ = ringAddr; }
static Action *Create() { return new PostPutAction; }
void DoState(PointerWrap &p) { p.Do(ringAddr_); p.DoMarker("PostPutAction"); }
void run();
void run(MipsCall &call);
private:
u32 ringAddr_;
};
@ -783,7 +783,7 @@ int sceMpegRingbufferAvailableSize(u32 ringbufferAddr)
void PostPutAction::run() {
void PostPutAction::run(MipsCall &call) {
SceMpegRingBuffer ringbuffer;
Memory::ReadStruct(ringAddr_, &ringbuffer);
@ -803,6 +803,7 @@ void PostPutAction::run() {
}
Memory::WriteStruct(ringAddr_, &ringbuffer);
call.savedV0 = packetsAdded;
}