mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #10349 from AdmiralCurtiss/config-port-core-2
Config: Port remaining Core settings to new config system (part 2).
This commit is contained in:
@@ -35,11 +35,15 @@ Mixer::Mixer(unsigned int BackendSampleRate)
|
||||
m_surround_decoder(BackendSampleRate,
|
||||
DPL2QualityToFrameBlockSize(Config::Get(Config::MAIN_DPL2_QUALITY)))
|
||||
{
|
||||
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); });
|
||||
RefreshConfig();
|
||||
|
||||
INFO_LOG_FMT(AUDIO_INTERFACE, "Mixer is initialized");
|
||||
}
|
||||
|
||||
Mixer::~Mixer()
|
||||
{
|
||||
Config::RemoveConfigChangedCallback(m_config_changed_callback_id);
|
||||
}
|
||||
|
||||
void Mixer::DoState(PointerWrap& p)
|
||||
@@ -53,7 +57,8 @@ void Mixer::DoState(PointerWrap& p)
|
||||
|
||||
// Executed from sound stream thread
|
||||
unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
|
||||
bool consider_framelimit)
|
||||
bool consider_framelimit, float emulationspeed,
|
||||
int timing_variance)
|
||||
{
|
||||
unsigned int currentSample = 0;
|
||||
|
||||
@@ -71,13 +76,12 @@ unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
|
||||
// advance indexR with sample position
|
||||
// remember fractional offset
|
||||
|
||||
float emulationspeed = SConfig::GetInstance().m_EmulationSpeed;
|
||||
float aid_sample_rate = static_cast<float>(m_input_sample_rate);
|
||||
if (consider_framelimit && emulationspeed > 0.0f)
|
||||
{
|
||||
float numLeft = static_cast<float>(((indexW - indexR) & INDEX_MASK) / 2);
|
||||
|
||||
u32 low_waterwark = m_input_sample_rate * SConfig::GetInstance().iTimingVariance / 1000;
|
||||
u32 low_waterwark = m_input_sample_rate * timing_variance / 1000;
|
||||
low_waterwark = std::min(low_waterwark, MAX_SAMPLES / 2);
|
||||
|
||||
m_numLeftI = (numLeft + m_numLeftI * (CONTROL_AVG - 1)) / CONTROL_AVG;
|
||||
@@ -154,18 +158,26 @@ unsigned int Mixer::Mix(short* samples, unsigned int num_samples)
|
||||
|
||||
memset(samples, 0, num_samples * 2 * sizeof(short));
|
||||
|
||||
if (Config::Get(Config::MAIN_AUDIO_STRETCH))
|
||||
const float emulation_speed = m_config_emulation_speed;
|
||||
const int timing_variance = m_config_timing_variance;
|
||||
if (m_config_audio_stretch)
|
||||
{
|
||||
unsigned int available_samples =
|
||||
std::min(m_dma_mixer.AvailableSamples(), m_streaming_mixer.AvailableSamples());
|
||||
|
||||
m_scratch_buffer.fill(0);
|
||||
|
||||
m_dma_mixer.Mix(m_scratch_buffer.data(), available_samples, false);
|
||||
m_streaming_mixer.Mix(m_scratch_buffer.data(), available_samples, false);
|
||||
m_wiimote_speaker_mixer.Mix(m_scratch_buffer.data(), available_samples, false);
|
||||
m_dma_mixer.Mix(m_scratch_buffer.data(), available_samples, false, emulation_speed,
|
||||
timing_variance);
|
||||
m_streaming_mixer.Mix(m_scratch_buffer.data(), available_samples, false, emulation_speed,
|
||||
timing_variance);
|
||||
m_wiimote_speaker_mixer.Mix(m_scratch_buffer.data(), available_samples, false, emulation_speed,
|
||||
timing_variance);
|
||||
for (auto& mixer : m_gba_mixers)
|
||||
mixer.Mix(m_scratch_buffer.data(), available_samples, false);
|
||||
{
|
||||
mixer.Mix(m_scratch_buffer.data(), available_samples, false, emulation_speed,
|
||||
timing_variance);
|
||||
}
|
||||
|
||||
if (!m_is_stretching)
|
||||
{
|
||||
@@ -177,11 +189,11 @@ unsigned int Mixer::Mix(short* samples, unsigned int num_samples)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dma_mixer.Mix(samples, num_samples, true);
|
||||
m_streaming_mixer.Mix(samples, num_samples, true);
|
||||
m_wiimote_speaker_mixer.Mix(samples, num_samples, true);
|
||||
m_dma_mixer.Mix(samples, num_samples, true, emulation_speed, timing_variance);
|
||||
m_streaming_mixer.Mix(samples, num_samples, true, emulation_speed, timing_variance);
|
||||
m_wiimote_speaker_mixer.Mix(samples, num_samples, true, emulation_speed, timing_variance);
|
||||
for (auto& mixer : m_gba_mixers)
|
||||
mixer.Mix(samples, num_samples, true);
|
||||
mixer.Mix(samples, num_samples, true, emulation_speed, timing_variance);
|
||||
m_is_stretching = false;
|
||||
}
|
||||
|
||||
@@ -385,6 +397,13 @@ void Mixer::StopLogDSPAudio()
|
||||
}
|
||||
}
|
||||
|
||||
void Mixer::RefreshConfig()
|
||||
{
|
||||
m_config_emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
|
||||
m_config_timing_variance = Config::Get(Config::MAIN_TIMING_VARIANCE);
|
||||
m_config_audio_stretch = Config::Get(Config::MAIN_AUDIO_STRETCH);
|
||||
}
|
||||
|
||||
void Mixer::MixerFifo::DoState(PointerWrap& p)
|
||||
{
|
||||
p.Do(m_input_sample_rate);
|
||||
|
||||
@@ -69,7 +69,8 @@ private:
|
||||
}
|
||||
void DoState(PointerWrap& p);
|
||||
void PushSamples(const short* samples, unsigned int num_samples);
|
||||
unsigned int Mix(short* samples, unsigned int numSamples, bool consider_framelimit = true);
|
||||
unsigned int Mix(short* samples, unsigned int numSamples, bool consider_framelimit,
|
||||
float emulationspeed, int timing_variance);
|
||||
void SetInputSampleRate(unsigned int rate);
|
||||
unsigned int GetInputSampleRate() const;
|
||||
void SetVolume(unsigned int lvolume, unsigned int rvolume);
|
||||
@@ -89,6 +90,8 @@ private:
|
||||
u32 m_frac = 0;
|
||||
};
|
||||
|
||||
void RefreshConfig();
|
||||
|
||||
MixerFifo m_dma_mixer{this, 32000, false};
|
||||
MixerFifo m_streaming_mixer{this, 48000, false};
|
||||
MixerFifo m_wiimote_speaker_mixer{this, 3000, true};
|
||||
@@ -109,4 +112,10 @@ private:
|
||||
|
||||
// Current rate of emulation (1.0 = 100% speed)
|
||||
std::atomic<float> m_speed{0.0f};
|
||||
|
||||
float m_config_emulation_speed;
|
||||
int m_config_timing_variance;
|
||||
bool m_config_audio_stretch;
|
||||
|
||||
size_t m_config_changed_callback_id;
|
||||
};
|
||||
|
||||
@@ -64,7 +64,6 @@ public:
|
||||
|
||||
// These store if the relevant setting should be reset back later (true) or if it should be left
|
||||
// alone on restore (false)
|
||||
bool bSetEmulationSpeed = false;
|
||||
bool bSetVolume = false;
|
||||
std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
|
||||
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads{};
|
||||
@@ -73,16 +72,11 @@ public:
|
||||
private:
|
||||
bool valid = false;
|
||||
bool bCPUThread = false;
|
||||
bool bSyncGPUOnSkipIdleHack = false;
|
||||
bool bMMU = false;
|
||||
bool bDisableICache = false;
|
||||
bool bSyncGPU = false;
|
||||
int iSyncGpuMaxDistance = 0;
|
||||
int iSyncGpuMinDistance = 0;
|
||||
float fSyncGpuOverclock = 0;
|
||||
bool bFastDiscSpeed = false;
|
||||
float m_EmulationSpeed = 0;
|
||||
std::string m_strGPUDeterminismMode;
|
||||
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
|
||||
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
|
||||
std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice{};
|
||||
@@ -93,16 +87,11 @@ void ConfigCache::SaveConfig(const SConfig& config)
|
||||
valid = true;
|
||||
|
||||
bCPUThread = config.bCPUThread;
|
||||
bSyncGPUOnSkipIdleHack = config.bSyncGPUOnSkipIdleHack;
|
||||
bDisableICache = config.bDisableICache;
|
||||
bMMU = config.bMMU;
|
||||
bSyncGPU = config.bSyncGPU;
|
||||
iSyncGpuMaxDistance = config.iSyncGpuMaxDistance;
|
||||
iSyncGpuMinDistance = config.iSyncGpuMinDistance;
|
||||
fSyncGpuOverclock = config.fSyncGpuOverclock;
|
||||
bFastDiscSpeed = config.bFastDiscSpeed;
|
||||
m_EmulationSpeed = config.m_EmulationSpeed;
|
||||
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
|
||||
|
||||
for (int i = 0; i != MAX_BBMOTES; ++i)
|
||||
iWiimoteSource[i] = WiimoteCommon::GetSource(i);
|
||||
@@ -110,7 +99,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
|
||||
std::copy(std::begin(config.m_SIDevice), std::end(config.m_SIDevice), std::begin(Pads));
|
||||
std::copy(std::begin(config.m_EXIDevice), std::end(config.m_EXIDevice), std::begin(m_EXIDevice));
|
||||
|
||||
bSetEmulationSpeed = false;
|
||||
bSetVolume = false;
|
||||
bSetWiimoteSource.fill(false);
|
||||
bSetPads.fill(false);
|
||||
@@ -125,14 +113,11 @@ void ConfigCache::RestoreConfig(SConfig* config)
|
||||
valid = false;
|
||||
|
||||
config->bCPUThread = bCPUThread;
|
||||
config->bSyncGPUOnSkipIdleHack = bSyncGPUOnSkipIdleHack;
|
||||
config->bDisableICache = bDisableICache;
|
||||
config->bMMU = bMMU;
|
||||
config->bSyncGPU = bSyncGPU;
|
||||
config->iSyncGpuMaxDistance = iSyncGpuMaxDistance;
|
||||
config->iSyncGpuMinDistance = iSyncGpuMinDistance;
|
||||
config->fSyncGpuOverclock = fSyncGpuOverclock;
|
||||
config->bFastDiscSpeed = bFastDiscSpeed;
|
||||
|
||||
// Only change these back if they were actually set by game ini, since they can be changed while a
|
||||
// game is running.
|
||||
@@ -151,38 +136,15 @@ void ConfigCache::RestoreConfig(SConfig* config)
|
||||
config->m_SIDevice[i] = Pads[i];
|
||||
}
|
||||
|
||||
if (bSetEmulationSpeed)
|
||||
config->m_EmulationSpeed = m_EmulationSpeed;
|
||||
|
||||
for (unsigned int i = 0; i < ExpansionInterface::MAX_EXI_CHANNELS; ++i)
|
||||
{
|
||||
if (bSetEXIDevice[i])
|
||||
config->m_EXIDevice[i] = m_EXIDevice[i];
|
||||
}
|
||||
|
||||
config->m_strGPUDeterminismMode = m_strGPUDeterminismMode;
|
||||
}
|
||||
|
||||
static ConfigCache config_cache;
|
||||
|
||||
void SetEmulationSpeedReset(bool value)
|
||||
{
|
||||
config_cache.bSetEmulationSpeed = value;
|
||||
}
|
||||
|
||||
static GPUDeterminismMode ParseGPUDeterminismMode(const std::string& mode)
|
||||
{
|
||||
if (mode == "auto")
|
||||
return GPUDeterminismMode::Auto;
|
||||
if (mode == "none")
|
||||
return GPUDeterminismMode::Disabled;
|
||||
if (mode == "fake-completion")
|
||||
return GPUDeterminismMode::FakeCompletion;
|
||||
|
||||
NOTICE_LOG_FMT(BOOT, "Unknown GPU determinism mode {}", mode);
|
||||
return GPUDeterminismMode::Auto;
|
||||
}
|
||||
|
||||
// Boot the ISO or file
|
||||
bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
{
|
||||
@@ -206,17 +168,8 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
IniFile::Section* controls_section = game_ini.GetOrCreateSection("Controls");
|
||||
|
||||
core_section->Get("CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
|
||||
core_section->Get("SyncOnSkipIdle", &StartUp.bSyncGPUOnSkipIdleHack,
|
||||
StartUp.bSyncGPUOnSkipIdleHack);
|
||||
core_section->Get("DisableICache", &StartUp.bDisableICache, StartUp.bDisableICache);
|
||||
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
|
||||
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
|
||||
core_section->Get("FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
|
||||
if (core_section->Get("EmulationSpeed", &StartUp.m_EmulationSpeed, StartUp.m_EmulationSpeed))
|
||||
config_cache.bSetEmulationSpeed = true;
|
||||
|
||||
core_section->Get("GPUDeterminismMode", &StartUp.m_strGPUDeterminismMode,
|
||||
StartUp.m_strGPUDeterminismMode);
|
||||
|
||||
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
||||
{
|
||||
@@ -256,14 +209,11 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
}
|
||||
}
|
||||
|
||||
StartUp.m_GPUDeterminismMode = ParseGPUDeterminismMode(StartUp.m_strGPUDeterminismMode);
|
||||
|
||||
// Movie settings
|
||||
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
|
||||
{
|
||||
// TODO: remove this once ConfigManager starts using OnionConfig.
|
||||
StartUp.bCPUThread = Config::Get(Config::MAIN_CPU_THREAD);
|
||||
StartUp.bFastDiscSpeed = Config::Get(Config::MAIN_FAST_DISC_SPEED);
|
||||
StartUp.bSyncGPU = Config::Get(Config::MAIN_SYNC_GPU);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
@@ -293,17 +243,11 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
config_cache.bSetEXIDevice[0] = true;
|
||||
config_cache.bSetEXIDevice[1] = true;
|
||||
config_cache.bSetEXIDevice[2] = true;
|
||||
StartUp.bDisableICache = netplay_settings.m_DisableICache;
|
||||
StartUp.bSyncGPUOnSkipIdleHack = netplay_settings.m_SyncOnSkipIdle;
|
||||
StartUp.bSyncGPU = netplay_settings.m_SyncGPU;
|
||||
StartUp.iSyncGpuMaxDistance = netplay_settings.m_SyncGpuMaxDistance;
|
||||
StartUp.iSyncGpuMinDistance = netplay_settings.m_SyncGpuMinDistance;
|
||||
StartUp.fSyncGpuOverclock = netplay_settings.m_SyncGpuOverclock;
|
||||
StartUp.bFastDiscSpeed = netplay_settings.m_FastDiscSpeed;
|
||||
StartUp.bMMU = netplay_settings.m_MMU;
|
||||
StartUp.bFastmem = netplay_settings.m_Fastmem;
|
||||
if (netplay_settings.m_HostInputAuthority && !netplay_settings.m_IsHosting)
|
||||
config_cache.bSetEmulationSpeed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -355,7 +299,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
|
||||
// Disable loading time emulation for Riivolution-patched games until we have proper emulation.
|
||||
if (!boot->riivolution_patches.empty())
|
||||
StartUp.bFastDiscSpeed = true;
|
||||
Config::SetCurrent(Config::MAIN_FAST_DISC_SPEED, true);
|
||||
|
||||
Core::UpdateWantDeterminism(/*initial*/ true);
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ struct WindowSystemInfo;
|
||||
namespace BootManager
|
||||
{
|
||||
bool BootCore(std::unique_ptr<BootParameters> parameters, const WindowSystemInfo& wsi);
|
||||
void SetEmulationSpeedReset(bool value);
|
||||
|
||||
// Synchronise Dolphin's configuration with the SYSCONF (which may have changed during emulation),
|
||||
// and restore settings that were overriden by per-game INIs or for some other reason.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "AudioCommon/AudioCommon.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MathUtil.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Version.h"
|
||||
@@ -96,6 +97,8 @@ const Info<bool> MAIN_WII_KEYBOARD{{System::Main, "Core", "WiiKeyboard"}, false}
|
||||
const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING{
|
||||
{System::Main, "Core", "WiimoteContinuousScanning"}, false};
|
||||
const Info<bool> MAIN_WIIMOTE_ENABLE_SPEAKER{{System::Main, "Core", "WiimoteEnableSpeaker"}, false};
|
||||
const Info<bool> MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE{
|
||||
{System::Main, "Core", "WiimoteControllerInterface"}, false};
|
||||
const Info<bool> MAIN_MMU{{System::Main, "Core", "MMU"}, false};
|
||||
const Info<int> MAIN_BB_DUMP_PORT{{System::Main, "Core", "BBDumpPort"}, -1};
|
||||
const Info<bool> MAIN_SYNC_GPU{{System::Main, "Core", "SyncGPU"}, false};
|
||||
@@ -118,8 +121,24 @@ const Info<u32> MAIN_MEM1_SIZE{{System::Main, "Core", "MEM1Size"}, Memory::MEM1_
|
||||
const Info<u32> MAIN_MEM2_SIZE{{System::Main, "Core", "MEM2Size"}, Memory::MEM2_SIZE_RETAIL};
|
||||
const Info<std::string> MAIN_GFX_BACKEND{{System::Main, "Core", "GFXBackend"},
|
||||
VideoBackendBase::GetDefaultBackendName()};
|
||||
|
||||
const Info<std::string> MAIN_GPU_DETERMINISM_MODE{{System::Main, "Core", "GPUDeterminismMode"},
|
||||
"auto"};
|
||||
|
||||
GPUDeterminismMode GetGPUDeterminismMode()
|
||||
{
|
||||
auto mode = Config::Get(Config::MAIN_GPU_DETERMINISM_MODE);
|
||||
if (mode == "auto")
|
||||
return GPUDeterminismMode::Auto;
|
||||
if (mode == "none")
|
||||
return GPUDeterminismMode::Disabled;
|
||||
if (mode == "fake-completion")
|
||||
return GPUDeterminismMode::FakeCompletion;
|
||||
|
||||
NOTICE_LOG_FMT(CORE, "Unknown GPU determinism mode {}", mode);
|
||||
return GPUDeterminismMode::Auto;
|
||||
}
|
||||
|
||||
const Info<std::string> MAIN_PERF_MAP_DIR{{System::Main, "Core", "PerfMapDir"}, ""};
|
||||
const Info<bool> MAIN_CUSTOM_RTC_ENABLE{{System::Main, "Core", "EnableCustomRTC"}, false};
|
||||
// Default to seconds between 1.1.1970 and 1.1.2000
|
||||
|
||||
@@ -72,6 +72,7 @@ extern const Info<bool> MAIN_WII_SD_CARD;
|
||||
extern const Info<bool> MAIN_WII_KEYBOARD;
|
||||
extern const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING;
|
||||
extern const Info<bool> MAIN_WIIMOTE_ENABLE_SPEAKER;
|
||||
extern const Info<bool> MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE;
|
||||
extern const Info<bool> MAIN_MMU;
|
||||
extern const Info<int> MAIN_BB_DUMP_PORT;
|
||||
extern const Info<bool> MAIN_SYNC_GPU;
|
||||
@@ -93,7 +94,18 @@ extern const Info<u32> MAIN_MEM1_SIZE;
|
||||
extern const Info<u32> MAIN_MEM2_SIZE;
|
||||
// Should really be part of System::GFX, but again, we're stuck with past mistakes.
|
||||
extern const Info<std::string> MAIN_GFX_BACKEND;
|
||||
|
||||
enum class GPUDeterminismMode
|
||||
{
|
||||
Auto,
|
||||
Disabled,
|
||||
// This is currently the only mode. There will probably be at least
|
||||
// one more at some point.
|
||||
FakeCompletion,
|
||||
};
|
||||
extern const Info<std::string> MAIN_GPU_DETERMINISM_MODE;
|
||||
GPUDeterminismMode GetGPUDeterminismMode();
|
||||
|
||||
extern const Info<std::string> MAIN_PERF_MAP_DIR;
|
||||
extern const Info<bool> MAIN_CUSTOM_RTC_ENABLE;
|
||||
extern const Info<u32> MAIN_CUSTOM_RTC_VALUE;
|
||||
|
||||
@@ -97,6 +97,19 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
||||
&Config::GetInfoForSimulateKonga(1).GetLocation(),
|
||||
&Config::GetInfoForSimulateKonga(2).GetLocation(),
|
||||
&Config::GetInfoForSimulateKonga(3).GetLocation(),
|
||||
&Config::MAIN_EMULATION_SPEED.GetLocation(),
|
||||
&Config::MAIN_PERF_MAP_DIR.GetLocation(),
|
||||
&Config::MAIN_GPU_DETERMINISM_MODE.GetLocation(),
|
||||
&Config::MAIN_DISABLE_ICACHE.GetLocation(),
|
||||
&Config::MAIN_FAST_DISC_SPEED.GetLocation(),
|
||||
&Config::MAIN_SYNC_ON_SKIP_IDLE.GetLocation(),
|
||||
&Config::MAIN_FASTMEM.GetLocation(),
|
||||
&Config::MAIN_TIMING_VARIANCE.GetLocation(),
|
||||
&Config::MAIN_WII_SD_CARD.GetLocation(),
|
||||
&Config::MAIN_WII_KEYBOARD.GetLocation(),
|
||||
&Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING.GetLocation(),
|
||||
&Config::MAIN_WIIMOTE_ENABLE_SPEAKER.GetLocation(),
|
||||
&Config::MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE.GetLocation(),
|
||||
|
||||
// UI.General
|
||||
|
||||
|
||||
@@ -99,10 +99,7 @@ void SConfig::SaveCoreSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* core = ini.GetOrCreateSection("Core");
|
||||
|
||||
core->Set("TimingVariance", iTimingVariance);
|
||||
core->Set("Fastmem", bFastmem);
|
||||
core->Set("CPUThread", bCPUThread);
|
||||
core->Set("SyncOnSkipIdle", bSyncGPUOnSkipIdleHack);
|
||||
core->Set("SyncGPU", bSyncGPU);
|
||||
core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance);
|
||||
core->Set("SyncGpuMinDistance", iSyncGpuMinDistance);
|
||||
@@ -114,15 +111,7 @@ void SConfig::SaveCoreSettings(IniFile& ini)
|
||||
{
|
||||
core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]);
|
||||
}
|
||||
core->Set("WiiSDCard", m_WiiSDCard);
|
||||
core->Set("WiiKeyboard", m_WiiKeyboard);
|
||||
core->Set("WiimoteContinuousScanning", m_WiimoteContinuousScanning);
|
||||
core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
|
||||
core->Set("WiimoteControllerInterface", connect_wiimotes_for_ciface);
|
||||
core->Set("MMU", bMMU);
|
||||
core->Set("EmulationSpeed", m_EmulationSpeed);
|
||||
core->Set("GPUDeterminismMode", m_strGPUDeterminismMode);
|
||||
core->Set("PerfMapDir", m_perfDir);
|
||||
}
|
||||
|
||||
void SConfig::LoadSettings()
|
||||
@@ -140,10 +129,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* core = ini.GetOrCreateSection("Core");
|
||||
|
||||
core->Get("Fastmem", &bFastmem, true);
|
||||
core->Get("TimingVariance", &iTimingVariance, 40);
|
||||
core->Get("CPUThread", &bCPUThread, true);
|
||||
core->Get("SyncOnSkipIdle", &bSyncGPUOnSkipIdleHack, true);
|
||||
core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER);
|
||||
core->Get("SlotB", (int*)&m_EXIDevice[1], ExpansionInterface::EXIDEVICE_NONE);
|
||||
core->Get("SerialPort1", (int*)&m_EXIDevice[2], ExpansionInterface::EXIDEVICE_NONE);
|
||||
@@ -152,22 +138,12 @@ void SConfig::LoadCoreSettings(IniFile& ini)
|
||||
core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i],
|
||||
(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
|
||||
}
|
||||
core->Get("WiiSDCard", &m_WiiSDCard, true);
|
||||
core->Get("WiiKeyboard", &m_WiiKeyboard, false);
|
||||
core->Get("WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
|
||||
core->Get("WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, false);
|
||||
core->Get("WiimoteControllerInterface", &connect_wiimotes_for_ciface, false);
|
||||
core->Get("MMU", &bMMU, bMMU);
|
||||
core->Get("BBDumpPort", &iBBDumpPort, -1);
|
||||
core->Get("SyncGPU", &bSyncGPU, false);
|
||||
core->Get("SyncGpuMaxDistance", &iSyncGpuMaxDistance, 200000);
|
||||
core->Get("SyncGpuMinDistance", &iSyncGpuMinDistance, -200000);
|
||||
core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
|
||||
core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
|
||||
core->Get("DisableICache", &bDisableICache, false);
|
||||
core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
|
||||
core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
|
||||
core->Get("PerfMapDir", &m_perfDir, "");
|
||||
}
|
||||
|
||||
void SConfig::ResetRunningGameMetadata()
|
||||
@@ -283,15 +259,10 @@ void SConfig::LoadDefaults()
|
||||
bAutomaticStart = false;
|
||||
bBootToPause = false;
|
||||
|
||||
iTimingVariance = 40;
|
||||
bCPUThread = false;
|
||||
bSyncGPUOnSkipIdleHack = true;
|
||||
bFastmem = true;
|
||||
bDisableICache = false;
|
||||
bMMU = false;
|
||||
iBBDumpPort = -1;
|
||||
bSyncGPU = false;
|
||||
bFastDiscSpeed = false;
|
||||
bWii = false;
|
||||
|
||||
ResetRunningGameMetadata();
|
||||
|
||||
@@ -47,24 +47,8 @@ enum SIDevices : int;
|
||||
|
||||
struct BootParameters;
|
||||
|
||||
enum class GPUDeterminismMode
|
||||
{
|
||||
Auto,
|
||||
Disabled,
|
||||
// This is currently the only mode. There will probably be at least
|
||||
// one more at some point.
|
||||
FakeCompletion,
|
||||
};
|
||||
|
||||
struct SConfig
|
||||
{
|
||||
// Wii Devices
|
||||
bool m_WiiSDCard;
|
||||
bool m_WiiKeyboard;
|
||||
bool m_WiimoteContinuousScanning;
|
||||
bool m_WiimoteEnableSpeaker;
|
||||
bool connect_wiimotes_for_ciface;
|
||||
|
||||
// Settings
|
||||
bool bAutomaticStart = false;
|
||||
bool bBootToPause = false;
|
||||
@@ -72,17 +56,11 @@ struct SConfig
|
||||
bool bJITNoBlockCache = false;
|
||||
bool bJITNoBlockLinking = false;
|
||||
|
||||
bool bFastmem;
|
||||
bool bDisableICache = false;
|
||||
|
||||
int iTimingVariance = 40; // in milli secounds
|
||||
bool bCPUThread = true;
|
||||
bool bSyncGPUOnSkipIdleHack = true;
|
||||
bool bCopyWiiSaveNetplay = true;
|
||||
|
||||
bool bMMU = false;
|
||||
int iBBDumpPort = 0;
|
||||
bool bFastDiscSpeed = false;
|
||||
|
||||
bool bSyncGPU = false;
|
||||
int iSyncGpuMaxDistance;
|
||||
@@ -94,17 +72,10 @@ struct SConfig
|
||||
|
||||
DiscIO::Region m_region;
|
||||
|
||||
std::string m_strGPUDeterminismMode;
|
||||
|
||||
// set based on the string version
|
||||
GPUDeterminismMode m_GPUDeterminismMode;
|
||||
|
||||
// files
|
||||
std::string m_strBootROM;
|
||||
std::string m_strSRAM;
|
||||
|
||||
std::string m_perfDir;
|
||||
|
||||
std::string m_debugger_game_id;
|
||||
// TODO: remove this as soon as the ticket view hack in IOS/ES/Views is dropped.
|
||||
bool m_disc_booted_from_game_list = false;
|
||||
@@ -146,8 +117,6 @@ struct SConfig
|
||||
ExpansionInterface::TEXIDevices m_EXIDevice[3];
|
||||
SerialInterface::SIDevices m_SIDevice[4];
|
||||
|
||||
float m_EmulationSpeed;
|
||||
|
||||
SConfig(const SConfig&) = delete;
|
||||
SConfig& operator=(const SConfig&) = delete;
|
||||
SConfig(SConfig&&) = delete;
|
||||
|
||||
@@ -348,7 +348,8 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
|
||||
static_cast<void>(IDCache::GetEnvForThread());
|
||||
#endif
|
||||
|
||||
if (_CoreParameter.bFastmem)
|
||||
const bool fastmem_enabled = Config::Get(Config::MAIN_FASTMEM);
|
||||
if (fastmem_enabled)
|
||||
EMM::InstallExceptionHandler(); // Let's run under memory watch
|
||||
|
||||
#ifdef USE_MEMORYWATCHER
|
||||
@@ -396,7 +397,7 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
|
||||
|
||||
s_is_started = false;
|
||||
|
||||
if (_CoreParameter.bFastmem)
|
||||
if (fastmem_enabled)
|
||||
EMM::UninstallExceptionHandler();
|
||||
|
||||
if (GDBStub::IsActive())
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "Common/SPSCQueue.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
|
||||
@@ -81,6 +80,7 @@ static EventType* s_ev_lost = nullptr;
|
||||
static size_t s_registered_config_callback_id;
|
||||
static float s_config_OC_factor;
|
||||
static float s_config_OC_inv_factor;
|
||||
static bool s_config_sync_on_skip_idle;
|
||||
|
||||
static void EmptyTimedCallback(u64 userdata, s64 cyclesLate)
|
||||
{
|
||||
@@ -161,6 +161,7 @@ void RefreshConfig()
|
||||
s_config_OC_factor =
|
||||
Config::Get(Config::MAIN_OVERCLOCK_ENABLE) ? Config::Get(Config::MAIN_OVERCLOCK) : 1.0f;
|
||||
s_config_OC_inv_factor = 1.0f / s_config_OC_factor;
|
||||
s_config_sync_on_skip_idle = Config::Get(Config::MAIN_SYNC_ON_SKIP_IDLE);
|
||||
}
|
||||
|
||||
void DoState(PointerWrap& p)
|
||||
@@ -388,7 +389,7 @@ void AdjustEventQueueTimes(u32 new_ppc_clock, u32 old_ppc_clock)
|
||||
|
||||
void Idle()
|
||||
{
|
||||
if (SConfig::GetInstance().bSyncGPUOnSkipIdleHack)
|
||||
if (s_config_sync_on_skip_idle)
|
||||
{
|
||||
// When the FIFO is processing data we must not advance because in this way
|
||||
// the VI will be desynchronized. So, We are waiting until the FIFO finish and
|
||||
|
||||
@@ -360,7 +360,7 @@ void DolphinAnalytics::MakePerGameBuilder()
|
||||
builder.AddData("cfg-dsp-jit", Config::Get(Config::MAIN_DSP_JIT));
|
||||
builder.AddData("cfg-dsp-thread", Config::Get(Config::MAIN_DSP_THREAD));
|
||||
builder.AddData("cfg-cpu-thread", SConfig::GetInstance().bCPUThread);
|
||||
builder.AddData("cfg-fastmem", SConfig::GetInstance().bFastmem);
|
||||
builder.AddData("cfg-fastmem", Config::Get(Config::MAIN_FASTMEM));
|
||||
builder.AddData("cfg-syncgpu", SConfig::GetInstance().bSyncGPU);
|
||||
builder.AddData("cfg-audio-backend", Config::Get(Config::MAIN_AUDIO_BACKEND));
|
||||
builder.AddData("cfg-oc-enable", Config::Get(Config::MAIN_OVERCLOCK_ENABLE));
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/DolphinAnalytics.h"
|
||||
#include "Core/HW/AudioInterface.h"
|
||||
@@ -1382,7 +1381,7 @@ static void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& parti
|
||||
dvd_offset = Common::AlignDown(dvd_offset, DVD_ECC_BLOCK_SIZE);
|
||||
const u64 first_block = dvd_offset;
|
||||
|
||||
if (SConfig::GetInstance().bFastDiscSpeed)
|
||||
if (Config::Get(Config::MAIN_FAST_DISC_SPEED))
|
||||
{
|
||||
// The SUDTR setting makes us act as if all reads are buffered
|
||||
buffer_start = std::numeric_limits<u64>::min();
|
||||
|
||||
@@ -173,8 +173,8 @@ void ThrottleCallback(u64 last_time, s64 cyclesLate)
|
||||
u64 time = Common::Timer::GetTimeUs();
|
||||
|
||||
s64 diff = last_time - time;
|
||||
const SConfig& config = SConfig::GetInstance();
|
||||
bool frame_limiter = config.m_EmulationSpeed > 0.0f && !Core::GetIsThrottlerTempDisabled();
|
||||
const float emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
|
||||
bool frame_limiter = emulation_speed > 0.0f && !Core::GetIsThrottlerTempDisabled();
|
||||
u32 next_event = GetTicksPerSecond() / 1000;
|
||||
|
||||
{
|
||||
@@ -186,9 +186,9 @@ void ThrottleCallback(u64 last_time, s64 cyclesLate)
|
||||
|
||||
if (frame_limiter)
|
||||
{
|
||||
if (config.m_EmulationSpeed != 1.0f)
|
||||
next_event = u32(next_event * config.m_EmulationSpeed);
|
||||
const s64 max_fallback = config.iTimingVariance * 1000;
|
||||
if (emulation_speed != 1.0f)
|
||||
next_event = u32(next_event * emulation_speed);
|
||||
const s64 max_fallback = Config::Get(Config::MAIN_TIMING_VARIANCE) * 1000;
|
||||
if (std::abs(diff) > max_fallback)
|
||||
{
|
||||
DEBUG_LOG_FMT(COMMON, "system too {}, {} ms skipped", diff < 0 ? "slow" : "fast",
|
||||
|
||||
@@ -73,7 +73,7 @@ void stopdamnwav()
|
||||
void SpeakerLogic::SpeakerData(const u8* data, int length, float speaker_pan)
|
||||
{
|
||||
// TODO: should we still process samples for the decoder state?
|
||||
if (!SConfig::GetInstance().m_WiimoteEnableSpeaker)
|
||||
if (!m_speaker_enabled)
|
||||
return;
|
||||
|
||||
if (reg_data.sample_rate == 0 || length == 0)
|
||||
@@ -186,6 +186,11 @@ void SpeakerLogic::DoState(PointerWrap& p)
|
||||
p.Do(reg_data);
|
||||
}
|
||||
|
||||
void SpeakerLogic::SetSpeakerEnabled(bool enabled)
|
||||
{
|
||||
m_speaker_enabled = enabled;
|
||||
}
|
||||
|
||||
int SpeakerLogic::BusRead(u8 slave_addr, u8 addr, int count, u8* data_out)
|
||||
{
|
||||
if (I2C_ADDR != slave_addr)
|
||||
|
||||
@@ -29,6 +29,8 @@ public:
|
||||
void Reset();
|
||||
void DoState(PointerWrap& p);
|
||||
|
||||
void SetSpeakerEnabled(bool enabled);
|
||||
|
||||
private:
|
||||
// Pan is -1.0 to +1.0
|
||||
void SpeakerData(const u8* data, int length, float speaker_pan);
|
||||
@@ -71,6 +73,8 @@ private:
|
||||
ADPCMState adpcm_state{};
|
||||
|
||||
ControllerEmu::SettingValue<double> m_speaker_pan_setting;
|
||||
|
||||
bool m_speaker_enabled = false;
|
||||
};
|
||||
|
||||
} // namespace WiimoteEmu
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
#include "Common/MathUtil.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
|
||||
#include "Core/Config/SYSCONFSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/Movie.h"
|
||||
@@ -297,6 +296,14 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index)
|
||||
m_hotkeys->AddInput(_trans("Upright Hold"), false);
|
||||
|
||||
Reset();
|
||||
|
||||
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); });
|
||||
RefreshConfig();
|
||||
}
|
||||
|
||||
Wiimote::~Wiimote()
|
||||
{
|
||||
Config::RemoveConfigChangedCallback(m_config_changed_callback_id);
|
||||
}
|
||||
|
||||
std::string Wiimote::GetName() const
|
||||
@@ -726,6 +733,11 @@ void Wiimote::SetRumble(bool on)
|
||||
m_rumble->controls.front()->control_ref->State(on);
|
||||
}
|
||||
|
||||
void Wiimote::RefreshConfig()
|
||||
{
|
||||
m_speaker_logic.SetSpeakerEnabled(Config::Get(Config::MAIN_WIIMOTE_ENABLE_SPEAKER));
|
||||
}
|
||||
|
||||
void Wiimote::StepDynamics()
|
||||
{
|
||||
EmulateSwing(&m_swing_state, m_swing, 1.f / ::Wiimote::UPDATE_FREQ);
|
||||
|
||||
@@ -109,6 +109,7 @@ public:
|
||||
static constexpr u16 BUTTON_HOME = 0x8000;
|
||||
|
||||
explicit Wiimote(unsigned int index);
|
||||
~Wiimote();
|
||||
|
||||
std::string GetName() const override;
|
||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||
@@ -144,6 +145,8 @@ private:
|
||||
// This is the region exposed over bluetooth:
|
||||
static constexpr int EEPROM_FREE_SIZE = 0x1700;
|
||||
|
||||
void RefreshConfig();
|
||||
|
||||
void StepDynamics();
|
||||
void UpdateButtonsStatus();
|
||||
|
||||
@@ -297,5 +300,7 @@ private:
|
||||
PositionalState m_shake_state;
|
||||
|
||||
IMUCursorState m_imu_cursor_state;
|
||||
|
||||
size_t m_config_changed_callback_id;
|
||||
};
|
||||
} // namespace WiimoteEmu
|
||||
|
||||
@@ -111,7 +111,7 @@ void ProcessWiimotePool()
|
||||
for (u32 index = 0; index != MAX_WIIMOTES; ++index)
|
||||
TryToFillWiimoteSlot(index);
|
||||
|
||||
if (SConfig::GetInstance().connect_wiimotes_for_ciface)
|
||||
if (Config::Get(Config::MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE))
|
||||
{
|
||||
for (auto& entry : s_wiimote_pool)
|
||||
ciface::WiimoteController::AddDevice(std::move(entry.wiimote));
|
||||
@@ -142,7 +142,16 @@ void AddWiimoteToPool(std::unique_ptr<Wiimote> wiimote)
|
||||
s_wiimote_pool.emplace_back(WiimotePoolEntry{std::move(wiimote)});
|
||||
}
|
||||
|
||||
Wiimote::Wiimote() = default;
|
||||
Wiimote::Wiimote()
|
||||
{
|
||||
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); });
|
||||
RefreshConfig();
|
||||
}
|
||||
|
||||
Wiimote::~Wiimote()
|
||||
{
|
||||
Config::RemoveConfigChangedCallback(m_config_changed_callback_id);
|
||||
}
|
||||
|
||||
void Wiimote::Shutdown()
|
||||
{
|
||||
@@ -263,7 +272,7 @@ void Wiimote::InterruptDataOutput(const u8* data, const u32 size)
|
||||
}
|
||||
}
|
||||
else if (rpt[1] == u8(OutputReportID::SpeakerData) &&
|
||||
(!SConfig::GetInstance().m_WiimoteEnableSpeaker || !m_speaker_enable || m_speaker_mute))
|
||||
(!m_speaker_enabled_in_dolphin_config || !m_speaker_enable || m_speaker_mute))
|
||||
{
|
||||
rpt.resize(3);
|
||||
// Translate undesired speaker data reports into rumble reports.
|
||||
@@ -677,7 +686,7 @@ void WiimoteScanner::ThreadFunc()
|
||||
continue;
|
||||
|
||||
// If we don't want Wiimotes in ControllerInterface, we may not need them at all.
|
||||
if (!SConfig::GetInstance().connect_wiimotes_for_ciface)
|
||||
if (!Config::Get(Config::MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE))
|
||||
{
|
||||
// We don't want any remotes in passthrough mode or running in GC mode.
|
||||
const bool core_running = Core::GetState() != Core::State::Uninitialized;
|
||||
@@ -804,6 +813,11 @@ void Wiimote::ThreadFunc()
|
||||
DisconnectInternal();
|
||||
}
|
||||
|
||||
void Wiimote::RefreshConfig()
|
||||
{
|
||||
m_speaker_enabled_in_dolphin_config = Config::Get(Config::MAIN_WIIMOTE_ENABLE_SPEAKER);
|
||||
}
|
||||
|
||||
int Wiimote::GetIndex() const
|
||||
{
|
||||
return m_index;
|
||||
@@ -843,7 +857,7 @@ void Initialize(::Wiimote::InitializeMode init_mode)
|
||||
s_wiimote_scanner.StartThread();
|
||||
}
|
||||
|
||||
if (SConfig::GetInstance().m_WiimoteContinuousScanning)
|
||||
if (Config::Get(Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING))
|
||||
s_wiimote_scanner.SetScanMode(WiimoteScanMode::CONTINUOUSLY_SCAN);
|
||||
else
|
||||
s_wiimote_scanner.SetScanMode(WiimoteScanMode::DO_NOT_SCAN);
|
||||
@@ -957,7 +971,7 @@ static void HandleWiimoteDisconnect(int index)
|
||||
// This is called from the GUI thread
|
||||
void Refresh()
|
||||
{
|
||||
if (!SConfig::GetInstance().m_WiimoteContinuousScanning)
|
||||
if (!Config::Get(Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING))
|
||||
s_wiimote_scanner.SetScanMode(WiimoteScanMode::SCAN_ONCE);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
Wiimote(Wiimote&&) = delete;
|
||||
Wiimote& operator=(Wiimote&&) = delete;
|
||||
|
||||
virtual ~Wiimote() {}
|
||||
~Wiimote() override;
|
||||
// This needs to be called in derived destructors!
|
||||
void Shutdown();
|
||||
|
||||
@@ -125,6 +125,8 @@ private:
|
||||
|
||||
void ThreadFunc();
|
||||
|
||||
void RefreshConfig();
|
||||
|
||||
bool m_is_linked = false;
|
||||
|
||||
// We track the speaker state to convert unnecessary speaker data into rumble reports.
|
||||
@@ -144,6 +146,10 @@ private:
|
||||
|
||||
Common::SPSCQueue<Report> m_read_reports;
|
||||
Common::SPSCQueue<Report> m_write_reports;
|
||||
|
||||
bool m_speaker_enabled_in_dolphin_config = false;
|
||||
|
||||
size_t m_config_changed_callback_id;
|
||||
};
|
||||
|
||||
class WiimoteScannerBackend
|
||||
@@ -209,5 +215,4 @@ void InitAdapterClass();
|
||||
void HandleWiimotesInControllerInterfaceSettingChange();
|
||||
void PopulateDevices();
|
||||
void ProcessWiimotePool();
|
||||
|
||||
} // namespace WiimoteReal
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user