Navigation Menu

Skip to content

Commit

Permalink
Config: Port MMU setting to new config system.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiralCurtiss committed Jan 9, 2022
1 parent d8825f5 commit 92d2fd9
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
5 changes: 0 additions & 5 deletions Source/Core/Core/BootManager.cpp
Expand Up @@ -70,7 +70,6 @@ struct ConfigCache

private:
bool valid = false;
bool bMMU = false;
bool bSyncGPU = false;
int iSyncGpuMaxDistance = 0;
int iSyncGpuMinDistance = 0;
Expand All @@ -82,7 +81,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
{
valid = true;

bMMU = config.bMMU;
bSyncGPU = config.bSyncGPU;
iSyncGpuMaxDistance = config.iSyncGpuMaxDistance;
iSyncGpuMinDistance = config.iSyncGpuMinDistance;
Expand All @@ -102,7 +100,6 @@ void ConfigCache::RestoreConfig(SConfig* config)

valid = false;

config->bMMU = bMMU;
config->bSyncGPU = bSyncGPU;
config->iSyncGpuMaxDistance = iSyncGpuMaxDistance;
config->iSyncGpuMinDistance = iSyncGpuMinDistance;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions Source/Core/Core/ConfigManager.cpp
Expand Up @@ -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()
Expand All @@ -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);
Expand Down Expand Up @@ -242,7 +240,6 @@ void SConfig::LoadDefaults()
bAutomaticStart = false;
bBootToPause = false;

bMMU = false;
iBBDumpPort = -1;
bSyncGPU = false;
bWii = false;
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/ConfigManager.h
Expand Up @@ -58,7 +58,6 @@ struct SConfig

bool bCopyWiiSaveNetplay = true;

bool bMMU = false;
int iBBDumpPort = 0;

bool bSyncGPU = false;
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/HW/Memmap.cpp
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/JitArm64/Jit.cpp
Expand Up @@ -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);

Expand Down
4 changes: 3 additions & 1 deletion Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/PowerPC/JitCommon/JitBase.h
Expand Up @@ -133,6 +133,7 @@ class JitBase : public CPUCoreBase
bool m_fprf = false;
bool m_accurate_nans = false;
bool m_fastmem_enabled = false;
bool m_mmu_enabled = false;

void RefreshConfig();

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/PowerPC/MMU.cpp
Expand Up @@ -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"

Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/System.cpp
Expand Up @@ -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
2 changes: 2 additions & 0 deletions Source/Core/Core/System.h
Expand Up @@ -29,6 +29,7 @@ class System
void Initialize();

bool IsDualCoreMode() const { return m_separate_cpu_and_gpu_threads; }
bool IsMMUMode() const { return m_mmu_enabled; }

private:
System();
Expand All @@ -37,5 +38,6 @@ class System
std::unique_ptr<Impl> m_impl;

bool m_separate_cpu_and_gpu_threads = false;
bool m_mmu_enabled = false;
};
} // namespace Core
4 changes: 2 additions & 2 deletions Source/Core/DolphinQt/Settings/AdvancedPane.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 92d2fd9

Please sign in to comment.