settings: Remove includes of core.h

This commit is contained in:
german77 2021-11-04 21:54:22 -06:00 committed by Narr the Reg
parent e7eee36d52
commit a17550be98
10 changed files with 55 additions and 57 deletions

View file

@ -2,17 +2,18 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/core.h"
#include "core/hid/hid_core.h"
#include "ui_configure_debug_controller.h"
#include "yuzu/configuration/configure_debug_controller.h"
#include "yuzu/configuration/configure_input_player.h"
ConfigureDebugController::ConfigureDebugController(QWidget* parent,
InputCommon::InputSubsystem* input_subsystem,
InputProfiles* profiles, Core::System& system)
InputProfiles* profiles,
Core::HID::HIDCore& hid_core, bool is_powered_on)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()),
debug_controller(
new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, true)) {
debug_controller(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles,
hid_core, is_powered_on, true)) {
ui->setupUi(this);
ui->controllerLayout->addWidget(debug_controller);

View file

@ -13,8 +13,8 @@ class ConfigureInputPlayer;
class InputProfiles;
namespace Core {
class System;
namespace Core::HID {
class HIDCore;
}
namespace InputCommon {
@ -30,7 +30,8 @@ class ConfigureDebugController : public QDialog {
public:
explicit ConfigureDebugController(QWidget* parent, InputCommon::InputSubsystem* input_subsystem,
InputProfiles* profiles, Core::System& system);
InputProfiles* profiles, Core::HID::HIDCore& hid_core,
bool is_powered_on);
~ConfigureDebugController() override;
void ApplyConfiguration();

View file

@ -74,7 +74,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
hotkeys_tab->Populate(registry);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
input_tab->Initialize(input_subsystem, system_);
input_tab->Initialize(input_subsystem);
general_tab->SetResetCallback([&] { this->close(); });

View file

@ -10,6 +10,8 @@
#include <QTimer>
#include "core/core.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applet_ae.h"
#include "core/hle/service/am/applet_oe.h"
@ -73,25 +75,27 @@ ConfigureInput::ConfigureInput(Core::System& system_, QWidget* parent)
ConfigureInput::~ConfigureInput() = default;
void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, Core::System& system,
void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
std::size_t max_players) {
const bool is_powered_on = system.IsPoweredOn();
auto& hid_core = system.HIDCore();
player_controllers = {
new ConfigureInputPlayer(this, 0, ui->consoleInputSettings, input_subsystem, profiles.get(),
system),
hid_core, is_powered_on),
new ConfigureInputPlayer(this, 1, ui->consoleInputSettings, input_subsystem, profiles.get(),
system),
hid_core, is_powered_on),
new ConfigureInputPlayer(this, 2, ui->consoleInputSettings, input_subsystem, profiles.get(),
system),
hid_core, is_powered_on),
new ConfigureInputPlayer(this, 3, ui->consoleInputSettings, input_subsystem, profiles.get(),
system),
hid_core, is_powered_on),
new ConfigureInputPlayer(this, 4, ui->consoleInputSettings, input_subsystem, profiles.get(),
system),
hid_core, is_powered_on),
new ConfigureInputPlayer(this, 5, ui->consoleInputSettings, input_subsystem, profiles.get(),
system),
hid_core, is_powered_on),
new ConfigureInputPlayer(this, 6, ui->consoleInputSettings, input_subsystem, profiles.get(),
system),
hid_core, is_powered_on),
new ConfigureInputPlayer(this, 7, ui->consoleInputSettings, input_subsystem, profiles.get(),
system),
hid_core, is_powered_on),
};
player_tabs = {
@ -147,10 +151,11 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, Co
advanced = new ConfigureInputAdvanced(this);
ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced));
ui->tabAdvanced->layout()->addWidget(advanced);
connect(advanced, &ConfigureInputAdvanced::CallDebugControllerDialog,
[this, input_subsystem, &system] {
CallConfigureDialog<ConfigureDebugController>(*this, input_subsystem,
profiles.get(), system);
[this, input_subsystem, &hid_core, is_powered_on] {
CallConfigureDialog<ConfigureDebugController>(
*this, input_subsystem, profiles.get(), hid_core, is_powered_on);
});
connect(advanced, &ConfigureInputAdvanced::CallMouseConfigDialog, [this, input_subsystem] {
CallConfigureDialog<ConfigureMouseAdvanced>(*this, input_subsystem);

View file

@ -42,8 +42,7 @@ public:
~ConfigureInput() override;
/// Initializes the input dialog with the given input subsystem.
void Initialize(InputCommon::InputSubsystem* input_subsystem_, Core::System& system,
std::size_t max_players = 8);
void Initialize(InputCommon::InputSubsystem* input_subsystem_, std::size_t max_players = 8);
/// Save all button configurations to settings file.
void ApplyConfiguration();

View file

@ -12,7 +12,6 @@
#include <QMessageBox>
#include <QTimer>
#include "common/param_package.h"
#include "core/core.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
@ -134,18 +133,17 @@ QString ConfigureInputPlayer::AnalogToText(const Common::ParamPackage& param,
ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index,
QWidget* bottom_row,
InputCommon::InputSubsystem* input_subsystem_,
InputProfiles* profiles_, Core::System& system_,
bool debug)
InputProfiles* profiles_, Core::HID::HIDCore& hid_core_,
bool is_powered_on_, bool debug)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index(player_index),
debug(debug), input_subsystem{input_subsystem_}, profiles(profiles_),
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()),
bottom_row(bottom_row), system{system_} {
debug(debug), is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_},
profiles(profiles_), timeout_timer(std::make_unique<QTimer>()),
poll_timer(std::make_unique<QTimer>()), bottom_row(bottom_row), hid_core{hid_core_} {
if (player_index == 0) {
auto* emulated_controller_p1 =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_hanheld =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
emulated_controller_p1->SaveCurrentConfig();
emulated_controller_p1->EnableConfiguration();
emulated_controller_hanheld->SaveCurrentConfig();
@ -157,7 +155,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
emulated_controller = emulated_controller_p1;
}
} else {
emulated_controller = system_.HIDCore().GetEmulatedControllerByIndex(player_index);
emulated_controller = hid_core.GetEmulatedControllerByIndex(player_index);
emulated_controller->SaveCurrentConfig();
emulated_controller->EnableConfiguration();
}
@ -487,9 +485,9 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
if (player_index == 0) {
auto* emulated_controller_p1 =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_hanheld =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
bool is_connected = emulated_controller->IsConnected(true);
emulated_controller_p1->SetNpadStyleIndex(type);
@ -547,9 +545,9 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
ConfigureInputPlayer::~ConfigureInputPlayer() {
if (player_index == 0) {
auto* emulated_controller_p1 =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_hanheld =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
emulated_controller_p1->DisableConfiguration();
emulated_controller_hanheld->DisableConfiguration();
} else {
@ -560,9 +558,9 @@ ConfigureInputPlayer::~ConfigureInputPlayer() {
void ConfigureInputPlayer::ApplyConfiguration() {
if (player_index == 0) {
auto* emulated_controller_p1 =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_hanheld =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
emulated_controller_p1->DisableConfiguration();
emulated_controller_p1->SaveCurrentConfig();
emulated_controller_p1->EnableConfiguration();
@ -846,12 +844,11 @@ void ConfigureInputPlayer::SetConnectableControllers() {
}
};
if (!system.IsPoweredOn()) {
if (!is_powered_on) {
add_controllers(true);
return;
}
add_controllers(false, system.HIDCore().GetSupportedStyleTag());
add_controllers(false, hid_core.GetSupportedStyleTag());
}
Core::HID::NpadStyleIndex ConfigureInputPlayer::GetControllerTypeFromIndex(int index) const {

View file

@ -29,10 +29,6 @@ class QWidget;
class InputProfiles;
namespace Core {
class System;
}
namespace InputCommon {
class InputSubsystem;
}
@ -45,11 +41,8 @@ namespace Ui {
class ConfigureInputPlayer;
}
namespace Core {
class System;
}
namespace Core::HID {
class HIDCore;
class EmulatedController;
enum class NpadStyleIndex : u8;
} // namespace Core::HID
@ -60,8 +53,8 @@ class ConfigureInputPlayer : public QWidget {
public:
explicit ConfigureInputPlayer(QWidget* parent, std::size_t player_index, QWidget* bottom_row,
InputCommon::InputSubsystem* input_subsystem_,
InputProfiles* profiles_, Core::System& system_,
bool debug = false);
InputProfiles* profiles_, Core::HID::HIDCore& hid_core_,
bool is_powered_on_, bool debug = false);
~ConfigureInputPlayer() override;
/// Save all button configurations to settings file.
@ -173,6 +166,7 @@ private:
std::size_t player_index;
bool debug;
bool is_powered_on;
InputCommon::InputSubsystem* input_subsystem;
@ -228,5 +222,5 @@ private:
/// parent of the widget to this widget (but thats fine).
QWidget* bottom_row;
Core::System& system;
Core::HID::HIDCore& hid_core;
};

View file

@ -6,7 +6,8 @@
#include <QMenu>
#include <QPainter>
#include <QTimer>
#include "core/core.h"
#include "core/hid/emulated_controller.h"
#include "yuzu/configuration/configure_input_player_widget.h"
PlayerControlPreview::PlayerControlPreview(QWidget* parent) : QFrame(parent) {

View file

@ -7,10 +7,10 @@
#include <array>
#include <QFrame>
#include <QPointer>
#include "common/input.h"
#include "common/settings.h"
#include "common/settings_input.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
class QLabel;

View file

@ -11,8 +11,8 @@ ConfigureInputProfileDialog::ConfigureInputProfileDialog(
QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles,
Core::System& system)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureInputProfileDialog>()),
profile_widget(
new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, false)) {
profile_widget(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles,
system.HIDCore(), system.IsPoweredOn(), false)) {
ui->setupUi(this);
ui->controllerLayout->addWidget(profile_widget);