service/hid: Remove includes of core.h and settings.h

merge-requests/60/head
german77 2021-11-04 19:05:58 +07:00 committed by Narr the Reg
parent 690013b342
commit e7eee36d52
29 changed files with 67 additions and 67 deletions

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included // Refer to the license.txt file included
#include "common/settings.h"
#include "core/hid/emulated_console.h" #include "core/hid/emulated_console.h"
#include "core/hid/input_converter.h" #include "core/hid/input_converter.h"

@ -15,7 +15,6 @@
#include "common/param_package.h" #include "common/param_package.h"
#include "common/point.h" #include "common/point.h"
#include "common/quaternion.h" #include "common/quaternion.h"
#include "common/settings.h"
#include "common/vector_math.h" #include "common/vector_math.h"
#include "core/hid/hid_types.h" #include "core/hid/hid_types.h"
#include "core/hid/motion_input.h" #include "core/hid/motion_input.h"

@ -15,7 +15,6 @@
#include "common/param_package.h" #include "common/param_package.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/hid/hid_types.h" #include "core/hid/hid_types.h"
#include "core/hid/motion_input.h"
namespace Core::HID { namespace Core::HID {
@ -103,7 +102,7 @@ public:
/// Reverts any mapped changes made that weren't saved /// Reverts any mapped changes made that weren't saved
void RestoreConfig(); void RestoreConfig();
/// Returns the current mapped motion device /// Returns the current mapped mouse button device
Common::ParamPackage GetMouseButtonParam(std::size_t index) const; Common::ParamPackage GetMouseButtonParam(std::size_t index) const;
/** /**

@ -3,17 +3,17 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hid/emulated_console.h" #include "core/hid/emulated_console.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/console_sixaxis.h" #include "core/hle/service/hid/controllers/console_sixaxis.h"
namespace Service::HID { namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200; constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200;
Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::System& system_) Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_core_)
: ControllerBase{system_} { : ControllerBase{hid_core_} {
console = system.HIDCore().GetEmulatedConsole(); console = hid_core.GetEmulatedConsole();
} }
Controller_ConsoleSixAxis::~Controller_ConsoleSixAxis() = default; Controller_ConsoleSixAxis::~Controller_ConsoleSixAxis() = default;

@ -5,16 +5,20 @@
#pragma once #pragma once
#include <array> #include <array>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/quaternion.h" #include "common/quaternion.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h" #include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/controller_base.h"
namespace Core::HID {
class EmulatedConsole;
} // namespace Core::HID
namespace Service::HID { namespace Service::HID {
class Controller_ConsoleSixAxis final : public ControllerBase { class Controller_ConsoleSixAxis final : public ControllerBase {
public: public:
explicit Controller_ConsoleSixAxis(Core::System& system_); explicit Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_core_);
~Controller_ConsoleSixAxis() override; ~Controller_ConsoleSixAxis() override;
// Called when the controller is initialized // Called when the controller is initialized

@ -6,7 +6,7 @@
namespace Service::HID { namespace Service::HID {
ControllerBase::ControllerBase(Core::System& system_) : system(system_) {} ControllerBase::ControllerBase(Core::HID::HIDCore& hid_core_) : hid_core(hid_core_) {}
ControllerBase::~ControllerBase() = default; ControllerBase::~ControllerBase() = default;
void ControllerBase::ActivateController() { void ControllerBase::ActivateController() {

@ -11,14 +11,14 @@ namespace Core::Timing {
class CoreTiming; class CoreTiming;
} }
namespace Core { namespace Core::HID {
class System; class HIDCore;
} }
namespace Service::HID { namespace Service::HID {
class ControllerBase { class ControllerBase {
public: public:
explicit ControllerBase(Core::System& system_); explicit ControllerBase(Core::HID::HIDCore& hid_core_);
virtual ~ControllerBase(); virtual ~ControllerBase();
// Called when the controller is initialized // Called when the controller is initialized
@ -44,6 +44,6 @@ public:
protected: protected:
bool is_activated{false}; bool is_activated{false};
Core::System& system; Core::HID::HIDCore& hid_core;
}; };
} // namespace Service::HID } // namespace Service::HID

@ -5,7 +5,6 @@
#include <cstring> #include <cstring>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hid/emulated_controller.h" #include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h" #include "core/hid/hid_core.h"
@ -15,8 +14,9 @@
namespace Service::HID { namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x00000; constexpr std::size_t SHARED_MEMORY_OFFSET = 0x00000;
Controller_DebugPad::Controller_DebugPad(Core::System& system_) : ControllerBase{system_} { Controller_DebugPad::Controller_DebugPad(Core::HID::HIDCore& hid_core_)
controller = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Other); : ControllerBase{hid_core_} {
controller = hid_core.GetEmulatedController(Core::HID::NpadIdType::Other);
} }
Controller_DebugPad::~Controller_DebugPad() = default; Controller_DebugPad::~Controller_DebugPad() = default;

@ -8,7 +8,6 @@
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/settings.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h" #include "core/hle/service/hid/ring_lifo.h"
@ -22,7 +21,7 @@ struct AnalogStickState;
namespace Service::HID { namespace Service::HID {
class Controller_DebugPad final : public ControllerBase { class Controller_DebugPad final : public ControllerBase {
public: public:
explicit Controller_DebugPad(Core::System& system_); explicit Controller_DebugPad(Core::HID::HIDCore& hid_core_);
~Controller_DebugPad() override; ~Controller_DebugPad() override;
// Called when the controller is initialized // Called when the controller is initialized

@ -5,7 +5,6 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/math_util.h" #include "common/math_util.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
#include "core/hid/hid_core.h" #include "core/hid/hid_core.h"
@ -25,8 +24,8 @@ constexpr f32 Square(s32 num) {
return static_cast<f32>(num * num); return static_cast<f32>(num * num);
} }
Controller_Gesture::Controller_Gesture(Core::System& system_) : ControllerBase(system_) { Controller_Gesture::Controller_Gesture(Core::HID::HIDCore& hid_core_) : ControllerBase(hid_core_) {
console = system.HIDCore().GetEmulatedConsole(); console = hid_core.GetEmulatedConsole();
} }
Controller_Gesture::~Controller_Gesture() = default; Controller_Gesture::~Controller_Gesture() = default;

@ -15,7 +15,7 @@
namespace Service::HID { namespace Service::HID {
class Controller_Gesture final : public ControllerBase { class Controller_Gesture final : public ControllerBase {
public: public:
explicit Controller_Gesture(Core::System& system_); explicit Controller_Gesture(Core::HID::HIDCore& hid_core_);
~Controller_Gesture() override; ~Controller_Gesture() override;
// Called when the controller is initialized // Called when the controller is initialized

@ -5,7 +5,6 @@
#include <cstring> #include <cstring>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hid/emulated_devices.h" #include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h" #include "core/hid/hid_core.h"
@ -14,8 +13,9 @@
namespace Service::HID { namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3800; constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3800;
Controller_Keyboard::Controller_Keyboard(Core::System& system_) : ControllerBase{system_} { Controller_Keyboard::Controller_Keyboard(Core::HID::HIDCore& hid_core_)
emulated_devices = system.HIDCore().GetEmulatedDevices(); : ControllerBase{hid_core_} {
emulated_devices = hid_core.GetEmulatedDevices();
} }
Controller_Keyboard::~Controller_Keyboard() = default; Controller_Keyboard::~Controller_Keyboard() = default;

@ -8,7 +8,6 @@
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/settings.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h" #include "core/hle/service/hid/ring_lifo.h"
@ -22,7 +21,7 @@ struct KeyboardKey;
namespace Service::HID { namespace Service::HID {
class Controller_Keyboard final : public ControllerBase { class Controller_Keyboard final : public ControllerBase {
public: public:
explicit Controller_Keyboard(Core::System& system_); explicit Controller_Keyboard(Core::HID::HIDCore& hid_core_);
~Controller_Keyboard() override; ~Controller_Keyboard() override;
// Called when the controller is initialized // Called when the controller is initialized

@ -4,7 +4,6 @@
#include <cstring> #include <cstring>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
#include "core/hid/emulated_devices.h" #include "core/hid/emulated_devices.h"
@ -14,8 +13,8 @@
namespace Service::HID { namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3400; constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3400;
Controller_Mouse::Controller_Mouse(Core::System& system_) : ControllerBase{system_} { Controller_Mouse::Controller_Mouse(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {
emulated_devices = system.HIDCore().GetEmulatedDevices(); emulated_devices = hid_core.GetEmulatedDevices();
} }
Controller_Mouse::~Controller_Mouse() = default; Controller_Mouse::~Controller_Mouse() = default;

@ -7,7 +7,6 @@
#include <array> #include <array>
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/settings.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h" #include "core/hle/service/hid/ring_lifo.h"
@ -20,7 +19,7 @@ struct MouseState;
namespace Service::HID { namespace Service::HID {
class Controller_Mouse final : public ControllerBase { class Controller_Mouse final : public ControllerBase {
public: public:
explicit Controller_Mouse(Core::System& system_); explicit Controller_Mouse(Core::HID::HIDCore& hid_core_);
~Controller_Mouse() override; ~Controller_Mouse() override;
// Called when the controller is initialized // Called when the controller is initialized

@ -10,7 +10,6 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hid/emulated_controller.h" #include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h" #include "core/hid/hid_core.h"
@ -97,12 +96,12 @@ bool Controller_NPad::IsDeviceHandleValid(const DeviceHandle& device_handle) {
device_handle.device_index < DeviceIndex::MaxDeviceIndex; device_handle.device_index < DeviceIndex::MaxDeviceIndex;
} }
Controller_NPad::Controller_NPad(Core::System& system_, Controller_NPad::Controller_NPad(Core::HID::HIDCore& hid_core_,
KernelHelpers::ServiceContext& service_context_) KernelHelpers::ServiceContext& service_context_)
: ControllerBase{system_}, service_context{service_context_} { : ControllerBase{hid_core_}, service_context{service_context_} {
for (std::size_t i = 0; i < controller_data.size(); ++i) { for (std::size_t i = 0; i < controller_data.size(); ++i) {
auto& controller = controller_data[i]; auto& controller = controller_data[i];
controller.device = system.HIDCore().GetEmulatedControllerByIndex(i); controller.device = hid_core.GetEmulatedControllerByIndex(i);
controller.vibration[Core::HID::DeviceIndex::LeftIndex].latest_vibration_value = controller.vibration[Core::HID::DeviceIndex::LeftIndex].latest_vibration_value =
DEFAULT_VIBRATION_VALUE; DEFAULT_VIBRATION_VALUE;
controller.vibration[Core::HID::DeviceIndex::RightIndex].latest_vibration_value = controller.vibration[Core::HID::DeviceIndex::RightIndex].latest_vibration_value =
@ -284,7 +283,7 @@ void Controller_NPad::OnInit() {
service_context.CreateEvent(fmt::format("npad:NpadStyleSetChanged_{}", i)); service_context.CreateEvent(fmt::format("npad:NpadStyleSetChanged_{}", i));
} }
if (system.HIDCore().GetSupportedStyleTag().raw == 0) { if (hid_core.GetSupportedStyleTag().raw == 0) {
// We want to support all controllers // We want to support all controllers
Core::HID::NpadStyleTag style{}; Core::HID::NpadStyleTag style{};
style.handheld.Assign(1); style.handheld.Assign(1);
@ -294,7 +293,7 @@ void Controller_NPad::OnInit() {
style.fullkey.Assign(1); style.fullkey.Assign(1);
style.gamecube.Assign(1); style.gamecube.Assign(1);
style.palma.Assign(1); style.palma.Assign(1);
system.HIDCore().SetSupportedStyleTag(style); hid_core.SetSupportedStyleTag(style);
} }
supported_npad_id_types.resize(npad_id_list.size()); supported_npad_id_types.resize(npad_id_list.size());
@ -678,11 +677,11 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
} }
void Controller_NPad::SetSupportedStyleSet(Core::HID::NpadStyleTag style_set) { void Controller_NPad::SetSupportedStyleSet(Core::HID::NpadStyleTag style_set) {
system.HIDCore().SetSupportedStyleTag(style_set); hid_core.SetSupportedStyleTag(style_set);
} }
Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const { Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const {
return system.HIDCore().GetSupportedStyleTag(); return hid_core.GetSupportedStyleTag();
} }
void Controller_NPad::SetSupportedNpadIdTypes(u8* data, std::size_t length) { void Controller_NPad::SetSupportedNpadIdTypes(u8* data, std::size_t length) {

@ -11,7 +11,6 @@
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/quaternion.h" #include "common/quaternion.h"
#include "common/settings.h"
#include "core/hid/hid_types.h" #include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h" #include "core/hle/service/hid/ring_lifo.h"
@ -37,7 +36,7 @@ constexpr u32 NPAD_UNKNOWN = 16; // TODO(ogniK): What is this?
class Controller_NPad final : public ControllerBase { class Controller_NPad final : public ControllerBase {
public: public:
explicit Controller_NPad(Core::System& system_, explicit Controller_NPad(Core::HID::HIDCore& hid_core_,
KernelHelpers::ServiceContext& service_context_); KernelHelpers::ServiceContext& service_context_);
~Controller_NPad() override; ~Controller_NPad() override;

@ -5,11 +5,12 @@
#include <cstring> #include <cstring>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/stubbed.h" #include "core/hle/service/hid/controllers/stubbed.h"
namespace Service::HID { namespace Service::HID {
Controller_Stubbed::Controller_Stubbed(Core::System& system_) : ControllerBase{system_} {} Controller_Stubbed::Controller_Stubbed(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
Controller_Stubbed::~Controller_Stubbed() = default; Controller_Stubbed::~Controller_Stubbed() = default;
void Controller_Stubbed::OnInit() {} void Controller_Stubbed::OnInit() {}

@ -10,7 +10,7 @@
namespace Service::HID { namespace Service::HID {
class Controller_Stubbed final : public ControllerBase { class Controller_Stubbed final : public ControllerBase {
public: public:
explicit Controller_Stubbed(Core::System& system_); explicit Controller_Stubbed(Core::HID::HIDCore& hid_core_);
~Controller_Stubbed() override; ~Controller_Stubbed() override;
// Called when the controller is initialized // Called when the controller is initialized

@ -10,13 +10,16 @@
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
#include "core/hid/emulated_console.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/touchscreen.h" #include "core/hle/service/hid/controllers/touchscreen.h"
namespace Service::HID { namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x400; constexpr std::size_t SHARED_MEMORY_OFFSET = 0x400;
Controller_Touchscreen::Controller_Touchscreen(Core::System& system_) : ControllerBase{system_} { Controller_Touchscreen::Controller_Touchscreen(Core::HID::HIDCore& hid_core_)
console = system.HIDCore().GetEmulatedConsole(); : ControllerBase{hid_core_} {
console = hid_core.GetEmulatedConsole();
} }
Controller_Touchscreen::~Controller_Touchscreen() = default; Controller_Touchscreen::~Controller_Touchscreen() = default;

@ -9,12 +9,14 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/point.h" #include "common/point.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/hid/emulated_console.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h" #include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h" #include "core/hle/service/hid/ring_lifo.h"
namespace Core::HID {
class EmulatedConsole;
} // namespace Core::HID
namespace Service::HID { namespace Service::HID {
class Controller_Touchscreen final : public ControllerBase { class Controller_Touchscreen final : public ControllerBase {
public: public:
@ -34,7 +36,7 @@ public:
static_assert(sizeof(TouchScreenConfigurationForNx) == 0x17, static_assert(sizeof(TouchScreenConfigurationForNx) == 0x17,
"TouchScreenConfigurationForNx is an invalid size"); "TouchScreenConfigurationForNx is an invalid size");
explicit Controller_Touchscreen(Core::System& system_); explicit Controller_Touchscreen(Core::HID::HIDCore& hid_core_);
~Controller_Touchscreen() override; ~Controller_Touchscreen() override;
// Called when the controller is initialized // Called when the controller is initialized

@ -5,12 +5,13 @@
#include <cstring> #include <cstring>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/xpad.h" #include "core/hle/service/hid/controllers/xpad.h"
namespace Service::HID { namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C00; constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C00;
Controller_XPad::Controller_XPad(Core::System& system_) : ControllerBase{system_} {} Controller_XPad::Controller_XPad(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
Controller_XPad::~Controller_XPad() = default; Controller_XPad::~Controller_XPad() = default;
void Controller_XPad::OnInit() {} void Controller_XPad::OnInit() {}

@ -15,7 +15,7 @@
namespace Service::HID { namespace Service::HID {
class Controller_XPad final : public ControllerBase { class Controller_XPad final : public ControllerBase {
public: public:
explicit Controller_XPad(Core::System& system_); explicit Controller_XPad(Core::HID::HIDCore& hid_core_);
~Controller_XPad() override; ~Controller_XPad() override;
// Called when the controller is initialized // Called when the controller is initialized

@ -8,6 +8,7 @@
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hid/hid_core.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/k_readable_event.h" #include "core/hle/kernel/k_readable_event.h"
#include "core/hle/kernel/k_shared_memory.h" #include "core/hle/kernel/k_shared_memory.h"

@ -60,12 +60,12 @@ public:
private: private:
template <typename T> template <typename T>
void MakeController(HidController controller) { void MakeController(HidController controller) {
controllers[static_cast<std::size_t>(controller)] = std::make_unique<T>(system); controllers[static_cast<std::size_t>(controller)] = std::make_unique<T>(system.HIDCore());
} }
template <typename T> template <typename T>
void MakeControllerWithServiceContext(HidController controller) { void MakeControllerWithServiceContext(HidController controller) {
controllers[static_cast<std::size_t>(controller)] = controllers[static_cast<std::size_t>(controller)] =
std::make_unique<T>(system, service_context); std::make_unique<T>(system.HIDCore(), service_context);
} }
void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx);

@ -27,7 +27,6 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/microprofile.h" #include "common/microprofile.h"
#include "common/param_package.h"
#include "common/scm_rev.h" #include "common/scm_rev.h"
#include "common/scope_exit.h" #include "common/scope_exit.h"
#include "common/settings.h" #include "common/settings.h"

@ -6,17 +6,17 @@
#include <QLayout> #include <QLayout>
#include <QString> #include <QString>
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h"
#include "core/hid/emulated_controller.h" #include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "input_common/drivers/tas_input.h" #include "input_common/drivers/tas_input.h"
#include "input_common/main.h" #include "input_common/main.h"
#include "yuzu/configuration/configure_input_player_widget.h" #include "yuzu/configuration/configure_input_player_widget.h"
#include "yuzu/debugger/controller.h" #include "yuzu/debugger/controller.h"
ControllerDialog::ControllerDialog(Core::System& system_, ControllerDialog::ControllerDialog(Core::HID::HIDCore& hid_core_,
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_, std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
QWidget* parent) QWidget* parent)
: QWidget(parent, Qt::Dialog), system{system_}, input_subsystem{input_subsystem_} { : QWidget(parent, Qt::Dialog), hid_core{hid_core_}, input_subsystem{input_subsystem_} {
setObjectName(QStringLiteral("Controller")); setObjectName(QStringLiteral("Controller"));
setWindowTitle(tr("Controller P1")); setWindowTitle(tr("Controller P1"));
resize(500, 350); resize(500, 350);
@ -41,8 +41,8 @@ ControllerDialog::ControllerDialog(Core::System& system_,
void ControllerDialog::refreshConfiguration() { void ControllerDialog::refreshConfiguration() {
UnloadController(); UnloadController();
auto* player_1 = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); auto* player_1 = hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); auto* handheld = hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
// Display the correct controller // Display the correct controller
controller = handheld->IsConnected() ? handheld : player_1; controller = handheld->IsConnected() ? handheld : player_1;

@ -15,11 +15,8 @@ namespace InputCommon {
class InputSubsystem; class InputSubsystem;
} }
namespace Core {
class System;
}
namespace Core::HID { namespace Core::HID {
class HIDCore;
class EmulatedController; class EmulatedController;
enum class ControllerTriggerType; enum class ControllerTriggerType;
} // namespace Core::HID } // namespace Core::HID
@ -28,7 +25,7 @@ class ControllerDialog : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ControllerDialog(Core::System& system_, explicit ControllerDialog(Core::HID::HIDCore& hid_core_,
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_, std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
QWidget* parent = nullptr); QWidget* parent = nullptr);
@ -55,6 +52,6 @@ private:
QAction* toggle_view_action = nullptr; QAction* toggle_view_action = nullptr;
PlayerControlPreview* widget; PlayerControlPreview* widget;
Core::System& system; Core::HID::HIDCore& hid_core;
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
}; };

@ -928,7 +928,7 @@ void GMainWindow::InitializeDebugWidgets() {
waitTreeWidget->hide(); waitTreeWidget->hide();
debug_menu->addAction(waitTreeWidget->toggleViewAction()); debug_menu->addAction(waitTreeWidget->toggleViewAction());
controller_dialog = new ControllerDialog(*system, input_subsystem, this); controller_dialog = new ControllerDialog(system->HIDCore(), input_subsystem, this);
controller_dialog->hide(); controller_dialog->hide();
debug_menu->addAction(controller_dialog->toggleViewAction()); debug_menu->addAction(controller_dialog->toggleViewAction());