mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-24 14:00:03 +00:00
Allow mipscalls to change the return value.
At least, seems like mpeg needs this.
This commit is contained in:
parent
a1bf5a2a10
commit
0d8bdfe989
@ -10,14 +10,14 @@
|
|||||||
// Unlike CoreTiming events, these are not timed in any way and do not care about the time.
|
// 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.
|
// 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.
|
// Pretty much a Runnable. Similar to Action from JPCSP.
|
||||||
class Action
|
class Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Action() {}
|
virtual ~Action() {}
|
||||||
virtual void run() = 0;
|
virtual void run(MipsCall &call) = 0;
|
||||||
virtual void DoState(PointerWrap &p) = 0;
|
virtual void DoState(PointerWrap &p) = 0;
|
||||||
int actionTypeID;
|
int actionTypeID;
|
||||||
};
|
};
|
||||||
|
@ -161,7 +161,7 @@ public:
|
|||||||
AfterModuleEntryCall() {}
|
AfterModuleEntryCall() {}
|
||||||
SceUID moduleID_;
|
SceUID moduleID_;
|
||||||
u32 retValAddr;
|
u32 retValAddr;
|
||||||
virtual void run();
|
virtual void run(MipsCall &call);
|
||||||
virtual void DoState(PointerWrap &p) {
|
virtual void DoState(PointerWrap &p) {
|
||||||
p.Do(moduleID_);
|
p.Do(moduleID_);
|
||||||
p.Do(retValAddr);
|
p.Do(retValAddr);
|
||||||
@ -172,7 +172,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AfterModuleEntryCall::run() {
|
void AfterModuleEntryCall::run(MipsCall &call) {
|
||||||
Memory::Write_U32(retValAddr, currentMIPS->r[2]);
|
Memory::Write_U32(retValAddr, currentMIPS->r[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ private:
|
|||||||
class ActionAfterMipsCall : public Action
|
class ActionAfterMipsCall : public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void run();
|
virtual void run(MipsCall &call);
|
||||||
|
|
||||||
static Action *Create()
|
static Action *Create()
|
||||||
{
|
{
|
||||||
@ -298,7 +298,7 @@ class ActionAfterCallback : public Action
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ActionAfterCallback() {}
|
ActionAfterCallback() {}
|
||||||
virtual void run();
|
virtual void run(MipsCall &call);
|
||||||
|
|
||||||
static Action *Create()
|
static Action *Create()
|
||||||
{
|
{
|
||||||
@ -1968,7 +1968,7 @@ void sceKernelReferCallbackStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionAfterMipsCall::run() {
|
void ActionAfterMipsCall::run(MipsCall &call) {
|
||||||
u32 error;
|
u32 error;
|
||||||
Thread *thread = kernelObjects.Get<Thread>(threadID, error);
|
Thread *thread = kernelObjects.Get<Thread>(threadID, error);
|
||||||
if (thread) {
|
if (thread) {
|
||||||
@ -1980,7 +1980,7 @@ void ActionAfterMipsCall::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (chainedAction) {
|
if (chainedAction) {
|
||||||
chainedAction->run();
|
chainedAction->run(call);
|
||||||
delete chainedAction;
|
delete chainedAction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2271,7 +2271,7 @@ void __KernelReturnFromMipsCall()
|
|||||||
// Should also save/restore wait state here.
|
// Should also save/restore wait state here.
|
||||||
if (call->doAfter)
|
if (call->doAfter)
|
||||||
{
|
{
|
||||||
call->doAfter->run();
|
call->doAfter->run(*call);
|
||||||
delete call->doAfter;
|
delete call->doAfter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2350,7 +2350,7 @@ void __KernelRunCallbackOnThread(SceUID cbId, Thread *thread, bool reschedAfter)
|
|||||||
__KernelCallAddress(thread, cb->nc.entrypoint, action, false, args, reschedAfter);
|
__KernelCallAddress(thread, cb->nc.entrypoint, action, false, args, reschedAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionAfterCallback::run() {
|
void ActionAfterCallback::run(MipsCall &call) {
|
||||||
if (cbId != -1) {
|
if (cbId != -1) {
|
||||||
u32 error;
|
u32 error;
|
||||||
Callback *cb = kernelObjects.Get<Callback>(cbId, error);
|
Callback *cb = kernelObjects.Get<Callback>(cbId, error);
|
||||||
|
@ -262,7 +262,7 @@ public:
|
|||||||
void setRingAddr(u32 ringAddr) { ringAddr_ = ringAddr; }
|
void setRingAddr(u32 ringAddr) { ringAddr_ = ringAddr; }
|
||||||
static Action *Create() { return new PostPutAction; }
|
static Action *Create() { return new PostPutAction; }
|
||||||
void DoState(PointerWrap &p) { p.Do(ringAddr_); p.DoMarker("PostPutAction"); }
|
void DoState(PointerWrap &p) { p.Do(ringAddr_); p.DoMarker("PostPutAction"); }
|
||||||
void run();
|
void run(MipsCall &call);
|
||||||
private:
|
private:
|
||||||
u32 ringAddr_;
|
u32 ringAddr_;
|
||||||
};
|
};
|
||||||
@ -783,7 +783,7 @@ int sceMpegRingbufferAvailableSize(u32 ringbufferAddr)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PostPutAction::run() {
|
void PostPutAction::run(MipsCall &call) {
|
||||||
SceMpegRingBuffer ringbuffer;
|
SceMpegRingBuffer ringbuffer;
|
||||||
Memory::ReadStruct(ringAddr_, &ringbuffer);
|
Memory::ReadStruct(ringAddr_, &ringbuffer);
|
||||||
|
|
||||||
@ -803,6 +803,7 @@ void PostPutAction::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Memory::WriteStruct(ringAddr_, &ringbuffer);
|
Memory::WriteStruct(ringAddr_, &ringbuffer);
|
||||||
|
call.savedV0 = packetsAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user