2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

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 // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/core.h" #include "core/hid/hid_core.h"
#include "ui_configure_debug_controller.h" #include "ui_configure_debug_controller.h"
#include "yuzu/configuration/configure_debug_controller.h" #include "yuzu/configuration/configure_debug_controller.h"
#include "yuzu/configuration/configure_input_player.h" #include "yuzu/configuration/configure_input_player.h"
ConfigureDebugController::ConfigureDebugController(QWidget* parent, ConfigureDebugController::ConfigureDebugController(QWidget* parent,
InputCommon::InputSubsystem* input_subsystem, 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>()), : QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()),
debug_controller( debug_controller(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles,
new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, true)) { hid_core, is_powered_on, true)) {
ui->setupUi(this); ui->setupUi(this);
ui->controllerLayout->addWidget(debug_controller); ui->controllerLayout->addWidget(debug_controller);

View file

@ -13,8 +13,8 @@ class ConfigureInputPlayer;
class InputProfiles; class InputProfiles;
namespace Core { namespace Core::HID {
class System; class HIDCore;
} }
namespace InputCommon { namespace InputCommon {
@ -30,7 +30,8 @@ class ConfigureDebugController : public QDialog {
public: public:
explicit ConfigureDebugController(QWidget* parent, InputCommon::InputSubsystem* input_subsystem, 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; ~ConfigureDebugController() override;
void ApplyConfiguration(); void ApplyConfiguration();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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