Jit: Automatically clear cache when JIT settings are updated

This fixes a problem where changing the JIT debug settings on
Android while a game was running wouldn't cause the changed settings
to apply to code blocks that already had been compiled.
This commit is contained in:
JosJuice
2022-04-10 11:06:40 +02:00
parent cd31da97d6
commit 28e8117b90
6 changed files with 83 additions and 74 deletions

View File

@ -854,10 +854,8 @@ void MenuBar::AddJITMenu()
m_jit_disable_fastmem = m_jit->addAction(tr("Disable Fastmem"));
m_jit_disable_fastmem->setCheckable(true);
m_jit_disable_fastmem->setChecked(!Config::Get(Config::MAIN_FASTMEM));
connect(m_jit_disable_fastmem, &QAction::toggled, [this](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_FASTMEM, !enabled);
ClearCache();
});
connect(m_jit_disable_fastmem, &QAction::toggled,
[](bool enabled) { Config::SetBaseOrCurrent(Config::MAIN_FASTMEM, !enabled); });
m_jit_clear_cache = m_jit->addAction(tr("Clear Cache"), this, &MenuBar::ClearCache);
@ -873,106 +871,92 @@ void MenuBar::AddJITMenu()
m_jit_off = m_jit->addAction(tr("JIT Off (JIT Core)"));
m_jit_off->setCheckable(true);
m_jit_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_OFF));
connect(m_jit_off, &QAction::toggled, [this](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_OFF, enabled);
ClearCache();
});
connect(m_jit_off, &QAction::toggled,
[](bool enabled) { Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_OFF, enabled); });
m_jit_loadstore_off = m_jit->addAction(tr("JIT LoadStore Off"));
m_jit_loadstore_off->setCheckable(true);
m_jit_loadstore_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_LOAD_STORE_OFF));
connect(m_jit_loadstore_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_loadstore_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_LOAD_STORE_OFF, enabled);
ClearCache();
});
m_jit_loadstore_lbzx_off = m_jit->addAction(tr("JIT LoadStore lbzx Off"));
m_jit_loadstore_lbzx_off->setCheckable(true);
m_jit_loadstore_lbzx_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_LOAD_STORE_LBZX_OFF));
connect(m_jit_loadstore_lbzx_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_loadstore_lbzx_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_LOAD_STORE_LBZX_OFF, enabled);
ClearCache();
});
m_jit_loadstore_lxz_off = m_jit->addAction(tr("JIT LoadStore lXz Off"));
m_jit_loadstore_lxz_off->setCheckable(true);
m_jit_loadstore_lxz_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_LOAD_STORE_LXZ_OFF));
connect(m_jit_loadstore_lxz_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_loadstore_lxz_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_LOAD_STORE_LXZ_OFF, enabled);
ClearCache();
});
m_jit_loadstore_lwz_off = m_jit->addAction(tr("JIT LoadStore lwz Off"));
m_jit_loadstore_lwz_off->setCheckable(true);
m_jit_loadstore_lwz_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_LOAD_STORE_LWZ_OFF));
connect(m_jit_loadstore_lwz_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_loadstore_lwz_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_LOAD_STORE_LWZ_OFF, enabled);
ClearCache();
});
m_jit_loadstore_floating_off = m_jit->addAction(tr("JIT LoadStore Floating Off"));
m_jit_loadstore_floating_off->setCheckable(true);
m_jit_loadstore_floating_off->setChecked(
Config::Get(Config::MAIN_DEBUG_JIT_LOAD_STORE_FLOATING_OFF));
connect(m_jit_loadstore_floating_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_loadstore_floating_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_LOAD_STORE_FLOATING_OFF, enabled);
ClearCache();
});
m_jit_loadstore_paired_off = m_jit->addAction(tr("JIT LoadStore Paired Off"));
m_jit_loadstore_paired_off->setCheckable(true);
m_jit_loadstore_paired_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_LOAD_STORE_PAIRED_OFF));
connect(m_jit_loadstore_paired_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_loadstore_paired_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_LOAD_STORE_PAIRED_OFF, enabled);
ClearCache();
});
m_jit_floatingpoint_off = m_jit->addAction(tr("JIT FloatingPoint Off"));
m_jit_floatingpoint_off->setCheckable(true);
m_jit_floatingpoint_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_FLOATING_POINT_OFF));
connect(m_jit_floatingpoint_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_floatingpoint_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_FLOATING_POINT_OFF, enabled);
ClearCache();
});
m_jit_integer_off = m_jit->addAction(tr("JIT Integer Off"));
m_jit_integer_off->setCheckable(true);
m_jit_integer_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_INTEGER_OFF));
connect(m_jit_integer_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_integer_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_INTEGER_OFF, enabled);
ClearCache();
});
m_jit_paired_off = m_jit->addAction(tr("JIT Paired Off"));
m_jit_paired_off->setCheckable(true);
m_jit_paired_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_PAIRED_OFF));
connect(m_jit_paired_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_paired_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_PAIRED_OFF, enabled);
ClearCache();
});
m_jit_systemregisters_off = m_jit->addAction(tr("JIT SystemRegisters Off"));
m_jit_systemregisters_off->setCheckable(true);
m_jit_systemregisters_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_SYSTEM_REGISTERS_OFF));
connect(m_jit_systemregisters_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_systemregisters_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_SYSTEM_REGISTERS_OFF, enabled);
ClearCache();
});
m_jit_branch_off = m_jit->addAction(tr("JIT Branch Off"));
m_jit_branch_off->setCheckable(true);
m_jit_branch_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_BRANCH_OFF));
connect(m_jit_branch_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_branch_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_BRANCH_OFF, enabled);
ClearCache();
});
m_jit_register_cache_off = m_jit->addAction(tr("JIT Register Cache Off"));
m_jit_register_cache_off->setCheckable(true);
m_jit_register_cache_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_REGISTER_CACHE_OFF));
connect(m_jit_register_cache_off, &QAction::toggled, [this](bool enabled) {
connect(m_jit_register_cache_off, &QAction::toggled, [](bool enabled) {
Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_REGISTER_CACHE_OFF, enabled);
ClearCache();
});
}