Core::GetState: Avoid Global System Accessor

This commit is contained in:
mitaclaw
2024-03-28 11:35:13 -07:00
parent db0cd82326
commit eb92d6f0a8
42 changed files with 135 additions and 101 deletions

View File

@ -66,10 +66,10 @@ GamecubeControllersWidget::GamecubeControllersWidget(QWidget* parent) : QWidget(
ConnectWidgets();
connect(&Settings::Instance(), &Settings::ConfigChanged, this,
[this] { LoadSettings(Core::GetState()); });
[this] { LoadSettings(Core::GetState(Core::System::GetInstance())); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[this](Core::State state) { LoadSettings(state); });
LoadSettings(Core::GetState());
LoadSettings(Core::GetState(Core::System::GetInstance()));
}
void GamecubeControllersWidget::CreateLayout()

View File

@ -14,6 +14,7 @@
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/System.h"
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
@ -42,7 +43,8 @@ AdvancedWidget::AdvancedWidget(GraphicsWindow* parent)
});
OnBackendChanged();
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);
OnEmulationStateChanged(Core::GetState(Core::System::GetInstance()) !=
Core::State::Uninitialized);
}
void AdvancedWidget::CreateWidgets()

View File

@ -17,6 +17,7 @@
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/System.h"
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
@ -43,7 +44,8 @@ GeneralWidget::GeneralWidget(GraphicsWindow* parent)
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
OnEmulationStateChanged(state != Core::State::Uninitialized);
});
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);
OnEmulationStateChanged(Core::GetState(Core::System::GetInstance()) !=
Core::State::Uninitialized);
}
void GeneralWidget::CreateWidgets()

View File

@ -18,6 +18,7 @@
#include "Common/FileUtil.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/System.h"
#include "DolphinQt/Config/GraphicsModWarningWidget.h"
#include "DolphinQt/QtUtils/ClearLayoutRecursively.h"
#include "DolphinQt/Settings.h"
@ -28,7 +29,7 @@
GraphicsModListWidget::GraphicsModListWidget(const UICommon::GameFile& game)
: m_game_id(game.GetGameID()), m_mod_group(m_game_id)
{
CalculateGameRunning(Core::GetState());
CalculateGameRunning(Core::GetState(Core::System::GetInstance()));
if (m_loaded_game_is_running && g_Config.graphics_mod_config)
{
m_mod_group.SetChangeCount(g_Config.graphics_mod_config->GetChangeCount());

View File

@ -17,6 +17,7 @@
#include "Common/CommonTypes.h"
#include "Core/Core.h"
#include "Core/System.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeVerifier.h"
#include "DolphinQt/QtUtils/ParallelProgressDialog.h"
@ -49,7 +50,7 @@ VerifyWidget::VerifyWidget(std::shared_ptr<DiscIO::Volume> volume) : m_volume(st
void VerifyWidget::OnEmulationStateChanged()
{
const bool running = Core::GetState() != Core::State::Uninitialized;
const bool running = Core::GetState(Core::System::GetInstance()) != Core::State::Uninitialized;
// Verifying a Wii game while emulation is running doesn't work correctly
// due to verification of a Wii game creating an instance of IOS

View File

@ -46,10 +46,10 @@ WiimoteControllersWidget::WiimoteControllersWidget(QWidget* parent) : QWidget(pa
ConnectWidgets();
connect(&Settings::Instance(), &Settings::ConfigChanged, this,
[this] { LoadSettings(Core::GetState()); });
[this] { LoadSettings(Core::GetState(Core::System::GetInstance())); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[this](Core::State state) { LoadSettings(state); });
LoadSettings(Core::GetState());
LoadSettings(Core::GetState(Core::System::GetInstance()));
}
void WiimoteControllersWidget::UpdateBluetoothAvailableStatus()
@ -173,16 +173,16 @@ void WiimoteControllersWidget::ConnectWidgets()
{
connect(m_wiimote_passthrough, &QRadioButton::toggled, this, [this] {
SaveSettings();
LoadSettings(Core::GetState());
LoadSettings(Core::GetState(Core::System::GetInstance()));
});
connect(m_wiimote_ciface, &QCheckBox::toggled, this, [this] {
SaveSettings();
LoadSettings(Core::GetState());
LoadSettings(Core::GetState(Core::System::GetInstance()));
WiimoteReal::HandleWiimotesInControllerInterfaceSettingChange();
});
connect(m_wiimote_continuous_scanning, &QCheckBox::toggled, this, [this] {
SaveSettings();
LoadSettings(Core::GetState());
LoadSettings(Core::GetState(Core::System::GetInstance()));
});
connect(m_wiimote_real_balance_board, &QCheckBox::toggled, this,
@ -200,7 +200,7 @@ void WiimoteControllersWidget::ConnectWidgets()
{
connect(m_wiimote_boxes[i], &QComboBox::currentIndexChanged, this, [this] {
SaveSettings();
LoadSettings(Core::GetState());
LoadSettings(Core::GetState(Core::System::GetInstance()));
});
connect(m_wiimote_buttons[i], &QPushButton::clicked, this,
[this, i] { OnWiimoteConfigure(i); });