2019-10-04 05:00:32 +00:00
|
|
|
#include "settings.h"
|
2020-01-10 03:31:12 +00:00
|
|
|
#include "common/string_util.h"
|
2019-11-06 15:43:51 +00:00
|
|
|
#include <array>
|
|
|
|
|
|
|
|
Settings::Settings() = default;
|
|
|
|
|
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 =
|
|
|
|
ParseConsoleRegionName(si.GetStringValue("Console", "Region", "NTSC-U").c_str()).value_or(ConsoleRegion::NTSC_U);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
emulation_speed = si.GetFloatValue("Main", "EmulationSpeed", 1.0f);
|
|
|
|
speed_limiter_enabled = si.GetBoolValue("Main", "SpeedLimiterEnabled", true);
|
|
|
|
increase_timer_resolution = si.GetBoolValue("Main", "IncreaseTimerResolution", 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-02-28 07:00:09 +00:00
|
|
|
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
|
|
|
|
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
|
2019-11-16 10:27:30 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
cpu_execution_mode = ParseCPUExecutionMode(si.GetStringValue("CPU", "ExecutionMode", "Interpreter").c_str())
|
|
|
|
.value_or(CPUExecutionMode::Interpreter);
|
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);
|
2019-12-30 11:22:22 +00:00
|
|
|
gpu_resolution_scale = static_cast<u32>(si.GetIntValue("GPU", "ResolutionScale", 1));
|
2020-02-29 14:05:31 +00:00
|
|
|
gpu_true_color = si.GetBoolValue("GPU", "TrueColor", true);
|
|
|
|
gpu_scaled_dithering = si.GetBoolValue("GPU", "ScaledDithering", false);
|
2019-12-30 11:22:22 +00:00
|
|
|
gpu_texture_filtering = si.GetBoolValue("GPU", "TextureFiltering", false);
|
2020-01-19 04:53:49 +00:00
|
|
|
gpu_use_debug_device = si.GetBoolValue("GPU", "UseDebugDevice", false);
|
2019-11-23 10:22:09 +00:00
|
|
|
|
2020-02-28 07:01:01 +00:00
|
|
|
display_crop_mode = ParseDisplayCropMode(
|
|
|
|
si.GetStringValue("Display", "CropMode", GetDisplayCropModeName(DisplayCropMode::None)).c_str())
|
|
|
|
.value_or(DisplayCropMode::None);
|
|
|
|
display_force_progressive_scan = si.GetBoolValue("Display", "ForceProgressiveScan", true);
|
2019-12-30 11:22:22 +00:00
|
|
|
display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true);
|
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_vps = si.GetBoolValue("Display", "ShowVPS", false);
|
|
|
|
display_show_speed = si.GetBoolValue("Display", "ShowSpeed", false);
|
2019-12-30 11:22:22 +00:00
|
|
|
video_sync_enabled = si.GetBoolValue("Display", "VSync", true);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-02-21 15:19:10 +00:00
|
|
|
cdrom_read_thread = si.GetBoolValue("CDROM", "ReadThread", true);
|
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
audio_backend =
|
2020-02-15 15:14:35 +00:00
|
|
|
ParseAudioBackend(si.GetStringValue("Audio", "Backend", "Cubeb").c_str()).value_or(AudioBackend::Cubeb);
|
2019-12-30 11:22:22 +00:00
|
|
|
audio_sync_enabled = si.GetBoolValue("Audio", "Sync", true);
|
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-02-28 06:58:30 +00:00
|
|
|
bios_path = si.GetStringValue("BIOS", "Path", "bios/scph1001.bin");
|
2019-12-30 11:22:22 +00:00
|
|
|
bios_patch_tty_enable = si.GetBoolValue("BIOS", "PatchTTYEnable", true);
|
|
|
|
bios_patch_fast_boot = si.GetBoolValue("BIOS", "PatchFastBoot", false);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-01-02 06:10:30 +00:00
|
|
|
controller_types[0] = ParseControllerTypeName(si.GetStringValue("Controller1", "Type", "DigitalController").c_str())
|
|
|
|
.value_or(ControllerType::DigitalController);
|
|
|
|
controller_types[1] =
|
|
|
|
ParseControllerTypeName(si.GetStringValue("Controller2", "Type", "None").c_str()).value_or(ControllerType::None);
|
|
|
|
|
2020-02-28 06:58:30 +00:00
|
|
|
memory_card_paths[0] = si.GetStringValue("MemoryCards", "Card1Path", "memcards/shared_card_1.mcd");
|
2020-01-02 06:10:30 +00:00
|
|
|
memory_card_paths[1] = si.GetStringValue("MemoryCards", "Card2Path", "");
|
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");
|
|
|
|
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");
|
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));
|
2019-11-16 10:27:30 +00:00
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
si.SetFloatValue("Main", "EmulationSpeed", emulation_speed);
|
|
|
|
si.SetBoolValue("Main", "SpeedLimiterEnabled", speed_limiter_enabled);
|
|
|
|
si.SetBoolValue("Main", "IncreaseTimerResolution", increase_timer_resolution);
|
|
|
|
si.SetBoolValue("Main", "StartPaused", start_paused);
|
2020-03-12 03:53:58 +00:00
|
|
|
si.SetBoolValue("Main", "StartFullscreen", start_fullscreen);
|
2020-02-28 07:00:09 +00:00
|
|
|
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
|
|
|
|
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
|
2019-11-16 10:50:11 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(cpu_execution_mode));
|
2019-11-23 10:22:09 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetStringValue("GPU", "Renderer", GetRendererName(gpu_renderer));
|
|
|
|
si.SetIntValue("GPU", "ResolutionScale", static_cast<long>(gpu_resolution_scale));
|
|
|
|
si.SetBoolValue("GPU", "TrueColor", gpu_true_color);
|
2020-02-29 14:05:31 +00:00
|
|
|
si.SetBoolValue("GPU", "ScaledDithering", gpu_scaled_dithering);
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetBoolValue("GPU", "TextureFiltering", gpu_texture_filtering);
|
2020-01-19 04:53:49 +00:00
|
|
|
si.SetBoolValue("GPU", "UseDebugDevice", gpu_use_debug_device);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2020-02-28 07:01:01 +00:00
|
|
|
si.SetBoolValue("Display", "ForceProgressiveScan", display_force_progressive_scan);
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetBoolValue("Display", "LinearFiltering", display_linear_filtering);
|
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", "ShowVPS", display_show_vps);
|
|
|
|
si.SetBoolValue("Display", "ShowSpeed", display_show_speed);
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetBoolValue("Display", "VSync", video_sync_enabled);
|
2019-12-23 07:02:37 +00:00
|
|
|
|
2020-02-21 15:19:10 +00:00
|
|
|
si.SetBoolValue("CDROM", "ReadThread", cdrom_read_thread);
|
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetStringValue("Audio", "Backend", GetAudioBackendName(audio_backend));
|
|
|
|
si.SetBoolValue("Audio", "Sync", audio_sync_enabled);
|
2020-03-15 12:04:17 +00:00
|
|
|
si.SetBoolValue("Audio", "DumpOnBoot", audio_dump_on_boot);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2019-12-30 11:22:22 +00:00
|
|
|
si.SetStringValue("BIOS", "Path", bios_path.c_str());
|
|
|
|
si.SetBoolValue("BIOS", "PatchTTYEnable", bios_patch_tty_enable);
|
|
|
|
si.SetBoolValue("BIOS", "PatchFastBoot", bios_patch_fast_boot);
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2019-12-16 06:46:43 +00:00
|
|
|
if (controller_types[0] != ControllerType::None)
|
2020-01-02 06:10:30 +00:00
|
|
|
si.SetStringValue("Controller1", "Type", GetControllerTypeName(controller_types[0]));
|
2019-12-15 12:24:27 +00:00
|
|
|
else
|
2020-01-02 06:10:30 +00:00
|
|
|
si.DeleteValue("Controller1", "Type");
|
2019-12-15 12:24:27 +00:00
|
|
|
|
2019-12-16 06:46:43 +00:00
|
|
|
if (controller_types[1] != ControllerType::None)
|
2020-01-02 06:10:30 +00:00
|
|
|
si.SetStringValue("Controller2", "Type", GetControllerTypeName(controller_types[1]));
|
2019-12-15 12:24:27 +00:00
|
|
|
else
|
2020-01-02 06:10:30 +00:00
|
|
|
si.DeleteValue("Controller2", "Type");
|
2019-12-14 13:29:26 +00:00
|
|
|
|
2019-12-16 06:46:43 +00:00
|
|
|
if (!memory_card_paths[0].empty())
|
2020-01-02 06:10:30 +00:00
|
|
|
si.SetStringValue("MemoryCards", "Card1Path", memory_card_paths[0].c_str());
|
2019-11-06 15:43:51 +00:00
|
|
|
else
|
2020-01-02 06:10:30 +00:00
|
|
|
si.DeleteValue("MemoryCards", "Card1Path");
|
2019-11-06 15:43:51 +00:00
|
|
|
|
2019-12-16 06:46:43 +00:00
|
|
|
if (!memory_card_paths[1].empty())
|
2020-01-02 06:10:30 +00:00
|
|
|
si.SetStringValue("MemoryCards", "Card2Path", memory_card_paths[1].c_str());
|
2019-11-06 15:43:51 +00:00
|
|
|
else
|
2020-01-02 06:10:30 +00:00
|
|
|
si.DeleteValue("MemoryCards", "Card2Path");
|
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);
|
2019-11-06 15:43:51 +00:00
|
|
|
}
|
|
|
|
|
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 = {
|
|
|
|
{"Auto-Detect", "NTSC-J (Japan)", "NTSC-U (US)", "PAL (Europe, Australia)"}};
|
|
|
|
|
|
|
|
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 = {
|
|
|
|
{"NTSC-J (Japan)", "NTSC-U (US)", "PAL (Europe, Australia)", "Other"}};
|
|
|
|
|
|
|
|
std::optional<DiscRegion> Settings::ParseDiscRegionName(const char* str)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
for (const char* name : s_console_region_names)
|
|
|
|
{
|
|
|
|
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 = {
|
|
|
|
{"Intepreter (Slowest)", "Cached Interpreter (Faster)", "Recompiler (Fastest)"}};
|
|
|
|
|
|
|
|
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-01-07 08:54:39 +00:00
|
|
|
static std::array<const char*, 3> s_gpu_renderer_names = {{
|
|
|
|
#ifdef WIN32
|
|
|
|
"D3D11",
|
|
|
|
#endif
|
|
|
|
"OpenGL", "Software"}};
|
|
|
|
static std::array<const char*, 3> s_gpu_renderer_display_names = {{
|
|
|
|
#ifdef WIN32
|
|
|
|
"Hardware (D3D11)",
|
|
|
|
#endif
|
|
|
|
"Hardware (OpenGL)", "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
|
|
|
|
2020-02-28 07:01:01 +00:00
|
|
|
static std::array<const char*, 3> s_display_crop_mode_names = {{"None", "Overscan", "Borders"}};
|
|
|
|
static std::array<const char*, 3> s_display_crop_mode_display_names = {{"None", "Only Overscan Area", "All Borders"}};
|
|
|
|
|
|
|
|
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)];
|
|
|
|
}
|
|
|
|
|
2020-02-15 15:14:35 +00:00
|
|
|
static std::array<const char*, 3> s_audio_backend_names = {{"Null", "Cubeb", "SDL"}};
|
|
|
|
static std::array<const char*, 3> s_audio_backend_display_names = {{"Null (No Output)", "Cubeb", "SDL"}};
|
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)];
|
|
|
|
}
|
|
|
|
|
2019-12-15 11:58:27 +00:00
|
|
|
static std::array<const char*, 3> s_controller_type_names = {{"None", "DigitalController", "AnalogController"}};
|
|
|
|
static std::array<const char*, 3> s_controller_display_names = {
|
|
|
|
{"None", "Digital Controller", "Analog Controller (DualShock)"}};
|
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)];
|
|
|
|
}
|