diff options
| author | 2014-06-14 12:13:16 -0400 | |
|---|---|---|
| committer | 2014-06-14 12:13:16 -0400 | |
| commit | 004df767953a949817da89bddcd5d1379240f769 (patch) | |
| tree | b2d54928dcbf3cb4dde0cd5d3277afe7999b7bd9 /src/core/hle/service/srv.cpp | |
| parent | GPU debugger: Const correctness and build fix. (diff) | |
| parent | Kernel: Removed unnecessary "#pragma once". (diff) | |
| download | yuzu-004df767953a949817da89bddcd5d1379240f769.tar.gz yuzu-004df767953a949817da89bddcd5d1379240f769.tar.xz yuzu-004df767953a949817da89bddcd5d1379240f769.zip | |
Merge branch 'threading' of https://github.com/bunnei/citra
Conflicts:
src/core/hle/function_wrappers.h
src/core/hle/service/gsp.cpp
Diffstat (limited to 'src/core/hle/service/srv.cpp')
| -rw-r--r-- | src/core/hle/service/srv.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index ff6da8f1c..f45c0efc2 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp | |||
| @@ -5,21 +5,28 @@ | |||
| 5 | #include "core/hle/hle.h" | 5 | #include "core/hle/hle.h" |
| 6 | #include "core/hle/service/srv.h" | 6 | #include "core/hle/service/srv.h" |
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | 8 | #include "core/hle/kernel/mutex.h" | |
| 9 | 9 | ||
| 10 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 10 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 11 | // Namespace SRV | 11 | // Namespace SRV |
| 12 | 12 | ||
| 13 | namespace SRV { | 13 | namespace SRV { |
| 14 | 14 | ||
| 15 | Handle g_mutex = 0; | ||
| 16 | |||
| 15 | void Initialize(Service::Interface* self) { | 17 | void Initialize(Service::Interface* self) { |
| 16 | NOTICE_LOG(OSHLE, "SRV::Sync - Initialize"); | 18 | DEBUG_LOG(OSHLE, "called"); |
| 19 | if (!g_mutex) { | ||
| 20 | g_mutex = Kernel::CreateMutex(true, "SRV:Lock"); | ||
| 21 | } | ||
| 17 | } | 22 | } |
| 18 | 23 | ||
| 19 | void GetProcSemaphore(Service::Interface* self) { | 24 | void GetProcSemaphore(Service::Interface* self) { |
| 25 | DEBUG_LOG(OSHLE, "called"); | ||
| 20 | // Get process semaphore? | 26 | // Get process semaphore? |
| 21 | u32* cmd_buff = Service::GetCommandBuffer(); | 27 | u32* cmd_buff = Service::GetCommandBuffer(); |
| 22 | cmd_buff[3] = 0xDEADBEEF; // Return something... 0 == NULL, raises an exception | 28 | cmd_buff[1] = 0; // No error |
| 29 | cmd_buff[3] = g_mutex; // Return something... 0 == nullptr, raises an exception | ||
| 23 | } | 30 | } |
| 24 | 31 | ||
| 25 | void GetServiceHandle(Service::Interface* self) { | 32 | void GetServiceHandle(Service::Interface* self) { |
| @@ -29,25 +36,21 @@ void GetServiceHandle(Service::Interface* self) { | |||
| 29 | std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); | 36 | std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); |
| 30 | Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); | 37 | Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); |
| 31 | 38 | ||
| 32 | NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name.c_str(), | 39 | if (nullptr != service) { |
| 33 | service->GetHandle()); | ||
| 34 | |||
| 35 | if (NULL != service) { | ||
| 36 | cmd_buff[3] = service->GetHandle(); | 40 | cmd_buff[3] = service->GetHandle(); |
| 41 | DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); | ||
| 37 | } else { | 42 | } else { |
| 38 | ERROR_LOG(OSHLE, "Service %s does not exist", port_name.c_str()); | 43 | ERROR_LOG(OSHLE, "(UNIMPLEMENTED) called port=%s", port_name.c_str()); |
| 39 | res = -1; | 44 | res = -1; |
| 40 | } | 45 | } |
| 41 | cmd_buff[1] = res; | 46 | cmd_buff[1] = res; |
| 42 | |||
| 43 | //return res; | ||
| 44 | } | 47 | } |
| 45 | 48 | ||
| 46 | const Interface::FunctionInfo FunctionTable[] = { | 49 | const Interface::FunctionInfo FunctionTable[] = { |
| 47 | {0x00010002, Initialize, "Initialize"}, | 50 | {0x00010002, Initialize, "Initialize"}, |
| 48 | {0x00020000, GetProcSemaphore, "GetProcSemaphore"}, | 51 | {0x00020000, GetProcSemaphore, "GetProcSemaphore"}, |
| 49 | {0x00030100, NULL, "RegisterService"}, | 52 | {0x00030100, nullptr, "RegisterService"}, |
| 50 | {0x000400C0, NULL, "UnregisterService"}, | 53 | {0x000400C0, nullptr, "UnregisterService"}, |
| 51 | {0x00050100, GetServiceHandle, "GetServiceHandle"}, | 54 | {0x00050100, GetServiceHandle, "GetServiceHandle"}, |
| 52 | }; | 55 | }; |
| 53 | 56 | ||