Skip to content

Commit

Permalink
add pause on panic option
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamsyntax committed Oct 18, 2021
1 parent 13985b7 commit d62570a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/Core/Core/ConfigManager.h
Expand Up @@ -115,6 +115,7 @@ struct SConfig
bool bRunCompareClient = false;

bool bMMU = false;
bool bPauseOnPanicHandles = false;
bool bLowDCBZHack = false;
int iBBDumpPort = 0;
bool bFastDiscSpeed = false;
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
Expand Up @@ -45,7 +45,8 @@ void JitBase::UpdateMemoryAndExceptionOptions()
{
bool any_watchpoints = PowerPC::memchecks.HasAny();
jo.fastmem = SConfig::GetInstance().bFastmem && jo.fastmem_arena && (MSR.DR || !any_watchpoints);
jo.memcheck = SConfig::GetInstance().bMMU || any_watchpoints;
jo.memcheck =
SConfig::GetInstance().bMMU || SConfig::GetInstance().bPauseOnPanicHandles || any_watchpoints;
jo.fp_exceptions = SConfig::GetInstance().bFloatExceptions;
jo.div_by_zero_exceptions = SConfig::GetInstance().bDivideByZeroExceptions;
}
Expand Down
5 changes: 5 additions & 0 deletions Source/Core/Core/PowerPC/MMU.cpp
Expand Up @@ -1151,6 +1151,11 @@ static void GenerateDSIException(u32 effective_address, bool write)
{
PanicAlertFmt("Invalid {} {:#010x}, PC = {:#010x}", write ? "write to" : "read from",
effective_address, PC);
if (SConfig::GetInstance().bPauseOnPanicHandles)
{
CPU::Break();
ppcState.Exceptions |= EXCEPTION_DSI | EXCEPTION_FAKE_MEMCHECK_HIT;
}
return;
}

Expand Down
11 changes: 11 additions & 0 deletions Source/Core/DolphinQt/Settings/AdvancedPane.cpp
Expand Up @@ -68,6 +68,11 @@ void AdvancedPane::CreateLayout()
"Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)"));
cpu_options_group_layout->addWidget(m_enable_mmu_checkbox);

m_pause_on_panic_handles_checkbox = new QCheckBox(tr("Pause on Panic Handles"));
m_pause_on_panic_handles_checkbox->setToolTip(
tr("Pauses the emulation if a panic occurs. Enabling will affect performance."));
cpu_options_group_layout->addWidget(m_pause_on_panic_handles_checkbox);

auto* clock_override = new QGroupBox(tr("Clock Override"));
auto* clock_override_layout = new QVBoxLayout();
clock_override->setLayout(clock_override_layout);
Expand Down Expand Up @@ -181,6 +186,9 @@ void AdvancedPane::ConnectLayout()
connect(m_enable_mmu_checkbox, &QCheckBox::toggled, this,
[](bool checked) { SConfig::GetInstance().bMMU = checked; });

connect(m_pause_on_panic_handles_checkbox, &QCheckBox::toggled, this,
[](bool checked) { SConfig::GetInstance().bPauseOnPanicHandles = checked; });

m_cpu_clock_override_checkbox->setChecked(SConfig::GetInstance().m_OCEnable);
connect(m_cpu_clock_override_checkbox, &QCheckBox::toggled, [this](bool enable_clock_override) {
SConfig::GetInstance().m_OCEnable = enable_clock_override;
Expand Down Expand Up @@ -247,6 +255,9 @@ void AdvancedPane::Update()
m_enable_mmu_checkbox->setChecked(SConfig::GetInstance().bMMU);
m_enable_mmu_checkbox->setEnabled(!running);

m_pause_on_panic_handles_checkbox->setChecked(SConfig::GetInstance().bPauseOnPanicHandles);
m_pause_on_panic_handles_checkbox->setEnabled(!running);

QFont bf = font();
bf.setBold(Config::GetActiveLayerForConfig(Config::MAIN_OVERCLOCK_ENABLE) !=
Config::LayerType::Base);
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/Settings/AdvancedPane.h
Expand Up @@ -32,6 +32,7 @@ class AdvancedPane final : public QWidget

QComboBox* m_cpu_emulation_engine_combobox;
QCheckBox* m_enable_mmu_checkbox;
QCheckBox* m_pause_on_panic_handles_checkbox;
QCheckBox* m_cpu_clock_override_checkbox;
QSlider* m_cpu_clock_override_slider;
QLabel* m_cpu_clock_override_slider_label;
Expand Down

0 comments on commit d62570a

Please sign in to comment.