Settings: Move set defaults to HostInterface so it can use user paths
This commit is contained in:
parent
b5e73a0be4
commit
faf2308695
|
@ -54,10 +54,10 @@ HostInterface::HostInterface()
|
|||
{
|
||||
SetUserDirectory();
|
||||
CreateUserDirectorySubdirectories();
|
||||
SetDefaultSettings();
|
||||
m_game_list = std::make_unique<GameList>();
|
||||
m_game_list->SetCacheFilename(GetGameListCacheFileName());
|
||||
m_game_list->SetDatabaseFilename(GetGameListDatabaseFileName());
|
||||
m_settings.SetDefaults();
|
||||
m_last_throttle_time = Common::Timer::GetValue();
|
||||
}
|
||||
|
||||
|
@ -542,6 +542,38 @@ std::string HostInterface::GetGameMemoryCardPath(const char* game_code, u32 slot
|
|||
return GetUserDirectoryRelativePath("memcards/game_card_%s_%d.mcd", game_code, slot + 1);
|
||||
}
|
||||
|
||||
void HostInterface::SetDefaultSettings()
|
||||
{
|
||||
m_settings.region = ConsoleRegion::Auto;
|
||||
m_settings.cpu_execution_mode = CPUExecutionMode::Interpreter;
|
||||
|
||||
m_settings.speed_limiter_enabled = true;
|
||||
m_settings.start_paused = false;
|
||||
|
||||
m_settings.gpu_renderer = GPURenderer::HardwareOpenGL;
|
||||
m_settings.gpu_resolution_scale = 1;
|
||||
m_settings.gpu_true_color = true;
|
||||
m_settings.gpu_texture_filtering = false;
|
||||
m_settings.gpu_force_progressive_scan = true;
|
||||
m_settings.gpu_use_debug_device = false;
|
||||
m_settings.display_linear_filtering = true;
|
||||
m_settings.display_fullscreen = false;
|
||||
m_settings.video_sync_enabled = true;
|
||||
|
||||
m_settings.audio_backend = AudioBackend::Default;
|
||||
m_settings.audio_sync_enabled = true;
|
||||
|
||||
m_settings.bios_path = "scph1001.bin";
|
||||
m_settings.bios_patch_tty_enable = false;
|
||||
m_settings.bios_patch_fast_boot = false;
|
||||
|
||||
m_settings.controller_types[0] = ControllerType::DigitalController;
|
||||
m_settings.controller_types[1] = ControllerType::None;
|
||||
|
||||
m_settings.memory_card_paths[0] = GetSharedMemoryCardPath(0);
|
||||
m_settings.memory_card_paths[1] = GetSharedMemoryCardPath(1);
|
||||
}
|
||||
|
||||
void HostInterface::UpdateSettings(const std::function<void()>& apply_callback)
|
||||
{
|
||||
const GPURenderer old_gpu_renderer = m_settings.gpu_renderer;
|
||||
|
|
|
@ -116,6 +116,9 @@ protected:
|
|||
/// Returns the default path to a memory card for a specific game.
|
||||
std::string GetGameMemoryCardPath(const char* game_code, u32 slot);
|
||||
|
||||
/// Restores all settings to defaults.
|
||||
void SetDefaultSettings();
|
||||
|
||||
/// Applies new settings, updating internal state as needed. apply_callback should call m_settings.Load() after
|
||||
/// locking any required mutexes.
|
||||
void UpdateSettings(const std::function<void()>& apply_callback);
|
||||
|
|
|
@ -4,38 +4,6 @@
|
|||
|
||||
Settings::Settings() = default;
|
||||
|
||||
void Settings::SetDefaults()
|
||||
{
|
||||
region = ConsoleRegion::Auto;
|
||||
cpu_execution_mode = CPUExecutionMode::Interpreter;
|
||||
|
||||
speed_limiter_enabled = true;
|
||||
start_paused = false;
|
||||
|
||||
gpu_renderer = GPURenderer::HardwareOpenGL;
|
||||
gpu_resolution_scale = 1;
|
||||
gpu_true_color = true;
|
||||
gpu_texture_filtering = false;
|
||||
gpu_force_progressive_scan = true;
|
||||
gpu_use_debug_device = false;
|
||||
display_linear_filtering = true;
|
||||
display_fullscreen = false;
|
||||
video_sync_enabled = true;
|
||||
|
||||
audio_backend = AudioBackend::Default;
|
||||
audio_sync_enabled = true;
|
||||
|
||||
bios_path = "scph1001.bin";
|
||||
bios_patch_tty_enable = false;
|
||||
bios_patch_fast_boot = false;
|
||||
|
||||
controller_types[0] = ControllerType::DigitalController;
|
||||
controller_types[1] = ControllerType::None;
|
||||
|
||||
memory_card_paths[0] = "memory_card_1.mcd";
|
||||
memory_card_paths[1].clear();
|
||||
}
|
||||
|
||||
void Settings::Load(SettingsInterface& si)
|
||||
{
|
||||
region =
|
||||
|
|
|
@ -75,7 +75,6 @@ struct Settings
|
|||
std::array<ControllerType, NUM_CONTROLLER_AND_CARD_PORTS> controller_types{};
|
||||
std::array<std::string, NUM_CONTROLLER_AND_CARD_PORTS> memory_card_paths{};
|
||||
|
||||
void SetDefaults();
|
||||
void Load(SettingsInterface& si);
|
||||
void Save(SettingsInterface& si) const;
|
||||
|
||||
|
|
|
@ -52,12 +52,12 @@ void QtHostInterface::ReportMessage(const char* message)
|
|||
|
||||
void QtHostInterface::setDefaultSettings()
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(m_qsettings_mutex);
|
||||
|
||||
m_settings.SetDefaults();
|
||||
HostInterface::UpdateSettings([this]() {
|
||||
HostInterface::SetDefaultSettings();
|
||||
});
|
||||
|
||||
// default input settings for Qt
|
||||
m_settings.controller_types[0] = ControllerType::DigitalController;
|
||||
std::lock_guard<std::mutex> guard(m_qsettings_mutex);
|
||||
m_qsettings.setValue(QStringLiteral("Controller1/ButtonUp"), QStringLiteral("Keyboard/W"));
|
||||
m_qsettings.setValue(QStringLiteral("Controller1/ButtonDown"), QStringLiteral("Keyboard/S"));
|
||||
m_qsettings.setValue(QStringLiteral("Controller1/ButtonLeft"), QStringLiteral("Keyboard/A"));
|
||||
|
|
Loading…
Reference in New Issue