Add a registry for actions so they can be stated.

Also add late loaders to ensure things are hooked up properly.
This commit is contained in:
Unknown W. Brackets committed 2012-12-28 13:55:26 -08:00
1 parent f5dd7f03e8
commit a8c9c31e16
7 files changed
+257 -35

No files matched your search

+28 -12
View File
@@ -136,6 +136,25 @@ KernelObject *__KernelModuleObject()
return new Module;
}
class AfterModuleEntryCall : public Action {
public:
AfterModuleEntryCall() {}
SceUID moduleID_;
u32 retValAddr;
virtual void run();
virtual void DoState(PointerWrap &p) {
p.Do(moduleID_);
p.Do(retValAddr);
}
static Action *Create() {
return new AfterModuleEntryCall;
}
};
void AfterModuleEntryCall::run() {
Memory::Write_U32(retValAddr, currentMIPS->r[2]);
}
//////////////////////////////////////////////////////////////////////////
// MODULES
//////////////////////////////////////////////////////////////////////////
@@ -168,13 +187,21 @@ struct SceKernelSMOption {
//////////////////////////////////////////////////////////////////////////
// STATE BEGIN
static int actionAfterModule;
static SceUID mainModuleID; // hack
// STATE END
//////////////////////////////////////////////////////////////////////////
void __KernelModuleInit()
{
actionAfterModule = __KernelRegisterActionType(AfterModuleEntryCall::Create);
}
void __KernelModuleDoState(PointerWrap &p)
{
p.Do(mainModuleID);
p.Do(actionAfterModule);
__KernelRestoreActionType(actionAfterModule, AfterModuleEntryCall::Create);
p.DoMarker("sceKernelModule");
}
@@ -533,6 +560,7 @@ bool __KernelLoadExec(const char *filename, SceKernelLoadExecParam *param, std::
if (__KernelIsRunning())
__KernelShutdown();
__KernelModuleInit();
__KernelInit();
PSPFileInfo info = pspFileSystem.GetFileInfo(filename);
@@ -657,18 +685,6 @@ u32 sceKernelLoadModule(const char *name, u32 flags)
return module->GetUID();
}
class AfterModuleEntryCall : public Action {
public:
AfterModuleEntryCall() {}
SceUID moduleID_;
u32 retValAddr;
virtual void run();
};
void AfterModuleEntryCall::run() {
Memory::Write_U32(retValAddr, currentMIPS->r[2]);
}
void sceKernelStartModule(u32 moduleId, u32 argsize, u32 argAddr, u32 returnValueAddr, u32 optionAddr)
{
ERROR_LOG(HLE,"UNIMPL sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x)",