mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-28 10:51:06 +00:00
Wrap sceKernelAllocateFpl() and friends.
This commit is contained in:
parent
61e240f482
commit
6c6aa1b8ee
@ -797,9 +797,9 @@ const HLEFunction ThreadManForUser[] =
|
||||
|
||||
{0xC07BB470,WrapI_CUUUUU<sceKernelCreateFpl>, "sceKernelCreateFpl"},
|
||||
{0xED1410E0,WrapI_I<sceKernelDeleteFpl>, "sceKernelDeleteFpl"},
|
||||
{0xD979E9BF,sceKernelAllocateFpl,"sceKernelAllocateFpl"},
|
||||
{0xE7282CB6,sceKernelAllocateFplCB,"sceKernelAllocateFplCB"},
|
||||
{0x623AE665,sceKernelTryAllocateFpl,"sceKernelTryAllocateFpl"},
|
||||
{0xD979E9BF,WrapI_IUU<sceKernelAllocateFpl>, "sceKernelAllocateFpl"},
|
||||
{0xE7282CB6,WrapI_IUU<sceKernelAllocateFplCB>, "sceKernelAllocateFplCB"},
|
||||
{0x623AE665,WrapI_IU<sceKernelTryAllocateFpl>, "sceKernelTryAllocateFpl"},
|
||||
{0xF6414A71,sceKernelFreeFpl,"sceKernelFreeFpl"},
|
||||
{0xA8AA591F,WrapI_IU<sceKernelCancelFpl>, "sceKernelCancelFpl"},
|
||||
{0xD8199E4C,WrapI_IU<sceKernelReferFplStatus>, "sceKernelReferFplStatus"},
|
||||
|
@ -457,100 +457,89 @@ void __KernelSetFplTimeout(u32 timeoutPtr)
|
||||
CoreTiming::ScheduleEvent(usToCycles(micro), fplWaitTimer, __KernelGetCurThread());
|
||||
}
|
||||
|
||||
void sceKernelAllocateFpl()
|
||||
int sceKernelAllocateFpl(SceUID uid, u32 blockPtrAddr, u32 timeoutPtr)
|
||||
{
|
||||
SceUID id = PARAM(0);
|
||||
u32 error;
|
||||
FPL *fpl = kernelObjects.Get<FPL>(id, error);
|
||||
FPL *fpl = kernelObjects.Get<FPL>(uid, error);
|
||||
if (fpl)
|
||||
{
|
||||
u32 blockPtrAddr = PARAM(1);
|
||||
int timeOut = PARAM(2);
|
||||
DEBUG_LOG(HLE, "sceKernelAllocateFpl(%i, %08x, %08x)", uid, blockPtrAddr, timeoutPtr);
|
||||
|
||||
int blockNum = fpl->allocateBlock();
|
||||
if (blockNum >= 0) {
|
||||
u32 blockPtr = fpl->address + fpl->alignedSize * blockNum;
|
||||
Memory::Write_U32(blockPtr, blockPtrAddr);
|
||||
RETURN(0);
|
||||
} else {
|
||||
SceUID threadID = __KernelGetCurThread();
|
||||
__KernelFplRemoveThread(fpl, threadID);
|
||||
FplWaitingThread waiting = {threadID, blockPtrAddr};
|
||||
fpl->waitingThreads.push_back(waiting);
|
||||
|
||||
__KernelSetFplTimeout(timeOut);
|
||||
__KernelWaitCurThread(WAITTYPE_FPL, id, 0, timeOut, false, "fpl waited");
|
||||
return;
|
||||
__KernelSetFplTimeout(timeoutPtr);
|
||||
__KernelWaitCurThread(WAITTYPE_FPL, uid, 0, timeoutPtr, false, "fpl waited");
|
||||
}
|
||||
|
||||
DEBUG_LOG(HLE,"sceKernelAllocateFpl(%i, %08x, %i)", id, blockPtrAddr, timeOut);
|
||||
RETURN(0);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE,"ERROR: sceKernelAllocateFpl(%i)", id);
|
||||
RETURN(error);
|
||||
DEBUG_LOG(HLE, "sceKernelAllocateFpl(%i, %08x, %08x): invalid fpl", uid, blockPtrAddr, timeoutPtr);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
void sceKernelAllocateFplCB()
|
||||
int sceKernelAllocateFplCB(SceUID uid, u32 blockPtrAddr, u32 timeoutPtr)
|
||||
{
|
||||
SceUID id = PARAM(0);
|
||||
u32 error;
|
||||
FPL *fpl = kernelObjects.Get<FPL>(id, error);
|
||||
FPL *fpl = kernelObjects.Get<FPL>(uid, error);
|
||||
if (fpl)
|
||||
{
|
||||
u32 blockPtrAddr = PARAM(1);
|
||||
int timeOut = PARAM(2);
|
||||
DEBUG_LOG(HLE, "sceKernelAllocateFplCB(%i, %08x, %08x)", uid, blockPtrAddr, timeoutPtr);
|
||||
|
||||
int blockNum = fpl->allocateBlock();
|
||||
if (blockNum >= 0) {
|
||||
u32 blockPtr = fpl->address + fpl->alignedSize * blockNum;
|
||||
Memory::Write_U32(blockPtr, blockPtrAddr);
|
||||
RETURN(0);
|
||||
} else {
|
||||
SceUID threadID = __KernelGetCurThread();
|
||||
__KernelFplRemoveThread(fpl, threadID);
|
||||
FplWaitingThread waiting = {threadID, blockPtrAddr};
|
||||
fpl->waitingThreads.push_back(waiting);
|
||||
|
||||
__KernelSetFplTimeout(timeOut);
|
||||
__KernelWaitCurThread(WAITTYPE_FPL, id, 0, timeOut, true, "fpl waited");
|
||||
return;
|
||||
__KernelSetFplTimeout(timeoutPtr);
|
||||
__KernelWaitCurThread(WAITTYPE_FPL, uid, 0, timeoutPtr, true, "fpl waited");
|
||||
}
|
||||
|
||||
DEBUG_LOG(HLE,"sceKernelAllocateFpl(%i, %08x, %i)", id, PARAM(1), timeOut);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE,"ERROR: sceKernelAllocateFplCB(%i)", id);
|
||||
RETURN(error);
|
||||
DEBUG_LOG(HLE, "sceKernelAllocateFplCB(%i, %08x, %08x): invalid fpl", uid, blockPtrAddr, timeoutPtr);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
void sceKernelTryAllocateFpl()
|
||||
int sceKernelTryAllocateFpl(SceUID uid, u32 blockPtrAddr)
|
||||
{
|
||||
SceUID id = PARAM(0);
|
||||
u32 error;
|
||||
FPL *fpl = kernelObjects.Get<FPL>(id, error);
|
||||
FPL *fpl = kernelObjects.Get<FPL>(uid, error);
|
||||
if (fpl)
|
||||
{
|
||||
u32 blockPtrAddr = PARAM(1);
|
||||
DEBUG_LOG(HLE,"sceKernelTryAllocateFpl(%i, %08x)", id, PARAM(1));
|
||||
DEBUG_LOG(HLE, "sceKernelTryAllocateFpl(%i, %08x)", uid, blockPtrAddr);
|
||||
|
||||
int blockNum = fpl->allocateBlock();
|
||||
if (blockNum >= 0) {
|
||||
u32 blockPtr = fpl->address + fpl->alignedSize * blockNum;
|
||||
Memory::Write_U32(blockPtr, blockPtrAddr);
|
||||
RETURN(0);
|
||||
return 0;
|
||||
} else {
|
||||
RETURN(SCE_KERNEL_ERROR_NO_MEMORY);
|
||||
return SCE_KERNEL_ERROR_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE,"sceKernelTryAllocateFpl(%i) - bad UID", id);
|
||||
RETURN(error);
|
||||
DEBUG_LOG(HLE, "sceKernelTryAllocateFpl(%i, %08x): invalid fpl", uid, blockPtrAddr);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,9 @@ int sceKernelReferVplStatus(SceUID uid, u32 infoPtr);
|
||||
|
||||
int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blocksize, u32 numBlocks, u32 optPtr);
|
||||
int sceKernelDeleteFpl(SceUID uid);
|
||||
void sceKernelAllocateFpl();
|
||||
void sceKernelAllocateFplCB();
|
||||
void sceKernelTryAllocateFpl();
|
||||
int sceKernelAllocateFpl(SceUID uid, u32 blockPtrAddr, u32 timeoutPtr);
|
||||
int sceKernelAllocateFplCB(SceUID uid, u32 blockPtrAddr, u32 timeoutPtr);
|
||||
int sceKernelTryAllocateFpl(SceUID uid, u32 blockPtrAddr);
|
||||
void sceKernelFreeFpl();
|
||||
int sceKernelCancelFpl(SceUID uid, u32 numWaitThreadsPtr);
|
||||
int sceKernelReferFplStatus(SceUID uid, u32 statusPtr);
|
||||
|
Loading…
Reference in New Issue
Block a user