diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-01-11 06:43:29 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-01-30 14:47:04 +0100 |
commit | 4bb33dfc30768c536d3f0ffb980464b1ab2d25d9 (patch) | |
tree | 09f772e5283ef1302f1b29d30f3f0150dd690bf0 /src/core/hle/service/hid | |
parent | Common: Fix SCOPE_EXIT to actually create unique identifiers. (diff) | |
download | yuzu-4bb33dfc30768c536d3f0ffb980464b1ab2d25d9.tar yuzu-4bb33dfc30768c536d3f0ffb980464b1ab2d25d9.tar.gz yuzu-4bb33dfc30768c536d3f0ffb980464b1ab2d25d9.tar.bz2 yuzu-4bb33dfc30768c536d3f0ffb980464b1ab2d25d9.tar.lz yuzu-4bb33dfc30768c536d3f0ffb980464b1ab2d25d9.tar.xz yuzu-4bb33dfc30768c536d3f0ffb980464b1ab2d25d9.tar.zst yuzu-4bb33dfc30768c536d3f0ffb980464b1ab2d25d9.zip |
Diffstat (limited to 'src/core/hle/service/hid')
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.h | 6 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid_user.cpp | 4 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5abcb2596..ee2ba7e01 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -12,7 +12,7 @@ namespace Service { namespace HID { -Handle g_shared_mem = 0; +Kernel::SharedPtr<Kernel::SharedMemory> g_shared_mem = nullptr; Handle g_event_pad_or_touch_1 = 0; Handle g_event_pad_or_touch_2 = 0; @@ -30,7 +30,7 @@ static s16 next_circle_y = 0; * Gets a pointer to the PadData structure inside HID shared memory */ static inline PadData* GetPadData() { - return reinterpret_cast<PadData*>(Kernel::GetSharedMemoryPointer(g_shared_mem, 0).ValueOr(nullptr)); + return reinterpret_cast<PadData*>(g_shared_mem->GetPointer().ValueOr(nullptr)); } /** @@ -120,7 +120,7 @@ void PadUpdateComplete() { } void HIDInit() { - g_shared_mem = Kernel::CreateSharedMemory("HID:SharedMem"); // Create shared memory object + g_shared_mem = Kernel::SharedMemory::Create("HID:SharedMem").MoveFrom(); // Create event handles g_event_pad_or_touch_1 = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID:EventPadOrTouch1"); diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 73cdaa527..5e6236647 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -9,11 +9,15 @@ #include "core/hle/kernel/kernel.h" #include "common/bit_field.h" +namespace Kernel { + class SharedMemory; +} + namespace Service { namespace HID { // Handle to shared memory region designated to HID_User service -extern Handle g_shared_mem; +extern Kernel::SharedPtr<Kernel::SharedMemory> g_shared_mem; // Event handles extern Handle g_event_pad_or_touch_1; diff --git a/src/core/hle/service/hid/hid_user.cpp b/src/core/hle/service/hid/hid_user.cpp index 3a6275707..c167927ea 100644 --- a/src/core/hle/service/hid/hid_user.cpp +++ b/src/core/hle/service/hid/hid_user.cpp @@ -5,6 +5,7 @@ #include "common/log.h" #include "core/hle/hle.h" +#include "core/hle/kernel/shared_memory.h" #include "core/hle/service/hid/hid.h" #include "hid_user.h" @@ -46,7 +47,8 @@ void GetIPCHandles(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[1] = 0; // No error - cmd_buff[3] = Service::HID::g_shared_mem; + // TODO(yuriks): Return error from SendSyncRequest is this fails (part of IPC marshalling) + cmd_buff[3] = Kernel::g_handle_table.Create(Service::HID::g_shared_mem).MoveFrom(); cmd_buff[4] = Service::HID::g_event_pad_or_touch_1; cmd_buff[5] = Service::HID::g_event_pad_or_touch_2; cmd_buff[6] = Service::HID::g_event_accelerometer; |