mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Core::GetState: Avoid Global System Accessor
This commit is contained in:
@ -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);
|
||||
|
@ -267,7 +267,7 @@ void CodeViewWidget::Update()
|
||||
if (m_updating)
|
||||
return;
|
||||
|
||||
if (Core::GetState() == Core::State::Paused)
|
||||
if (Core::GetState(m_system) == Core::State::Paused)
|
||||
{
|
||||
Core::CPUThreadGuard guard(m_system);
|
||||
Update(&guard);
|
||||
@ -558,8 +558,8 @@ void CodeViewWidget::OnContextMenu()
|
||||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
|
||||
const bool running = Core::GetState() != Core::State::Uninitialized;
|
||||
const bool paused = Core::GetState() == Core::State::Paused;
|
||||
const bool running = Core::GetState(m_system) != Core::State::Uninitialized;
|
||||
const bool paused = Core::GetState(m_system) == Core::State::Paused;
|
||||
|
||||
const u32 addr = GetContextAddress();
|
||||
|
||||
@ -761,7 +761,7 @@ void CodeViewWidget::OnCopyAddress()
|
||||
|
||||
void CodeViewWidget::OnCopyTargetAddress()
|
||||
{
|
||||
if (Core::GetState() != Core::State::Paused)
|
||||
if (Core::GetState(m_system) != Core::State::Paused)
|
||||
return;
|
||||
|
||||
const u32 addr = GetContextAddress();
|
||||
@ -791,7 +791,7 @@ void CodeViewWidget::OnShowInMemory()
|
||||
|
||||
void CodeViewWidget::OnShowTargetInMemory()
|
||||
{
|
||||
if (Core::GetState() != Core::State::Paused)
|
||||
if (Core::GetState(m_system) != Core::State::Paused)
|
||||
return;
|
||||
|
||||
const u32 addr = GetContextAddress();
|
||||
|
@ -60,7 +60,7 @@ CodeWidget::CodeWidget(QWidget* parent)
|
||||
[this](bool visible) { setHidden(!visible); });
|
||||
|
||||
connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, [this] {
|
||||
if (Core::GetState() == Core::State::Paused)
|
||||
if (Core::GetState(m_system) == Core::State::Paused)
|
||||
SetAddress(m_system.GetPPCState().pc, CodeViewWidget::SetAddressUpdate::WithoutUpdate);
|
||||
Update();
|
||||
});
|
||||
@ -339,7 +339,7 @@ void CodeWidget::UpdateCallstack()
|
||||
{
|
||||
m_callstack_list->clear();
|
||||
|
||||
if (Core::GetState() != Core::State::Paused)
|
||||
if (Core::GetState(m_system) != Core::State::Paused)
|
||||
return;
|
||||
|
||||
std::vector<Dolphin_Debugger::CallstackEntry> stack;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/PowerPC/PPCAnalyst.h"
|
||||
#include "Core/System.h"
|
||||
#include "UICommon/Disassembler.h"
|
||||
|
||||
#include "DolphinQt/Host.h"
|
||||
@ -136,7 +137,7 @@ void JITWidget::Update()
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
||||
if (!m_address || (Core::GetState() != Core::State::Paused))
|
||||
if (!m_address || (Core::GetState(Core::System::GetInstance()) != Core::State::Paused))
|
||||
{
|
||||
m_ppc_asm_widget->setHtml(QStringLiteral("<i>%1</i>").arg(tr("(ppc)")));
|
||||
m_host_asm_widget->setHtml(QStringLiteral("<i>%1</i>").arg(tr("(host)")));
|
||||
|
@ -441,7 +441,7 @@ void MemoryViewWidget::UpdateColumns()
|
||||
if (m_table->item(1, 1) == nullptr)
|
||||
return;
|
||||
|
||||
if (Core::GetState() == Core::State::Paused)
|
||||
if (Core::GetState(m_system) == Core::State::Paused)
|
||||
{
|
||||
const Core::CPUThreadGuard guard(m_system);
|
||||
UpdateColumns(&guard);
|
||||
|
@ -239,7 +239,8 @@ void NetworkWidget::Update()
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
||||
if (Core::GetState() != Core::State::Paused)
|
||||
auto& system = Core::System::GetInstance();
|
||||
if (Core::GetState(system) != Core::State::Paused)
|
||||
{
|
||||
m_socket_table->setDisabled(true);
|
||||
m_ssl_table->setDisabled(true);
|
||||
@ -250,9 +251,9 @@ void NetworkWidget::Update()
|
||||
m_ssl_table->setDisabled(false);
|
||||
|
||||
// needed because there's a race condition on the IOS instance otherwise
|
||||
Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||
const Core::CPUThreadGuard guard(system);
|
||||
|
||||
auto* ios = guard.GetSystem().GetIOS();
|
||||
auto* ios = system.GetIOS();
|
||||
if (!ios)
|
||||
return;
|
||||
|
||||
|
@ -533,7 +533,7 @@ void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::st
|
||||
|
||||
void RegisterWidget::Update()
|
||||
{
|
||||
if (isVisible() && Core::GetState() == Core::State::Paused)
|
||||
if (isVisible() && Core::GetState(m_system) == Core::State::Paused)
|
||||
{
|
||||
m_updating = true;
|
||||
emit UpdateTable();
|
||||
|
@ -252,13 +252,14 @@ void ThreadWidget::Update()
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
||||
const auto emu_state = Core::GetState();
|
||||
auto& system = Core::System::GetInstance();
|
||||
const auto emu_state = Core::GetState(system);
|
||||
if (emu_state == Core::State::Stopping)
|
||||
{
|
||||
m_thread_table->setRowCount(0);
|
||||
UpdateThreadContext({});
|
||||
|
||||
Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||
const Core::CPUThreadGuard guard(system);
|
||||
UpdateThreadCallstack(guard, {});
|
||||
}
|
||||
if (emu_state != Core::State::Paused)
|
||||
@ -303,7 +304,7 @@ void ThreadWidget::Update()
|
||||
};
|
||||
|
||||
{
|
||||
Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||
const Core::CPUThreadGuard guard(system);
|
||||
|
||||
// YAGCD - Section 4.2.1.4 Dolphin OS Globals
|
||||
m_current_context->setText(format_hex_from(guard, 0x800000D4));
|
||||
|
@ -158,7 +158,7 @@ void WatchWidget::Update()
|
||||
|
||||
m_updating = true;
|
||||
|
||||
if (Core::GetState() != Core::State::Paused)
|
||||
if (Core::GetState(m_system) != Core::State::Paused)
|
||||
{
|
||||
m_table->setDisabled(true);
|
||||
m_updating = false;
|
||||
|
Reference in New Issue
Block a user