mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #12669 from mitaclaw/core-global-system-3
Core::GetState: Avoid Global System Accessor
This commit is contained in:
@@ -283,7 +283,7 @@ JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsRunnin
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_NativeLibrary_IsRunningAndUnpaused(JNIEnv*, jclass)
|
||||
{
|
||||
return static_cast<jboolean>(Core::GetState() == Core::State::Running);
|
||||
return static_cast<jboolean>(Core::GetState(Core::System::GetInstance()) == Core::State::Running);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv* env,
|
||||
@@ -458,7 +458,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestr
|
||||
host_identity_guard.Lock();
|
||||
}
|
||||
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
if (Core::GetState(Core::System::GetInstance()) == Core::State::Running)
|
||||
Core::SetState(Core::State::Paused);
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ static void Run(JNIEnv* env, std::unique_ptr<BootParameters>&& boot, bool riivol
|
||||
if (BootManager::BootCore(Core::System::GetInstance(), std::move(boot), wsi))
|
||||
{
|
||||
static constexpr int WAIT_STEP = 25;
|
||||
while (Core::GetState() == Core::State::Starting)
|
||||
while (Core::GetState(Core::System::GetInstance()) == Core::State::Starting)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_STEP));
|
||||
}
|
||||
|
||||
|
||||
@@ -211,12 +211,13 @@ Cheats::NewSearch(const Core::CPUThreadGuard& guard,
|
||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
auto& system = guard.GetSystem();
|
||||
std::vector<Cheats::SearchResult<T>> results;
|
||||
const Core::State core_state = Core::GetState();
|
||||
const Core::State core_state = Core::GetState(system);
|
||||
if (core_state != Core::State::Running && core_state != Core::State::Paused)
|
||||
return Cheats::SearchErrorCode::NoEmulationActive;
|
||||
|
||||
const auto& ppc_state = guard.GetSystem().GetPPCState();
|
||||
const auto& ppc_state = system.GetPPCState();
|
||||
if (address_space == PowerPC::RequestedAddressSpace::Virtual && !ppc_state.msr.DR)
|
||||
return Cheats::SearchErrorCode::VirtualAddressesCurrentlyNotAccessible;
|
||||
|
||||
@@ -265,12 +266,13 @@ Cheats::NextSearch(const Core::CPUThreadGuard& guard,
|
||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||
return Cheats::SearchErrorCode::DisabledInHardcoreMode;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
auto& system = guard.GetSystem();
|
||||
std::vector<Cheats::SearchResult<T>> results;
|
||||
const Core::State core_state = Core::GetState();
|
||||
const Core::State core_state = Core::GetState(system);
|
||||
if (core_state != Core::State::Running && core_state != Core::State::Paused)
|
||||
return Cheats::SearchErrorCode::NoEmulationActive;
|
||||
|
||||
const auto& ppc_state = guard.GetSystem().GetPPCState();
|
||||
const auto& ppc_state = system.GetPPCState();
|
||||
if (address_space == PowerPC::RequestedAddressSpace::Virtual && !ppc_state.msr.DR)
|
||||
return Cheats::SearchErrorCode::VirtualAddressesCurrentlyNotAccessible;
|
||||
|
||||
|
||||
@@ -202,7 +202,8 @@ void DisplayMessage(std::string message, int time_in_ms)
|
||||
|
||||
bool IsRunning()
|
||||
{
|
||||
return (GetState() != State::Uninitialized || s_hardware_initialized) && !s_is_stopping;
|
||||
auto& system = Core::System::GetInstance();
|
||||
return (GetState(system) != State::Uninitialized || s_hardware_initialized) && !s_is_stopping;
|
||||
}
|
||||
|
||||
bool IsRunningAndStarted()
|
||||
@@ -281,8 +282,11 @@ static void ResetRumble()
|
||||
// Called from GUI thread
|
||||
void Stop(Core::System& system) // - Hammertime!
|
||||
{
|
||||
if (GetState() == State::Stopping || GetState() == State::Uninitialized)
|
||||
if (const State state = GetState(system);
|
||||
state == State::Stopping || state == State::Uninitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
AchievementManager::GetInstance().CloseGame();
|
||||
@@ -728,17 +732,16 @@ void SetState(State state, bool report_state_change)
|
||||
// Certain callers only change the state momentarily. Sending a callback for them causes
|
||||
// unwanted updates, such as the Pause/Play button flickering between states on frame advance.
|
||||
if (report_state_change)
|
||||
CallOnStateChangedCallbacks(GetState());
|
||||
CallOnStateChangedCallbacks(GetState(system));
|
||||
}
|
||||
|
||||
State GetState()
|
||||
State GetState(Core::System& system)
|
||||
{
|
||||
if (s_is_stopping)
|
||||
return State::Stopping;
|
||||
|
||||
if (s_hardware_initialized)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
if (system.GetCPU().IsStepping())
|
||||
return State::Paused;
|
||||
|
||||
@@ -904,7 +907,7 @@ void Callback_NewField(Core::System& system)
|
||||
{
|
||||
s_frame_step = false;
|
||||
system.GetCPU().Break();
|
||||
CallOnStateChangedCallbacks(Core::GetState());
|
||||
CallOnStateChangedCallbacks(Core::GetState(system));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1046,7 +1049,7 @@ void HostDispatchJobs(Core::System& system)
|
||||
}
|
||||
|
||||
// NOTE: Host Thread
|
||||
void DoFrameStep()
|
||||
void DoFrameStep(Core::System& system)
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||
@@ -1055,7 +1058,7 @@ void DoFrameStep()
|
||||
return;
|
||||
}
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
if (GetState() == State::Paused)
|
||||
if (GetState(system) == State::Paused)
|
||||
{
|
||||
// if already paused, frame advance for 1 frame
|
||||
s_stop_frame_step = false;
|
||||
|
||||
@@ -144,7 +144,7 @@ bool WantsDeterminism();
|
||||
|
||||
// [NOT THREADSAFE] For use by Host only
|
||||
void SetState(State state, bool report_state_change = true);
|
||||
State GetState();
|
||||
State GetState(Core::System& system);
|
||||
|
||||
void SaveScreenShot();
|
||||
void SaveScreenShot(std::string_view name);
|
||||
@@ -185,7 +185,7 @@ void QueueHostJob(std::function<void(Core::System&)> job, bool run_during_stop =
|
||||
// WMUserJobDispatch will be sent when something is added to the queue.
|
||||
void HostDispatchJobs(Core::System& system);
|
||||
|
||||
void DoFrameStep();
|
||||
void DoFrameStep(Core::System& system);
|
||||
|
||||
void UpdateInputGate(bool require_focus, bool require_full_focus = false);
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ void BranchWatch::IsolateNotExecuted(const CPUThreadGuard&)
|
||||
|
||||
void BranchWatch::IsolateWasOverwritten(const CPUThreadGuard& guard)
|
||||
{
|
||||
if (Core::GetState() == Core::State::Uninitialized)
|
||||
if (Core::GetState(guard.GetSystem()) == Core::State::Uninitialized)
|
||||
{
|
||||
ASSERT_MSG(CORE, false, "Core is uninitialized.");
|
||||
return;
|
||||
@@ -246,7 +246,7 @@ void BranchWatch::IsolateWasOverwritten(const CPUThreadGuard& guard)
|
||||
|
||||
void BranchWatch::IsolateNotOverwritten(const CPUThreadGuard& guard)
|
||||
{
|
||||
if (Core::GetState() == Core::State::Uninitialized)
|
||||
if (Core::GetState(guard.GetSystem()) == Core::State::Uninitialized)
|
||||
{
|
||||
ASSERT_MSG(CORE, false, "Core is uninitialized.");
|
||||
return;
|
||||
|
||||
@@ -720,11 +720,14 @@ void WiimoteScanner::ThreadFunc()
|
||||
// If we don't want Wiimotes in ControllerInterface, we may not need them at all.
|
||||
if (!Config::Get(Config::MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE))
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
// We don't want any remotes in passthrough mode or running in GC mode.
|
||||
const bool core_running = Core::GetState() != Core::State::Uninitialized;
|
||||
const bool core_running = Core::GetState(system) != Core::State::Uninitialized;
|
||||
if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED) ||
|
||||
(core_running && !Core::System::GetInstance().IsWii()))
|
||||
(core_running && !system.IsWii()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// We don't want any remotes if we already connected everything we need.
|
||||
if (0 == CalculateWantedWiimotes() && 0 == CalculateWantedBB())
|
||||
|
||||
@@ -42,7 +42,8 @@
|
||||
|
||||
- (void)togglePause
|
||||
{
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
auto& system = Core::System::GetInstance();
|
||||
if (Core::GetState(system) == Core::State::Running)
|
||||
Core::SetState(Core::State::Paused);
|
||||
else
|
||||
Core::SetState(Core::State::Running);
|
||||
@@ -263,8 +264,10 @@ void PlatformMacOS::ProcessEvents()
|
||||
{
|
||||
m_window_focus = true;
|
||||
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never &&
|
||||
Core::GetState() != Core::State::Paused)
|
||||
Core::GetState(Core::System::GetInstance()) != Core::State::Paused)
|
||||
{
|
||||
[NSCursor unhide];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -199,7 +199,7 @@ void PlatformX11::ProcessEvents()
|
||||
}
|
||||
else if (key == XK_F10)
|
||||
{
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
if (Core::GetState(Core::System::GetInstance()) == Core::State::Running)
|
||||
{
|
||||
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
|
||||
XUndefineCursor(m_display, m_window);
|
||||
@@ -245,8 +245,10 @@ void PlatformX11::ProcessEvents()
|
||||
{
|
||||
m_window_focus = true;
|
||||
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never &&
|
||||
Core::GetState() != Core::State::Paused)
|
||||
Core::GetState(Core::System::GetInstance()) != Core::State::Paused)
|
||||
{
|
||||
XDefineCursor(m_display, m_window, m_blank_cursor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FocusOut:
|
||||
|
||||
@@ -197,10 +197,11 @@ void AchievementSettingsWidget::LoadSettings()
|
||||
|
||||
SignalBlocking(m_common_hardcore_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_HARDCORE_ENABLED));
|
||||
auto& system = Core::System::GetInstance();
|
||||
SignalBlocking(m_common_hardcore_enabled_input)
|
||||
->setEnabled(enabled && (hardcore_enabled ||
|
||||
(Core::GetState() == Core::State::Uninitialized &&
|
||||
!Core::System::GetInstance().GetMovie().IsPlayingInput())));
|
||||
->setEnabled(enabled &&
|
||||
(hardcore_enabled || (Core::GetState(system) == Core::State::Uninitialized &&
|
||||
!system.GetMovie().IsPlayingInput())));
|
||||
|
||||
SignalBlocking(m_common_progress_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_PROGRESS_ENABLED));
|
||||
@@ -294,7 +295,7 @@ void AchievementSettingsWidget::ToggleHardcore()
|
||||
Settings::Instance().SetCheatsEnabled(false);
|
||||
Settings::Instance().SetDebugModeEnabled(false);
|
||||
}
|
||||
emit Settings::Instance().EmulationStateChanged(Core::GetState());
|
||||
emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance()));
|
||||
}
|
||||
|
||||
void AchievementSettingsWidget::ToggleProgress()
|
||||
|
||||
@@ -158,7 +158,8 @@ void CheatSearchFactoryWidget::OnNewSearchClicked()
|
||||
PowerPC::RequestedAddressSpace address_space;
|
||||
if (m_standard_address_space->isChecked())
|
||||
{
|
||||
const Core::State core_state = Core::GetState();
|
||||
auto& system = Core::System::GetInstance();
|
||||
const Core::State core_state = Core::GetState(system);
|
||||
if (core_state != Core::State::Running && core_state != Core::State::Paused)
|
||||
{
|
||||
ModalMessageBox::warning(
|
||||
@@ -167,7 +168,6 @@ void CheatSearchFactoryWidget::OnNewSearchClicked()
|
||||
return;
|
||||
}
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
memory_ranges.emplace_back(0x80000000, memory.GetRamSizeReal());
|
||||
if (system.IsWii())
|
||||
|
||||
@@ -520,7 +520,7 @@ void CheatSearchWidget::OnDisplayHexCheckboxStateChanged()
|
||||
return;
|
||||
|
||||
// If the game is running CheatsManager::OnFrameEnd will update values automatically.
|
||||
if (Core::GetState() != Core::State::Running)
|
||||
if (Core::GetState(m_system) != Core::State::Running)
|
||||
UpdateTableAllCurrentValues(UpdateSource::User);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ CheatsManager::CheatsManager(Core::System& system, QWidget* parent)
|
||||
CreateWidgets();
|
||||
ConnectWidgets();
|
||||
|
||||
RefreshCodeTabs(Core::GetState(), true);
|
||||
RefreshCodeTabs(Core::GetState(m_system), true);
|
||||
|
||||
auto& settings = Settings::GetQSettings();
|
||||
restoreGeometry(settings.value(QStringLiteral("cheatsmanager/geometry")).toByteArray());
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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); });
|
||||
|
||||
@@ -531,7 +531,7 @@ void BranchWatchDialog::hideEvent(QHideEvent* event)
|
||||
|
||||
void BranchWatchDialog::showEvent(QShowEvent* event)
|
||||
{
|
||||
if (TimerCondition(m_branch_watch, Core::GetState()))
|
||||
if (TimerCondition(m_branch_watch, Core::GetState(m_system)))
|
||||
m_timer->start(BRANCH_WATCH_TOOL_TIMER_DELAY_MS);
|
||||
QDialog::showEvent(event);
|
||||
}
|
||||
@@ -544,7 +544,7 @@ void BranchWatchDialog::OnStartPause(bool checked)
|
||||
m_btn_start_pause->setText(tr("Pause Branch Watch"));
|
||||
// Restart the timer if the situation calls for it, but always turn off single-shot.
|
||||
m_timer->setSingleShot(false);
|
||||
if (Core::GetState() > Core::State::Paused)
|
||||
if (Core::GetState(m_system) > Core::State::Paused)
|
||||
m_timer->start(BRANCH_WATCH_TOOL_TIMER_DELAY_MS);
|
||||
}
|
||||
else
|
||||
@@ -552,7 +552,7 @@ void BranchWatchDialog::OnStartPause(bool checked)
|
||||
m_branch_watch.Pause();
|
||||
m_btn_start_pause->setText(tr("Start Branch Watch"));
|
||||
// Schedule one last update in the future in case Branch Watch is in the middle of a hit.
|
||||
if (Core::GetState() > Core::State::Paused)
|
||||
if (Core::GetState(m_system) > Core::State::Paused)
|
||||
m_timer->setInterval(BRANCH_WATCH_TOOL_TIMER_PAUSE_ONESHOT_MS);
|
||||
m_timer->setSingleShot(true);
|
||||
}
|
||||
@@ -645,7 +645,7 @@ void BranchWatchDialog::OnCodePathNotTaken()
|
||||
|
||||
void BranchWatchDialog::OnBranchWasOverwritten()
|
||||
{
|
||||
if (Core::GetState() == Core::State::Uninitialized)
|
||||
if (Core::GetState(m_system) == Core::State::Uninitialized)
|
||||
{
|
||||
ModalMessageBox::warning(this, tr("Error"), tr("Core is uninitialized."));
|
||||
return;
|
||||
@@ -660,7 +660,7 @@ void BranchWatchDialog::OnBranchWasOverwritten()
|
||||
|
||||
void BranchWatchDialog::OnBranchNotOverwritten()
|
||||
{
|
||||
if (Core::GetState() == Core::State::Uninitialized)
|
||||
if (Core::GetState(m_system) == Core::State::Uninitialized)
|
||||
{
|
||||
ModalMessageBox::warning(this, tr("Error"), tr("Core is uninitialized."));
|
||||
return;
|
||||
@@ -810,7 +810,7 @@ void BranchWatchDialog::OnTableContextMenu(const QPoint& pos)
|
||||
case Column::Origin:
|
||||
{
|
||||
QAction* const action = menu->addAction(tr("Insert &NOP"));
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
if (Core::GetState(m_system) != Core::State::Uninitialized)
|
||||
connect(action, &QAction::triggered,
|
||||
[this, index_list]() { OnTableSetNOP(std::move(index_list)); });
|
||||
else
|
||||
@@ -824,7 +824,7 @@ void BranchWatchDialog::OnTableContextMenu(const QPoint& pos)
|
||||
{
|
||||
QAction* const action = menu->addAction(tr("Insert &BLR"));
|
||||
const bool enable_action =
|
||||
Core::GetState() != Core::State::Uninitialized &&
|
||||
Core::GetState(m_system) != Core::State::Uninitialized &&
|
||||
std::all_of(index_list.begin(), index_list.end(), [this](const QModelIndex& idx) {
|
||||
const QModelIndex sibling = idx.siblingAtColumn(Column::Instruction);
|
||||
return BranchSavesLR(m_table_proxy->data(sibling, UserRole::ClickRole).value<u32>());
|
||||
@@ -844,7 +844,7 @@ void BranchWatchDialog::OnTableContextMenu(const QPoint& pos)
|
||||
{
|
||||
QAction* const action = menu->addAction(tr("Insert &BLR at start"));
|
||||
const bool enable_action =
|
||||
Core::GetState() != Core::State::Uninitialized &&
|
||||
Core::GetState(m_system) != Core::State::Uninitialized &&
|
||||
std::all_of(index_list.begin(), index_list.end(), [this](const QModelIndex& idx) {
|
||||
return m_table_proxy->data(idx, UserRole::ClickRole).isValid();
|
||||
});
|
||||
|
||||
@@ -150,7 +150,7 @@ void BreakpointWidget::UpdateButtonsEnabled()
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
||||
const bool is_initialised = Core::GetState() != Core::State::Uninitialized;
|
||||
const bool is_initialised = Core::GetState(m_system) != Core::State::Uninitialized;
|
||||
m_new->setEnabled(is_initialised);
|
||||
m_load->setEnabled(is_initialised);
|
||||
m_save->setEnabled(is_initialised);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user