Implement sceKernelGetThreadmanIdList (partially)

This commit is contained in:
Henrik Rydgard 2012-12-17 22:20:32 +01:00
parent 19af6531f7
commit 5a11d4d9c5
4 changed files with 33 additions and 17 deletions

View File

@ -226,7 +226,7 @@ u32 sceAudioSetChannelDataLen(u32 chan, u32 len)
}
else
{
INFO_LOG(HLE, "sceAudioSetChannelDataLen(%i, %i)", chan, len);
DEBUG_LOG(HLE, "sceAudioSetChannelDataLen(%i, %i)", chan, len);
chans[chan].sampleCount = len;
return 0;
}

View File

@ -385,8 +385,8 @@ const HLEFunction ThreadManForUser[] =
{0x840E8133,sceKernelWaitThreadEndCB,"sceKernelWaitThreadEndCB"},
{0xd13bde95,sceKernelCheckThreadStack,"sceKernelCheckThreadStack"},
{0x94416130,0,"sceKernelGetThreadmanIdList"},
{0x57CF62DD,sceKernelGetThreadmanIdType,"sceKernelGetThreadmanIdType"},
{0x94416130,WrapU_UUUU<sceKernelGetThreadmanIdList>,"sceKernelGetThreadmanIdList"},
{0x57CF62DD,WrapU_U<sceKernelGetThreadmanIdType>,"sceKernelGetThreadmanIdType"},
{0x20fff560,sceKernelCreateVTimer,"sceKernelCreateVTimer"},
{0x328F9E52,0,"sceKernelDeleteVTimer"},

View File

@ -522,20 +522,35 @@ void sceKernelGetThreadExitStatus()
}
}
void sceKernelGetThreadmanIdType()
u32 sceKernelGetThreadmanIdType(u32 uid) {
int type;
if (kernelObjects.GetIDType(uid, &type)) {
DEBUG_LOG(HLE, "%i=sceKernelGetThreadmanIdType(%i)", type, uid);
return type;
} else {
ERROR_LOG(HLE, "sceKernelGetThreadmanIdType(%i) - FAILED", uid);
return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT;
}
}
u32 sceKernelGetThreadmanIdList(u32 type, u32 readBufPtr, u32 readBufSize, u32 idCountPtr)
{
SceUID uid = PARAM(0);
int type;
if (kernelObjects.GetIDType(uid, &type))
{
RETURN(type);
DEBUG_LOG(HLE, "%i=sceKernelGetThreadmanIdType(%i)", type, uid);
}
else
{
ERROR_LOG(HLE, "sceKernelGetThreadmanIdType(%i) - FAILED", uid);
RETURN(SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT);
}
DEBUG_LOG(HLE, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x)",
type, readBufPtr, readBufSize, idCountPtr);
if (!Memory::IsValidAddress(readBufPtr))
return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT;
if (type != SCE_KERNEL_TMID_Thread) {
ERROR_LOG(HLE, "sceKernelGetThreadmanIdList only implemented for threads");
return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT;
}
for (size_t i = 0; i < std::min(readBufSize, threadqueue.size()); i++)
{
Memory::Write_U32(threadqueue[i]->GetUID(), readBufPtr + i * 4);
}
Memory::Write_U32(threadqueue.size(), idCountPtr);
return 0;
}
// Saves the current CPU context

View File

@ -51,7 +51,8 @@ int sceKernelTerminateDeleteThread(int threadno);
int sceKernelTerminateThread(u32 threadID);
void sceKernelWaitThreadEndCB();
void sceKernelGetThreadExitStatus();
void sceKernelGetThreadmanIdType();
u32 sceKernelGetThreadmanIdType(u32);
u32 sceKernelGetThreadmanIdList(u32 type, u32 readBufPtr, u32 readBufSize, u32 idCountPtr);
enum WaitType //probably not the real values