Config: Port MMU setting to new config system.

This commit is contained in:
Admiral H. Curtiss 2022-01-07 04:37:07 +01:00
parent d8825f5635
commit 92d2fd9d5f
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
12 changed files with 15 additions and 15 deletions

View File

@ -70,7 +70,6 @@ public:
private:
bool valid = false;
bool bMMU = false;
bool bSyncGPU = false;
int iSyncGpuMaxDistance = 0;
int iSyncGpuMinDistance = 0;
@ -82,7 +81,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
{
valid = true;
bMMU = config.bMMU;
bSyncGPU = config.bSyncGPU;
iSyncGpuMaxDistance = config.iSyncGpuMaxDistance;
iSyncGpuMinDistance = config.iSyncGpuMinDistance;
@ -102,7 +100,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
valid = false;
config->bMMU = bMMU;
config->bSyncGPU = bSyncGPU;
config->iSyncGpuMaxDistance = iSyncGpuMaxDistance;
config->iSyncGpuMinDistance = iSyncGpuMinDistance;
@ -144,7 +141,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
IniFile::Section* core_section = game_ini.GetOrCreateSection("Core");
IniFile::Section* controls_section = game_ini.GetOrCreateSection("Controls");
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
// Wii settings
@ -204,7 +200,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
StartUp.iSyncGpuMaxDistance = netplay_settings.m_SyncGpuMaxDistance;
StartUp.iSyncGpuMinDistance = netplay_settings.m_SyncGpuMinDistance;
StartUp.fSyncGpuOverclock = netplay_settings.m_SyncGpuOverclock;
StartUp.bMMU = netplay_settings.m_MMU;
}
else
{

View File

@ -118,6 +118,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::GetInfoForSIDevice(2).GetLocation(),
&Config::GetInfoForSIDevice(3).GetLocation(),
&Config::MAIN_CPU_THREAD.GetLocation(),
&Config::MAIN_MMU.GetLocation(),
// UI.General

View File

@ -103,7 +103,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance);
core->Set("SyncGpuMinDistance", iSyncGpuMinDistance);
core->Set("SyncGpuOverclock", fSyncGpuOverclock);
core->Set("MMU", bMMU);
}
void SConfig::LoadSettings()
@ -121,7 +120,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
{
IniFile::Section* core = ini.GetOrCreateSection("Core");
core->Get("MMU", &bMMU, bMMU);
core->Get("BBDumpPort", &iBBDumpPort, -1);
core->Get("SyncGPU", &bSyncGPU, false);
core->Get("SyncGpuMaxDistance", &iSyncGpuMaxDistance, 200000);
@ -242,7 +240,6 @@ void SConfig::LoadDefaults()
bAutomaticStart = false;
bBootToPause = false;
bMMU = false;
iBBDumpPort = -1;
bSyncGPU = false;
bWii = false;

View File

@ -58,7 +58,6 @@ struct SConfig
bool bCopyWiiSaveNetplay = true;
bool bMMU = false;
int iBBDumpPort = 0;
bool bSyncGPU = false;

View File

@ -33,6 +33,7 @@
#include "Core/HW/WII_IPC.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/System.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/PixelEngine.h"
@ -260,7 +261,7 @@ void Init()
false};
const bool wii = SConfig::GetInstance().bWii;
const bool mmu = SConfig::GetInstance().bMMU;
const bool mmu = Core::System::GetInstance().IsMMUMode();
bool fake_vmem = false;
#ifndef _ARCH_32

View File

@ -48,7 +48,7 @@ JitArm64::~JitArm64() = default;
void JitArm64::Init()
{
const size_t child_code_size = SConfig::GetInstance().bMMU ? FARCODE_SIZE_MMU : FARCODE_SIZE;
const size_t child_code_size = m_mmu_enabled ? FARCODE_SIZE_MMU : FARCODE_SIZE;
AllocCodeSpace(CODE_SIZE + child_code_size);
AddChildCodeSpace(&m_far_code, child_code_size);

View File

@ -10,6 +10,7 @@
#include "Core/HW/CPU.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/System.h"
const u8* JitBase::Dispatch(JitBase& jit)
{
@ -55,6 +56,7 @@ void JitBase::RefreshConfig()
m_fprf = Config::Get(Config::MAIN_FPRF);
m_accurate_nans = Config::Get(Config::MAIN_ACCURATE_NANS);
m_fastmem_enabled = Config::Get(Config::MAIN_FASTMEM);
m_mmu_enabled = Core::System::GetInstance().IsMMUMode();
analyzer.SetDebuggingEnabled(m_enable_debugging);
analyzer.SetBranchFollowingEnabled(Config::Get(Config::MAIN_JIT_FOLLOW_BRANCH));
analyzer.SetFloatExceptionsEnabled(m_enable_float_exceptions);
@ -80,7 +82,7 @@ void JitBase::UpdateMemoryAndExceptionOptions()
{
bool any_watchpoints = PowerPC::memchecks.HasAny();
jo.fastmem = m_fastmem_enabled && jo.fastmem_arena && (MSR.DR || !any_watchpoints);
jo.memcheck = SConfig::GetInstance().bMMU || any_watchpoints;
jo.memcheck = m_mmu_enabled || any_watchpoints;
jo.fp_exceptions = m_enable_float_exceptions;
jo.div_by_zero_exceptions = m_enable_div_by_zero_exceptions;
}

View File

@ -133,6 +133,7 @@ protected:
bool m_fprf = false;
bool m_accurate_nans = false;
bool m_fastmem_enabled = false;
bool m_mmu_enabled = false;
void RefreshConfig();

View File

@ -21,6 +21,7 @@
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/System.h"
#include "VideoCommon/VideoBackendBase.h"
@ -1147,7 +1148,7 @@ TranslateResult JitCache_TranslateAddress(u32 address)
static void GenerateDSIException(u32 effective_address, bool write)
{
// DSI exceptions are only supported in MMU mode.
if (!SConfig::GetInstance().bMMU)
if (!Core::System::GetInstance().IsMMUMode())
{
PanicAlertFmt("Invalid {} {:#010x}, PC = {:#010x}", write ? "write to" : "read from",
effective_address, PC);

View File

@ -20,5 +20,6 @@ System::~System() = default;
void System::Initialize()
{
m_separate_cpu_and_gpu_threads = Config::Get(Config::MAIN_CPU_THREAD);
m_mmu_enabled = Config::Get(Config::MAIN_MMU);
}
} // namespace Core

View File

@ -29,6 +29,7 @@ public:
void Initialize();
bool IsDualCoreMode() const { return m_separate_cpu_and_gpu_threads; }
bool IsMMUMode() const { return m_mmu_enabled; }
private:
System();
@ -37,5 +38,6 @@ private:
std::unique_ptr<Impl> m_impl;
bool m_separate_cpu_and_gpu_threads = false;
bool m_mmu_enabled = false;
};
} // namespace Core

View File

@ -178,7 +178,7 @@ void AdvancedPane::ConnectLayout()
});
connect(m_enable_mmu_checkbox, &QCheckBox::toggled, this,
[](bool checked) { SConfig::GetInstance().bMMU = checked; });
[](bool checked) { Config::SetBaseOrCurrent(Config::MAIN_MMU, checked); });
m_cpu_clock_override_checkbox->setChecked(Config::Get(Config::MAIN_OVERCLOCK_ENABLE));
connect(m_cpu_clock_override_checkbox, &QCheckBox::toggled, [this](bool enable_clock_override) {
@ -243,7 +243,7 @@ void AdvancedPane::Update()
}
m_cpu_emulation_engine_combobox->setEnabled(!running);
m_enable_mmu_checkbox->setChecked(SConfig::GetInstance().bMMU);
m_enable_mmu_checkbox->setChecked(Config::Get(Config::MAIN_MMU));
m_enable_mmu_checkbox->setEnabled(!running);
QFont bf = font();