diff options
Diffstat (limited to 'src/core')
18 files changed, 33 insertions, 19 deletions
diff --git a/src/core/hle/service/hid/controllers/controller_base.cpp b/src/core/hle/service/hid/controllers/controller_base.cpp index 1625e9c3d..0993a7815 100644 --- a/src/core/hle/service/hid/controllers/controller_base.cpp +++ b/src/core/hle/service/hid/controllers/controller_base.cpp @@ -5,6 +5,8 @@ #include "core/hle/service/hid/controllers/controller_base.h" namespace Service::HID { + +ControllerBase::ControllerBase() = default; ControllerBase::~ControllerBase() = default; void ControllerBase::ActivateController() { diff --git a/src/core/hle/service/hid/controllers/controller_base.h b/src/core/hle/service/hid/controllers/controller_base.h index fa98e2354..f0e092b1b 100644 --- a/src/core/hle/service/hid/controllers/controller_base.h +++ b/src/core/hle/service/hid/controllers/controller_base.h @@ -10,8 +10,8 @@ namespace Service::HID { class ControllerBase { public: - ControllerBase() = default; - virtual ~ControllerBase() = 0; + ControllerBase(); + virtual ~ControllerBase(); // Called when the controller is initialized virtual void OnInit() = 0; diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index 6f8ef6e3f..3d100763f 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp @@ -4,13 +4,13 @@ #include <cstring> #include "common/common_types.h" -#include "common/swap.h" #include "core/core_timing.h" #include "core/hle/service/hid/controllers/debug_pad.h" namespace Service::HID { Controller_DebugPad::Controller_DebugPad() = default; +Controller_DebugPad::~Controller_DebugPad() = default; void Controller_DebugPad::OnInit() {} diff --git a/src/core/hle/service/hid/controllers/debug_pad.h b/src/core/hle/service/hid/controllers/debug_pad.h index e35675fa1..62b4f2682 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.h +++ b/src/core/hle/service/hid/controllers/debug_pad.h @@ -14,6 +14,7 @@ namespace Service::HID { class Controller_DebugPad final : public ControllerBase { public: Controller_DebugPad(); + ~Controller_DebugPad() override; // Called when the controller is initialized void OnInit() override; diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index b473b9e2b..898572277 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp @@ -4,7 +4,6 @@ #include <cstring> #include "common/common_types.h" -#include "common/swap.h" #include "core/core_timing.h" #include "core/hle/service/hid/controllers/gesture.h" @@ -12,6 +11,7 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3BA00; Controller_Gesture::Controller_Gesture() = default; +Controller_Gesture::~Controller_Gesture() = default; void Controller_Gesture::OnInit() {} diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h index 0ced50dfd..1056ffbcd 100644 --- a/src/core/hle/service/hid/controllers/gesture.h +++ b/src/core/hle/service/hid/controllers/gesture.h @@ -13,6 +13,7 @@ namespace Service::HID { class Controller_Gesture final : public ControllerBase { public: Controller_Gesture(); + ~Controller_Gesture() override; // Called when the controller is initialized void OnInit() override; diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index 089c02ac4..ccfbce9ac 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp @@ -4,7 +4,6 @@ #include <cstring> #include "common/common_types.h" -#include "common/swap.h" #include "core/core_timing.h" #include "core/hle/service/hid/controllers/keyboard.h" @@ -12,6 +11,7 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3800; Controller_Keyboard::Controller_Keyboard() = default; +Controller_Keyboard::~Controller_Keyboard() = default; void Controller_Keyboard::OnInit() {} diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h index 778e14f7e..493e68fce 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h @@ -14,6 +14,7 @@ namespace Service::HID { class Controller_Keyboard final : public ControllerBase { public: Controller_Keyboard(); + ~Controller_Keyboard() override; // Called when the controller is initialized void OnInit() override; diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index 78e9b5e9e..4e246a57d 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp @@ -4,7 +4,6 @@ #include <cstring> #include "common/common_types.h" -#include "common/swap.h" #include "core/core_timing.h" #include "core/hle/service/hid/controllers/mouse.h" @@ -12,6 +11,7 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3400; Controller_Mouse::Controller_Mouse() = default; +Controller_Mouse::~Controller_Mouse() = default; void Controller_Mouse::OnInit() {} diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h index 05358a4f5..543b0b71f 100644 --- a/src/core/hle/service/hid/controllers/mouse.h +++ b/src/core/hle/service/hid/controllers/mouse.h @@ -13,6 +13,7 @@ namespace Service::HID { class Controller_Mouse final : public ControllerBase { public: Controller_Mouse(); + ~Controller_Mouse() override; // Called when the controller is initialized void OnInit() override; diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index d17e64b2a..b26593b4f 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -2,8 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#pragma once - #include <algorithm> #include <array> #include <cstring> @@ -11,7 +9,6 @@ #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" -#include "common/swap.h" #include "core/core.h" #include "core/core_timing.h" #include "core/frontend/input.h" @@ -20,6 +17,7 @@ #include "core/settings.h" namespace Service::HID { + constexpr u32 JOYCON_BODY_NEON_RED = 0xFF3C28; constexpr u32 JOYCON_BUTTONS_NEON_RED = 0x1E0A0A; constexpr u32 JOYCON_BODY_NEON_BLUE = 0x0AB9E6; @@ -28,9 +26,18 @@ constexpr s32 HID_JOYSTICK_MAX = 0x7fff; constexpr s32 HID_JOYSTICK_MIN = -0x7fff; constexpr std::size_t NPAD_OFFSET = 0x9A00; constexpr u32 BATTERY_FULL = 2; -enum class JoystickId : std::size_t { Joystick_Left, Joystick_Right }; + +constexpr std::array<u32, 10> npad_id_list{ + 0, 1, 2, 3, 4, 5, 6, 7, 32, 16, +}; + +enum class JoystickId : std::size_t { + Joystick_Left, + Joystick_Right, +}; Controller_NPad::Controller_NPad() = default; +Controller_NPad::~Controller_NPad() = default; void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) { const auto controller_type = connected_controllers[controller_idx].type; @@ -315,7 +322,7 @@ void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) { std::memcpy(supported_npad_id_types.data(), data, length); } -const void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { +void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { ASSERT(max_length < supported_npad_id_types.size()); std::memcpy(data, supported_npad_id_types.data(), supported_npad_id_types.size()); } diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 9d07d258d..7c0f93acf 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -15,6 +15,7 @@ namespace Service::HID { class Controller_NPad final : public ControllerBase { public: Controller_NPad(); + ~Controller_NPad() override; // Called when the controller is initialized void OnInit() override; @@ -77,7 +78,7 @@ public: position1.Assign(light2); position1.Assign(light3); position1.Assign(light4); - }; + } union { u64 raw{}; BitField<0, 1, u64> position1; @@ -91,7 +92,7 @@ public: NPadType GetSupportedStyleSet() const; void SetSupportedNPadIdTypes(u8* data, std::size_t length); - const void GetSupportedNpadIdTypes(u32* data, std::size_t max_length); + void GetSupportedNpadIdTypes(u32* data, std::size_t max_length); std::size_t GetSupportedNPadIdTypesSize() const; void SetHoldType(NpadHoldType joy_hold_type); @@ -277,9 +278,7 @@ private: std::vector<u32> supported_npad_id_types{}; NpadHoldType hold_type{NpadHoldType::Vertical}; Kernel::SharedPtr<Kernel::Event> styleset_changed_event; - std::size_t dump_idx{}; Vibration last_processed_vibration{}; - static constexpr std::array<u32, 10> npad_id_list{0, 1, 2, 3, 4, 5, 6, 7, 32, 16}; std::array<ControllerHolder, 10> connected_controllers{}; bool can_controllers_vibrate{true}; diff --git a/src/core/hle/service/hid/controllers/stubbed.cpp b/src/core/hle/service/hid/controllers/stubbed.cpp index 3a13d5991..02fcfadd9 100644 --- a/src/core/hle/service/hid/controllers/stubbed.cpp +++ b/src/core/hle/service/hid/controllers/stubbed.cpp @@ -4,13 +4,13 @@ #include <cstring> #include "common/common_types.h" -#include "common/swap.h" #include "core/core_timing.h" #include "core/hle/service/hid/controllers/stubbed.h" namespace Service::HID { Controller_Stubbed::Controller_Stubbed() = default; +Controller_Stubbed::~Controller_Stubbed() = default; void Controller_Stubbed::OnInit() {} diff --git a/src/core/hle/service/hid/controllers/stubbed.h b/src/core/hle/service/hid/controllers/stubbed.h index 9c1b57f83..4a21c643e 100644 --- a/src/core/hle/service/hid/controllers/stubbed.h +++ b/src/core/hle/service/hid/controllers/stubbed.h @@ -11,6 +11,7 @@ namespace Service::HID { class Controller_Stubbed final : public ControllerBase { public: Controller_Stubbed(); + ~Controller_Stubbed() override; // Called when the controller is initialized void OnInit() override; diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index e97f84ea1..43efef803 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -4,7 +4,6 @@ #include <cstring> #include "common/common_types.h" -#include "common/swap.h" #include "core/core_timing.h" #include "core/frontend/emu_window.h" #include "core/frontend/input.h" @@ -15,6 +14,7 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x400; Controller_Touchscreen::Controller_Touchscreen() = default; +Controller_Touchscreen::~Controller_Touchscreen() = default; void Controller_Touchscreen::OnInit() {} diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h index 1d97b6c2a..e5db6e6ba 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h @@ -14,6 +14,7 @@ namespace Service::HID { class Controller_Touchscreen final : public ControllerBase { public: Controller_Touchscreen(); + ~Controller_Touchscreen() override; // Called when the controller is initialized void OnInit() override; diff --git a/src/core/hle/service/hid/controllers/xpad.cpp b/src/core/hle/service/hid/controllers/xpad.cpp index df0b48451..cd397c70b 100644 --- a/src/core/hle/service/hid/controllers/xpad.cpp +++ b/src/core/hle/service/hid/controllers/xpad.cpp @@ -4,7 +4,6 @@ #include <cstring> #include "common/common_types.h" -#include "common/swap.h" #include "core/core_timing.h" #include "core/hle/service/hid/controllers/xpad.h" @@ -12,6 +11,7 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C00; Controller_XPad::Controller_XPad() = default; +Controller_XPad::~Controller_XPad() = default; void Controller_XPad::OnInit() {} diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h index e2007183d..ff836989f 100644 --- a/src/core/hle/service/hid/controllers/xpad.h +++ b/src/core/hle/service/hid/controllers/xpad.h @@ -7,13 +7,13 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" -#include "core/frontend/input.h" #include "core/hle/service/hid/controllers/controller_base.h" namespace Service::HID { class Controller_XPad final : public ControllerBase { public: Controller_XPad(); + ~Controller_XPad() override; // Called when the controller is initialized void OnInit() override; |