From bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 22 Sep 2019 16:41:34 +1000 Subject: Rebase --- src/core/hle/service/hid/controllers/controller_base.cpp | 6 +++--- src/core/hle/service/hid/controllers/controller_base.h | 8 +++++--- src/core/hle/service/hid/controllers/debug_pad.cpp | 5 +++-- src/core/hle/service/hid/controllers/debug_pad.h | 5 +++-- src/core/hle/service/hid/controllers/gesture.cpp | 5 +++-- src/core/hle/service/hid/controllers/gesture.h | 5 +++-- src/core/hle/service/hid/controllers/keyboard.cpp | 5 +++-- src/core/hle/service/hid/controllers/keyboard.h | 5 +++-- src/core/hle/service/hid/controllers/mouse.cpp | 4 ++-- src/core/hle/service/hid/controllers/mouse.h | 5 +++-- src/core/hle/service/hid/controllers/npad.cpp | 4 ++-- src/core/hle/service/hid/controllers/npad.h | 5 +++-- src/core/hle/service/hid/controllers/stubbed.cpp | 5 +++-- src/core/hle/service/hid/controllers/stubbed.h | 5 +++-- src/core/hle/service/hid/controllers/touchscreen.cpp | 5 +++-- src/core/hle/service/hid/controllers/touchscreen.h | 5 +++-- src/core/hle/service/hid/controllers/xpad.cpp | 4 ++-- src/core/hle/service/hid/controllers/xpad.h | 5 +++-- 18 files changed, 53 insertions(+), 38 deletions(-) (limited to 'src/core/hle/service/hid/controllers') diff --git a/src/core/hle/service/hid/controllers/controller_base.cpp b/src/core/hle/service/hid/controllers/controller_base.cpp index cc935b031..2ea9b78d8 100644 --- a/src/core/hle/service/hid/controllers/controller_base.cpp +++ b/src/core/hle/service/hid/controllers/controller_base.cpp @@ -6,15 +6,15 @@ namespace Service::HID { -ControllerBase::ControllerBase() = default; +ControllerBase::ControllerBase(Core::System& system) : system(system){}; ControllerBase::~ControllerBase() = default; -void ControllerBase::ActivateController(Core::System& system) { +void ControllerBase::ActivateController() { if (is_activated) { OnRelease(); } is_activated = true; - OnInit(system); + OnInit(); } void ControllerBase::DeactivateController() { diff --git a/src/core/hle/service/hid/controllers/controller_base.h b/src/core/hle/service/hid/controllers/controller_base.h index 7abe24f1d..47972f5fc 100644 --- a/src/core/hle/service/hid/controllers/controller_base.h +++ b/src/core/hle/service/hid/controllers/controller_base.h @@ -18,11 +18,11 @@ class System; namespace Service::HID { class ControllerBase { public: - ControllerBase(); + ControllerBase(Core::System& system); virtual ~ControllerBase(); // Called when the controller is initialized - virtual void OnInit(Core::System& system) = 0; + virtual void OnInit() = 0; // When the controller is released virtual void OnRelease() = 0; @@ -34,7 +34,7 @@ public: // Called when input devices should be loaded virtual void OnLoadInputDevices() = 0; - void ActivateController(Core::System& system); + void ActivateController(); void DeactivateController(); @@ -50,5 +50,7 @@ protected: s64_le entry_count; }; static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); + + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index 2c5528b67..8e8263f5b 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp @@ -14,10 +14,11 @@ constexpr s32 HID_JOYSTICK_MAX = 0x7fff; constexpr s32 HID_JOYSTICK_MIN = -0x7fff; enum class JoystickId : std::size_t { Joystick_Left, Joystick_Right }; -Controller_DebugPad::Controller_DebugPad() = default; +Controller_DebugPad::Controller_DebugPad(Core::System& system) + : ControllerBase(system), system(system) {} Controller_DebugPad::~Controller_DebugPad() = default; -void Controller_DebugPad::OnInit(Core::System& system) {} +void Controller_DebugPad::OnInit() {} void Controller_DebugPad::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/debug_pad.h b/src/core/hle/service/hid/controllers/debug_pad.h index 629d6d582..6c4de817e 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.h +++ b/src/core/hle/service/hid/controllers/debug_pad.h @@ -16,11 +16,11 @@ namespace Service::HID { class Controller_DebugPad final : public ControllerBase { public: - Controller_DebugPad(); + explicit Controller_DebugPad(Core::System& system); ~Controller_DebugPad() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -89,5 +89,6 @@ private: buttons; std::array, Settings::NativeAnalog::NUM_STICKS_HID> analogs; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index c01fd6d4e..80da0a0d3 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp @@ -10,10 +10,11 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3BA00; -Controller_Gesture::Controller_Gesture() = default; +Controller_Gesture::Controller_Gesture(Core::System& system) + : ControllerBase(system), system(system) {} Controller_Gesture::~Controller_Gesture() = default; -void Controller_Gesture::OnInit(Core::System& system) {} +void Controller_Gesture::OnInit() {} void Controller_Gesture::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h index c3827fa00..b0f8794ba 100644 --- a/src/core/hle/service/hid/controllers/gesture.h +++ b/src/core/hle/service/hid/controllers/gesture.h @@ -12,11 +12,11 @@ namespace Service::HID { class Controller_Gesture final : public ControllerBase { public: - Controller_Gesture(); + Controller_Gesture(Core::System& system); ~Controller_Gesture() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -59,5 +59,6 @@ private: std::array gesture_states; }; SharedMemory shared_memory{}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index b3fbb7962..e587b2e15 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp @@ -12,10 +12,11 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3800; constexpr u8 KEYS_PER_BYTE = 8; -Controller_Keyboard::Controller_Keyboard() = default; +Controller_Keyboard::Controller_Keyboard(Core::System& system) + : ControllerBase(system), system(system) {} Controller_Keyboard::~Controller_Keyboard() = default; -void Controller_Keyboard::OnInit(Core::System& system) {} +void Controller_Keyboard::OnInit() {} void Controller_Keyboard::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h index a594706a9..37ff075b1 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h @@ -15,11 +15,11 @@ namespace Service::HID { class Controller_Keyboard final : public ControllerBase { public: - Controller_Keyboard(); + Controller_Keyboard(Core::System& system); ~Controller_Keyboard() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -53,5 +53,6 @@ private: keyboard_keys; std::array, Settings::NativeKeyboard::NumKeyboardMods> keyboard_mods; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index fd3f91e65..88f2ca4c1 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp @@ -11,10 +11,10 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3400; -Controller_Mouse::Controller_Mouse() = default; +Controller_Mouse::Controller_Mouse(Core::System& system) : ControllerBase(system), system(system) {} Controller_Mouse::~Controller_Mouse() = default; -void Controller_Mouse::OnInit(Core::System& system) {} +void Controller_Mouse::OnInit() {} void Controller_Mouse::OnRelease() {} void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h index df3a17491..67e2647ad 100644 --- a/src/core/hle/service/hid/controllers/mouse.h +++ b/src/core/hle/service/hid/controllers/mouse.h @@ -14,11 +14,11 @@ namespace Service::HID { class Controller_Mouse final : public ControllerBase { public: - Controller_Mouse(); + Controller_Mouse(Core::System& system); ~Controller_Mouse() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -53,5 +53,6 @@ private: std::unique_ptr mouse_device; std::array, Settings::NativeMouseButton::NumMouseButtons> mouse_button_devices; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 104924d03..f7a0aa4ff 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -93,7 +93,7 @@ u32 Controller_NPad::IndexToNPad(std::size_t index) { }; } -Controller_NPad::Controller_NPad() = default; +Controller_NPad::Controller_NPad(Core::System& system) : ControllerBase(system), system(system) {} Controller_NPad::~Controller_NPad() = default; void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) { @@ -167,7 +167,7 @@ void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) { controller.battery_level[2] = BATTERY_FULL; } -void Controller_NPad::OnInit(Core::System& system) { +void Controller_NPad::OnInit() { auto& kernel = system.Kernel(); styleset_changed_event = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::Automatic, "npad:NpadStyleSetChanged"); diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 755739700..3552c248e 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -20,11 +20,11 @@ constexpr u32 NPAD_UNKNOWN = 16; // TODO(ogniK): What is this? class Controller_NPad final : public ControllerBase { public: - Controller_NPad(); + Controller_NPad(Core::System& system); ~Controller_NPad() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -327,5 +327,6 @@ private: std::array npad_pad_states{}; bool IsControllerSupported(NPadControllerType controller); bool is_in_lr_assignment_mode{false}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/stubbed.cpp b/src/core/hle/service/hid/controllers/stubbed.cpp index 5de75c958..9b829341e 100644 --- a/src/core/hle/service/hid/controllers/stubbed.cpp +++ b/src/core/hle/service/hid/controllers/stubbed.cpp @@ -9,10 +9,11 @@ namespace Service::HID { -Controller_Stubbed::Controller_Stubbed() = default; +Controller_Stubbed::Controller_Stubbed(Core::System& system) + : ControllerBase(system), system(system) {} Controller_Stubbed::~Controller_Stubbed() = default; -void Controller_Stubbed::OnInit(Core::System& system) {} +void Controller_Stubbed::OnInit() {} void Controller_Stubbed::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/stubbed.h b/src/core/hle/service/hid/controllers/stubbed.h index af636bae3..96dec4872 100644 --- a/src/core/hle/service/hid/controllers/stubbed.h +++ b/src/core/hle/service/hid/controllers/stubbed.h @@ -10,11 +10,11 @@ namespace Service::HID { class Controller_Stubbed final : public ControllerBase { public: - Controller_Stubbed(); + Controller_Stubbed(Core::System& system); ~Controller_Stubbed() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -30,5 +30,6 @@ public: private: bool smart_update{}; std::size_t common_offset{}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index ea8dffaab..25912fd69 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -13,10 +13,11 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x400; -Controller_Touchscreen::Controller_Touchscreen() = default; +Controller_Touchscreen::Controller_Touchscreen(Core::System& system) + : ControllerBase(system), system(system) {} Controller_Touchscreen::~Controller_Touchscreen() = default; -void Controller_Touchscreen::OnInit(Core::System& system) {} +void Controller_Touchscreen::OnInit() {} void Controller_Touchscreen::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h index fdb45fd85..2e8383b80 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h @@ -14,11 +14,11 @@ namespace Service::HID { class Controller_Touchscreen final : public ControllerBase { public: - Controller_Touchscreen(); + Controller_Touchscreen(Core::System& system); ~Controller_Touchscreen() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -69,5 +69,6 @@ private: TouchScreenSharedMemory shared_memory{}; std::unique_ptr touch_device; s64_le last_touch{}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/xpad.cpp b/src/core/hle/service/hid/controllers/xpad.cpp index 22ee0c7d7..1bce044b4 100644 --- a/src/core/hle/service/hid/controllers/xpad.cpp +++ b/src/core/hle/service/hid/controllers/xpad.cpp @@ -10,10 +10,10 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C00; -Controller_XPad::Controller_XPad() = default; +Controller_XPad::Controller_XPad(Core::System& system) : ControllerBase(system), system(system) {} Controller_XPad::~Controller_XPad() = default; -void Controller_XPad::OnInit(Core::System& system) {} +void Controller_XPad::OnInit() {} void Controller_XPad::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h index 8522efd50..813cb7755 100644 --- a/src/core/hle/service/hid/controllers/xpad.h +++ b/src/core/hle/service/hid/controllers/xpad.h @@ -12,11 +12,11 @@ namespace Service::HID { class Controller_XPad final : public ControllerBase { public: - Controller_XPad(); + Controller_XPad(Core::System& system); ~Controller_XPad() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -56,5 +56,6 @@ private: }; static_assert(sizeof(SharedMemory) == 0x1000, "SharedMemory is an invalid size"); SharedMemory shared_memory{}; + Core::System& system; }; } // namespace Service::HID -- cgit v1.2.3