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

This commit is contained in:
german77 2021-11-04 19:05:58 -06:00 committed by Narr the Reg
parent 690013b342
commit e7eee36d52
29 changed files with 67 additions and 67 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,6 @@
#include "common/common_types.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hid/emulated_controller.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;
}
Controller_NPad::Controller_NPad(Core::System& system_,
Controller_NPad::Controller_NPad(Core::HID::HIDCore& hid_core_,
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) {
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 =
DEFAULT_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));
}
if (system.HIDCore().GetSupportedStyleTag().raw == 0) {
if (hid_core.GetSupportedStyleTag().raw == 0) {
// We want to support all controllers
Core::HID::NpadStyleTag style{};
style.handheld.Assign(1);
@ -294,7 +293,7 @@ void Controller_NPad::OnInit() {
style.fullkey.Assign(1);
style.gamecube.Assign(1);
style.palma.Assign(1);
system.HIDCore().SetSupportedStyleTag(style);
hid_core.SetSupportedStyleTag(style);
}
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) {
system.HIDCore().SetSupportedStyleTag(style_set);
hid_core.SetSupportedStyleTag(style_set);
}
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) {

View file

@ -11,7 +11,6 @@
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/quaternion.h"
#include "common/settings.h"
#include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.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 {
public:
explicit Controller_NPad(Core::System& system_,
explicit Controller_NPad(Core::HID::HIDCore& hid_core_,
KernelHelpers::ServiceContext& service_context_);
~Controller_NPad() override;

View file

@ -5,11 +5,12 @@
#include <cstring>
#include "common/common_types.h"
#include "core/core_timing.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/stubbed.h"
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;
void Controller_Stubbed::OnInit() {}

View file

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

View file

@ -10,13 +10,16 @@
#include "core/core.h"
#include "core/core_timing.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"
namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x400;
Controller_Touchscreen::Controller_Touchscreen(Core::System& system_) : ControllerBase{system_} {
console = system.HIDCore().GetEmulatedConsole();
Controller_Touchscreen::Controller_Touchscreen(Core::HID::HIDCore& hid_core_)
: ControllerBase{hid_core_} {
console = hid_core.GetEmulatedConsole();
}
Controller_Touchscreen::~Controller_Touchscreen() = default;

View file

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

View file

@ -5,12 +5,13 @@
#include <cstring>
#include "common/common_types.h"
#include "core/core_timing.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/xpad.h"
namespace Service::HID {
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;
void Controller_XPad::OnInit() {}

View file

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

View file

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

View file

@ -60,12 +60,12 @@ public:
private:
template <typename T>
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>
void MakeControllerWithServiceContext(HidController 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);

View file

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

View file

@ -6,17 +6,17 @@
#include <QLayout>
#include <QString>
#include "common/settings.h"
#include "core/core.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "input_common/drivers/tas_input.h"
#include "input_common/main.h"
#include "yuzu/configuration/configure_input_player_widget.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_,
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"));
setWindowTitle(tr("Controller P1"));
resize(500, 350);
@ -41,8 +41,8 @@ ControllerDialog::ControllerDialog(Core::System& system_,
void ControllerDialog::refreshConfiguration() {
UnloadController();
auto* player_1 = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
auto* player_1 = hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* handheld = hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
// Display the correct controller
controller = handheld->IsConnected() ? handheld : player_1;

View file

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

View file

@ -928,7 +928,7 @@ void GMainWindow::InitializeDebugWidgets() {
waitTreeWidget->hide();
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();
debug_menu->addAction(controller_dialog->toggleViewAction());