Oops, CreateMutex was missing a parameter.

This commit is contained in:
Unknown W. Brackets 2012-11-14 23:15:33 -08:00
parent 4bab714db5
commit 429ac9de87
4 changed files with 11 additions and 5 deletions

View file

@ -133,6 +133,11 @@ template<u32 func(const char *, u32, u32)> void WrapU_CUU() {
RETURN((u32)retval);
}
template<u32 func(const char *, u32, u32, u32)> void WrapU_CUUU() {
int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
RETURN((u32)retval);
}
template<u32 func(u32, u32, u32)> void WrapU_UUU() {
u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
RETURN(retval);

View file

@ -343,7 +343,7 @@ const HLEFunction ThreadManForUser[] =
{0xB011B11F,&WrapU_UUU<sceKernelLockMutex>,"sceKernelLockMutex"},
{0x5bf4dd27,&WrapU_UUU<sceKernelLockMutexCB>,"sceKernelLockMutexCB"},
{0x6b30100f,&WrapV_UU<sceKernelUnlockMutex>,"sceKernelUnlockMutex"},
{0xb7d098c6,&WrapU_CUU<sceKernelCreateMutex>,"sceKernelCreateMutex"},
{0xb7d098c6,&WrapU_CUUU<sceKernelCreateMutex>,"sceKernelCreateMutex"},
{0x0DDCD2C9, 0, "sceKernelTryLockMutex"},
// NOTE: LockLwMutex and UnlockLwMutex are in Kernel_Library, see sceKernelInterrupt.cpp.

View file

@ -28,7 +28,7 @@
#define PSP_MUTEX_ATTR_ALLOW_RECURSIVE 0x200
// Not sure about the names of these
#define PSP_MUTEX_ERROR_NOT_LOCKED 0x800201C7
#define PSP_MUTEX_ERROR_NOT_LOCKED 0x800201C5
#define PSP_MUTEX_ERROR_NO_SUCH_MUTEX 0x800201C3
#define PSP_MUTEX_ERROR_UNLOCK_UNDERFLOW 0x800201C7
@ -63,7 +63,7 @@ struct LWMutex : public KernelObject
std::vector<SceUID> waitingThreads;
};
u32 sceKernelCreateMutex(const char *name, u32 attr, u32 options)
u32 sceKernelCreateMutex(const char *name, u32 attr, u32 initial_count, u32 options)
{
DEBUG_LOG(HLE,"sceKernelCreateMutex(%s, %08x, %08x)", name, attr, options);
@ -72,7 +72,8 @@ u32 sceKernelCreateMutex(const char *name, u32 attr, u32 options)
mutex->nm.size = sizeof(mutex);
mutex->nm.attr = attr;
mutex->nm.lockLevel = 0;
mutex->nm.lockLevel = initial_count;
// TODO: Does initial_count > 0 mean lock automatically by the current thread? Would make sense.
mutex->nm.lockThread = -1;
strncpy(mutex->nm.name, name, 32);

View file

@ -18,7 +18,7 @@
#pragma once
// TODO
u32 sceKernelCreateMutex(const char *name, u32 attr, u32 options);
u32 sceKernelCreateMutex(const char *name, u32 attr, u32 initial_count, u32 options);
u32 sceKernelDeleteMutex(u32 id);
u32 sceKernelLockMutex(u32 id, u32 count, u32 timeoutPtr);
u32 sceKernelLockMutexCB(u32 id, u32 count, u32 timeoutPtr);