diff options
| -rw-r--r-- | src/core/hle/service/sm/srv.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/hle/service/sm/srv.cpp b/src/core/hle/service/sm/srv.cpp index 9d7a83597..d6946c734 100644 --- a/src/core/hle/service/sm/srv.cpp +++ b/src/core/hle/service/sm/srv.cpp | |||
| @@ -7,14 +7,16 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "core/hle/kernel/client_session.h" | 9 | #include "core/hle/kernel/client_session.h" |
| 10 | #include "core/hle/kernel/event.h" | 10 | #include "core/hle/kernel/semaphore.h" |
| 11 | #include "core/hle/kernel/server_session.h" | 11 | #include "core/hle/kernel/server_session.h" |
| 12 | #include "core/hle/service/sm/srv.h" | 12 | #include "core/hle/service/sm/srv.h" |
| 13 | 13 | ||
| 14 | namespace Service { | 14 | namespace Service { |
| 15 | namespace SM { | 15 | namespace SM { |
| 16 | 16 | ||
| 17 | static Kernel::SharedPtr<Kernel::Event> event_handle; | 17 | constexpr int MAX_PENDING_NOTIFICATIONS = 16; |
| 18 | |||
| 19 | static Kernel::SharedPtr<Kernel::Semaphore> notification_semaphore; | ||
| 18 | 20 | ||
| 19 | /** | 21 | /** |
| 20 | * SRV::RegisterClient service function | 22 | * SRV::RegisterClient service function |
| @@ -51,14 +53,13 @@ static void RegisterClient(Interface* self) { | |||
| 51 | static void EnableNotification(Interface* self) { | 53 | static void EnableNotification(Interface* self) { |
| 52 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 54 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 53 | 55 | ||
| 54 | // TODO(bunnei): Change to a semaphore once these have been implemented | 56 | notification_semaphore = |
| 55 | event_handle = Kernel::Event::Create(Kernel::ResetType::OneShot, "SRV:Event"); | 57 | Kernel::Semaphore::Create(0, MAX_PENDING_NOTIFICATIONS, "SRV:Notification").Unwrap(); |
| 56 | event_handle->Clear(); | ||
| 57 | 58 | ||
| 58 | cmd_buff[0] = IPC::MakeHeader(0x2, 0x1, 0x2); // 0x20042 | 59 | cmd_buff[0] = IPC::MakeHeader(0x2, 0x1, 0x2); // 0x20042 |
| 59 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 60 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 60 | cmd_buff[2] = IPC::CopyHandleDesc(1); | 61 | cmd_buff[2] = IPC::CopyHandleDesc(1); |
| 61 | cmd_buff[3] = Kernel::g_handle_table.Create(event_handle).MoveFrom(); | 62 | cmd_buff[3] = Kernel::g_handle_table.Create(notification_semaphore).MoveFrom(); |
| 62 | LOG_WARNING(Service_SRV, "(STUBBED) called"); | 63 | LOG_WARNING(Service_SRV, "(STUBBED) called"); |
| 63 | } | 64 | } |
| 64 | 65 | ||
| @@ -177,11 +178,11 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 177 | 178 | ||
| 178 | SRV::SRV() { | 179 | SRV::SRV() { |
| 179 | Register(FunctionTable); | 180 | Register(FunctionTable); |
| 180 | event_handle = nullptr; | 181 | notification_semaphore = nullptr; |
| 181 | } | 182 | } |
| 182 | 183 | ||
| 183 | SRV::~SRV() { | 184 | SRV::~SRV() { |
| 184 | event_handle = nullptr; | 185 | notification_semaphore = nullptr; |
| 185 | } | 186 | } |
| 186 | 187 | ||
| 187 | } // namespace SM | 188 | } // namespace SM |