From 49b31badba5672bae3a5950abe3d45c883879c0d Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 4 Dec 2014 11:40:36 -0500 Subject: SVC: Implemented ReleaseSemaphore. This behavior was tested on hardware, however i'm still not sure what use the "initial_count" parameter has --- src/core/hle/svc.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/core/hle/svc.cpp') diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 107d12156..2846bb482 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -291,10 +291,17 @@ static Result GetThreadId(u32* thread_id, Handle handle) { /// Creates a semaphore static Result CreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count) { - *semaphore = Kernel::CreateSemaphore(initial_count, max_count); + ResultCode res = Kernel::CreateSemaphore(semaphore, initial_count, max_count); DEBUG_LOG(SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X", initial_count, max_count, *semaphore); - return 0; + return res.raw; +} + +/// Releases a certain number of slots in a semaphore +static Result ReleaseSemaphore(s32* count, Handle semaphore, s32 release_count) { + DEBUG_LOG(SVC, "called release_count=%d, handle=0x%08X", release_count, semaphore); + ResultCode res = Kernel::ReleaseSemaphore(count, semaphore, release_count); + return res.raw; } /// Query memory @@ -376,7 +383,7 @@ const HLE::FunctionDef SVC_Table[] = { {0x13, HLE::Wrap, "CreateMutex"}, {0x14, HLE::Wrap, "ReleaseMutex"}, {0x15, HLE::Wrap, "CreateSemaphore"}, - {0x16, nullptr, "ReleaseSemaphore"}, + {0x16, HLE::Wrap, "ReleaseSemaphore"}, {0x17, HLE::Wrap, "CreateEvent"}, {0x18, HLE::Wrap, "SignalEvent"}, {0x19, HLE::Wrap, "ClearEvent"}, -- cgit v1.2.3