2019-10-04 05:00:32 +00:00
|
|
|
#include "settings.h"
|
2022-07-11 13:03:29 +00:00
|
|
|
#include "achievements.h"
|
2021-01-21 07:59:40 +00:00
|
|
|
#include "common/assert.h"
|
2020-09-19 20:39:04 +00:00
|
|
|
#include "common/file_system.h"
|
2022-07-11 13:03:29 +00:00
|
|
|
#include "common/log.h"
|
2020-08-23 04:42:53 +00:00
|
|
|
#include "common/make_array.h"
|
2022-07-11 13:03:29 +00:00
|
|
|
#include "common/path.h"
|
2020-01-10 03:31:12 +00:00
|
|
|
#include "common/string_util.h"
|
2022-07-11 13:03:29 +00:00
|
|
|
#include "controller.h"
|
|
|
|
#include "host.h"
|
2021-04-28 16:42:08 +00:00
|
|
|
#include "host_display.h"
|
2022-07-22 15:28:19 +00:00
|
|
|
#include "host_settings.h"
|
|
|
|
#include "system.h"
|
2020-06-03 16:15:27 +00:00
|
|
|
#include <algorithm>
|
2020-06-07 16:53:53 +00:00
|
|
|
#include <array>
|
2020-11-01 14:38:54 +00:00
|
|
|
#include <cctype>
|
2020-09-29 13:29:28 +00:00
|
|
|
#include <numeric>
|
2022-07-11 13:03:29 +00:00
|
|
|
Log_SetChannel(Settings);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-07-31 07:09:18 +00:00
|
|
|
Settings g_settings;
|
|
|
|
|
2020-06-30 14:33:45 +00:00
|
|
|
const char* SettingInfo::StringDefaultValue() const
|
|
|
|
{
|
|
|
|
return default_value ? default_value : "";
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SettingInfo::BooleanDefaultValue() const
|
|
|
|
{
|
|
|
|
return default_value ? StringUtil::FromChars<bool>(default_value).value_or(false) : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 SettingInfo::IntegerDefaultValue() const
|
|
|
|
{
|
|
|
|
return default_value ? StringUtil::FromChars<s32>(default_value).value_or(0) : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 SettingInfo::IntegerMinValue() const
|
|
|
|
{
|
|
|
|
static constexpr s32 fallback_value = std::numeric_limits<s32>::min();
|
|
|
|
return min_value ? StringUtil::FromChars<s32>(min_value).value_or(fallback_value) : fallback_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 SettingInfo::IntegerMaxValue() const
|
|
|
|
{
|
|
|
|
static constexpr s32 fallback_value = std::numeric_limits<s32>::max();
|
|
|
|
return max_value ? StringUtil::FromChars<s32>(max_value).value_or(fallback_value) : fallback_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 SettingInfo::IntegerStepValue() const
|
|
|
|
{
|
|
|
|
static constexpr s32 fallback_value = 1;
|
|
|
|
return step_value ? StringUtil::FromChars<s32>(step_value).value_or(fallback_value) : fallback_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
float SettingInfo::FloatDefaultValue() const
|
|
|
|
{
|
|
|
|
return default_value ? StringUtil::FromChars<float>(default_value).value_or(0.0f) : 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
float SettingInfo::FloatMinValue() const
|
|
|
|
{
|
|
|
|
static constexpr float fallback_value = std::numeric_limits<float>::min();
|
|
|
|
return min_value ? StringUtil::FromChars<float>(min_value).value_or(fallback_value) : fallback_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
float SettingInfo::FloatMaxValue() const
|
|
|
|
{
|
|
|
|
static constexpr float fallback_value = std::numeric_limits<float>::max();
|
|
|
|
return max_value ? StringUtil::FromChars<float>(max_value).value_or(fallback_value) : fallback_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
float SettingInfo::FloatStepValue() const
|
|
|
|
{
|
|
|
|
static constexpr float fallback_value = 0.1f;
|
|
|
|
return step_value ? StringUtil::FromChars<float>(step_value).value_or(fallback_value) : fallback_value;
|
|
|
|
}
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
Settings::Settings()
|
|
|
|
{
|
|
|
|
controller_types[0] = DEFAULT_CONTROLLER_1_TYPE;
|
|
|
|
memory_card_types[0] = DEFAULT_MEMORY_CARD_1_TYPE;
|
|
|
|
for (u32 i = 1; i < NUM_CONTROLLER_AND_CARD_PORTS; i++)
|
|
|
|
{
|
|
|
|
controller_types[i] = DEFAULT_CONTROLLER_2_TYPE;
|
|
|
|
memory_card_types[i] = DEFAULT_MEMORY_CARD_2_TYPE;
|
|
|
|
}
|
|
|
|
}
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-06-03 16:15:27 +00:00
|
|
|
bool Settings::HasAnyPerGameMemoryCards() const
|
|
|
|
{
|
|
|
|
return std::any_of(memory_card_types.begin(), memory_card_types.end(), [](MemoryCardType t) {
|
|
|
|
return (t == MemoryCardType::PerGame || t == MemoryCardType::PerGameTitle);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-01 22:59:59 +00:00
|
|
|
std::array<TinyString, NUM_CONTROLLER_AND_CARD_PORTS> Settings::GeneratePortLabels() const
|
2021-01-21 07:59:40 +00:00
|
|
|
{
|
2021-03-01 22:59:59 +00:00
|
|
|
static constexpr std::array<std::array<bool, NUM_MULTITAPS>, static_cast<size_t>(MultitapMode::Count)>
|
|
|
|
multitap_enabled_on_port = {{{false, false}, {true, false}, {false, true}, {true, true}}};
|
2021-01-21 07:59:40 +00:00
|
|
|
|
2021-03-01 22:59:59 +00:00
|
|
|
std::array<TinyString, NUM_CONTROLLER_AND_CARD_PORTS> labels;
|
2021-01-21 07:59:40 +00:00
|
|
|
|
2021-03-01 22:59:59 +00:00
|
|
|
u32 logical_port = 0;
|
|
|
|
for (u32 physical_port = 0; physical_port < NUM_MULTITAPS; physical_port++)
|
|
|
|
{
|
|
|
|
if (multitap_enabled_on_port[static_cast<size_t>(multitap_mode)][physical_port])
|
|
|
|
{
|
|
|
|
for (u32 i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
labels[logical_port] = TinyString::FromFormat("Port %u%c", physical_port + 1u, 'A' + i);
|
|
|
|
logical_port++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
labels[logical_port] = TinyString::FromFormat("Port %u", physical_port + 1u);
|
|
|
|
logical_port++;
|
2021-01-21 07:59:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-01 22:59:59 +00:00
|
|
|
return labels;
|
2021-01-21 07:59:40 +00:00
|
|
|
}
|
|
|
|
|
2020-09-29 13:29:28 +00:00
|
|
|
void Settings::CPUOverclockPercentToFraction(u32 percent, u32* numerator, u32* denominator)
|
|
|
|
{
|
|
|
|
const u32 percent_gcd = std::gcd(percent, 100);
|
|
|
|
*numerator = percent / percent_gcd;
|
|
|
|
*denominator = 100u / percent_gcd;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 Settings::CPUOverclockFractionToPercent(u32 numerator, u32 denominator)
|
|
|
|
{
|
|
|
|
return (numerator * 100u) / denominator;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetCPUOverclockPercent(u32 percent)
|
|
|
|
{
|
|
|
|
CPUOverclockPercentToFraction(percent, &cpu_overclock_numerator, &cpu_overclock_denominator);
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 Settings::GetCPUOverclockPercent() const
|
|
|
|
{
|
|
|
|
return CPUOverclockFractionToPercent(cpu_overclock_numerator, cpu_overclock_denominator);
|
|
|
|
}
|
|
|
|
|
2020-09-30 13:46:35 +00:00
|
|
|
void Settings::UpdateOverclockActive()
|
|
|
|
{
|
|
|
|
cpu_overclock_active = (cpu_overclock_enable && (cpu_overclock_numerator != 1 || cpu_overclock_denominator != 1));
|
|
|
|
}
|
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
void Settings::Load(SettingsInterface& si)
|
2019-11-06 15:43:51 +00:00
|
|
|
{
|
2019-12-30 11:22:22 +00:00
|
|
|
region =
|
2021-05-26 07:59:09 +00:00
|
|
|
ParseConsoleRegionName(
|
|
|
|
si.GetStringValue("Console", "Region", Settings::GetConsoleRegionName(Settings::DEFAULT_CONSOLE_REGION)).c_str())
|
|
|
|
.value_or(DEFAULT_CONSOLE_REGION);
|
2021-05-02 10:46:48 +00:00
|
|
|
enable_8mb_ram = si.GetBoolValue("Console", "Enable8MBRAM", false);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
emulation_speed = si.GetFloatValue("Main", "EmulationSpeed", 1.0f);
|
2020-11-03 11:21:11 +00:00
|
|
|
fast_forward_speed = si.GetFloatValue("Main", "FastForwardSpeed", 0.0f);
|
2021-01-10 15:57:10 +00:00
|
|
|
turbo_speed = si.GetFloatValue("Main", "TurboSpeed", 0.0f);
|
2021-01-14 08:08:48 +00:00
|
|
|
sync_to_host_refresh_rate = si.GetBoolValue("Main", "SyncToHostRefreshRate", false);
|
2020-02-28 07:00:09 +00:00
|
|
|
increase_timer_resolution = si.GetBoolValue("Main", "IncreaseTimerResolution", true);
|
2021-06-20 05:41:01 +00:00
|
|
|
inhibit_screensaver = si.GetBoolValue("Main", "InhibitScreensaver", true);
|
2020-03-12 03:53:43 +00:00
|
|
|
start_paused = si.GetBoolValue("Main", "StartPaused", false);
|
2020-03-12 03:53:58 +00:00
|
|
|
start_fullscreen = si.GetBoolValue("Main", "StartFullscreen", false);
|
2020-12-04 14:16:22 +00:00
|
|
|
pause_on_focus_loss = si.GetBoolValue("Main", "PauseOnFocusLoss", false);
|
2021-02-24 08:56:43 +00:00
|
|
|
pause_on_menu = si.GetBoolValue("Main", "PauseOnMenu", true);
|
2020-02-28 07:00:09 +00:00
|
|
|
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
|
2022-08-18 11:21:22 +00:00
|
|
|
create_save_state_backups = si.GetBoolValue("Main", "CreateSaveStateBackups", DEFAULT_SAVE_STATE_BACKUPS);
|
|
|
|
compress_save_states = si.GetBoolValue("Main", "CompressSaveStates", DEFAULT_SAVE_STATE_COMPRESSION);
|
2020-02-28 07:00:09 +00:00
|
|
|
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
|
2020-07-01 14:43:18 +00:00
|
|
|
load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
2022-07-22 14:13:55 +00:00
|
|
|
apply_compatibility_settings = si.GetBoolValue("Main", "ApplyCompatibilitySettings", true);
|
2020-08-20 14:08:40 +00:00
|
|
|
apply_game_settings = si.GetBoolValue("Main", "ApplyGameSettings", true);
|
2021-02-27 03:55:56 +00:00
|
|
|
auto_load_cheats = si.GetBoolValue("Main", "AutoLoadCheats", true);
|
2020-12-30 07:39:29 +00:00
|
|
|
disable_all_enhancements = si.GetBoolValue("Main", "DisableAllEnhancements", false);
|
2021-01-23 09:00:54 +00:00
|
|
|
rewind_enable = si.GetBoolValue("Main", "RewindEnable", false);
|
|
|
|
rewind_save_frequency = si.GetFloatValue("Main", "RewindFrequency", 10.0f);
|
|
|
|
rewind_save_slots = static_cast<u32>(si.GetIntValue("Main", "RewindSaveSlots", 10));
|
2021-01-25 16:48:40 +00:00
|
|
|
runahead_frames = static_cast<u32>(si.GetIntValue("Main", "RunaheadFrameCount", 0));
|
2019-11-16 10:27:30 +00:00
|
|
|
|
2020-06-30 14:33:53 +00:00
|
|
|
cpu_execution_mode =
|
|
|
|
ParseCPUExecutionMode(
|
|
|
|
si.GetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(DEFAULT_CPU_EXECUTION_MODE)).c_str())
|
|
|
|
.value_or(DEFAULT_CPU_EXECUTION_MODE);
|
2020-09-29 13:29:28 +00:00
|
|
|
cpu_overclock_numerator = std::max(si.GetIntValue("CPU", "OverclockNumerator", 1), 1);
|
|
|
|
cpu_overclock_denominator = std::max(si.GetIntValue("CPU", "OverclockDenominator", 1), 1);
|
|
|
|
cpu_overclock_enable = si.GetBoolValue("CPU", "OverclockEnable", false);
|
2020-09-30 13:46:35 +00:00
|
|
|
UpdateOverclockActive();
|
2020-08-08 06:44:12 +00:00
|
|
|
cpu_recompiler_memory_exceptions = si.GetBoolValue("CPU", "RecompilerMemoryExceptions", false);
|
2021-05-22 04:55:25 +00:00
|
|
|
cpu_recompiler_block_linking = si.GetBoolValue("CPU", "RecompilerBlockLinking", true);
|
2020-08-29 12:07:33 +00:00
|
|
|
cpu_recompiler_icache = si.GetBoolValue("CPU", "RecompilerICache", false);
|
2020-11-22 15:06:25 +00:00
|
|
|
cpu_fastmem_mode = ParseCPUFastmemMode(
|
|
|
|
si.GetStringValue("CPU", "FastmemMode", GetCPUFastmemModeName(DEFAULT_CPU_FASTMEM_MODE)).c_str())
|
|
|
|
.value_or(DEFAULT_CPU_FASTMEM_MODE);
|
2019-11-16 10:50:11 +00:00
|
|
|
|
2020-02-15 01:21:57 +00:00
|
|
|
gpu_renderer = ParseRendererName(si.GetStringValue("GPU", "Renderer", GetRendererName(DEFAULT_GPU_RENDERER)).c_str())
|
|
|
|
.value_or(DEFAULT_GPU_RENDERER);
|
2020-06-19 17:33:57 +00:00
|
|
|
gpu_adapter = si.GetStringValue("GPU", "Adapter", "");
|
2019-12-30 11:22:22 +00:00
|
|
|
gpu_resolution_scale = static_cast<u32>(si.GetIntValue("GPU", "ResolutionScale", 1));
|
2020-10-30 14:38:06 +00:00
|
|
|
gpu_multisamples = static_cast<u32>(si.GetIntValue("GPU", "Multisamples", 1));
|
2020-04-11 06:37:51 +00:00
|
|
|
gpu_use_debug_device = si.GetBoolValue("GPU", "UseDebugDevice", false);
|
2020-10-30 14:38:06 +00:00
|
|
|
gpu_per_sample_shading = si.GetBoolValue("GPU", "PerSampleShading", false);
|
2020-11-21 03:32:58 +00:00
|
|
|
gpu_use_thread = si.GetBoolValue("GPU", "UseThread", true);
|
2021-05-19 03:43:49 +00:00
|
|
|
gpu_use_software_renderer_for_readbacks = si.GetBoolValue("GPU", "UseSoftwareRendererForReadbacks", false);
|
2020-12-26 13:22:24 +00:00
|
|
|
gpu_threaded_presentation = si.GetBoolValue("GPU", "ThreadedPresentation", true);
|
2022-07-11 13:03:29 +00:00
|
|
|
gpu_true_color = si.GetBoolValue("GPU", "TrueColor", true);
|
|
|
|
gpu_scaled_dithering = si.GetBoolValue("GPU", "ScaledDithering", true);
|
2020-09-11 12:20:19 +00:00
|
|
|
gpu_texture_filter =
|
|
|
|
ParseTextureFilterName(
|
|
|
|
si.GetStringValue("GPU", "TextureFilter", GetTextureFilterName(DEFAULT_GPU_TEXTURE_FILTER)).c_str())
|
|
|
|
.value_or(DEFAULT_GPU_TEXTURE_FILTER);
|
2020-12-30 06:26:20 +00:00
|
|
|
gpu_downsample_mode =
|
|
|
|
ParseDownsampleModeName(
|
|
|
|
si.GetStringValue("GPU", "DownsampleMode", GetDownsampleModeName(DEFAULT_GPU_DOWNSAMPLE_MODE)).c_str())
|
|
|
|
.value_or(DEFAULT_GPU_DOWNSAMPLE_MODE);
|
2021-01-28 13:52:23 +00:00
|
|
|
gpu_disable_interlacing = si.GetBoolValue("GPU", "DisableInterlacing", true);
|
2020-04-10 03:34:12 +00:00
|
|
|
gpu_force_ntsc_timings = si.GetBoolValue("GPU", "ForceNTSCTimings", false);
|
2020-07-17 14:25:08 +00:00
|
|
|
gpu_widescreen_hack = si.GetBoolValue("GPU", "WidescreenHack", false);
|
2020-11-03 04:17:51 +00:00
|
|
|
gpu_24bit_chroma_smoothing = si.GetBoolValue("GPU", "ChromaSmoothing24Bit", false);
|
2020-08-01 14:25:07 +00:00
|
|
|
gpu_pgxp_enable = si.GetBoolValue("GPU", "PGXPEnable", false);
|
|
|
|
gpu_pgxp_culling = si.GetBoolValue("GPU", "PGXPCulling", true);
|
|
|
|
gpu_pgxp_texture_correction = si.GetBoolValue("GPU", "PGXPTextureCorrection", true);
|
2022-10-03 10:03:30 +00:00
|
|
|
gpu_pgxp_color_correction = si.GetBoolValue("GPU", "PGXPColorCorrection", false);
|
2020-08-01 14:25:07 +00:00
|
|
|
gpu_pgxp_vertex_cache = si.GetBoolValue("GPU", "PGXPVertexCache", false);
|
2020-08-19 13:26:57 +00:00
|
|
|
gpu_pgxp_cpu = si.GetBoolValue("GPU", "PGXPCPU", false);
|
2020-10-09 14:07:07 +00:00
|
|
|
gpu_pgxp_preserve_proj_fp = si.GetBoolValue("GPU", "PGXPPreserveProjFP", false);
|
2020-11-26 14:02:13 +00:00
|
|
|
gpu_pgxp_tolerance = si.GetFloatValue("GPU", "PGXPTolerance", -1.0f);
|
2020-12-22 15:10:49 +00:00
|
|
|
gpu_pgxp_depth_buffer = si.GetBoolValue("GPU", "PGXPDepthBuffer", false);
|
|
|
|
SetPGXPDepthClearThreshold(si.GetFloatValue("GPU", "PGXPDepthClearThreshold", DEFAULT_GPU_PGXP_DEPTH_THRESHOLD));
|
2019-11-23 10:22:09 +00:00
|
|
|
|
2020-06-30 14:33:53 +00:00
|
|
|
display_crop_mode =
|
|
|
|
ParseDisplayCropMode(
|
|
|
|
si.GetStringValue("Display", "CropMode", GetDisplayCropModeName(DEFAULT_DISPLAY_CROP_MODE)).c_str())
|
|
|
|
.value_or(DEFAULT_DISPLAY_CROP_MODE);
|
2020-04-10 05:12:16 +00:00
|
|
|
display_aspect_ratio =
|
|
|
|
ParseDisplayAspectRatio(
|
2020-06-30 14:33:53 +00:00
|
|
|
si.GetStringValue("Display", "AspectRatio", GetDisplayAspectRatioName(DEFAULT_DISPLAY_ASPECT_RATIO)).c_str())
|
|
|
|
.value_or(DEFAULT_DISPLAY_ASPECT_RATIO);
|
2021-04-28 16:42:08 +00:00
|
|
|
display_aspect_ratio_custom_numerator = static_cast<u16>(
|
|
|
|
std::clamp<int>(si.GetIntValue("Display", "CustomAspectRatioNumerator", 4), 1, std::numeric_limits<u16>::max()));
|
|
|
|
display_aspect_ratio_custom_denominator = static_cast<u16>(
|
|
|
|
std::clamp<int>(si.GetIntValue("Display", "CustomAspectRatioDenominator", 3), 1, std::numeric_limits<u16>::max()));
|
2022-10-09 04:55:56 +00:00
|
|
|
display_alignment =
|
|
|
|
ParseDisplayAlignment(
|
|
|
|
si.GetStringValue("Display", "Alignment", GetDisplayAlignmentName(DEFAULT_DISPLAY_ALIGNMENT)).c_str())
|
|
|
|
.value_or(DEFAULT_DISPLAY_ALIGNMENT);
|
2020-09-26 05:11:45 +00:00
|
|
|
display_force_4_3_for_24bit = si.GetBoolValue("Display", "Force4_3For24Bit", false);
|
2020-08-20 11:30:11 +00:00
|
|
|
display_active_start_offset = static_cast<s16>(si.GetIntValue("Display", "ActiveStartOffset", 0));
|
|
|
|
display_active_end_offset = static_cast<s16>(si.GetIntValue("Display", "ActiveEndOffset", 0));
|
2020-12-03 12:31:21 +00:00
|
|
|
display_line_start_offset = static_cast<s8>(si.GetIntValue("Display", "LineStartOffset", 0));
|
|
|
|
display_line_end_offset = static_cast<s8>(si.GetIntValue("Display", "LineEndOffset", 0));
|
2019-12-30 11:22:22 +00:00
|
|
|
display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true);
|
2020-04-30 15:00:22 +00:00
|
|
|
display_integer_scaling = si.GetBoolValue("Display", "IntegerScaling", false);
|
2021-02-27 03:53:03 +00:00
|
|
|
display_stretch = si.GetBoolValue("Display", "Stretch", false);
|
2020-09-13 12:24:20 +00:00
|
|
|
display_post_processing = si.GetBoolValue("Display", "PostProcessing", false);
|
2020-03-21 13:05:04 +00:00
|
|
|
display_show_osd_messages = si.GetBoolValue("Display", "ShowOSDMessages", true);
|
|
|
|
display_show_fps = si.GetBoolValue("Display", "ShowFPS", false);
|
|
|
|
display_show_speed = si.GetBoolValue("Display", "ShowSpeed", false);
|
2020-08-15 14:17:10 +00:00
|
|
|
display_show_resolution = si.GetBoolValue("Display", "ShowResolution", false);
|
2022-07-11 13:03:29 +00:00
|
|
|
display_show_cpu = si.GetBoolValue("Display", "ShowCPU", false);
|
2022-09-03 04:15:15 +00:00
|
|
|
display_show_gpu = si.GetBoolValue("Display", "ShowGPU", false);
|
2021-08-10 14:03:44 +00:00
|
|
|
display_show_status_indicators = si.GetBoolValue("Display", "ShowStatusIndicators", true);
|
2022-07-11 13:03:29 +00:00
|
|
|
display_show_inputs = si.GetBoolValue("Display", "ShowInputs", false);
|
2021-08-15 03:11:27 +00:00
|
|
|
display_show_enhancements = si.GetBoolValue("Display", "ShowEnhancements", false);
|
2021-01-28 10:20:15 +00:00
|
|
|
display_all_frames = si.GetBoolValue("Display", "DisplayAllFrames", false);
|
2022-07-11 13:03:29 +00:00
|
|
|
display_internal_resolution_screenshots = si.GetBoolValue("Display", "InternalResolutionScreenshots", false);
|
2021-05-01 04:31:27 +00:00
|
|
|
video_sync_enabled = si.GetBoolValue("Display", "VSync", DEFAULT_VSYNC_VALUE);
|
2020-09-12 15:19:57 +00:00
|
|
|
display_post_process_chain = si.GetStringValue("Display", "PostProcessChain", "");
|
2021-04-07 17:20:25 +00:00
|
|
|
display_max_fps = si.GetFloatValue("Display", "MaxFPS", DEFAULT_DISPLAY_MAX_FPS);
|
2022-07-11 13:03:29 +00:00
|
|
|
display_osd_scale = si.GetFloatValue("Display", "OSDScale", DEFAULT_OSD_SCALE);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
cdrom_readahead_sectors =
|
|
|
|
static_cast<u8>(si.GetIntValue("CDROM", "ReadaheadSectors", DEFAULT_CDROM_READAHEAD_SECTORS));
|
2021-05-26 07:59:09 +00:00
|
|
|
cdrom_region_check = si.GetBoolValue("CDROM", "RegionCheck", false);
|
2020-07-21 14:03:22 +00:00
|
|
|
cdrom_load_image_to_ram = si.GetBoolValue("CDROM", "LoadImageToRAM", false);
|
2022-08-27 06:52:24 +00:00
|
|
|
cdrom_load_image_patches = si.GetBoolValue("CDROM", "LoadImagePatches", false);
|
2020-10-03 02:24:03 +00:00
|
|
|
cdrom_mute_cd_audio = si.GetBoolValue("CDROM", "MuteCDAudio", false);
|
2020-10-04 14:05:14 +00:00
|
|
|
cdrom_read_speedup = si.GetIntValue("CDROM", "ReadSpeedup", 1);
|
2021-05-23 03:35:10 +00:00
|
|
|
cdrom_seek_speedup = si.GetIntValue("CDROM", "SeekSpeedup", 1);
|
2020-02-21 15:19:10 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
audio_backend =
|
2020-06-30 14:33:53 +00:00
|
|
|
ParseAudioBackend(si.GetStringValue("Audio", "Backend", GetAudioBackendName(DEFAULT_AUDIO_BACKEND)).c_str())
|
|
|
|
.value_or(DEFAULT_AUDIO_BACKEND);
|
2022-08-05 07:50:28 +00:00
|
|
|
audio_driver = si.GetStringValue("Audio", "Driver");
|
2022-07-27 14:42:41 +00:00
|
|
|
audio_stretch_mode =
|
|
|
|
AudioStream::ParseStretchMode(
|
|
|
|
si.GetStringValue("Audio", "StretchMode", AudioStream::GetStretchModeName(DEFAULT_AUDIO_STRETCH_MODE)).c_str())
|
|
|
|
.value_or(DEFAULT_AUDIO_STRETCH_MODE);
|
|
|
|
audio_output_latency_ms = si.GetUIntValue("Audio", "OutputLatencyMS", DEFAULT_AUDIO_OUTPUT_LATENCY_MS);
|
|
|
|
audio_buffer_ms = si.GetUIntValue("Audio", "BufferMS", DEFAULT_AUDIO_BUFFER_MS);
|
|
|
|
audio_output_volume = si.GetUIntValue("Audio", "OutputVolume", 100);
|
|
|
|
audio_fast_forward_volume = si.GetUIntValue("Audio", "FastForwardVolume", 100);
|
|
|
|
|
2020-05-09 14:44:37 +00:00
|
|
|
audio_output_muted = si.GetBoolValue("Audio", "OutputMuted", false);
|
2020-03-15 12:04:17 +00:00
|
|
|
audio_dump_on_boot = si.GetBoolValue("Audio", "DumpOnBoot", false);
|
2019-12-23 07:02:37 +00:00
|
|
|
|
2020-05-17 04:12:23 +00:00
|
|
|
dma_max_slice_ticks = si.GetIntValue("Hacks", "DMAMaxSliceTicks", DEFAULT_DMA_MAX_SLICE_TICKS);
|
|
|
|
dma_halt_ticks = si.GetIntValue("Hacks", "DMAHaltTicks", DEFAULT_DMA_HALT_TICKS);
|
|
|
|
gpu_fifo_size = static_cast<u32>(si.GetIntValue("Hacks", "GPUFIFOSize", DEFAULT_GPU_FIFO_SIZE));
|
|
|
|
gpu_max_run_ahead = si.GetIntValue("Hacks", "GPUMaxRunAhead", DEFAULT_GPU_MAX_RUN_AHEAD);
|
2020-04-29 10:00:22 +00:00
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
bios_patch_tty_enable = si.GetBoolValue("BIOS", "PatchTTYEnable", false);
|
2021-04-07 17:20:25 +00:00
|
|
|
bios_patch_fast_boot = si.GetBoolValue("BIOS", "PatchFastBoot", DEFAULT_FAST_BOOT_VALUE);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
multitap_mode =
|
|
|
|
ParseMultitapModeName(
|
|
|
|
si.GetStringValue("ControllerPorts", "MultitapMode", GetMultitapModeName(DEFAULT_MULTITAP_MODE)).c_str())
|
|
|
|
.value_or(DEFAULT_MULTITAP_MODE);
|
|
|
|
|
|
|
|
controller_types[0] = ParseControllerTypeName(si.GetStringValue(Controller::GetSettingsSection(0).c_str(), "Type",
|
|
|
|
GetControllerTypeName(DEFAULT_CONTROLLER_1_TYPE))
|
|
|
|
.c_str())
|
|
|
|
.value_or(DEFAULT_CONTROLLER_1_TYPE);
|
2021-01-21 07:59:40 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
const std::array<bool, 2> mtap_enabled = {{IsPort1MultitapEnabled(), IsPort2MultitapEnabled()}};
|
2021-01-21 07:59:40 +00:00
|
|
|
for (u32 i = 1; i < NUM_CONTROLLER_AND_CARD_PORTS; i++)
|
|
|
|
{
|
2022-07-11 13:03:29 +00:00
|
|
|
// Ignore types when multitap not enabled
|
|
|
|
const auto [port, slot] = Controller::ConvertPadToPortAndSlot(i);
|
|
|
|
if (Controller::PadIsMultitapSlot(slot) && !mtap_enabled[port])
|
|
|
|
{
|
|
|
|
controller_types[i] = ControllerType::None;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
controller_types[i] = ParseControllerTypeName(si.GetStringValue(Controller::GetSettingsSection(i).c_str(), "Type",
|
|
|
|
GetControllerTypeName(DEFAULT_CONTROLLER_2_TYPE))
|
|
|
|
.c_str())
|
|
|
|
.value_or(DEFAULT_CONTROLLER_2_TYPE);
|
2021-01-21 07:59:40 +00:00
|
|
|
}
|
2020-01-02 06:10:30 +00:00
|
|
|
|
2020-04-27 06:15:38 +00:00
|
|
|
memory_card_types[0] =
|
|
|
|
ParseMemoryCardTypeName(
|
2020-06-30 14:33:53 +00:00
|
|
|
si.GetStringValue("MemoryCards", "Card1Type", GetMemoryCardTypeName(DEFAULT_MEMORY_CARD_1_TYPE)).c_str())
|
|
|
|
.value_or(DEFAULT_MEMORY_CARD_1_TYPE);
|
2020-04-27 06:15:38 +00:00
|
|
|
memory_card_types[1] =
|
|
|
|
ParseMemoryCardTypeName(
|
2020-06-30 14:33:53 +00:00
|
|
|
si.GetStringValue("MemoryCards", "Card2Type", GetMemoryCardTypeName(DEFAULT_MEMORY_CARD_2_TYPE)).c_str())
|
|
|
|
.value_or(DEFAULT_MEMORY_CARD_2_TYPE);
|
2021-03-27 05:18:23 +00:00
|
|
|
memory_card_paths[0] = si.GetStringValue("MemoryCards", "Card1Path", "");
|
|
|
|
memory_card_paths[1] = si.GetStringValue("MemoryCards", "Card2Path", "");
|
2020-08-15 10:38:54 +00:00
|
|
|
memory_card_use_playlist_title = si.GetBoolValue("MemoryCards", "UsePlaylistTitle", true);
|
2020-02-04 06:22:48 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
achievements_enabled = si.GetBoolValue("Cheevos", "Enabled", false);
|
|
|
|
achievements_test_mode = si.GetBoolValue("Cheevos", "TestMode", false);
|
|
|
|
achievements_unofficial_test_mode = si.GetBoolValue("Cheevos", "UnofficialTestMode", false);
|
|
|
|
achievements_use_first_disc_from_playlist = si.GetBoolValue("Cheevos", "UseFirstDiscFromPlaylist", true);
|
|
|
|
achievements_rich_presence = si.GetBoolValue("Cheevos", "RichPresence", true);
|
|
|
|
achievements_challenge_mode = si.GetBoolValue("Cheevos", "ChallengeMode", false);
|
2022-09-21 13:45:24 +00:00
|
|
|
achievements_leaderboards = si.GetBoolValue("Cheevos", "Leaderboards", true);
|
2022-09-21 12:54:37 +00:00
|
|
|
achievements_sound_effects = si.GetBoolValue("Cheevos", "SoundEffects", true);
|
2022-10-08 10:25:34 +00:00
|
|
|
achievements_primed_indicators = si.GetBoolValue("Cheevos", "PrimedIndicators", true);
|
2021-01-21 07:59:40 +00:00
|
|
|
|
2020-06-30 14:33:53 +00:00
|
|
|
log_level = ParseLogLevelName(si.GetStringValue("Logging", "LogLevel", GetLogLevelName(DEFAULT_LOG_LEVEL)).c_str())
|
|
|
|
.value_or(DEFAULT_LOG_LEVEL);
|
2020-04-30 14:58:32 +00:00
|
|
|
log_filter = si.GetStringValue("Logging", "LogFilter", "");
|
2021-02-06 17:27:37 +00:00
|
|
|
log_to_console = si.GetBoolValue("Logging", "LogToConsole", DEFAULT_LOG_TO_CONSOLE);
|
2020-04-30 14:58:32 +00:00
|
|
|
log_to_debug = si.GetBoolValue("Logging", "LogToDebug", false);
|
|
|
|
log_to_window = si.GetBoolValue("Logging", "LogToWindow", false);
|
|
|
|
log_to_file = si.GetBoolValue("Logging", "LogToFile", false);
|
|
|
|
|
2020-02-04 06:22:48 +00:00
|
|
|
debugging.show_vram = si.GetBoolValue("Debug", "ShowVRAM");
|
|
|
|
debugging.dump_cpu_to_vram_copies = si.GetBoolValue("Debug", "DumpCPUToVRAMCopies");
|
|
|
|
debugging.dump_vram_to_cpu_copies = si.GetBoolValue("Debug", "DumpVRAMToCPUCopies");
|
2020-12-09 17:07:49 +00:00
|
|
|
debugging.enable_gdb_server = si.GetBoolValue("Debug", "EnableGDBServer");
|
2021-01-25 16:23:06 +00:00
|
|
|
debugging.gdb_server_port = static_cast<u16>(si.GetIntValue("Debug", "GDBServerPort"));
|
2020-02-04 06:22:48 +00:00
|
|
|
debugging.show_gpu_state = si.GetBoolValue("Debug", "ShowGPUState");
|
|
|
|
debugging.show_cdrom_state = si.GetBoolValue("Debug", "ShowCDROMState");
|
|
|
|
debugging.show_spu_state = si.GetBoolValue("Debug", "ShowSPUState");
|
|
|
|
debugging.show_timers_state = si.GetBoolValue("Debug", "ShowTimersState");
|
|
|
|
debugging.show_mdec_state = si.GetBoolValue("Debug", "ShowMDECState");
|
2020-09-26 09:33:10 +00:00
|
|
|
debugging.show_dma_state = si.GetBoolValue("Debug", "ShowDMAState");
|
2020-12-25 08:02:38 +00:00
|
|
|
|
|
|
|
texture_replacements.enable_vram_write_replacements =
|
|
|
|
si.GetBoolValue("TextureReplacements", "EnableVRAMWriteReplacements", false);
|
|
|
|
texture_replacements.preload_textures = si.GetBoolValue("TextureReplacements", "PreloadTextures", false);
|
|
|
|
texture_replacements.dump_vram_writes = si.GetBoolValue("TextureReplacements", "DumpVRAMWrites", false);
|
|
|
|
texture_replacements.dump_vram_write_force_alpha_channel =
|
|
|
|
si.GetBoolValue("TextureReplacements", "DumpVRAMWriteForceAlphaChannel", true);
|
|
|
|
texture_replacements.dump_vram_write_width_threshold =
|
|
|
|
si.GetIntValue("TextureReplacements", "DumpVRAMWriteWidthThreshold", 128);
|
|
|
|
texture_replacements.dump_vram_write_height_threshold =
|
|
|
|
si.GetIntValue("TextureReplacements", "DumpVRAMWriteHeightThreshold", 128);
|
2019-11-06 15:43:51 +00:00
|
|
|
}
|
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
void Settings::Save(SettingsInterface& si) const
|
2019-11-06 15:43:51 +00:00
|
|
|
{
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetStringValue("Console", "Region", GetConsoleRegionName(region));
|
2021-05-02 10:46:48 +00:00
|
|
|
si.SetBoolValue("Console", "Enable8MBRAM", enable_8mb_ram);
|
2019-11-16 10:27:30 +00:00
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
si.SetFloatValue("Main", "EmulationSpeed", emulation_speed);
|
2020-11-03 11:21:11 +00:00
|
|
|
si.SetFloatValue("Main", "FastForwardSpeed", fast_forward_speed);
|
2021-01-10 15:57:10 +00:00
|
|
|
si.SetFloatValue("Main", "TurboSpeed", turbo_speed);
|
2021-01-10 17:50:44 +00:00
|
|
|
si.SetBoolValue("Main", "SyncToHostRefreshRate", sync_to_host_refresh_rate);
|
2020-02-28 07:00:09 +00:00
|
|
|
si.SetBoolValue("Main", "IncreaseTimerResolution", increase_timer_resolution);
|
2021-06-20 05:41:01 +00:00
|
|
|
si.SetBoolValue("Main", "InhibitScreensaver", inhibit_screensaver);
|
2020-02-28 07:00:09 +00:00
|
|
|
si.SetBoolValue("Main", "StartPaused", start_paused);
|
2020-03-12 03:53:58 +00:00
|
|
|
si.SetBoolValue("Main", "StartFullscreen", start_fullscreen);
|
2020-12-04 14:16:22 +00:00
|
|
|
si.SetBoolValue("Main", "PauseOnFocusLoss", pause_on_focus_loss);
|
2021-02-24 08:56:43 +00:00
|
|
|
si.SetBoolValue("Main", "PauseOnMenu", pause_on_menu);
|
2020-02-28 07:00:09 +00:00
|
|
|
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
|
2022-07-11 13:03:29 +00:00
|
|
|
si.SetBoolValue("Main", "CreateSaveStateBackups", create_save_state_backups);
|
2022-08-18 11:21:22 +00:00
|
|
|
si.SetBoolValue("Main", "CompressSaveStates", compress_save_states);
|
2020-02-28 07:00:09 +00:00
|
|
|
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
|
2020-07-01 14:43:18 +00:00
|
|
|
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
|
2022-07-22 14:13:55 +00:00
|
|
|
si.SetBoolValue("Main", "ApplyCompatibilitySettings", apply_compatibility_settings);
|
2020-08-20 14:08:40 +00:00
|
|
|
si.SetBoolValue("Main", "ApplyGameSettings", apply_game_settings);
|
2020-09-09 13:44:02 +00:00
|
|
|
si.SetBoolValue("Main", "AutoLoadCheats", auto_load_cheats);
|
2020-12-30 07:39:29 +00:00
|
|
|
si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements);
|
2021-01-23 09:00:54 +00:00
|
|
|
si.SetBoolValue("Main", "RewindEnable", rewind_enable);
|
|
|
|
si.SetFloatValue("Main", "RewindFrequency", rewind_save_frequency);
|
|
|
|
si.SetIntValue("Main", "RewindSaveSlots", rewind_save_slots);
|
2021-01-25 16:48:40 +00:00
|
|
|
si.SetIntValue("Main", "RunaheadFrameCount", runahead_frames);
|
2019-11-16 10:50:11 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(cpu_execution_mode));
|
2020-09-29 13:29:28 +00:00
|
|
|
si.SetBoolValue("CPU", "OverclockEnable", cpu_overclock_enable);
|
|
|
|
si.SetIntValue("CPU", "OverclockNumerator", cpu_overclock_numerator);
|
|
|
|
si.SetIntValue("CPU", "OverclockDenominator", cpu_overclock_denominator);
|
2020-08-08 06:44:12 +00:00
|
|
|
si.SetBoolValue("CPU", "RecompilerMemoryExceptions", cpu_recompiler_memory_exceptions);
|
2021-05-22 04:55:25 +00:00
|
|
|
si.SetBoolValue("CPU", "RecompilerBlockLinking", cpu_recompiler_block_linking);
|
2020-08-29 12:07:33 +00:00
|
|
|
si.SetBoolValue("CPU", "RecompilerICache", cpu_recompiler_icache);
|
2020-11-22 15:06:25 +00:00
|
|
|
si.SetStringValue("CPU", "FastmemMode", GetCPUFastmemModeName(cpu_fastmem_mode));
|
2019-11-23 10:22:09 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetStringValue("GPU", "Renderer", GetRendererName(gpu_renderer));
|
2020-06-19 17:33:57 +00:00
|
|
|
si.SetStringValue("GPU", "Adapter", gpu_adapter.c_str());
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetIntValue("GPU", "ResolutionScale", static_cast<long>(gpu_resolution_scale));
|
2020-10-30 14:38:06 +00:00
|
|
|
si.SetIntValue("GPU", "Multisamples", static_cast<long>(gpu_multisamples));
|
2020-04-11 06:37:51 +00:00
|
|
|
si.SetBoolValue("GPU", "UseDebugDevice", gpu_use_debug_device);
|
2020-10-30 14:38:06 +00:00
|
|
|
si.SetBoolValue("GPU", "PerSampleShading", gpu_per_sample_shading);
|
2020-11-21 03:32:58 +00:00
|
|
|
si.SetBoolValue("GPU", "UseThread", gpu_use_thread);
|
2020-12-26 13:22:24 +00:00
|
|
|
si.SetBoolValue("GPU", "ThreadedPresentation", gpu_threaded_presentation);
|
2021-05-19 03:43:49 +00:00
|
|
|
si.SetBoolValue("GPU", "UseSoftwareRendererForReadbacks", gpu_use_software_renderer_for_readbacks);
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetBoolValue("GPU", "TrueColor", gpu_true_color);
|
2020-02-29 14:05:31 +00:00
|
|
|
si.SetBoolValue("GPU", "ScaledDithering", gpu_scaled_dithering);
|
2020-09-11 12:20:19 +00:00
|
|
|
si.SetStringValue("GPU", "TextureFilter", GetTextureFilterName(gpu_texture_filter));
|
2020-12-30 06:26:20 +00:00
|
|
|
si.SetStringValue("GPU", "DownsampleMode", GetDownsampleModeName(gpu_downsample_mode));
|
2020-04-11 06:37:51 +00:00
|
|
|
si.SetBoolValue("GPU", "DisableInterlacing", gpu_disable_interlacing);
|
2020-04-10 03:34:12 +00:00
|
|
|
si.SetBoolValue("GPU", "ForceNTSCTimings", gpu_force_ntsc_timings);
|
2020-07-17 14:25:08 +00:00
|
|
|
si.SetBoolValue("GPU", "WidescreenHack", gpu_widescreen_hack);
|
2020-11-03 04:17:51 +00:00
|
|
|
si.SetBoolValue("GPU", "ChromaSmoothing24Bit", gpu_24bit_chroma_smoothing);
|
2020-08-01 14:25:07 +00:00
|
|
|
si.SetBoolValue("GPU", "PGXPEnable", gpu_pgxp_enable);
|
|
|
|
si.SetBoolValue("GPU", "PGXPCulling", gpu_pgxp_culling);
|
|
|
|
si.SetBoolValue("GPU", "PGXPTextureCorrection", gpu_pgxp_texture_correction);
|
2022-10-03 10:03:30 +00:00
|
|
|
si.SetBoolValue("GPU", "PGXPColorCorrection", gpu_pgxp_color_correction);
|
2020-08-01 14:25:07 +00:00
|
|
|
si.SetBoolValue("GPU", "PGXPVertexCache", gpu_pgxp_vertex_cache);
|
2020-08-19 13:26:57 +00:00
|
|
|
si.SetBoolValue("GPU", "PGXPCPU", gpu_pgxp_cpu);
|
2020-10-09 14:07:07 +00:00
|
|
|
si.SetBoolValue("GPU", "PGXPPreserveProjFP", gpu_pgxp_preserve_proj_fp);
|
2020-11-26 14:02:13 +00:00
|
|
|
si.SetFloatValue("GPU", "PGXPTolerance", gpu_pgxp_tolerance);
|
2020-12-22 15:10:49 +00:00
|
|
|
si.SetBoolValue("GPU", "PGXPDepthBuffer", gpu_pgxp_depth_buffer);
|
|
|
|
si.SetFloatValue("GPU", "PGXPDepthClearThreshold", GetPGXPDepthClearThreshold());
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-03-28 15:13:53 +00:00
|
|
|
si.SetStringValue("Display", "CropMode", GetDisplayCropModeName(display_crop_mode));
|
2020-08-20 11:30:11 +00:00
|
|
|
si.SetIntValue("Display", "ActiveStartOffset", display_active_start_offset);
|
|
|
|
si.SetIntValue("Display", "ActiveEndOffset", display_active_end_offset);
|
2020-12-03 12:31:21 +00:00
|
|
|
si.SetIntValue("Display", "LineStartOffset", display_line_start_offset);
|
|
|
|
si.SetIntValue("Display", "LineEndOffset", display_line_end_offset);
|
2020-09-26 05:11:45 +00:00
|
|
|
si.SetBoolValue("Display", "Force4_3For24Bit", display_force_4_3_for_24bit);
|
2020-04-10 05:12:16 +00:00
|
|
|
si.SetStringValue("Display", "AspectRatio", GetDisplayAspectRatioName(display_aspect_ratio));
|
2022-10-09 04:55:56 +00:00
|
|
|
si.SetStringValue("Display", "Alignment", GetDisplayAlignmentName(display_alignment));
|
2021-04-28 16:42:08 +00:00
|
|
|
si.SetIntValue("Display", "CustomAspectRatioNumerator", display_aspect_ratio_custom_numerator);
|
|
|
|
si.GetIntValue("Display", "CustomAspectRatioDenominator", display_aspect_ratio_custom_denominator);
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetBoolValue("Display", "LinearFiltering", display_linear_filtering);
|
2020-04-30 15:00:22 +00:00
|
|
|
si.SetBoolValue("Display", "IntegerScaling", display_integer_scaling);
|
2021-02-27 03:53:03 +00:00
|
|
|
si.SetBoolValue("Display", "Stretch", display_stretch);
|
2020-09-13 12:24:20 +00:00
|
|
|
si.SetBoolValue("Display", "PostProcessing", display_post_processing);
|
2020-03-21 13:05:04 +00:00
|
|
|
si.SetBoolValue("Display", "ShowOSDMessages", display_show_osd_messages);
|
|
|
|
si.SetBoolValue("Display", "ShowFPS", display_show_fps);
|
|
|
|
si.SetBoolValue("Display", "ShowSpeed", display_show_speed);
|
2021-01-30 05:30:16 +00:00
|
|
|
si.SetBoolValue("Display", "ShowResolution", display_show_resolution);
|
2022-07-11 13:03:29 +00:00
|
|
|
si.SetBoolValue("Display", "ShowCPU", display_show_cpu);
|
2022-09-03 04:15:15 +00:00
|
|
|
si.SetBoolValue("Display", "ShowGPU", display_show_gpu);
|
2021-08-10 14:03:44 +00:00
|
|
|
si.SetBoolValue("Display", "ShowStatusIndicators", display_show_status_indicators);
|
2022-07-11 13:03:29 +00:00
|
|
|
si.SetBoolValue("Display", "ShowInputs", display_show_inputs);
|
2021-08-15 03:11:27 +00:00
|
|
|
si.SetBoolValue("Display", "ShowEnhancements", display_show_enhancements);
|
2021-01-28 10:20:15 +00:00
|
|
|
si.SetBoolValue("Display", "DisplayAllFrames", display_all_frames);
|
2022-07-11 13:03:29 +00:00
|
|
|
si.SetBoolValue("Display", "InternalResolutionScreenshots", display_internal_resolution_screenshots);
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetBoolValue("Display", "VSync", video_sync_enabled);
|
2020-09-12 15:19:57 +00:00
|
|
|
if (display_post_process_chain.empty())
|
|
|
|
si.DeleteValue("Display", "PostProcessChain");
|
|
|
|
else
|
|
|
|
si.SetStringValue("Display", "PostProcessChain", display_post_process_chain.c_str());
|
2020-11-03 05:58:40 +00:00
|
|
|
si.SetFloatValue("Display", "MaxFPS", display_max_fps);
|
2022-07-11 13:03:29 +00:00
|
|
|
si.SetFloatValue("Display", "OSDScale", display_osd_scale);
|
2019-12-23 07:02:37 +00:00
|
|
|
|
2021-07-12 11:08:04 +00:00
|
|
|
si.SetIntValue("CDROM", "ReadaheadSectors", cdrom_readahead_sectors);
|
2020-03-31 15:48:37 +00:00
|
|
|
si.SetBoolValue("CDROM", "RegionCheck", cdrom_region_check);
|
2020-07-21 14:03:22 +00:00
|
|
|
si.SetBoolValue("CDROM", "LoadImageToRAM", cdrom_load_image_to_ram);
|
2022-08-27 06:52:24 +00:00
|
|
|
si.SetBoolValue("CDROM", "LoadImagePatches", cdrom_load_image_patches);
|
2020-10-03 02:24:03 +00:00
|
|
|
si.SetBoolValue("CDROM", "MuteCDAudio", cdrom_mute_cd_audio);
|
2020-10-04 14:05:14 +00:00
|
|
|
si.SetIntValue("CDROM", "ReadSpeedup", cdrom_read_speedup);
|
2021-05-23 03:35:10 +00:00
|
|
|
si.SetIntValue("CDROM", "SeekSpeedup", cdrom_seek_speedup);
|
2020-02-21 15:19:10 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetStringValue("Audio", "Backend", GetAudioBackendName(audio_backend));
|
2022-08-05 07:50:28 +00:00
|
|
|
si.SetStringValue("Audio", "Driver", audio_driver.c_str());
|
2022-07-27 14:42:41 +00:00
|
|
|
si.SetStringValue("Audio", "StretchMode", AudioStream::GetStretchModeName(audio_stretch_mode));
|
|
|
|
si.SetUIntValue("Audio", "BufferMS", audio_buffer_ms);
|
|
|
|
si.SetUIntValue("Audio", "OutputLatencyMS", audio_output_latency_ms);
|
|
|
|
si.SetUIntValue("Audio", "OutputVolume", audio_output_volume);
|
|
|
|
si.SetUIntValue("Audio", "FastForwardVolume", audio_fast_forward_volume);
|
2020-05-09 14:44:37 +00:00
|
|
|
si.SetBoolValue("Audio", "OutputMuted", audio_output_muted);
|
2020-03-15 12:04:17 +00:00
|
|
|
si.SetBoolValue("Audio", "DumpOnBoot", audio_dump_on_boot);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-05-17 04:12:23 +00:00
|
|
|
si.SetIntValue("Hacks", "DMAMaxSliceTicks", dma_max_slice_ticks);
|
|
|
|
si.SetIntValue("Hacks", "DMAHaltTicks", dma_halt_ticks);
|
|
|
|
si.SetIntValue("Hacks", "GPUFIFOSize", gpu_fifo_size);
|
|
|
|
si.SetIntValue("Hacks", "GPUMaxRunAhead", gpu_max_run_ahead);
|
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetBoolValue("BIOS", "PatchTTYEnable", bios_patch_tty_enable);
|
|
|
|
si.SetBoolValue("BIOS", "PatchFastBoot", bios_patch_fast_boot);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2021-02-26 17:37:53 +00:00
|
|
|
for (u32 i = 0; i < NUM_CONTROLLER_AND_CARD_PORTS; i++)
|
|
|
|
{
|
|
|
|
si.SetStringValue(TinyString::FromFormat("Controller%u", i + 1u), "Type",
|
|
|
|
GetControllerTypeName(controller_types[i]));
|
|
|
|
}
|
2019-12-14 13:29:26 +00:00
|
|
|
|
2020-04-27 06:15:38 +00:00
|
|
|
si.SetStringValue("MemoryCards", "Card1Type", GetMemoryCardTypeName(memory_card_types[0]));
|
|
|
|
si.SetStringValue("MemoryCards", "Card2Type", GetMemoryCardTypeName(memory_card_types[1]));
|
2021-03-27 05:18:23 +00:00
|
|
|
if (!memory_card_paths[0].empty())
|
|
|
|
si.SetStringValue("MemoryCards", "Card1Path", memory_card_paths[0].c_str());
|
|
|
|
else
|
|
|
|
si.DeleteValue("MemoryCards", "Card1Path");
|
|
|
|
|
|
|
|
if (!memory_card_paths[1].empty())
|
|
|
|
si.SetStringValue("MemoryCards", "Card2Path", memory_card_paths[1].c_str());
|
|
|
|
else
|
|
|
|
si.DeleteValue("MemoryCards", "Card2Path");
|
|
|
|
|
2020-08-15 10:38:54 +00:00
|
|
|
si.SetBoolValue("MemoryCards", "UsePlaylistTitle", memory_card_use_playlist_title);
|
2020-02-04 06:22:48 +00:00
|
|
|
|
2021-01-21 07:59:40 +00:00
|
|
|
si.SetStringValue("ControllerPorts", "MultitapMode", GetMultitapModeName(multitap_mode));
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
si.SetBoolValue("Cheevos", "Enabled", achievements_enabled);
|
|
|
|
si.SetBoolValue("Cheevos", "TestMode", achievements_test_mode);
|
|
|
|
si.SetBoolValue("Cheevos", "UnofficialTestMode", achievements_unofficial_test_mode);
|
|
|
|
si.SetBoolValue("Cheevos", "UseFirstDiscFromPlaylist", achievements_use_first_disc_from_playlist);
|
|
|
|
si.SetBoolValue("Cheevos", "RichPresence", achievements_rich_presence);
|
|
|
|
si.SetBoolValue("Cheevos", "ChallengeMode", achievements_challenge_mode);
|
2022-09-21 13:45:24 +00:00
|
|
|
si.SetBoolValue("Cheevos", "Leaderboards", achievements_leaderboards);
|
2022-09-21 12:54:37 +00:00
|
|
|
si.SetBoolValue("Cheevos", "SoundEffects", achievements_sound_effects);
|
2022-10-08 10:25:34 +00:00
|
|
|
si.SetBoolValue("Cheevos", "PrimedIndicators", achievements_primed_indicators);
|
2022-07-11 13:03:29 +00:00
|
|
|
|
2020-04-30 14:58:32 +00:00
|
|
|
si.SetStringValue("Logging", "LogLevel", GetLogLevelName(log_level));
|
|
|
|
si.SetStringValue("Logging", "LogFilter", log_filter.c_str());
|
|
|
|
si.SetBoolValue("Logging", "LogToConsole", log_to_console);
|
|
|
|
si.SetBoolValue("Logging", "LogToDebug", log_to_debug);
|
|
|
|
si.SetBoolValue("Logging", "LogToWindow", log_to_window);
|
|
|
|
si.SetBoolValue("Logging", "LogToFile", log_to_file);
|
|
|
|
|
2020-02-04 06:22:48 +00:00
|
|
|
si.SetBoolValue("Debug", "ShowVRAM", debugging.show_vram);
|
|
|
|
si.SetBoolValue("Debug", "DumpCPUToVRAMCopies", debugging.dump_cpu_to_vram_copies);
|
|
|
|
si.SetBoolValue("Debug", "DumpVRAMToCPUCopies", debugging.dump_vram_to_cpu_copies);
|
|
|
|
si.SetBoolValue("Debug", "ShowGPUState", debugging.show_gpu_state);
|
|
|
|
si.SetBoolValue("Debug", "ShowCDROMState", debugging.show_cdrom_state);
|
|
|
|
si.SetBoolValue("Debug", "ShowSPUState", debugging.show_spu_state);
|
|
|
|
si.SetBoolValue("Debug", "ShowTimersState", debugging.show_timers_state);
|
|
|
|
si.SetBoolValue("Debug", "ShowMDECState", debugging.show_mdec_state);
|
2020-09-26 09:33:10 +00:00
|
|
|
si.SetBoolValue("Debug", "ShowDMAState", debugging.show_dma_state);
|
2020-12-25 08:02:38 +00:00
|
|
|
|
|
|
|
si.SetBoolValue("TextureReplacements", "EnableVRAMWriteReplacements",
|
|
|
|
texture_replacements.enable_vram_write_replacements);
|
|
|
|
si.SetBoolValue("TextureReplacements", "PreloadTextures", texture_replacements.preload_textures);
|
|
|
|
si.SetBoolValue("TextureReplacements", "DumpVRAMWrites", texture_replacements.dump_vram_writes);
|
|
|
|
si.SetBoolValue("TextureReplacements", "DumpVRAMWriteForceAlphaChannel",
|
|
|
|
texture_replacements.dump_vram_write_force_alpha_channel);
|
|
|
|
si.SetIntValue("TextureReplacements", "DumpVRAMWriteWidthThreshold",
|
|
|
|
texture_replacements.dump_vram_write_width_threshold);
|
|
|
|
si.SetIntValue("TextureReplacements", "DumpVRAMWriteHeightThreshold",
|
|
|
|
texture_replacements.dump_vram_write_height_threshold);
|
2019-11-06 15:43:51 +00:00
|
|
|
}
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
void Settings::FixIncompatibleSettings(bool display_osd_messages)
|
|
|
|
{
|
|
|
|
if (g_settings.disable_all_enhancements)
|
|
|
|
{
|
|
|
|
Log_WarningPrintf("All enhancements disabled by config setting.");
|
|
|
|
g_settings.cpu_overclock_enable = false;
|
|
|
|
g_settings.cpu_overclock_active = false;
|
|
|
|
g_settings.enable_8mb_ram = false;
|
|
|
|
g_settings.gpu_resolution_scale = 1;
|
|
|
|
g_settings.gpu_multisamples = 1;
|
|
|
|
g_settings.gpu_per_sample_shading = false;
|
|
|
|
g_settings.gpu_true_color = false;
|
|
|
|
g_settings.gpu_scaled_dithering = false;
|
|
|
|
g_settings.gpu_texture_filter = GPUTextureFilter::Nearest;
|
|
|
|
g_settings.gpu_disable_interlacing = false;
|
|
|
|
g_settings.gpu_force_ntsc_timings = false;
|
|
|
|
g_settings.gpu_widescreen_hack = false;
|
|
|
|
g_settings.gpu_pgxp_enable = false;
|
|
|
|
g_settings.gpu_24bit_chroma_smoothing = false;
|
|
|
|
g_settings.cdrom_read_speedup = 1;
|
|
|
|
g_settings.cdrom_seek_speedup = 1;
|
|
|
|
g_settings.cdrom_mute_cd_audio = false;
|
|
|
|
g_settings.texture_replacements.enable_vram_write_replacements = false;
|
|
|
|
g_settings.bios_patch_fast_boot = false;
|
|
|
|
g_settings.bios_patch_tty_enable = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_settings.display_integer_scaling && g_settings.display_linear_filtering)
|
|
|
|
{
|
|
|
|
Log_WarningPrintf("Disabling linear filter due to integer upscaling.");
|
|
|
|
g_settings.display_linear_filtering = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_settings.display_integer_scaling && g_settings.display_stretch)
|
|
|
|
{
|
|
|
|
Log_WarningPrintf("Disabling stretch due to integer upscaling.");
|
|
|
|
g_settings.display_stretch = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_settings.gpu_pgxp_enable)
|
|
|
|
{
|
|
|
|
if (g_settings.gpu_renderer == GPURenderer::Software)
|
|
|
|
{
|
|
|
|
if (display_osd_messages)
|
|
|
|
{
|
2022-10-08 13:36:24 +00:00
|
|
|
Host::AddKeyedOSDMessage(
|
|
|
|
"pgxp_disabled_sw",
|
2022-07-11 13:03:29 +00:00
|
|
|
Host::TranslateStdString("OSDMessage", "PGXP is incompatible with the software renderer, disabling PGXP."),
|
|
|
|
10.0f);
|
|
|
|
}
|
|
|
|
g_settings.gpu_pgxp_enable = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef WITH_MMAP_FASTMEM
|
|
|
|
if (g_settings.cpu_fastmem_mode == CPUFastmemMode::MMap)
|
|
|
|
{
|
|
|
|
Log_WarningPrintf("mmap fastmem is not available on this platform, using LUT instead.");
|
|
|
|
g_settings.cpu_fastmem_mode = CPUFastmemMode::LUT;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__ANDROID__) && defined(__arm__) && !defined(__aarch64__) && !defined(_M_ARM64)
|
|
|
|
if (g_settings.rewind_enable)
|
|
|
|
{
|
2022-10-08 13:36:24 +00:00
|
|
|
Host::AddKeyedOSDMessage(
|
|
|
|
"rewind_disabled_android",
|
|
|
|
Host::TranslateStdString("OSDMessage", "Rewind is not supported on 32-bit ARM for Android."), 30.0f);
|
2022-07-11 13:03:29 +00:00
|
|
|
g_settings.rewind_enable = false;
|
|
|
|
}
|
2022-10-08 13:36:24 +00:00
|
|
|
if (g_settings.IsRunaheadEnabled())
|
|
|
|
{
|
|
|
|
Host::AddKeyedOSDMessage(
|
|
|
|
"rewind_disabled_android",
|
|
|
|
Host::TranslateStdString("OSDMessage", "Runahead is not supported on 32-bit ARM for Android."), 30.0f);
|
|
|
|
g_settings.runahead_frames = 0;
|
|
|
|
}
|
2022-07-11 13:03:29 +00:00
|
|
|
#endif
|
|
|
|
|
2022-10-08 13:36:24 +00:00
|
|
|
if (g_settings.IsRunaheadEnabled() && g_settings.rewind_enable)
|
|
|
|
{
|
|
|
|
Host::AddKeyedOSDMessage("rewind_disabled_android",
|
|
|
|
Host::TranslateStdString("OSDMessage", "Rewind is disabled because runahead is enabled."),
|
|
|
|
10.0f);
|
|
|
|
g_settings.rewind_enable = false;
|
|
|
|
}
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
// if challenge mode is enabled, disable things like rewind since they use save states
|
|
|
|
if (Achievements::ChallengeModeActive())
|
|
|
|
{
|
|
|
|
g_settings.emulation_speed =
|
|
|
|
(g_settings.emulation_speed != 0.0f) ? std::max(g_settings.emulation_speed, 1.0f) : 0.0f;
|
|
|
|
g_settings.fast_forward_speed =
|
|
|
|
(g_settings.fast_forward_speed != 0.0f) ? std::max(g_settings.fast_forward_speed, 1.0f) : 0.0f;
|
|
|
|
g_settings.turbo_speed = (g_settings.turbo_speed != 0.0f) ? std::max(g_settings.turbo_speed, 1.0f) : 0.0f;
|
|
|
|
g_settings.rewind_enable = false;
|
|
|
|
g_settings.auto_load_cheats = false;
|
|
|
|
if (g_settings.cpu_overclock_enable && g_settings.GetCPUOverclockPercent() < 100)
|
|
|
|
{
|
|
|
|
g_settings.cpu_overclock_enable = false;
|
|
|
|
g_settings.UpdateOverclockActive();
|
|
|
|
}
|
|
|
|
g_settings.debugging.enable_gdb_server = false;
|
|
|
|
g_settings.debugging.show_vram = false;
|
|
|
|
g_settings.debugging.show_gpu_state = false;
|
|
|
|
g_settings.debugging.show_cdrom_state = false;
|
|
|
|
g_settings.debugging.show_spu_state = false;
|
|
|
|
g_settings.debugging.show_timers_state = false;
|
|
|
|
g_settings.debugging.show_mdec_state = false;
|
|
|
|
g_settings.debugging.show_dma_state = false;
|
|
|
|
g_settings.debugging.dump_cpu_to_vram_copies = false;
|
|
|
|
g_settings.debugging.dump_vram_to_cpu_copies = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-30 14:58:32 +00:00
|
|
|
static std::array<const char*, LOGLEVEL_COUNT> s_log_level_names = {
|
2020-12-08 15:03:23 +00:00
|
|
|
{"None", "Error", "Warning", "Perf", "Info", "Verbose", "Dev", "Profile", "Debug", "Trace"}};
|
2020-04-30 14:58:32 +00:00
|
|
|
static std::array<const char*, LOGLEVEL_COUNT> s_log_level_display_names = {
|
2020-08-22 03:01:52 +00:00
|
|
|
{TRANSLATABLE("LogLevel", "None"), TRANSLATABLE("LogLevel", "Error"), TRANSLATABLE("LogLevel", "Warning"),
|
2020-12-08 15:03:23 +00:00
|
|
|
TRANSLATABLE("LogLevel", "Performance"), TRANSLATABLE("LogLevel", "Information"),
|
|
|
|
TRANSLATABLE("LogLevel", "Verbose"), TRANSLATABLE("LogLevel", "Developer"), TRANSLATABLE("LogLevel", "Profile"),
|
2020-08-22 03:01:52 +00:00
|
|
|
TRANSLATABLE("LogLevel", "Debug"), TRANSLATABLE("LogLevel", "Trace")}};
|
2020-04-30 14:58:32 +00:00
|
|
|
|
|
|
|
std::optional<LOGLEVEL> Settings::ParseLogLevelName(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_log_level_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<LOGLEVEL>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetLogLevelName(LOGLEVEL level)
|
|
|
|
{
|
|
|
|
return s_log_level_names[static_cast<int>(level)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetLogLevelDisplayName(LOGLEVEL level)
|
|
|
|
{
|
|
|
|
return s_log_level_display_names[static_cast<int>(level)];
|
|
|
|
}
|
|
|
|
|
2019-11-16 05:27:57 +00:00
|
|
|
static std::array<const char*, 4> s_console_region_names = {{"Auto", "NTSC-J", "NTSC-U", "PAL"}};
|
|
|
|
static std::array<const char*, 4> s_console_region_display_names = {
|
2020-08-22 03:01:52 +00:00
|
|
|
{TRANSLATABLE("ConsoleRegion", "Auto-Detect"), TRANSLATABLE("ConsoleRegion", "NTSC-J (Japan)"),
|
2020-09-09 06:54:07 +00:00
|
|
|
TRANSLATABLE("ConsoleRegion", "NTSC-U/C (US, Canada)"), TRANSLATABLE("ConsoleRegion", "PAL (Europe, Australia)")}};
|
2019-11-16 05:27:57 +00:00
|
|
|
|
|
|
|
std::optional<ConsoleRegion> Settings::ParseConsoleRegionName(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_console_region_names)
|
|
|
|
{
|
2020-01-10 03:31:12 +00:00
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
2019-11-16 05:27:57 +00:00
|
|
|
return static_cast<ConsoleRegion>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetConsoleRegionName(ConsoleRegion region)
|
|
|
|
{
|
|
|
|
return s_console_region_names[static_cast<int>(region)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetConsoleRegionDisplayName(ConsoleRegion region)
|
|
|
|
{
|
|
|
|
return s_console_region_display_names[static_cast<int>(region)];
|
|
|
|
}
|
|
|
|
|
2020-03-12 03:51:29 +00:00
|
|
|
static std::array<const char*, 4> s_disc_region_names = {{"NTSC-J", "NTSC-U", "PAL", "Other"}};
|
|
|
|
static std::array<const char*, 4> s_disc_region_display_names = {
|
2020-09-09 06:54:07 +00:00
|
|
|
{TRANSLATABLE("DiscRegion", "NTSC-J (Japan)"), TRANSLATABLE("DiscRegion", "NTSC-U/C (US, Canada)"),
|
2020-08-22 03:01:52 +00:00
|
|
|
TRANSLATABLE("DiscRegion", "PAL (Europe, Australia)"), TRANSLATABLE("DiscRegion", "Other")}};
|
2020-03-12 03:51:29 +00:00
|
|
|
|
|
|
|
std::optional<DiscRegion> Settings::ParseDiscRegionName(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
2020-05-16 10:01:19 +00:00
|
|
|
for (const char* name : s_disc_region_names)
|
2020-03-12 03:51:29 +00:00
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<DiscRegion>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDiscRegionName(DiscRegion region)
|
|
|
|
{
|
|
|
|
return s_disc_region_names[static_cast<int>(region)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDiscRegionDisplayName(DiscRegion region)
|
|
|
|
{
|
|
|
|
return s_disc_region_display_names[static_cast<int>(region)];
|
|
|
|
}
|
|
|
|
|
2019-11-23 10:22:09 +00:00
|
|
|
static std::array<const char*, 3> s_cpu_execution_mode_names = {{"Interpreter", "CachedInterpreter", "Recompiler"}};
|
|
|
|
static std::array<const char*, 3> s_cpu_execution_mode_display_names = {
|
2021-02-10 16:17:25 +00:00
|
|
|
{TRANSLATABLE("CPUExecutionMode", "Interpreter (Slowest)"),
|
2020-08-23 04:42:53 +00:00
|
|
|
TRANSLATABLE("CPUExecutionMode", "Cached Interpreter (Faster)"),
|
2020-08-22 03:01:52 +00:00
|
|
|
TRANSLATABLE("CPUExecutionMode", "Recompiler (Fastest)")}};
|
2019-11-23 10:22:09 +00:00
|
|
|
|
|
|
|
std::optional<CPUExecutionMode> Settings::ParseCPUExecutionMode(const char* str)
|
|
|
|
{
|
|
|
|
u8 index = 0;
|
|
|
|
for (const char* name : s_cpu_execution_mode_names)
|
|
|
|
{
|
2020-01-10 03:31:12 +00:00
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
2019-11-23 10:22:09 +00:00
|
|
|
return static_cast<CPUExecutionMode>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetCPUExecutionModeName(CPUExecutionMode mode)
|
|
|
|
{
|
|
|
|
return s_cpu_execution_mode_names[static_cast<u8>(mode)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetCPUExecutionModeDisplayName(CPUExecutionMode mode)
|
|
|
|
{
|
|
|
|
return s_cpu_execution_mode_display_names[static_cast<u8>(mode)];
|
|
|
|
}
|
2020-11-22 15:06:25 +00:00
|
|
|
|
|
|
|
static std::array<const char*, static_cast<u32>(CPUFastmemMode::Count)> s_cpu_fastmem_mode_names = {
|
|
|
|
{"Disabled", "MMap", "LUT"}};
|
|
|
|
static std::array<const char*, static_cast<u32>(CPUFastmemMode::Count)> s_cpu_fastmem_mode_display_names = {
|
|
|
|
{TRANSLATABLE("CPUFastmemMode", "Disabled (Slowest)"),
|
|
|
|
TRANSLATABLE("CPUFastmemMode", "MMap (Hardware, Fastest, 64-Bit Only)"),
|
|
|
|
TRANSLATABLE("CPUFastmemMode", "LUT (Faster)")}};
|
|
|
|
|
|
|
|
std::optional<CPUFastmemMode> Settings::ParseCPUFastmemMode(const char* str)
|
|
|
|
{
|
|
|
|
u8 index = 0;
|
|
|
|
for (const char* name : s_cpu_fastmem_mode_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<CPUFastmemMode>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetCPUFastmemModeName(CPUFastmemMode mode)
|
|
|
|
{
|
|
|
|
return s_cpu_fastmem_mode_names[static_cast<u8>(mode)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetCPUFastmemModeDisplayName(CPUFastmemMode mode)
|
|
|
|
{
|
|
|
|
return s_cpu_fastmem_mode_display_names[static_cast<u8>(mode)];
|
|
|
|
}
|
2019-11-23 10:22:09 +00:00
|
|
|
|
2020-08-23 04:42:53 +00:00
|
|
|
static constexpr auto s_gpu_renderer_names = make_array(
|
2021-06-28 10:16:48 +00:00
|
|
|
#ifdef _WIN32
|
2022-07-11 13:03:29 +00:00
|
|
|
"D3D11", "D3D12",
|
2020-01-07 08:54:39 +00:00
|
|
|
#endif
|
2022-07-30 15:06:40 +00:00
|
|
|
#ifdef WITH_VULKAN
|
|
|
|
"Vulkan",
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_OPENGL
|
|
|
|
"OpenGL",
|
|
|
|
#endif
|
|
|
|
"Software");
|
2020-08-23 04:42:53 +00:00
|
|
|
static constexpr auto s_gpu_renderer_display_names = make_array(
|
2021-06-28 10:16:48 +00:00
|
|
|
#ifdef _WIN32
|
2022-07-11 13:03:29 +00:00
|
|
|
TRANSLATABLE("GPURenderer", "Hardware (D3D11)"), TRANSLATABLE("GPURenderer", "Hardware (D3D12)"),
|
2020-01-07 08:54:39 +00:00
|
|
|
#endif
|
2022-07-30 15:06:40 +00:00
|
|
|
#ifdef WITH_VULKAN
|
|
|
|
TRANSLATABLE("GPURenderer", "Hardware (Vulkan)"),
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_OPENGL
|
|
|
|
TRANSLATABLE("GPURenderer", "Hardware (OpenGL)"),
|
|
|
|
#endif
|
2020-08-23 04:42:53 +00:00
|
|
|
TRANSLATABLE("GPURenderer", "Software"));
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2019-11-16 05:27:57 +00:00
|
|
|
std::optional<GPURenderer> Settings::ParseRendererName(const char* str)
|
2019-11-06 15:43:51 +00:00
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_gpu_renderer_names)
|
|
|
|
{
|
2020-01-10 03:31:12 +00:00
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
2019-11-06 15:43:51 +00:00
|
|
|
return static_cast<GPURenderer>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetRendererName(GPURenderer renderer)
|
|
|
|
{
|
|
|
|
return s_gpu_renderer_names[static_cast<int>(renderer)];
|
|
|
|
}
|
2019-11-07 13:52:19 +00:00
|
|
|
|
|
|
|
const char* Settings::GetRendererDisplayName(GPURenderer renderer)
|
|
|
|
{
|
|
|
|
return s_gpu_renderer_display_names[static_cast<int>(renderer)];
|
|
|
|
}
|
2019-12-14 13:29:26 +00:00
|
|
|
|
2022-08-26 11:59:45 +00:00
|
|
|
RenderAPI Settings::GetRenderAPIForRenderer(GPURenderer renderer)
|
|
|
|
{
|
|
|
|
switch (renderer)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
case GPURenderer::HardwareD3D11:
|
|
|
|
return RenderAPI::D3D11;
|
|
|
|
case GPURenderer::HardwareD3D12:
|
|
|
|
return RenderAPI::D3D12;
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_VULKAN
|
|
|
|
case GPURenderer::HardwareVulkan:
|
|
|
|
return RenderAPI::Vulkan;
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_OPENGL
|
|
|
|
case GPURenderer::HardwareOpenGL:
|
|
|
|
return RenderAPI::OpenGL;
|
|
|
|
#endif
|
|
|
|
case GPURenderer::Software:
|
|
|
|
default:
|
|
|
|
return HostDisplay::GetPreferredAPI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-01 12:54:03 +00:00
|
|
|
static constexpr auto s_texture_filter_names =
|
|
|
|
make_array("Nearest", "Bilinear", "BilinearBinAlpha", "JINC2", "JINC2BinAlpha", "xBR", "xBRBinAlpha");
|
2022-10-08 13:36:24 +00:00
|
|
|
static constexpr auto s_texture_filter_display_names = make_array(
|
|
|
|
TRANSLATABLE("GPUTextureFilter", "Nearest-Neighbor"), TRANSLATABLE("GPUTextureFilter", "Bilinear"),
|
|
|
|
TRANSLATABLE("GPUTextureFilter", "Bilinear (No Edge Blending)"), TRANSLATABLE("GPUTextureFilter", "JINC2 (Slow)"),
|
|
|
|
TRANSLATABLE("GPUTextureFilter", "JINC2 (Slow, No Edge Blending)"),
|
|
|
|
TRANSLATABLE("GPUTextureFilter", "xBR (Very Slow)"),
|
|
|
|
TRANSLATABLE("GPUTextureFilter", "xBR (Very Slow, No Edge Blending)"));
|
2020-09-11 12:20:19 +00:00
|
|
|
|
|
|
|
std::optional<GPUTextureFilter> Settings::ParseTextureFilterName(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_texture_filter_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<GPUTextureFilter>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetTextureFilterName(GPUTextureFilter filter)
|
|
|
|
{
|
|
|
|
return s_texture_filter_names[static_cast<int>(filter)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetTextureFilterDisplayName(GPUTextureFilter filter)
|
|
|
|
{
|
|
|
|
return s_texture_filter_display_names[static_cast<int>(filter)];
|
|
|
|
}
|
|
|
|
|
2020-12-30 06:26:20 +00:00
|
|
|
static constexpr auto s_downsample_mode_names = make_array("Disabled", "Box", "Adaptive");
|
|
|
|
static constexpr auto s_downsample_mode_display_names = make_array(
|
|
|
|
TRANSLATABLE("GPUDownsampleMode", "Disabled"), TRANSLATABLE("GPUDownsampleMode", "Box (Downsample 3D/Smooth All)"),
|
|
|
|
TRANSLATABLE("GPUDownsampleMode", "Adaptive (Preserve 3D/Smooth 2D)"));
|
|
|
|
|
|
|
|
std::optional<GPUDownsampleMode> Settings::ParseDownsampleModeName(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_downsample_mode_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<GPUDownsampleMode>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDownsampleModeName(GPUDownsampleMode mode)
|
|
|
|
{
|
|
|
|
return s_downsample_mode_names[static_cast<int>(mode)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDownsampleModeDisplayName(GPUDownsampleMode mode)
|
|
|
|
{
|
|
|
|
return s_downsample_mode_display_names[static_cast<int>(mode)];
|
|
|
|
}
|
|
|
|
|
2020-02-28 07:01:01 +00:00
|
|
|
static std::array<const char*, 3> s_display_crop_mode_names = {{"None", "Overscan", "Borders"}};
|
2020-08-23 04:42:53 +00:00
|
|
|
static std::array<const char*, 3> s_display_crop_mode_display_names = {
|
|
|
|
{TRANSLATABLE("DisplayCropMode", "None"), TRANSLATABLE("DisplayCropMode", "Only Overscan Area"),
|
|
|
|
TRANSLATABLE("DisplayCropMode", "All Borders")}};
|
2020-02-28 07:01:01 +00:00
|
|
|
|
|
|
|
std::optional<DisplayCropMode> Settings::ParseDisplayCropMode(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_display_crop_mode_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<DisplayCropMode>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDisplayCropModeName(DisplayCropMode crop_mode)
|
|
|
|
{
|
|
|
|
return s_display_crop_mode_names[static_cast<int>(crop_mode)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDisplayCropModeDisplayName(DisplayCropMode crop_mode)
|
|
|
|
{
|
|
|
|
return s_display_crop_mode_display_names[static_cast<int>(crop_mode)];
|
|
|
|
}
|
|
|
|
|
2021-04-29 16:29:39 +00:00
|
|
|
static std::array<const char*, static_cast<size_t>(DisplayAspectRatio::Count)> s_display_aspect_ratio_names = {
|
2021-05-01 03:18:32 +00:00
|
|
|
{TRANSLATABLE("DisplayAspectRatio", "Auto (Game Native)"), TRANSLATABLE("DisplayAspectRatio", "Auto (Match Window)"),
|
|
|
|
TRANSLATABLE("DisplayAspectRatio", "Custom"), "4:3", "16:9", "19:9", "20:9", "PAR 1:1"}};
|
2021-04-29 16:29:39 +00:00
|
|
|
static constexpr std::array<float, static_cast<size_t>(DisplayAspectRatio::Count)> s_display_aspect_ratio_values = {
|
|
|
|
{-1.0f, -1.0f, -1.0f, 4.0f / 3.0f, 16.0f / 9.0f, 19.0f / 9.0f, 20.0f / 9.0f, -1.0f}};
|
2020-04-10 05:12:16 +00:00
|
|
|
|
|
|
|
std::optional<DisplayAspectRatio> Settings::ParseDisplayAspectRatio(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_display_aspect_ratio_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<DisplayAspectRatio>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDisplayAspectRatioName(DisplayAspectRatio ar)
|
|
|
|
{
|
|
|
|
return s_display_aspect_ratio_names[static_cast<int>(ar)];
|
|
|
|
}
|
|
|
|
|
2021-04-28 16:42:08 +00:00
|
|
|
float Settings::GetDisplayAspectRatioValue() const
|
2020-04-10 05:12:16 +00:00
|
|
|
{
|
2021-04-28 16:42:08 +00:00
|
|
|
switch (display_aspect_ratio)
|
|
|
|
{
|
|
|
|
case DisplayAspectRatio::MatchWindow:
|
|
|
|
{
|
2022-07-11 13:03:29 +00:00
|
|
|
if (!g_host_display)
|
2021-04-28 16:42:08 +00:00
|
|
|
return s_display_aspect_ratio_values[static_cast<int>(DEFAULT_DISPLAY_ASPECT_RATIO)];
|
|
|
|
|
2022-10-13 07:32:51 +00:00
|
|
|
return static_cast<float>(g_host_display->GetWindowWidth()) /
|
|
|
|
static_cast<float>(g_host_display->GetWindowHeight());
|
2021-04-28 16:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case DisplayAspectRatio::Custom:
|
|
|
|
{
|
|
|
|
return static_cast<float>(display_aspect_ratio_custom_numerator) /
|
|
|
|
static_cast<float>(display_aspect_ratio_custom_denominator);
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
return s_display_aspect_ratio_values[static_cast<int>(display_aspect_ratio)];
|
|
|
|
}
|
|
|
|
}
|
2020-04-10 05:12:16 +00:00
|
|
|
}
|
|
|
|
|
2022-10-13 07:32:51 +00:00
|
|
|
static std::array<const char*, static_cast<size_t>(DisplayAlignment::Count)> s_display_alignment_names = {
|
|
|
|
{"LeftOrTop", "Center", "RightOrBottom"}};
|
|
|
|
static std::array<const char*, static_cast<size_t>(DisplayAlignment::Count)> s_display_alignment_display_names = {
|
|
|
|
{TRANSLATABLE("DisplayAlignment", "Left / Top"), TRANSLATABLE("DisplayAlignment", "Center"),
|
|
|
|
TRANSLATABLE("DisplayAlignment", "Right / Bottom")}};
|
2022-10-09 04:55:56 +00:00
|
|
|
|
|
|
|
std::optional<DisplayAlignment> Settings::ParseDisplayAlignment(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_display_alignment_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<DisplayAlignment>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDisplayAlignmentName(DisplayAlignment alignment)
|
|
|
|
{
|
|
|
|
return s_display_alignment_names[static_cast<int>(alignment)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetDisplayAlignmentDisplayName(DisplayAlignment alignment)
|
|
|
|
{
|
|
|
|
return s_display_alignment_display_names[static_cast<int>(alignment)];
|
|
|
|
}
|
|
|
|
|
2022-08-04 11:34:16 +00:00
|
|
|
static constexpr const char* s_audio_backend_names[] = {
|
|
|
|
"Null",
|
|
|
|
#ifdef WITH_CUBEB
|
|
|
|
"Cubeb",
|
|
|
|
#endif
|
2021-06-30 05:15:39 +00:00
|
|
|
#ifdef _WIN32
|
2022-08-04 11:34:16 +00:00
|
|
|
"XAudio2",
|
|
|
|
#endif
|
|
|
|
#ifdef __ANDROID__
|
|
|
|
"AAudio", "OpenSLES",
|
2021-06-30 05:15:39 +00:00
|
|
|
#endif
|
2022-08-04 11:34:16 +00:00
|
|
|
};
|
|
|
|
static constexpr const char* s_audio_backend_display_names[] = {
|
|
|
|
TRANSLATABLE("AudioBackend", "Null (No Output)"),
|
|
|
|
#ifdef WITH_CUBEB
|
|
|
|
TRANSLATABLE("AudioBackend", "Cubeb"),
|
2021-06-30 05:15:39 +00:00
|
|
|
#endif
|
|
|
|
#ifdef _WIN32
|
2022-08-04 11:34:16 +00:00
|
|
|
TRANSLATABLE("AudioBackend", "XAudio2"),
|
2020-10-13 13:11:28 +00:00
|
|
|
#endif
|
2022-08-04 11:34:16 +00:00
|
|
|
#ifdef __ANDROID__
|
|
|
|
"AAudio",
|
|
|
|
"OpenSL ES",
|
2020-10-13 13:11:28 +00:00
|
|
|
#endif
|
2022-08-04 11:34:16 +00:00
|
|
|
};
|
2019-12-23 07:02:37 +00:00
|
|
|
|
|
|
|
std::optional<AudioBackend> Settings::ParseAudioBackend(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_audio_backend_names)
|
|
|
|
{
|
2020-01-10 03:31:12 +00:00
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
2019-12-23 07:02:37 +00:00
|
|
|
return static_cast<AudioBackend>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetAudioBackendName(AudioBackend backend)
|
|
|
|
{
|
|
|
|
return s_audio_backend_names[static_cast<int>(backend)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetAudioBackendDisplayName(AudioBackend backend)
|
|
|
|
{
|
|
|
|
return s_audio_backend_display_names[static_cast<int>(backend)];
|
|
|
|
}
|
|
|
|
|
2020-11-13 07:36:36 +00:00
|
|
|
static std::array<const char*, 7> s_controller_type_names = {
|
2022-07-11 13:03:29 +00:00
|
|
|
{"None", "DigitalController", "AnalogController", "AnalogJoystick", "GunCon", "PlayStationMouse", "NeGcon"}};
|
2020-11-13 07:36:36 +00:00
|
|
|
static std::array<const char*, 7> s_controller_display_names = {
|
2020-08-22 03:01:52 +00:00
|
|
|
{TRANSLATABLE("ControllerType", "None"), TRANSLATABLE("ControllerType", "Digital Controller"),
|
2020-11-13 07:36:36 +00:00
|
|
|
TRANSLATABLE("ControllerType", "Analog Controller (DualShock)"), TRANSLATABLE("ControllerType", "Analog Joystick"),
|
2022-07-11 13:03:29 +00:00
|
|
|
TRANSLATABLE("ControllerType", "GunCon"), TRANSLATABLE("ControllerType", "PlayStation Mouse"),
|
2020-11-13 07:36:36 +00:00
|
|
|
TRANSLATABLE("ControllerType", "NeGcon")}};
|
2019-12-14 13:29:26 +00:00
|
|
|
|
|
|
|
std::optional<ControllerType> Settings::ParseControllerTypeName(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_controller_type_names)
|
|
|
|
{
|
2020-01-10 03:31:12 +00:00
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
2019-12-14 13:29:26 +00:00
|
|
|
return static_cast<ControllerType>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetControllerTypeName(ControllerType type)
|
|
|
|
{
|
|
|
|
return s_controller_type_names[static_cast<int>(type)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetControllerTypeDisplayName(ControllerType type)
|
|
|
|
{
|
|
|
|
return s_controller_display_names[static_cast<int>(type)];
|
|
|
|
}
|
2020-04-27 06:15:38 +00:00
|
|
|
|
2021-05-23 07:11:59 +00:00
|
|
|
static std::array<const char*, 6> s_memory_card_type_names = {
|
|
|
|
{"None", "Shared", "PerGame", "PerGameTitle", "PerGameFileTitle", "NonPersistent"}};
|
|
|
|
static std::array<const char*, 6> s_memory_card_type_display_names = {
|
2020-08-22 03:01:52 +00:00
|
|
|
{TRANSLATABLE("MemoryCardType", "No Memory Card"), TRANSLATABLE("MemoryCardType", "Shared Between All Games"),
|
2022-10-05 08:29:08 +00:00
|
|
|
TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Serial)"),
|
|
|
|
TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Title)"),
|
2021-05-23 07:11:59 +00:00
|
|
|
TRANSLATABLE("MemoryCardType", "Separate Card Per Game (File Title)"),
|
|
|
|
TRANSLATABLE("MemoryCardType", "Non-Persistent Card (Do Not Save)")}};
|
2020-04-27 06:15:38 +00:00
|
|
|
|
|
|
|
std::optional<MemoryCardType> Settings::ParseMemoryCardTypeName(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_memory_card_type_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<MemoryCardType>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetMemoryCardTypeName(MemoryCardType type)
|
|
|
|
{
|
|
|
|
return s_memory_card_type_names[static_cast<int>(type)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetMemoryCardTypeDisplayName(MemoryCardType type)
|
|
|
|
{
|
|
|
|
return s_memory_card_type_display_names[static_cast<int>(type)];
|
|
|
|
}
|
2021-01-21 07:59:40 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
std::string Settings::GetDefaultSharedMemoryCardName(u32 slot)
|
|
|
|
{
|
|
|
|
return fmt::format("shared_card_{}.mcd", slot + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string Settings::GetSharedMemoryCardPath(u32 slot) const
|
|
|
|
{
|
|
|
|
std::string ret;
|
|
|
|
|
|
|
|
if (memory_card_paths[slot].empty())
|
|
|
|
ret = Path::Combine(EmuFolders::MemoryCards, GetDefaultSharedMemoryCardName(slot));
|
|
|
|
else if (!Path::IsAbsolute(memory_card_paths[slot]))
|
|
|
|
ret = Path::Combine(EmuFolders::MemoryCards, memory_card_paths[slot]);
|
|
|
|
else
|
|
|
|
ret = memory_card_paths[slot];
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2022-10-05 08:29:08 +00:00
|
|
|
std::string Settings::GetGameMemoryCardPath(const char* serial, u32 slot)
|
2022-07-11 13:03:29 +00:00
|
|
|
{
|
2022-10-05 08:29:08 +00:00
|
|
|
return Path::Combine(EmuFolders::MemoryCards, fmt::format("{}_{}.mcd", serial, slot + 1));
|
2022-07-11 13:03:29 +00:00
|
|
|
}
|
|
|
|
|
2021-03-01 22:59:59 +00:00
|
|
|
static std::array<const char*, 4> s_multitap_enable_mode_names = {{"Disabled", "Port1Only", "Port2Only", "BothPorts"}};
|
|
|
|
static std::array<const char*, 4> s_multitap_enable_mode_display_names = {
|
2021-03-03 11:43:20 +00:00
|
|
|
{TRANSLATABLE("MultitapMode", "Disabled"), TRANSLATABLE("MultitapMode", "Enable on Port 1 Only"),
|
|
|
|
TRANSLATABLE("MultitapMode", "Enable on Port 2 Only"), TRANSLATABLE("MultitapMode", "Enable on Ports 1 and 2")}};
|
2021-01-21 07:59:40 +00:00
|
|
|
|
|
|
|
std::optional<MultitapMode> Settings::ParseMultitapModeName(const char* str)
|
|
|
|
{
|
|
|
|
u32 index = 0;
|
|
|
|
for (const char* name : s_multitap_enable_mode_names)
|
|
|
|
{
|
|
|
|
if (StringUtil::Strcasecmp(name, str) == 0)
|
|
|
|
return static_cast<MultitapMode>(index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetMultitapModeName(MultitapMode mode)
|
|
|
|
{
|
|
|
|
return s_multitap_enable_mode_names[static_cast<size_t>(mode)];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Settings::GetMultitapModeDisplayName(MultitapMode mode)
|
|
|
|
{
|
|
|
|
return s_multitap_enable_mode_display_names[static_cast<size_t>(mode)];
|
|
|
|
}
|
2022-07-11 13:03:29 +00:00
|
|
|
|
|
|
|
std::string EmuFolders::AppRoot;
|
|
|
|
std::string EmuFolders::DataRoot;
|
|
|
|
std::string EmuFolders::Bios;
|
|
|
|
std::string EmuFolders::Cache;
|
|
|
|
std::string EmuFolders::Cheats;
|
|
|
|
std::string EmuFolders::Covers;
|
|
|
|
std::string EmuFolders::Dumps;
|
|
|
|
std::string EmuFolders::GameSettings;
|
|
|
|
std::string EmuFolders::InputProfiles;
|
|
|
|
std::string EmuFolders::MemoryCards;
|
|
|
|
std::string EmuFolders::Resources;
|
|
|
|
std::string EmuFolders::SaveStates;
|
|
|
|
std::string EmuFolders::Screenshots;
|
|
|
|
std::string EmuFolders::Shaders;
|
|
|
|
std::string EmuFolders::Textures;
|
|
|
|
|
|
|
|
void EmuFolders::SetDefaults()
|
|
|
|
{
|
|
|
|
Bios = Path::Combine(DataRoot, "bios");
|
|
|
|
Cache = Path::Combine(DataRoot, "cache");
|
|
|
|
Cheats = Path::Combine(DataRoot, "cheats");
|
|
|
|
Covers = Path::Combine(DataRoot, "covers");
|
|
|
|
Dumps = Path::Combine(DataRoot, "dump");
|
|
|
|
GameSettings = Path::Combine(DataRoot, "gamesettings");
|
|
|
|
InputProfiles = Path::Combine(DataRoot, "inputprofiles");
|
|
|
|
MemoryCards = Path::Combine(DataRoot, "memcards");
|
|
|
|
SaveStates = Path::Combine(DataRoot, "savestates");
|
|
|
|
Screenshots = Path::Combine(DataRoot, "screenshots");
|
|
|
|
Shaders = Path::Combine(DataRoot, "shaders");
|
|
|
|
Textures = Path::Combine(DataRoot, "textures");
|
|
|
|
}
|
|
|
|
|
|
|
|
static std::string LoadPathFromSettings(SettingsInterface& si, const std::string& root, const char* section,
|
|
|
|
const char* name, const char* def)
|
|
|
|
{
|
|
|
|
std::string value = si.GetStringValue(section, name, def);
|
|
|
|
if (value.empty())
|
|
|
|
value = def;
|
|
|
|
if (!Path::IsAbsolute(value))
|
|
|
|
value = Path::Combine(root, value);
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmuFolders::LoadConfig(SettingsInterface& si)
|
|
|
|
{
|
|
|
|
Bios = LoadPathFromSettings(si, DataRoot, "BIOS", "SearchDirectory", "bios");
|
|
|
|
Cache = LoadPathFromSettings(si, DataRoot, "Folders", "Cache", "cache");
|
|
|
|
Cheats = LoadPathFromSettings(si, DataRoot, "Folders", "Cheats", "cheats");
|
|
|
|
Covers = LoadPathFromSettings(si, DataRoot, "Folders", "Covers", "covers");
|
|
|
|
Dumps = LoadPathFromSettings(si, DataRoot, "Folders", "Dumps", "dump");
|
|
|
|
GameSettings = LoadPathFromSettings(si, DataRoot, "Folders", "GameSettings", "gamesettings");
|
|
|
|
InputProfiles = LoadPathFromSettings(si, DataRoot, "Folders", "InputProfiles", "inputprofiles");
|
|
|
|
MemoryCards = LoadPathFromSettings(si, DataRoot, "MemoryCards", "Directory", "memcards");
|
2022-07-25 12:44:13 +00:00
|
|
|
SaveStates = LoadPathFromSettings(si, DataRoot, "Folders", "SaveStates", "savestates");
|
|
|
|
Screenshots = LoadPathFromSettings(si, DataRoot, "Folders", "Screenshots", "screenshots");
|
|
|
|
Shaders = LoadPathFromSettings(si, DataRoot, "Folders", "Shaders", "shaders");
|
2022-07-11 13:03:29 +00:00
|
|
|
Textures = LoadPathFromSettings(si, DataRoot, "Folders", "Textures", "textures");
|
|
|
|
|
|
|
|
Log_DevPrintf("BIOS Directory: %s", Bios.c_str());
|
|
|
|
Log_DevPrintf("Cache Directory: %s", Cache.c_str());
|
|
|
|
Log_DevPrintf("Cheats Directory: %s", Cheats.c_str());
|
|
|
|
Log_DevPrintf("Covers Directory: %s", Covers.c_str());
|
|
|
|
Log_DevPrintf("Dumps Directory: %s", Dumps.c_str());
|
|
|
|
Log_DevPrintf("Game Settings Directory: %s", GameSettings.c_str());
|
|
|
|
Log_DevPrintf("Input Profile Directory: %s", InputProfiles.c_str());
|
|
|
|
Log_DevPrintf("MemoryCards Directory: %s", MemoryCards.c_str());
|
|
|
|
Log_DevPrintf("SaveStates Directory: %s", SaveStates.c_str());
|
|
|
|
Log_DevPrintf("Screenshots Directory: %s", Screenshots.c_str());
|
|
|
|
Log_DevPrintf("Shaders Directory: %s", Shaders.c_str());
|
|
|
|
Log_DevPrintf("Textures Directory: %s", Textures.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmuFolders::Save(SettingsInterface& si)
|
|
|
|
{
|
|
|
|
// convert back to relative
|
|
|
|
si.SetStringValue("BIOS", "SearchDirectory", Path::MakeRelative(Bios, DataRoot).c_str());
|
|
|
|
si.SetStringValue("Folders", "Cache", Path::MakeRelative(Cache, DataRoot).c_str());
|
|
|
|
si.SetStringValue("Folders", "Cheats", Path::MakeRelative(Cheats, DataRoot).c_str());
|
|
|
|
si.SetStringValue("Folders", "Covers", Path::MakeRelative(Covers, DataRoot).c_str());
|
|
|
|
si.SetStringValue("Folders", "Dumps", Path::MakeRelative(Dumps, DataRoot).c_str());
|
2022-07-26 07:39:48 +00:00
|
|
|
si.SetStringValue("Folders", "GameSettings", Path::MakeRelative(GameSettings, DataRoot).c_str());
|
2022-07-11 13:03:29 +00:00
|
|
|
si.SetStringValue("Folders", "InputProfiles", Path::MakeRelative(InputProfiles, DataRoot).c_str());
|
|
|
|
si.SetStringValue("MemoryCards", "Directory", Path::MakeRelative(MemoryCards, DataRoot).c_str());
|
|
|
|
si.SetStringValue("Folders", "SaveStates", Path::MakeRelative(SaveStates, DataRoot).c_str());
|
|
|
|
si.SetStringValue("Folders", "Screenshots", Path::MakeRelative(Screenshots, DataRoot).c_str());
|
|
|
|
si.SetStringValue("Folders", "Shaders", Path::MakeRelative(Shaders, DataRoot).c_str());
|
|
|
|
si.SetStringValue("Folders", "Textures", Path::MakeRelative(Textures, DataRoot).c_str());
|
|
|
|
}
|
|
|
|
|
2022-07-22 15:28:19 +00:00
|
|
|
void EmuFolders::Update()
|
|
|
|
{
|
|
|
|
const std::string old_gamesettings(EmuFolders::GameSettings);
|
|
|
|
const std::string old_inputprofiles(EmuFolders::InputProfiles);
|
|
|
|
const std::string old_memorycards(EmuFolders::MemoryCards);
|
|
|
|
|
|
|
|
// have to manually grab the lock here, because of the ReloadGameSettings() below.
|
|
|
|
{
|
|
|
|
auto lock = Host::GetSettingsLock();
|
|
|
|
LoadConfig(*Host::Internal::GetBaseSettingsLayer());
|
|
|
|
EnsureFoldersExist();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (old_gamesettings != EmuFolders::GameSettings || old_inputprofiles != EmuFolders::InputProfiles)
|
|
|
|
System::ReloadGameSettings(false);
|
|
|
|
|
|
|
|
if (System::IsValid() && old_memorycards != EmuFolders::MemoryCards)
|
|
|
|
System::UpdateMemoryCardTypes();
|
|
|
|
}
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
bool EmuFolders::EnsureFoldersExist()
|
|
|
|
{
|
|
|
|
bool result = FileSystem::EnsureDirectoryExists(Bios.c_str(), false);
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Cache.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Path::Combine(Cache, "achievement_badge").c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Path::Combine(Cache, "achievement_gameicon").c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Cheats.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Covers.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Dumps.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Path::Combine(Dumps, "audio").c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Path::Combine(Dumps, "textures").c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(GameSettings.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(InputProfiles.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(MemoryCards.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(SaveStates.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Screenshots.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Shaders.c_str(), false) && result;
|
|
|
|
result = FileSystem::EnsureDirectoryExists(Textures.c_str(), false) && result;
|
|
|
|
return result;
|
|
|
|
}
|