Merge pull request #749 from dankcushions/coreopts

Prefix libretro core options with core name.
This commit is contained in:
Connor McLaughlin 2020-08-13 01:05:13 +10:00 committed by GitHub
commit 8e8588adaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 31 deletions

View file

@ -150,7 +150,7 @@ std::string LibretroHostInterface::GetStringSettingValue(const char* section, co
const char* default_value /*= ""*/) const char* default_value /*= ""*/)
{ {
TinyString name; TinyString name;
name.Format("%s.%s", section, key); name.Format("duckstation_%s.%s", section, key);
retro_variable var{name, default_value}; retro_variable var{name, default_value};
if (g_retro_environment_callback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) if (g_retro_environment_callback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
return var.value; return var.value;
@ -353,7 +353,7 @@ void LibretroHostInterface::OnSystemDestroyed()
} }
static std::array<retro_core_option_definition, 29> s_option_definitions = {{ static std::array<retro_core_option_definition, 29> s_option_definitions = {{
{"Console.Region", {"duckstation_Console.Region",
"Console Region", "Console Region",
"Determines which region/hardware to emulate. Auto-Detect will use the region of the disc inserted.", "Determines which region/hardware to emulate. Auto-Detect will use the region of the disc inserted.",
{{"Auto", "Auto-Detect"}, {{"Auto", "Auto-Detect"},
@ -361,34 +361,34 @@ static std::array<retro_core_option_definition, 29> s_option_definitions = {{
{"NTSC-U", "NTSC-U (US)"}, {"NTSC-U", "NTSC-U (US)"},
{"PAL", "PAL (Europe, Australia)"}}, {"PAL", "PAL (Europe, Australia)"}},
"Auto"}, "Auto"},
{"BIOS.PatchFastBoot", {"duckstation_BIOS.PatchFastBoot",
"Fast Boot", "Fast Boot",
"Skips the BIOS shell/intro, booting directly into the game. Usually safe to enable, but some games break.", "Skips the BIOS shell/intro, booting directly into the game. Usually safe to enable, but some games break.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"CDROM.RegionCheck", {"duckstation_CDROM.RegionCheck",
"CD-ROM Region Check", "CD-ROM Region Check",
"Prevents discs from incorrect regions being read by the emulator. Usually safe to disable.", "Prevents discs from incorrect regions being read by the emulator. Usually safe to disable.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"CDROM.ReadThread", {"duckstation_CDROM.ReadThread",
"CD-ROM Read Thread", "CD-ROM Read Thread",
"Reads CD-ROM sectors ahead asynchronously, reducing the risk of frame time spikes.", "Reads CD-ROM sectors ahead asynchronously, reducing the risk of frame time spikes.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"true"}, "true"},
{"CDROM.LoadImageToRAM", {"duckstation_CDROM.LoadImageToRAM",
"Preload CD-ROM Image To RAM", "Preload CD-ROM Image To RAM",
"Loads the disc image to RAM before starting emulation. May reduce hitching if you are running off a network share, " "Loads the disc image to RAM before starting emulation. May reduce hitching if you are running off a network share, "
"at a cost of a greater startup time. As libretro provides no way to draw overlays, the emulator will appear to " "at a cost of a greater startup time. As libretro provides no way to draw overlays, the emulator will appear to "
"lock up while the image is preloaded.", "lock up while the image is preloaded.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"CPU.ExecutionMode", {"duckstation_CPU.ExecutionMode",
"CPU Execution Mode", "CPU Execution Mode",
"Which mode to use for CPU emulation. Recompiler provides the best performance.", "Which mode to use for CPU emulation. Recompiler provides the best performance.",
{{"Interpreter", "Interpreter"}, {"CachedIntepreter", "Cached Interpreter"}, {"Recompiler", "Recompiler"}}, {{"Interpreter", "Interpreter"}, {"CachedIntepreter", "Cached Interpreter"}, {"Recompiler", "Recompiler"}},
"Recompiler"}, "Recompiler"},
{"GPU.Renderer", {"duckstation_GPU.Renderer",
"GPU Renderer", "GPU Renderer",
"Which renderer to use to emulate the GPU", "Which renderer to use to emulate the GPU",
{ {
@ -404,7 +404,7 @@ static std::array<retro_core_option_definition, 29> s_option_definitions = {{
"OpenGL" "OpenGL"
#endif #endif
}, },
{"GPU.ResolutionScale", {"duckstation_GPU.ResolutionScale",
"Internal Resolution Scale", "Internal Resolution Scale",
"Scales internal VRAM resolution by the specified multiplier. Larger values are slower. Some games require " "Scales internal VRAM resolution by the specified multiplier. Larger values are slower. Some games require "
"1x VRAM resolution or they will have rendering issues.", "1x VRAM resolution or they will have rendering issues.",
@ -425,81 +425,81 @@ static std::array<retro_core_option_definition, 29> s_option_definitions = {{
{"15", "15x"}, {"15", "15x"},
{"16", "16x"}}, {"16", "16x"}},
"1"}, "1"},
{"GPU.TrueColor", {"duckstation_GPU.TrueColor",
"True Color Rendering", "True Color Rendering",
"Disables dithering and uses the full 8 bits per channel of color information. May break rendering in some games.", "Disables dithering and uses the full 8 bits per channel of color information. May break rendering in some games.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"GPU.ScaledDithering", {"duckstation_GPU.ScaledDithering",
"Scaled Dithering", "Scaled Dithering",
"Scales the dithering pattern with the internal rendering resolution, making it less noticeable. Usually safe to " "Scales the dithering pattern with the internal rendering resolution, making it less noticeable. Usually safe to "
"enable.", "enable.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"true"}, "true"},
{"GPU.DisableInterlacing", {"duckstation_GPU.DisableInterlacing",
"Disable Interlacing", "Disable Interlacing",
"Disables interlaced rendering and display in the GPU. Some games can render in 480p this way, but others will " "Disables interlaced rendering and display in the GPU. Some games can render in 480p this way, but others will "
"break.", "break.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"GPU.ForceNTSCTimings", {"duckstation_GPU.ForceNTSCTimings",
"Force NTSC Timings", "Force NTSC Timings",
"Forces PAL games to run at NTSC timings, i.e. 60hz. Some PAL games will run at their \"normal\" speeds, while " "Forces PAL games to run at NTSC timings, i.e. 60hz. Some PAL games will run at their \"normal\" speeds, while "
"others will break.", "others will break.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"GPU.TextureFiltering", {"duckstation_GPU.TextureFiltering",
"Bilinear Texture Filtering", "Bilinear Texture Filtering",
"Smooths out the blockyness of magnified textures on 3D object by using bilinear filtering. Will have a " "Smooths out the blockyness of magnified textures on 3D object by using bilinear filtering. Will have a "
"greater effect on higher resolution scales. Only applies to the hardware renderers.", "greater effect on higher resolution scales. Only applies to the hardware renderers.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"GPU.WidescreenHack", {"duckstation_GPU.WidescreenHack",
"Widescreen Hack", "Widescreen Hack",
"Increases the field of view from 4:3 to 16:9 in 3D games. For 2D games, or games which use pre-rendered " "Increases the field of view from 4:3 to 16:9 in 3D games. For 2D games, or games which use pre-rendered "
"backgrounds, this enhancement will not work as expected.", "backgrounds, this enhancement will not work as expected.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"GPU.PGXPEnable", {"duckstation_GPU.PGXPEnable",
"PGXP Geometry Correction", "PGXP Geometry Correction",
"Reduces \"wobbly\" polygons by attempting to preserve the fractional component through memory transfers. Only " "Reduces \"wobbly\" polygons by attempting to preserve the fractional component through memory transfers. Only "
"works with the hardware renderers, and may not be compatible with all games.", "works with the hardware renderers, and may not be compatible with all games.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"GPU.PGXPCulling", {"duckstation_GPU.PGXPCulling",
"PGXP Culling Correction", "PGXP Culling Correction",
"Increases the precision of polygon culling, reducing the number of holes in geometry. Requires geometry correction " "Increases the precision of polygon culling, reducing the number of holes in geometry. Requires geometry correction "
"enabled.", "enabled.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"true"}, "true"},
{"GPU.PGXPTextureCorrection", {"duckstation_GPU.PGXPTextureCorrection",
"PGXP Texture Correction", "PGXP Texture Correction",
"Uses perspective-correct interpolation for texture coordinates and colors, straightening out warped textures. " "Uses perspective-correct interpolation for texture coordinates and colors, straightening out warped textures. "
"Requires geometry correction enabled.", "Requires geometry correction enabled.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"true"}, "true"},
{"GPU.PGXPVertexCache", {"duckstation_GPU.PGXPVertexCache",
"PGXP Vertex Cache", "PGXP Vertex Cache",
"Uses screen coordinates as a fallback when tracking vertices through memory fails. May improve PGXP compatibility.", "Uses screen coordinates as a fallback when tracking vertices through memory fails. May improve PGXP compatibility.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"Display.CropMode", {"duckstation_Display.CropMode",
"Crop Mode", "Crop Mode",
"Changes how much of the image is cropped. Some games display garbage in the overscan area which is typically " "Changes how much of the image is cropped. Some games display garbage in the overscan area which is typically "
"hidden.", "hidden.",
{{"None", "None"}, {"Overscan", "Only Overscan Area"}, {"Borders", "All Borders"}}, {{"None", "None"}, {"Overscan", "Only Overscan Area"}, {"Borders", "All Borders"}},
"Overscan"}, "Overscan"},
{"Display.AspectRatio", {"duckstation_Display.AspectRatio",
"Aspect Ratio", "Aspect Ratio",
"Sets the core-provided aspect ratio.", "Sets the core-provided aspect ratio.",
{{"4:3", "4:3"}, {"16:9", "16:9"}, {"2:1", "2:1 (VRAM 1:1)"}, {"1:1", "1:1"}}, {{"4:3", "4:3"}, {"16:9", "16:9"}, {"2:1", "2:1 (VRAM 1:1)"}, {"1:1", "1:1"}},
"4:3"}, "4:3"},
{"MemoryCards.LoadFromSaveStates", {"duckstation_MemoryCards.LoadFromSaveStates",
"Load Memory Cards From Save States", "Load Memory Cards From Save States",
"Sets whether the contents of memory cards will be loaded when a save state is loaded.", "Sets whether the contents of memory cards will be loaded when a save state is loaded.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"MemoryCards.Card1Type", {"duckstation_MemoryCards.Card1Type",
"Memory Card 1 Type", "Memory Card 1 Type",
"Sets the type of memory card for Slot 1.", "Sets the type of memory card for Slot 1.",
{{"None", "No Memory Card"}, {{"None", "No Memory Card"},
@ -507,7 +507,7 @@ static std::array<retro_core_option_definition, 29> s_option_definitions = {{
{"PerGame", "Separate Card Per Game (Game Code)"}, {"PerGame", "Separate Card Per Game (Game Code)"},
{"PerGameTitle", "Separate Card Per Game (Game Title)"}}, {"PerGameTitle", "Separate Card Per Game (Game Title)"}},
"PerGameTitle"}, "PerGameTitle"},
{"MemoryCards.Card2Type", {"duckstation_MemoryCards.Card2Type",
"Memory Card 2 Type", "Memory Card 2 Type",
"Sets the type of memory card for Slot 2.", "Sets the type of memory card for Slot 2.",
{{"None", "No Memory Card"}, {{"None", "No Memory Card"},
@ -515,7 +515,7 @@ static std::array<retro_core_option_definition, 29> s_option_definitions = {{
{"PerGame", "Separate Card Per Game (Game Code)"}, {"PerGame", "Separate Card Per Game (Game Code)"},
{"PerGameTitle", "Separate Card Per Game (Game Title)"}}, {"PerGameTitle", "Separate Card Per Game (Game Title)"}},
"None"}, "None"},
{"Controller1.Type", {"duckstation_Controller1.Type",
"Controller 1 Type", "Controller 1 Type",
"Sets the type of controller for Slot 1.", "Sets the type of controller for Slot 1.",
{{"None", "None"}, {{"None", "None"},
@ -525,12 +525,12 @@ static std::array<retro_core_option_definition, 29> s_option_definitions = {{
{"PlayStationMouse", "PlayStation Mouse"}, {"PlayStationMouse", "PlayStation Mouse"},
{"NeGcon", "NeGcon"}}, {"NeGcon", "NeGcon"}},
"DigitalController"}, "DigitalController"},
{"Controller1.AutoEnableAnalog", {"duckstation_Controller1.AutoEnableAnalog",
"Controller 1 Auto Analog Mode", "Controller 1 Auto Analog Mode",
"Automatically enables analog mode in supported controllers at start/reset.", "Automatically enables analog mode in supported controllers at start/reset.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"Controller2.Type", {"duckstation_Controller2.Type",
"Controller 2 Type", "Controller 2 Type",
"Sets the type of controller for Slot 2.", "Sets the type of controller for Slot 2.",
{{"None", "None"}, {{"None", "None"},
@ -540,12 +540,12 @@ static std::array<retro_core_option_definition, 29> s_option_definitions = {{
{"PlayStationMouse", "PlayStation Mouse"}, {"PlayStationMouse", "PlayStation Mouse"},
{"NeGcon", "NeGcon"}}, {"NeGcon", "NeGcon"}},
"None"}, "None"},
{"Controller2.AutoEnableAnalog", {"duckstation_Controller2.AutoEnableAnalog",
"Controller 2 Auto Analog Mode", "Controller 2 Auto Analog Mode",
"Automatically enables analog mode in supported controllers at start/reset.", "Automatically enables analog mode in supported controllers at start/reset.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
"false"}, "false"},
{"Logging.LogLevel", {"duckstation_Logging.LogLevel",
"Log Level", "Log Level",
"Sets the level of information logged by the core.", "Sets the level of information logged by the core.",
{{"None", "None"}, {{"None", "None"},
@ -788,7 +788,7 @@ static std::optional<GPURenderer> RenderAPIToRenderer(HostDisplay::RenderAPI api
bool LibretroHostInterface::RequestHardwareRendererContext() bool LibretroHostInterface::RequestHardwareRendererContext()
{ {
GPURenderer renderer = Settings::DEFAULT_GPU_RENDERER; GPURenderer renderer = Settings::DEFAULT_GPU_RENDERER;
retro_variable renderer_variable{"GPU.Renderer", Settings::GetRendererName(Settings::DEFAULT_GPU_RENDERER)}; retro_variable renderer_variable{"duckstation_GPU.Renderer", Settings::GetRendererName(Settings::DEFAULT_GPU_RENDERER)};
if (g_retro_environment_callback(RETRO_ENVIRONMENT_GET_VARIABLE, &renderer_variable) && renderer_variable.value) if (g_retro_environment_callback(RETRO_ENVIRONMENT_GET_VARIABLE, &renderer_variable) && renderer_variable.value)
renderer = Settings::ParseRendererName(renderer_variable.value).value_or(Settings::DEFAULT_GPU_RENDERER); renderer = Settings::ParseRendererName(renderer_variable.value).value_or(Settings::DEFAULT_GPU_RENDERER);

View file

@ -8,8 +8,9 @@ Log_SetChannel(LibretroSettingsInterface);
template<typename T, typename DefaultValueType> template<typename T, typename DefaultValueType>
static T GetVariable(const char* section, const char* key, DefaultValueType default_value) static T GetVariable(const char* section, const char* key, DefaultValueType default_value)
{ {
TinyString full_key; TinyString full_key;
full_key.Format("%s.%s", section, key); full_key.Format("duckstation_%s.%s", section, key);
retro_variable rv = {full_key.GetCharArray(), nullptr}; retro_variable rv = {full_key.GetCharArray(), nullptr};
if (!g_retro_environment_callback(RETRO_ENVIRONMENT_GET_VARIABLE, &rv) || !rv.value) if (!g_retro_environment_callback(RETRO_ENVIRONMENT_GET_VARIABLE, &rv) || !rv.value)