From 865abfc37c5b3e8945d833bd44db428ad720bd58 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Sun, 31 Dec 2023 00:42:23 -0600 Subject: service: hid: Use applet resource to get latest shared memory handle --- .../hle/service/hid/controllers/unique_pad.cpp | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/core/hle/service/hid/controllers/unique_pad.cpp (limited to 'src/core/hle/service/hid/controllers/unique_pad.cpp') diff --git a/src/core/hle/service/hid/controllers/unique_pad.cpp b/src/core/hle/service/hid/controllers/unique_pad.cpp new file mode 100644 index 000000000..8230501a5 --- /dev/null +++ b/src/core/hle/service/hid/controllers/unique_pad.cpp @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/core_timing.h" +#include "core/hle/service/hid/controllers/applet_resource.h" +#include "core/hle/service/hid/controllers/types/shared_memory_format.h" +#include "core/hle/service/hid/controllers/unique_pad.h" + +namespace Service::HID { + +UniquePad::UniquePad(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {} + +UniquePad::~UniquePad() = default; + +void UniquePad::OnInit() {} + +void UniquePad::OnRelease() {} + +void UniquePad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { + if (!smart_update) { + return; + } + + const u64 aruid = applet_resource->GetActiveAruid(); + auto* data = applet_resource->GetAruidData(aruid); + + if (data == nullptr) { + return; + } + + auto& header = data->shared_memory_format->capture_button.header; + header.timestamp = core_timing.GetGlobalTimeNs().count(); + header.total_entry_count = 17; + header.entry_count = 0; + header.last_entry_index = 0; +} + +} // namespace Service::HID -- cgit v1.2.3