mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-24 16:49:50 +00:00
Wrap sceKernelCreateFpl and fix refer status.
Just initial changes to make it test properly.
This commit is contained in:
parent
49d41abbd3
commit
f48b730828
@ -758,44 +758,44 @@ const HLEFunction ThreadManForUser[] =
|
||||
{0x72F3C145,0,"sceKernelReleaseThreadEventHandler"},
|
||||
{0x369EEB6B,0,"sceKernelReferThreadEventHandlerStatus"},
|
||||
|
||||
{0x349d6d6c,sceKernelCheckCallback, "sceKernelCheckCallback"},
|
||||
{0xE81CAF8F,WrapI_CUU<sceKernelCreateCallback>, "sceKernelCreateCallback"},
|
||||
{0xEDBA5844,WrapI_I<sceKernelDeleteCallback>, "sceKernelDeleteCallback"},
|
||||
{0xC11BA8C4,WrapI_II<sceKernelNotifyCallback>, "sceKernelNotifyCallback"},
|
||||
{0xBA4051D6,WrapI_I<sceKernelCancelCallback>, "sceKernelCancelCallback"},
|
||||
{0x2A3D44FF,WrapI_I<sceKernelGetCallbackCount>, "sceKernelGetCallbackCount"},
|
||||
{0x730ED8BC,WrapI_IU<sceKernelReferCallbackStatus>, "sceKernelReferCallbackStatus"},
|
||||
{0x349d6d6c,sceKernelCheckCallback, "sceKernelCheckCallback"},
|
||||
{0xE81CAF8F,WrapI_CUU<sceKernelCreateCallback>, "sceKernelCreateCallback"},
|
||||
{0xEDBA5844,WrapI_I<sceKernelDeleteCallback>, "sceKernelDeleteCallback"},
|
||||
{0xC11BA8C4,WrapI_II<sceKernelNotifyCallback>, "sceKernelNotifyCallback"},
|
||||
{0xBA4051D6,WrapI_I<sceKernelCancelCallback>, "sceKernelCancelCallback"},
|
||||
{0x2A3D44FF,WrapI_I<sceKernelGetCallbackCount>, "sceKernelGetCallbackCount"},
|
||||
{0x730ED8BC,WrapI_IU<sceKernelReferCallbackStatus>, "sceKernelReferCallbackStatus"},
|
||||
|
||||
{0x8125221D,WrapI_CUU<sceKernelCreateMbx>, "sceKernelCreateMbx"},
|
||||
{0x86255ADA,WrapI_I<sceKernelDeleteMbx>, "sceKernelDeleteMbx"},
|
||||
{0xE9B3061E,WrapI_IU<sceKernelSendMbx>, "sceKernelSendMbx"},
|
||||
{0x18260574,WrapI_IUU<sceKernelReceiveMbx>, "sceKernelReceiveMbx"},
|
||||
{0xF3986382,WrapI_IUU<sceKernelReceiveMbxCB>, "sceKernelReceiveMbxCB"},
|
||||
{0x0D81716A,WrapI_IU<sceKernelPollMbx>, "sceKernelPollMbx"},
|
||||
{0x87D4DD36,WrapI_IU<sceKernelCancelReceiveMbx>, "sceKernelCancelReceiveMbx"},
|
||||
{0xA8E8C846,WrapI_IU<sceKernelReferMbxStatus>, "sceKernelReferMbxStatus"},
|
||||
{0x8125221D,WrapI_CUU<sceKernelCreateMbx>, "sceKernelCreateMbx"},
|
||||
{0x86255ADA,WrapI_I<sceKernelDeleteMbx>, "sceKernelDeleteMbx"},
|
||||
{0xE9B3061E,WrapI_IU<sceKernelSendMbx>, "sceKernelSendMbx"},
|
||||
{0x18260574,WrapI_IUU<sceKernelReceiveMbx>, "sceKernelReceiveMbx"},
|
||||
{0xF3986382,WrapI_IUU<sceKernelReceiveMbxCB>, "sceKernelReceiveMbxCB"},
|
||||
{0x0D81716A,WrapI_IU<sceKernelPollMbx>, "sceKernelPollMbx"},
|
||||
{0x87D4DD36,WrapI_IU<sceKernelCancelReceiveMbx>, "sceKernelCancelReceiveMbx"},
|
||||
{0xA8E8C846,WrapI_IU<sceKernelReferMbxStatus>, "sceKernelReferMbxStatus"},
|
||||
|
||||
{0x7C0DC2A0,WrapI_CIUUU<sceKernelCreateMsgPipe>, "sceKernelCreateMsgPipe"},
|
||||
{0xF0B7DA1C,WrapI_I<sceKernelDeleteMsgPipe>, "sceKernelDeleteMsgPipe"},
|
||||
{0x876DBFAD,WrapI_IUUUUU<sceKernelSendMsgPipe>, "sceKernelSendMsgPipe"},
|
||||
{0x7C41F2C2,WrapI_IUUUUU<sceKernelSendMsgPipeCB>, "sceKernelSendMsgPipeCB"},
|
||||
{0x884C9F90,WrapI_IUUUU<sceKernelTrySendMsgPipe>, "sceKernelTrySendMsgPipe"},
|
||||
{0x74829B76,WrapI_IUUUUU<sceKernelReceiveMsgPipe>, "sceKernelReceiveMsgPipe"},
|
||||
{0xFBFA697D,WrapI_IUUUUU<sceKernelReceiveMsgPipeCB>, "sceKernelReceiveMsgPipeCB"},
|
||||
{0xDF52098F,WrapI_IUUUU<sceKernelTryReceiveMsgPipe>, "sceKernelTryReceiveMsgPipe"},
|
||||
{0x349B864D,WrapI_IUU<sceKernelCancelMsgPipe>, "sceKernelCancelMsgPipe"},
|
||||
{0x33BE4024,WrapI_IU<sceKernelReferMsgPipeStatus>, "sceKernelReferMsgPipeStatus"},
|
||||
{0x7C0DC2A0,WrapI_CIUUU<sceKernelCreateMsgPipe>, "sceKernelCreateMsgPipe"},
|
||||
{0xF0B7DA1C,WrapI_I<sceKernelDeleteMsgPipe>, "sceKernelDeleteMsgPipe"},
|
||||
{0x876DBFAD,WrapI_IUUUUU<sceKernelSendMsgPipe>, "sceKernelSendMsgPipe"},
|
||||
{0x7C41F2C2,WrapI_IUUUUU<sceKernelSendMsgPipeCB>, "sceKernelSendMsgPipeCB"},
|
||||
{0x884C9F90,WrapI_IUUUU<sceKernelTrySendMsgPipe>, "sceKernelTrySendMsgPipe"},
|
||||
{0x74829B76,WrapI_IUUUUU<sceKernelReceiveMsgPipe>, "sceKernelReceiveMsgPipe"},
|
||||
{0xFBFA697D,WrapI_IUUUUU<sceKernelReceiveMsgPipeCB>, "sceKernelReceiveMsgPipeCB"},
|
||||
{0xDF52098F,WrapI_IUUUU<sceKernelTryReceiveMsgPipe>, "sceKernelTryReceiveMsgPipe"},
|
||||
{0x349B864D,WrapI_IUU<sceKernelCancelMsgPipe>, "sceKernelCancelMsgPipe"},
|
||||
{0x33BE4024,WrapI_IU<sceKernelReferMsgPipeStatus>, "sceKernelReferMsgPipeStatus"},
|
||||
|
||||
{0x56C039B5,WrapI_CIUUU<sceKernelCreateVpl>,"sceKernelCreateVpl"},
|
||||
{0x89B3D48C,WrapI_I<sceKernelDeleteVpl>,"sceKernelDeleteVpl"},
|
||||
{0xBED27435,WrapI_IUUU<sceKernelAllocateVpl>,"sceKernelAllocateVpl"},
|
||||
{0xEC0A693F,WrapI_IUUU<sceKernelAllocateVplCB>,"sceKernelAllocateVplCB"},
|
||||
{0xAF36D708,WrapI_IUU<sceKernelTryAllocateVpl>,"sceKernelTryAllocateVpl"},
|
||||
{0xB736E9FF,WrapI_IU<sceKernelFreeVpl>,"sceKernelFreeVpl"},
|
||||
{0x1D371B8A,WrapI_IU<sceKernelCancelVpl>,"sceKernelCancelVpl"},
|
||||
{0x39810265,WrapI_IU<sceKernelReferVplStatus>,"sceKernelReferVplStatus"},
|
||||
{0x56C039B5,WrapI_CIUUU<sceKernelCreateVpl>, "sceKernelCreateVpl"},
|
||||
{0x89B3D48C,WrapI_I<sceKernelDeleteVpl>, "sceKernelDeleteVpl"},
|
||||
{0xBED27435,WrapI_IUUU<sceKernelAllocateVpl>, "sceKernelAllocateVpl"},
|
||||
{0xEC0A693F,WrapI_IUUU<sceKernelAllocateVplCB>, "sceKernelAllocateVplCB"},
|
||||
{0xAF36D708,WrapI_IUU<sceKernelTryAllocateVpl>, "sceKernelTryAllocateVpl"},
|
||||
{0xB736E9FF,WrapI_IU<sceKernelFreeVpl>, "sceKernelFreeVpl"},
|
||||
{0x1D371B8A,WrapI_IU<sceKernelCancelVpl>, "sceKernelCancelVpl"},
|
||||
{0x39810265,WrapI_IU<sceKernelReferVplStatus>, "sceKernelReferVplStatus"},
|
||||
|
||||
{0xC07BB470,sceKernelCreateFpl,"sceKernelCreateFpl"},
|
||||
{0xC07BB470,WrapI_CUUUUU<sceKernelCreateFpl>, "sceKernelCreateFpl"},
|
||||
{0xED1410E0,sceKernelDeleteFpl,"sceKernelDeleteFpl"},
|
||||
{0xD979E9BF,sceKernelAllocateFpl,"sceKernelAllocateFpl"},
|
||||
{0xE7282CB6,sceKernelAllocateFplCB,"sceKernelAllocateFplCB"},
|
||||
|
@ -51,7 +51,6 @@ struct NativeFPL
|
||||
{
|
||||
u32_le size;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH+1];
|
||||
SceUID_le mpid;
|
||||
u32_le attr;
|
||||
|
||||
s32_le blocksize;
|
||||
@ -195,15 +194,13 @@ void __KernelMemoryShutdown()
|
||||
kernelMemory.Shutdown();
|
||||
}
|
||||
|
||||
//sceKernelCreateFpl(const char *name, SceUID mpid, SceUint attr, SceSize blocksize, int numBlocks, optparam)
|
||||
void sceKernelCreateFpl()
|
||||
int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blockSize, u32 numBlocks, u32 optPtr)
|
||||
{
|
||||
const char *name = Memory::GetCharPointer(PARAM(0));
|
||||
|
||||
u32 mpid = PARAM(1);
|
||||
u32 attr = PARAM(2);
|
||||
u32 blockSize = PARAM(3);
|
||||
u32 numBlocks = PARAM(4);
|
||||
if (!name)
|
||||
{
|
||||
WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateFpl(): invalid name", SCE_KERNEL_ERROR_NO_MEMORY);
|
||||
return SCE_KERNEL_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
u32 totalSize = blockSize * numBlocks;
|
||||
|
||||
@ -214,20 +211,21 @@ void sceKernelCreateFpl()
|
||||
{
|
||||
DEBUG_LOG(HLE,"sceKernelCreateFpl(\"%s\", partition=%i, attr=%i, bsize=%i, nb=%i) FAILED - out of ram",
|
||||
name, mpid, attr, blockSize, numBlocks);
|
||||
RETURN(SCE_KERNEL_ERROR_NO_MEMORY);
|
||||
return;
|
||||
return SCE_KERNEL_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
FPL *fpl = new FPL;
|
||||
SceUID id = kernelObjects.Create(fpl);
|
||||
strncpy(fpl->nf.name, name, 32);
|
||||
|
||||
fpl->nf.size = sizeof(fpl->nf);
|
||||
fpl->nf.mpid = mpid; // partition
|
||||
strncpy(fpl->nf.name, name, KERNELOBJECT_MAX_NAME_LENGTH);
|
||||
fpl->nf.name[KERNELOBJECT_MAX_NAME_LENGTH] = 0;
|
||||
fpl->nf.attr = attr;
|
||||
fpl->nf.size = sizeof(fpl->nf);
|
||||
fpl->nf.blocksize = blockSize;
|
||||
fpl->nf.numBlocks = numBlocks;
|
||||
fpl->nf.numFreeBlocks = numBlocks;
|
||||
fpl->nf.numWaitThreads = 0;
|
||||
|
||||
fpl->blocks = new bool[fpl->nf.numBlocks];
|
||||
memset(fpl->blocks, 0, fpl->nf.numBlocks * sizeof(bool));
|
||||
fpl->address = address;
|
||||
@ -235,7 +233,7 @@ void sceKernelCreateFpl()
|
||||
DEBUG_LOG(HLE,"%i=sceKernelCreateFpl(\"%s\", partition=%i, attr=%i, bsize=%i, nb=%i)",
|
||||
id, name, mpid, attr, blockSize, numBlocks);
|
||||
|
||||
RETURN(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
void sceKernelDeleteFpl()
|
||||
@ -392,6 +390,13 @@ void sceKernelReferFplStatus()
|
||||
FPL *fpl = kernelObjects.Get<FPL>(id, error);
|
||||
if (fpl)
|
||||
{
|
||||
// Refresh free block count.
|
||||
fpl->nf.numFreeBlocks = 0;
|
||||
for (int i = 0; i < (int)fpl->nf.numBlocks; ++i)
|
||||
{
|
||||
if (!fpl->blocks[i])
|
||||
++fpl->nf.numFreeBlocks;
|
||||
}
|
||||
Memory::WriteStruct(statusAddr, &fpl->nf);
|
||||
RETURN(0);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ int sceKernelFreeVpl(SceUID uid, u32 addr);
|
||||
int sceKernelCancelVpl(SceUID uid, u32 numWaitThreadsPtr);
|
||||
int sceKernelReferVplStatus(SceUID uid, u32 infoPtr);
|
||||
|
||||
void sceKernelCreateFpl();
|
||||
int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blocksize, u32 numBlocks, u32 optPtr);
|
||||
void sceKernelDeleteFpl();
|
||||
void sceKernelAllocateFpl();
|
||||
void sceKernelAllocateFplCB();
|
||||
|
Loading…
Reference in New Issue
Block a user