Make sceKernelStartModule() do something.

Doesn't work right, but gets somewhere?
This commit is contained in:
Unknown W. Brackets 2013-01-01 17:04:06 -08:00
parent f3366a03fa
commit 31eeb3d50b
3 changed files with 15 additions and 3 deletions

View File

@ -837,6 +837,10 @@ void sceKernelStartModule(u32 moduleId, u32 argsize, u32 argAddr, u32 returnValu
entryAddr = module->nm.module_start_func;
// attr = module->nm
}
SceUID threadID = __KernelCreateThread(module->nm.name, moduleId, entryAddr, priority, stacksize, attr, 0);
sceKernelStartThread(threadID, argsize, argAddr);
sceKernelWaitThreadEnd(threadID, 0);
}
//SceUID threadId;

View File

@ -1357,8 +1357,7 @@ void __KernelSetupRootThread(SceUID moduleID, int args, const char *argp, int pr
Memory::Write_U8(argp[i], location + i);
}
int sceKernelCreateThread(const char *threadName, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr)
int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr)
{
if (threadName == NULL)
{
@ -1382,13 +1381,21 @@ int sceKernelCreateThread(const char *threadName, u32 entry, u32 prio, int stack
attr |= PSP_THREAD_ATTR_USER;
SceUID id;
__KernelCreateThread(id, curModule, threadName, entry, prio, stacksize, attr);
__KernelCreateThread(id, moduleID, threadName, entry, prio, stacksize, attr);
INFO_LOG(HLE, "%i = sceKernelCreateThread(name=\"%s\", entry=%08x, prio=%x, stacksize=%i)", id, threadName, entry, prio, stacksize);
if (optionAddr != 0)
WARN_LOG(HLE, "sceKernelCreateThread(name=\"%s\"): unsupported options parameter %08x", threadName, optionAddr);
return id;
}
int sceKernelCreateThread(const char *threadName, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr)
{
SceUID moduleId = curModule;
if (__GetCurrentThread())
moduleId = __GetCurrentThread()->moduleId;
return __KernelCreateThread(threadName, moduleId, entry, prio, stacksize, attr, optionAddr);
}
// int sceKernelStartThread(SceUID threadToStartID, SceSize argSize, void *argBlock)
int sceKernelStartThread(SceUID threadToStartID, u32 argSize, u32 argBlockPtr)

View File

@ -26,6 +26,7 @@
void sceKernelChangeThreadPriority();
int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr);
int sceKernelCreateThread(const char *threadName, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr);
void sceKernelDelayThread();
void sceKernelDelayThreadCB();