Wrap sceKernelCreateFpl and fix refer status.
Just initial changes to make it test properly.
This commit is contained in:
parent
49d41abbd3
commit
f48b730828
3 changed files with 55 additions and 50 deletions
|
@ -786,16 +786,16 @@ const HLEFunction ThreadManForUser[] =
|
||||||
{0x349B864D,WrapI_IUU<sceKernelCancelMsgPipe>, "sceKernelCancelMsgPipe"},
|
{0x349B864D,WrapI_IUU<sceKernelCancelMsgPipe>, "sceKernelCancelMsgPipe"},
|
||||||
{0x33BE4024,WrapI_IU<sceKernelReferMsgPipeStatus>, "sceKernelReferMsgPipeStatus"},
|
{0x33BE4024,WrapI_IU<sceKernelReferMsgPipeStatus>, "sceKernelReferMsgPipeStatus"},
|
||||||
|
|
||||||
{0x56C039B5,WrapI_CIUUU<sceKernelCreateVpl>,"sceKernelCreateVpl"},
|
{0x56C039B5,WrapI_CIUUU<sceKernelCreateVpl>, "sceKernelCreateVpl"},
|
||||||
{0x89B3D48C,WrapI_I<sceKernelDeleteVpl>,"sceKernelDeleteVpl"},
|
{0x89B3D48C,WrapI_I<sceKernelDeleteVpl>, "sceKernelDeleteVpl"},
|
||||||
{0xBED27435,WrapI_IUUU<sceKernelAllocateVpl>,"sceKernelAllocateVpl"},
|
{0xBED27435,WrapI_IUUU<sceKernelAllocateVpl>, "sceKernelAllocateVpl"},
|
||||||
{0xEC0A693F,WrapI_IUUU<sceKernelAllocateVplCB>,"sceKernelAllocateVplCB"},
|
{0xEC0A693F,WrapI_IUUU<sceKernelAllocateVplCB>, "sceKernelAllocateVplCB"},
|
||||||
{0xAF36D708,WrapI_IUU<sceKernelTryAllocateVpl>,"sceKernelTryAllocateVpl"},
|
{0xAF36D708,WrapI_IUU<sceKernelTryAllocateVpl>, "sceKernelTryAllocateVpl"},
|
||||||
{0xB736E9FF,WrapI_IU<sceKernelFreeVpl>,"sceKernelFreeVpl"},
|
{0xB736E9FF,WrapI_IU<sceKernelFreeVpl>, "sceKernelFreeVpl"},
|
||||||
{0x1D371B8A,WrapI_IU<sceKernelCancelVpl>,"sceKernelCancelVpl"},
|
{0x1D371B8A,WrapI_IU<sceKernelCancelVpl>, "sceKernelCancelVpl"},
|
||||||
{0x39810265,WrapI_IU<sceKernelReferVplStatus>,"sceKernelReferVplStatus"},
|
{0x39810265,WrapI_IU<sceKernelReferVplStatus>, "sceKernelReferVplStatus"},
|
||||||
|
|
||||||
{0xC07BB470,sceKernelCreateFpl,"sceKernelCreateFpl"},
|
{0xC07BB470,WrapI_CUUUUU<sceKernelCreateFpl>, "sceKernelCreateFpl"},
|
||||||
{0xED1410E0,sceKernelDeleteFpl,"sceKernelDeleteFpl"},
|
{0xED1410E0,sceKernelDeleteFpl,"sceKernelDeleteFpl"},
|
||||||
{0xD979E9BF,sceKernelAllocateFpl,"sceKernelAllocateFpl"},
|
{0xD979E9BF,sceKernelAllocateFpl,"sceKernelAllocateFpl"},
|
||||||
{0xE7282CB6,sceKernelAllocateFplCB,"sceKernelAllocateFplCB"},
|
{0xE7282CB6,sceKernelAllocateFplCB,"sceKernelAllocateFplCB"},
|
||||||
|
|
|
@ -51,7 +51,6 @@ struct NativeFPL
|
||||||
{
|
{
|
||||||
u32_le size;
|
u32_le size;
|
||||||
char name[KERNELOBJECT_MAX_NAME_LENGTH+1];
|
char name[KERNELOBJECT_MAX_NAME_LENGTH+1];
|
||||||
SceUID_le mpid;
|
|
||||||
u32_le attr;
|
u32_le attr;
|
||||||
|
|
||||||
s32_le blocksize;
|
s32_le blocksize;
|
||||||
|
@ -195,15 +194,13 @@ void __KernelMemoryShutdown()
|
||||||
kernelMemory.Shutdown();
|
kernelMemory.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
//sceKernelCreateFpl(const char *name, SceUID mpid, SceUint attr, SceSize blocksize, int numBlocks, optparam)
|
int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blockSize, u32 numBlocks, u32 optPtr)
|
||||||
void sceKernelCreateFpl()
|
|
||||||
{
|
{
|
||||||
const char *name = Memory::GetCharPointer(PARAM(0));
|
if (!name)
|
||||||
|
{
|
||||||
u32 mpid = PARAM(1);
|
WARN_LOG_REPORT(HLE, "%08x=sceKernelCreateFpl(): invalid name", SCE_KERNEL_ERROR_NO_MEMORY);
|
||||||
u32 attr = PARAM(2);
|
return SCE_KERNEL_ERROR_NO_MEMORY;
|
||||||
u32 blockSize = PARAM(3);
|
}
|
||||||
u32 numBlocks = PARAM(4);
|
|
||||||
|
|
||||||
u32 totalSize = blockSize * numBlocks;
|
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",
|
DEBUG_LOG(HLE,"sceKernelCreateFpl(\"%s\", partition=%i, attr=%i, bsize=%i, nb=%i) FAILED - out of ram",
|
||||||
name, mpid, attr, blockSize, numBlocks);
|
name, mpid, attr, blockSize, numBlocks);
|
||||||
RETURN(SCE_KERNEL_ERROR_NO_MEMORY);
|
return SCE_KERNEL_ERROR_NO_MEMORY;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FPL *fpl = new FPL;
|
FPL *fpl = new FPL;
|
||||||
SceUID id = kernelObjects.Create(fpl);
|
SceUID id = kernelObjects.Create(fpl);
|
||||||
strncpy(fpl->nf.name, name, 32);
|
|
||||||
|
|
||||||
fpl->nf.size = sizeof(fpl->nf);
|
strncpy(fpl->nf.name, name, KERNELOBJECT_MAX_NAME_LENGTH);
|
||||||
fpl->nf.mpid = mpid; // partition
|
fpl->nf.name[KERNELOBJECT_MAX_NAME_LENGTH] = 0;
|
||||||
fpl->nf.attr = attr;
|
fpl->nf.attr = attr;
|
||||||
|
fpl->nf.size = sizeof(fpl->nf);
|
||||||
fpl->nf.blocksize = blockSize;
|
fpl->nf.blocksize = blockSize;
|
||||||
fpl->nf.numBlocks = numBlocks;
|
fpl->nf.numBlocks = numBlocks;
|
||||||
|
fpl->nf.numFreeBlocks = numBlocks;
|
||||||
fpl->nf.numWaitThreads = 0;
|
fpl->nf.numWaitThreads = 0;
|
||||||
|
|
||||||
fpl->blocks = new bool[fpl->nf.numBlocks];
|
fpl->blocks = new bool[fpl->nf.numBlocks];
|
||||||
memset(fpl->blocks, 0, fpl->nf.numBlocks * sizeof(bool));
|
memset(fpl->blocks, 0, fpl->nf.numBlocks * sizeof(bool));
|
||||||
fpl->address = address;
|
fpl->address = address;
|
||||||
|
@ -235,7 +233,7 @@ void sceKernelCreateFpl()
|
||||||
DEBUG_LOG(HLE,"%i=sceKernelCreateFpl(\"%s\", partition=%i, attr=%i, bsize=%i, nb=%i)",
|
DEBUG_LOG(HLE,"%i=sceKernelCreateFpl(\"%s\", partition=%i, attr=%i, bsize=%i, nb=%i)",
|
||||||
id, name, mpid, attr, blockSize, numBlocks);
|
id, name, mpid, attr, blockSize, numBlocks);
|
||||||
|
|
||||||
RETURN(id);
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sceKernelDeleteFpl()
|
void sceKernelDeleteFpl()
|
||||||
|
@ -392,6 +390,13 @@ void sceKernelReferFplStatus()
|
||||||
FPL *fpl = kernelObjects.Get<FPL>(id, error);
|
FPL *fpl = kernelObjects.Get<FPL>(id, error);
|
||||||
if (fpl)
|
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);
|
Memory::WriteStruct(statusAddr, &fpl->nf);
|
||||||
RETURN(0);
|
RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ int sceKernelFreeVpl(SceUID uid, u32 addr);
|
||||||
int sceKernelCancelVpl(SceUID uid, u32 numWaitThreadsPtr);
|
int sceKernelCancelVpl(SceUID uid, u32 numWaitThreadsPtr);
|
||||||
int sceKernelReferVplStatus(SceUID uid, u32 infoPtr);
|
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 sceKernelDeleteFpl();
|
||||||
void sceKernelAllocateFpl();
|
void sceKernelAllocateFpl();
|
||||||
void sceKernelAllocateFplCB();
|
void sceKernelAllocateFplCB();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue