diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2024-01-05 03:37:43 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2024-01-05 18:41:15 +0100 |
commit | ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613 (patch) | |
tree | 3b95cbb74be05f0ce7a007353f1f9f95e1ed3901 /src/core/hle/service/hid/controllers/debug_mouse.cpp | |
parent | Merge pull request #12437 from ameerj/gl-amd-fixes (diff) | |
download | yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.gz yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.bz2 yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.lz yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.xz yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.tar.zst yuzu-ee847f8ff0b1b0aec39c1b78c010bc0c08a0a613.zip |
Diffstat (limited to 'src/core/hle/service/hid/controllers/debug_mouse.cpp')
-rw-r--r-- | src/core/hle/service/hid/controllers/debug_mouse.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/core/hle/service/hid/controllers/debug_mouse.cpp b/src/core/hle/service/hid/controllers/debug_mouse.cpp deleted file mode 100644 index ceeb78d36..000000000 --- a/src/core/hle/service/hid/controllers/debug_mouse.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/core_timing.h" -#include "core/frontend/emu_window.h" -#include "core/hid/emulated_devices.h" -#include "core/hid/hid_core.h" -#include "core/hle/service/hid/controllers/applet_resource.h" -#include "core/hle/service/hid/controllers/debug_mouse.h" -#include "core/hle/service/hid/controllers/types/shared_memory_format.h" - -namespace Service::HID { - -DebugMouse::DebugMouse(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} { - emulated_devices = hid_core.GetEmulatedDevices(); -} - -DebugMouse::~DebugMouse() = default; - -void DebugMouse::OnInit() {} -void DebugMouse::OnRelease() {} - -void DebugMouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) { - std::scoped_lock shared_lock{*shared_mutex}; - const u64 aruid = applet_resource->GetActiveAruid(); - auto* data = applet_resource->GetAruidData(aruid); - - if (data == nullptr || !data->flag.is_assigned) { - return; - } - - MouseSharedMemoryFormat& shared_memory = data->shared_memory_format->debug_mouse; - - if (!IsControllerActivated()) { - shared_memory.mouse_lifo.buffer_count = 0; - shared_memory.mouse_lifo.buffer_tail = 0; - return; - } - - next_state = {}; - - const auto& last_entry = shared_memory.mouse_lifo.ReadCurrentEntry().state; - next_state.sampling_number = last_entry.sampling_number + 1; - - if (Settings::values.mouse_enabled) { - const auto& mouse_button_state = emulated_devices->GetMouseButtons(); - const auto& mouse_position_state = emulated_devices->GetMousePosition(); - const auto& mouse_wheel_state = emulated_devices->GetMouseWheel(); - next_state.attribute.is_connected.Assign(1); - next_state.x = static_cast<s32>(mouse_position_state.x * Layout::ScreenUndocked::Width); - next_state.y = static_cast<s32>(mouse_position_state.y * Layout::ScreenUndocked::Height); - next_state.delta_x = next_state.x - last_entry.x; - next_state.delta_y = next_state.y - last_entry.y; - next_state.delta_wheel_x = mouse_wheel_state.x - last_mouse_wheel_state.x; - next_state.delta_wheel_y = mouse_wheel_state.y - last_mouse_wheel_state.y; - - last_mouse_wheel_state = mouse_wheel_state; - next_state.button = mouse_button_state; - } - - shared_memory.mouse_lifo.WriteNextEntry(next_state); -} - -} // namespace Service::HID |