diff --git a/shell/libretro/libretro.cpp b/shell/libretro/libretro.cpp index e13dc60e2..c9d0307e6 100644 --- a/shell/libretro/libretro.cpp +++ b/shell/libretro/libretro.cpp @@ -109,6 +109,15 @@ static bool allow_service_buttons = false; static bool libretro_supports_bitmasks = false; static bool categoriesSupported = false; +static bool platformIsDreamcast = true; +static bool platformIsArcade = false; +static bool threadedRenderingEnabled = true; +static bool oitEnabled = false; +#if defined(HAVE_TEXUPSCALE) +static bool textureUpscaleEnabled = false; +#endif +static bool vmuScreenSettingsShown = true; +static bool lightgunSettingsShown = true; u32 kcode[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; u8 rt[4]; @@ -173,6 +182,7 @@ static std::vector disk_labels; static bool disc_tray_open = false; void UpdateInputState(); +static bool set_variable_visibility(void); void retro_set_video_refresh(retro_video_refresh_t cb) { @@ -215,7 +225,20 @@ void retro_set_environment(retro_environment_t cb) { environ_cb = cb; - libretro_set_core_options(environ_cb, &categoriesSupported); + // An annoyance: retro_set_environment() can be called + // multiple times, and depending upon the current frontend + // state various environment callbacks may be disabled. + // This means the reported 'categories_supported' status + // may change on subsequent iterations. We therefore have + // to record whether 'categories_supported' is true on any + // iteration, and latch the result + bool optionCategoriesSupported = false; + libretro_set_core_options(environ_cb, &optionCategoriesSupported); + categoriesSupported |= optionCategoriesSupported; + + struct retro_core_options_update_display_callback update_display_cb; + update_display_cb.callback = set_variable_visibility; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK, &update_display_cb); static const struct retro_controller_description ports_default[] = { @@ -289,126 +312,222 @@ void retro_deinit() } os_UninstallFaultHandler(); libretro_supports_bitmasks = false; + categoriesSupported = false; + platformIsDreamcast = true; + platformIsArcade = false; + threadedRenderingEnabled = true; + oitEnabled = false; +#if defined(HAVE_TEXUPSCALE) + textureUpscaleEnabled = false; +#endif + vmuScreenSettingsShown = true; + lightgunSettingsShown = true; LogManager::Shutdown(); retro_audio_deinit(); } -static void set_variable_visibility() +static bool set_variable_visibility(void) { struct retro_core_option_display option_display; struct retro_variable var; + bool updated = false; - // Show/hide NAOMI/Atomiswave options - option_display.visible = ((settings.platform.system == DC_PLATFORM_NAOMI) || - (settings.platform.system == DC_PLATFORM_ATOMISWAVE)); + bool platformWasDreamcast = platformIsDreamcast; + bool platformWasArcade = platformIsArcade; - option_display.key = CORE_OPTION_NAME "_allow_service_buttons"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_enable_naomi_15khz_dipswitch"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + platformIsDreamcast = (settings.platform.system == DC_PLATFORM_DREAMCAST); + platformIsArcade = (settings.platform.system == DC_PLATFORM_NAOMI) || + (settings.platform.system == DC_PLATFORM_ATOMISWAVE); - // Show/hide Dreamcast options - option_display.visible = (settings.platform.system == DC_PLATFORM_DREAMCAST); + // Show/hide platform-dependent options + if (first_run || (platformIsDreamcast != platformWasDreamcast) || (platformIsArcade != platformWasArcade)) + { + // Show/hide NAOMI/Atomiswave options + option_display.visible = platformIsArcade; + option_display.key = CORE_OPTION_NAME "_allow_service_buttons"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_boot_to_bios"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_hle_bios"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_gdrom_fast_loading"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_cable_type"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_broadcast"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_language"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_force_wince"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_enable_purupuru"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - option_display.key = CORE_OPTION_NAME "_per_content_vmus"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + // Show/hide Dreamcast options + option_display.visible = platformIsDreamcast; + option_display.key = CORE_OPTION_NAME "_boot_to_bios"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = CORE_OPTION_NAME "_hle_bios"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = CORE_OPTION_NAME "_gdrom_fast_loading"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = CORE_OPTION_NAME "_cable_type"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = CORE_OPTION_NAME "_broadcast"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = CORE_OPTION_NAME "_language"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = CORE_OPTION_NAME "_force_wince"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = CORE_OPTION_NAME "_enable_purupuru"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = CORE_OPTION_NAME "_per_content_vmus"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - /* only show, if categories not supported */ - option_display.visible = ((settings.platform.system == DC_PLATFORM_DREAMCAST) - && (!categoriesSupported)); - option_display.key = CORE_OPTION_NAME "_show_vmu_screen_settings"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + vmuScreenSettingsShown = option_display.visible; + for (unsigned i = 0; i < 4; i++) + { + char key[256]; + option_display.key = key; + + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_display"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_position"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_size_mult"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_pixel_on_color"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_pixel_off_color"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_opacity"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + } + + // Show/hide manual option visibility toggles + // > Only show if categories are not supported + option_display.visible = platformIsDreamcast && !categoriesSupported; + option_display.key = CORE_OPTION_NAME "_show_vmu_screen_settings"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + + updated = true; + } + + // Show/hide additional manual option visibility toggles + // > Only show if categories are not supported + if (first_run) + { + option_display.visible = !categoriesSupported; + option_display.key = CORE_OPTION_NAME "_show_lightgun_settings"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + updated = true; + } // Show/hide settings-dependent options - option_display.visible = config::ThreadedRendering; - option_display.key = CORE_OPTION_NAME "_auto_skip_frame"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + // Only for threaded renderer + bool threadedRenderingWasEnabled = threadedRenderingEnabled; + threadedRenderingEnabled = true; + var.key = CORE_OPTION_NAME "_threaded_rendering"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && !strcmp(var.value, "disabled")) + threadedRenderingEnabled = false; + if (first_run || (threadedRenderingEnabled != threadedRenderingWasEnabled)) + { + option_display.visible = threadedRenderingEnabled; + option_display.key = CORE_OPTION_NAME "_auto_skip_frame"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + updated = true; + } + +#if defined(HAVE_OIT) || defined(HAVE_VULKAN) // Only for per-pixel renderers - option_display.visible = config::RendererType == RenderType::OpenGL_OIT || config::RendererType == RenderType::Vulkan_OIT; - option_display.key = CORE_OPTION_NAME "_oit_abuffer_size"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + bool oitWasEnabled = oitEnabled; + oitEnabled = false; + var.key = CORE_OPTION_NAME "_alpha_sorting"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && !strcmp(var.value, "per-pixel (accurate)")) + oitEnabled = true; + if (first_run || (oitEnabled != oitWasEnabled)) + { + option_display.visible = oitEnabled; + option_display.key = CORE_OPTION_NAME "_oit_abuffer_size"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + updated = true; + } +#endif + +#if defined(HAVE_TEXUPSCALE) // Only if texture upscaling is enabled - option_display.visible = config::TextureUpscale > 1; - option_display.key = CORE_OPTION_NAME "_texupscale_max_filtered_texture_size"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + bool textureUpscaleWasEnabled = textureUpscaleEnabled; + textureUpscaleEnabled = false; + var.key = CORE_OPTION_NAME "_texupscale"; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && strcmp(var.value, "off")) + textureUpscaleEnabled = true; + + if (first_run || (textureUpscaleEnabled != textureUpscaleWasEnabled)) + { + option_display.visible = textureUpscaleEnabled; + option_display.key = CORE_OPTION_NAME "_texupscale_max_filtered_texture_size"; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + updated = true; + } +#endif + + // If categories are supported, no further action is required + if (categoriesSupported) + return updated; // Show/hide VMU screen options - if (settings.platform.system == DC_PLATFORM_DREAMCAST) + bool vmuScreenSettingsWereShown = vmuScreenSettingsShown; + + if (platformIsDreamcast) { - option_display.visible = true; + vmuScreenSettingsShown = true; var.key = CORE_OPTION_NAME "_show_vmu_screen_settings"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) - && var.value - && !categoriesSupported) - if (!strcmp(var.value, "disabled")) - option_display.visible = false; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && !strcmp(var.value, "disabled")) + vmuScreenSettingsShown = false; } else - option_display.visible = false; + vmuScreenSettingsShown = false; - for (int i = 0; i < 4; i++) + if (first_run || (vmuScreenSettingsShown != vmuScreenSettingsWereShown)) { - char key[256]; - option_display.key = key; + option_display.visible = vmuScreenSettingsShown; - snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_display"); - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_position"); - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_size_mult"); - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_pixel_on_color"); - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_pixel_off_color"); - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_opacity"); - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + for (unsigned i = 0; i < 4; i++) + { + char key[256]; + option_display.key = key; + + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_display"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_position"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_size_mult"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_pixel_on_color"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_pixel_off_color"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_vmu", i + 1, "_screen_opacity"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + } + + updated = true; } - /* only show, if categories not supported */ - option_display.visible = !categoriesSupported; - option_display.key = CORE_OPTION_NAME "_show_lightgun_settings"; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); - // Show/hide light gun options - option_display.visible = true; + bool lightgunSettingsWereShown = lightgunSettingsShown; + lightgunSettingsShown = true; var.key = CORE_OPTION_NAME "_show_lightgun_settings"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) - && var.value - && !categoriesSupported) - if (!strcmp(var.value, "disabled")) - option_display.visible = false; + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && !strcmp(var.value, "disabled")) + lightgunSettingsShown = false; - for (int i = 0; i < 4; i++) + if (first_run || (lightgunSettingsShown != lightgunSettingsWereShown)) { - char key[256]; - option_display.key = key; + option_display.visible = lightgunSettingsShown; - snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_lightgun", i + 1, "_crosshair"); - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + for (unsigned i = 0; i < 4; i++) + { + char key[256]; + option_display.key = key; + + snprintf(key, sizeof(key), "%s%u%s", CORE_OPTION_NAME "_lightgun", i + 1, "_crosshair"); + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + } + + updated = true; } + + return updated; } static void setFramebufferSize() @@ -853,10 +972,7 @@ void retro_run() // On the first call, we start the emulator thread if (first_run) - { dc_resume(); - first_run = false; - } // Render is_dupe = true; @@ -898,6 +1014,8 @@ void retro_run() if (!config::ThreadedRendering) is_dupe = true; + + first_run = false; } static bool loadGame(const char *path) @@ -1588,8 +1706,6 @@ bool retro_load_game(const struct retro_game_info *game) } } } - // System may have changed - have to update hidden core options - set_variable_visibility(); if (game->path[0] == '\0') { @@ -1715,6 +1831,9 @@ bool retro_load_game(const struct retro_game_info *game) if (devices_need_refresh) refresh_devices(true); + // System may have changed - have to update hidden core options + set_variable_visibility(); + return true; } diff --git a/shell/libretro/libretro_core_options.h b/shell/libretro/libretro_core_options.h index deed9f0e1..c732b393a 100644 --- a/shell/libretro/libretro_core_options.h +++ b/shell/libretro/libretro_core_options.h @@ -69,37 +69,96 @@ extern "C" { struct retro_core_option_v2_category option_cats_us[] = { + { + "system", + "System", + "Configure region, language, BIOS and base hardware settings." + }, { "video", "Video", - "Change visual buffers & effects, display parameters, framerate/-skip and rendering/texture settings." + "Configure resolution, order-independent transparency and visual effect settings." }, { - "input", - "Input", - "Change controller & light gun settings." - }, - { - "vmu", - "Visual Memory", - "Change settings related to the Visual Memory Units/Systems (VMU)." + "performance", + "Performance", + "Configure threaded rendering, integer division optimisations and frame skip settings." }, { "hacks", "Emulation Hacks", - "Change different emulation hacks." + "Configure widescreen overrides, GD-ROM loading speed and texture replacement settings." + }, + { + "input", + "Input", + "Configure gamepad and light gun settings." + }, + { + "vmu", + "Visual Memory Unit", + "Configure per-game VMU save files and on-screen VMU visibility settings." }, { NULL, NULL, NULL }, }; struct retro_core_option_v2_definition option_defs_us[] = { + { + CORE_OPTION_NAME "_region", + "Region", + NULL, + "", + NULL, + "system", + { + { "Japan", NULL }, + { "USA", NULL }, + { "Europe", NULL }, + { "Default", NULL }, + { NULL, NULL }, + }, + "Default", + }, + { + CORE_OPTION_NAME "_language", + "Language", + NULL, + "Changes the language used by the BIOS and by any games that contain multiple languages.", + NULL, + "system", + { + { "Japanese", NULL }, + { "English", NULL }, + { "German", NULL }, + { "French", NULL }, + { "Spanish", NULL }, + { "Italian", NULL }, + { "Default", NULL }, + { NULL, NULL }, + }, + "Default", + }, + { + CORE_OPTION_NAME "_hle_bios", + "HLE BIOS", + NULL, + "Force use of high-level emulation BIOS.", + NULL, + "system", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL}, + }, + "disabled", + }, { CORE_OPTION_NAME "_boot_to_bios", "Boot to BIOS (Restart Required)", NULL, "Boot directly into the Dreamcast BIOS menu.", NULL, - NULL, + "system", { { "disabled", NULL }, { "enabled", NULL }, @@ -108,37 +167,51 @@ struct retro_core_option_v2_definition option_defs_us[] = { "disabled", }, { - CORE_OPTION_NAME "_hle_bios", - "HLE BIOS", - NULL, - "Force use of high-level emulation BIOS.", + CORE_OPTION_NAME "_enable_dsp", + "Enable DSP", NULL, + "Enable emulation of the Dreamcast's audio DSP (digital signal processor). Improves the accuracy of generated sound, but increases performance requirements.", NULL, + "system", { - { "disabled", NULL }, + { "disabled", NULL }, { "enabled", NULL }, - { NULL, NULL}, + { NULL, NULL }, + }, +#ifdef LOW_END + "disabled", +#else + "enabled", +#endif + }, + { + CORE_OPTION_NAME "_force_wince", + "Force Windows CE Mode", + NULL, + "Enable full MMU (Memory Management Unit) emulation and other settings for Windows CE games.", + NULL, + "system", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, }, "disabled", }, -#if defined(HAVE_OIT) || defined(HAVE_VULKAN) { - CORE_OPTION_NAME "_oit_abuffer_size", - "Accumulation Pixel Buffer Size (Restart Required)", + CORE_OPTION_NAME "_allow_service_buttons", + "Allow NAOMI Service Buttons", NULL, - "Higher values might be required for higher resolutions to output correctly.", + "Enables SERVICE button for NAOMI, to enter cabinet settings.", NULL, - "video", + "system", { - { "512MB", NULL }, - { "1GB", NULL }, - { "2GB", NULL }, - { "4GB", NULL }, + { "disabled", NULL }, + { "enabled", NULL }, { NULL, NULL }, }, - "512MB", + "disabled", }, -#endif { CORE_OPTION_NAME "_internal_resolution", "Internal Resolution (Restart Required)", @@ -182,6 +255,38 @@ struct retro_core_option_v2_definition option_defs_us[] = { "640x480", #endif }, + { + CORE_OPTION_NAME "_cable_type", + "Cable Type", + NULL, + "The output signal type. 'TV (Composite)' is the most widely supported.", + NULL, + "video", + { + { "VGA", NULL }, + { "TV (RGB)", NULL }, + { "TV (Composite)", NULL }, + { NULL, NULL }, + }, + "TV (Composite)", + }, + { + CORE_OPTION_NAME "_broadcast", + "Broadcast Standard", + NULL, + "", + NULL, + "video", + { + { "NTSC", NULL }, + { "PAL", "PAL (World)" }, + { "PAL_N", "PAL-N (Argentina, Paraguay, Uruguay)" }, + { "PAL_M", "PAL-M (Brazil)" }, + { "Default", NULL }, + { NULL, NULL }, + }, + "NTSC", + }, { CORE_OPTION_NAME "_screen_rotation", "Screen Orientation", @@ -202,7 +307,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { NULL, "", NULL, - NULL, + "video", { { "per-strip (fast, least accurate)", "Per-Strip (fast, least accurate)" }, { "per-triangle (normal)", "Per-Triangle (normal)" }, @@ -217,23 +322,37 @@ struct retro_core_option_v2_definition option_defs_us[] = { "per-triangle (normal)", #endif }, +#if defined(HAVE_OIT) || defined(HAVE_VULKAN) { - CORE_OPTION_NAME "_gdrom_fast_loading", - "GD-ROM Fast Loading (inaccurate)", + CORE_OPTION_NAME "_oit_abuffer_size", + "Accumulation Pixel Buffer Size (Restart Required)", NULL, - "Speeds up GD-ROM loading.", + "Higher values might be required for higher resolutions to output correctly.", NULL, + "video", + { + { "512MB", NULL }, + { "1GB", NULL }, + { "2GB", NULL }, + { "4GB", NULL }, + { NULL, NULL }, + }, + "512MB", + }, +#endif + {/* TODO: needs explanation */ + CORE_OPTION_NAME "_enable_rttb", + "Enable RTT (Render To Texture) Buffer", NULL, + "", + NULL, + "video", { { "disabled", NULL }, { "enabled", NULL }, { NULL, NULL }, }, -#ifdef LOW_END - "enabled", -#else "disabled", -#endif }, {/* TODO: needs explanation */ CORE_OPTION_NAME "_mipmapping", @@ -271,19 +390,36 @@ struct retro_core_option_v2_definition option_defs_us[] = { NULL, "video", { - { "disabled", NULL }, + { "disabled", NULL }, { "enabled", NULL }, { NULL, NULL }, }, "enabled", }, { - CORE_OPTION_NAME "_widescreen_hack", - "Widescreen Hack", + CORE_OPTION_NAME "_anisotropic_filtering", + "Anisotropic Filtering", NULL, - "Draw geometry outside of the normal 4:3 aspect ratio. May produce graphical glitches in the revealed areas.", + "Enhance the quality of textures on surfaces that are at oblique viewing angles with respect to the camera.", NULL, - "hacks", + "video", + { + { "off", "disabled" }, + { "2", NULL }, + { "4", NULL }, + { "8", NULL }, + { "16", NULL }, + { NULL, NULL }, + }, + "4", + }, + { + CORE_OPTION_NAME "_delay_frame_swapping", + "Delay Frame Swapping", + NULL, + "Useful to avoid flashing screens or glitchy videos. Not recommended on slow platforms.", + NULL, + "video", { { "disabled", NULL }, { "enabled", NULL }, @@ -291,6 +427,119 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "disabled", }, + { + CORE_OPTION_NAME "_pvr2_filtering", + "PowerVR2 Post-processing Filter", + NULL, + "Post-process the rendered image to simulate effects specific to the PowerVR2 GPU and analog video signals.", + NULL, + "video", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled", + }, +#ifdef HAVE_TEXUPSCALE + { + CORE_OPTION_NAME "_texupscale", + "Texture Upscaling (xBRZ)", + NULL, + "Enhance hand-drawn 2D pixel art graphics. Should only be used with 2D pixelated games.", + NULL, + "video", + { + { "off", "disabled" }, + { "2x", NULL }, + { "4x", NULL }, + { "6x", NULL }, + { NULL, NULL }, + }, + "off", + }, + {/* TODO: needs clarification */ + CORE_OPTION_NAME "_texupscale_max_filtered_texture_size", + "Texture Upscaling Max. Filtered Size", + NULL, + "", + NULL, + "video", + { + { "256", NULL }, + { "512", NULL }, + { "1024", NULL }, + { NULL, NULL }, + }, + "256", + }, +#endif + { + CORE_OPTION_NAME "_threaded_rendering", + "Threaded Rendering", + NULL, + "Runs the GPU and CPU on different threads. Highly recommended.", + NULL, + "performance", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "enabled", + }, + { + CORE_OPTION_NAME "_div_matching", + "DIV Matching", + NULL, + "Optimize integer division", + NULL, + "performance", + { + { "auto", "Auto" }, + { "disabled", NULL }, + { NULL, NULL }, + }, + "auto", + }, + { + CORE_OPTION_NAME "_auto_skip_frame", + "Auto Skip Frame", + NULL, + "Automatically skip frames when the emulator is running slow. Note: This setting only applies when 'Threaded Rendering' is enabled.", + NULL, + "performance", + { + { "disabled", NULL }, + { "some", "Normal" }, + { "more", "Maximum" }, + { NULL, NULL }, + }, +#ifdef LOW_END + "some", +#else + "disabled", +#endif + }, + { + CORE_OPTION_NAME "_frame_skipping", + "Frame Skipping", + NULL, + "Sets the number of frames to skip between each displayed frame.", + NULL, + "performance", + { + { "disabled", NULL }, + { "1", NULL }, + { "2", NULL }, + { "3", NULL }, + { "4", NULL }, + { "5", NULL }, + { "6", NULL }, + { NULL, NULL }, + }, + "disabled", + }, { CORE_OPTION_NAME "_widescreen_cheats", "Widescreen Cheats (Restart Required)", @@ -306,93 +555,58 @@ struct retro_core_option_v2_definition option_defs_us[] = { "disabled", }, { - CORE_OPTION_NAME "_cable_type", - "Cable Type", + CORE_OPTION_NAME "_widescreen_hack", + "Widescreen Hack", NULL, - "The output signal type. 'TV (Composite)' is the most widely supported.", + "Draw geometry outside of the normal 4:3 aspect ratio. May produce graphical glitches in the revealed areas.", NULL, - "video", + "hacks", { - { "VGA", NULL }, - { "TV (RGB)", NULL }, - { "TV (Composite)", NULL }, - { NULL, NULL }, - }, - "TV (Composite)", - }, - { - CORE_OPTION_NAME "_broadcast", - "Broadcast Standard", - NULL, - "", - NULL, - "video", - { - { "NTSC", NULL }, - { "PAL", "PAL (World)" }, - { "PAL_N", "PAL-N (Argentina, Paraguay, Uruguay)" }, - { "PAL_M", "PAL-M (Brazil)" }, - { "Default", NULL }, - { NULL, NULL }, - }, - "NTSC", - }, - { - CORE_OPTION_NAME "_region", - "Region", - NULL, - "", - NULL, - NULL, - { - { "Japan", NULL }, - { "USA", NULL }, - { "Europe", NULL }, - { "Default", NULL }, - { NULL, NULL }, - }, - "Default", - }, - { - CORE_OPTION_NAME "_language", - "Language", - NULL, - "Changes the language used by the BIOS and by any games that contain multiple languages.", - NULL, - NULL, - { - { "Japanese", NULL }, - { "English", NULL }, - { "German", NULL }, - { "French", NULL }, - { "Spanish", NULL }, - { "Italian", NULL }, - { "Default", NULL }, - { NULL, NULL }, - }, - "Default", - }, - { - CORE_OPTION_NAME "_div_matching", - "DIV Matching", - NULL, - "Optimize integer division", - NULL, - NULL, - { - { "auto", "Auto" }, { "disabled", NULL }, + { "enabled", NULL }, { NULL, NULL }, }, - "auto", + "disabled", }, { - CORE_OPTION_NAME "_force_wince", - "Force Windows CE Mode", + CORE_OPTION_NAME "_gdrom_fast_loading", + "GD-ROM Fast Loading (inaccurate)", NULL, - "Enable full MMU (Memory Management Unit) emulation and other settings for Windows CE games.", + "Speeds up GD-ROM loading.", NULL, + "hacks", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, +#ifdef LOW_END + "enabled", +#else + "disabled", +#endif + }, + { + CORE_OPTION_NAME "_custom_textures", + "Load Custom Textures", NULL, + "", + NULL, + "hacks", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled", + }, + {/* TODO: probably needs explanation */ + CORE_OPTION_NAME "_dump_textures", + "Dump Textures", + NULL, + "", + NULL, + "hacks", { { "disabled", NULL }, { "enabled", NULL }, @@ -452,168 +666,6 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "disabled", }, - { - CORE_OPTION_NAME "_enable_dsp", - "Enable DSP", - NULL, - "Enable emulation of the Dreamcast's audio DSP (digital signal processor). Improves the accuracy of generated sound, but increases performance requirements.", - NULL, - NULL, - { - { "disabled", NULL }, - { "enabled", NULL }, - { NULL, NULL }, - }, -#ifdef LOW_END - "disabled", -#else - "enabled", -#endif - }, - { - CORE_OPTION_NAME "_anisotropic_filtering", - "Anisotropic Filtering", - NULL, - "Enhance the quality of textures on surfaces that are at oblique viewing angles with respect to the camera.", - NULL, - "video", - { - { "off", "disabled" }, - { "2", NULL }, - { "4", NULL }, - { "8", NULL }, - { "16", NULL }, - { NULL, NULL }, - }, - "4", - }, - { - CORE_OPTION_NAME "_pvr2_filtering", - "PowerVR2 Post-processing Filter", - NULL, - "Post-process the rendered image to simulate effects specific to the PowerVR2 GPU and analog video signals.", - NULL, - "video", - { - { "disabled", NULL }, - { "enabled", NULL }, - { NULL, NULL }, - }, - "disabled", - }, -#ifdef HAVE_TEXUPSCALE - { - CORE_OPTION_NAME "_texupscale", - "Texture Upscaling (xBRZ)", - NULL, - "Enhance hand-drawn 2D pixel art graphics. Should only be used with 2D pixelated games.", - NULL, - "video", - { - { "off", "disabled" }, - { "2x", NULL }, - { "4x", NULL }, - { "6x", NULL }, - { NULL, NULL }, - }, - "off", - }, - {/* TODO: needs clarification */ - CORE_OPTION_NAME "_texupscale_max_filtered_texture_size", - "Texture Upscaling Max. Filtered Size", - NULL, - "", - NULL, - "video", - { - { "256", NULL }, - { "512", NULL }, - { "1024", NULL }, - { NULL, NULL }, - }, - "256", - }, -#endif - {/* TODO: needs explanation */ - CORE_OPTION_NAME "_enable_rttb", - "Enable RTT (Render To Texture) Buffer", - NULL, - "", - NULL, - "video", - { - { "disabled", NULL }, - { "enabled", NULL }, - { NULL, NULL }, - }, - "disabled", - }, - { - CORE_OPTION_NAME "_threaded_rendering", - "Threaded Rendering", - NULL, - "Runs the GPU and CPU on different threads. Highly recommended.", - NULL, - NULL, - { - { "disabled", NULL }, - { "enabled", NULL }, - { NULL, NULL }, - }, - "enabled", - }, - { - CORE_OPTION_NAME "_delay_frame_swapping", - "Delay Frame Swapping", - NULL, - "Useful to avoid flashing screens or glitchy videos. Not recommended on slow platforms.", - NULL, - "video", - { - { "disabled", NULL }, - { "enabled", NULL }, - { NULL, NULL }, - }, - "disabled", - }, - { - CORE_OPTION_NAME "_auto_skip_frame", - "Auto Skip Frame", - NULL, - "Automatically skip frames when the emulator is running slow. Note: This setting only applies when 'Threaded Rendering' is enabled.", - NULL, - "video", - { - { "disabled", NULL }, - { "some", "Normal" }, - { "more", "Maximum" }, - { NULL, NULL }, - }, -#ifdef LOW_END - "some", -#else - "disabled", -#endif - }, - { - CORE_OPTION_NAME "_frame_skipping", - "Frame Skipping", - NULL, - "Sets the number of frames to skip between each displayed frame.", - NULL, - "video", - { - { "disabled", NULL }, - { "1", NULL }, - { "2", NULL }, - { "3", NULL }, - { "4", NULL }, - { "5", NULL }, - { "6", NULL }, - { NULL, NULL }, - }, - "disabled", - }, { CORE_OPTION_NAME "_enable_purupuru", "Purupuru Pack/Vibration Pack", @@ -629,44 +681,84 @@ struct retro_core_option_v2_definition option_defs_us[] = { "enabled", }, { - CORE_OPTION_NAME "_allow_service_buttons", - "Allow NAOMI Service Buttons", + CORE_OPTION_NAME "_show_lightgun_settings", + "Show Light Gun Settings", NULL, - "Enables SERVICE button for NAOMI, to enter cabinet settings.", + "Enable configuration of light gun crosshair display options. NOTE: Quick Menu may need to be toggled for this setting to take effect.", NULL, + "input", + { + { "enabled", NULL }, + { "disabled", NULL }, + { NULL, NULL}, + }, + "disabled" + }, + { + CORE_OPTION_NAME "_lightgun1_crosshair", + "Gun Crosshair 1 Display", NULL, + "", + NULL, + "input", { { "disabled", NULL }, - { "enabled", NULL }, - { NULL, NULL }, + { "White", NULL }, + { "Red", NULL }, + { "Green", NULL }, + { "Blue", NULL }, + { NULL, NULL }, }, "disabled", }, { - CORE_OPTION_NAME "_custom_textures", - "Load Custom Textures", + CORE_OPTION_NAME "_lightgun2_crosshair", + "Gun Crosshair 2 Display", NULL, "", NULL, - "video", + "input", { { "disabled", NULL }, - { "enabled", NULL }, - { NULL, NULL }, + { "White", NULL }, + { "Red", NULL }, + { "Green", NULL }, + { "Blue", NULL }, + { NULL, NULL }, }, "disabled", }, - {/* TODO: probably needs explanation */ - CORE_OPTION_NAME "_dump_textures", - "Dump Textures", + { + CORE_OPTION_NAME "_lightgun3_crosshair", + "Gun Crosshair 3 Display", NULL, "", NULL, - "video", + "input", { { "disabled", NULL }, - { "enabled", NULL }, - { NULL, NULL }, + { "White", NULL }, + { "Red", NULL }, + { "Green", NULL }, + { "Blue", NULL }, + { NULL, NULL }, + }, + "disabled", + }, + { + CORE_OPTION_NAME "_lightgun4_crosshair", + "Gun Crosshair 4 Display", + NULL, + "", + NULL, + "input", + { + { "disabled", NULL }, + { "White", NULL }, + { "Red", NULL }, + { "Green", NULL }, + { "Blue", NULL }, + { NULL, NULL }, }, "disabled", }, @@ -689,7 +781,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { CORE_OPTION_NAME "_show_vmu_screen_settings", "Show Visual Memory Unit/System (VMU) Display Settings", "Show VMU Display Settings", - "Enable configuration of emulated VMU LCD screen visibility, size, position and color. NOTE: Quick Menu must be toggled for this setting to take effect.", + "Enable configuration of emulated VMU LCD screen visibility, size, position and color. NOTE: Quick Menu may need to be toggled for this setting to take effect.", NULL, "vmu", { @@ -1303,88 +1395,6 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "100%", }, - { - CORE_OPTION_NAME "_show_lightgun_settings", - "Show Light Gun Settings", - NULL, - "Enable configuration of light gun crosshair display options. NOTE: Quick Menu must be toggled for this setting to take effect.", - NULL, - "input", - { - { "enabled", NULL }, - { "disabled", NULL }, - { NULL, NULL}, - }, - "disabled" - }, - { - CORE_OPTION_NAME "_lightgun1_crosshair", - "Gun Crosshair 1 Display", - NULL, - "", - NULL, - "input", - { - { "disabled", NULL }, - { "White", NULL }, - { "Red", NULL }, - { "Green", NULL }, - { "Blue", NULL }, - { NULL, NULL }, - }, - "disabled", - }, - { - CORE_OPTION_NAME "_lightgun2_crosshair", - "Gun Crosshair 2 Display", - NULL, - "", - NULL, - "input", - { - { "disabled", NULL }, - { "White", NULL }, - { "Red", NULL }, - { "Green", NULL }, - { "Blue", NULL }, - { NULL, NULL }, - }, - "disabled", - }, - { - CORE_OPTION_NAME "_lightgun3_crosshair", - "Gun Crosshair 3 Display", - NULL, - "", - NULL, - "input", - { - { "disabled", NULL }, - { "White", NULL }, - { "Red", NULL }, - { "Green", NULL }, - { "Blue", NULL }, - { NULL, NULL }, - }, - "disabled", - }, - { - CORE_OPTION_NAME "_lightgun4_crosshair", - "Gun Crosshair 4 Display", - NULL, - "", - NULL, - "input", - { - { "disabled", NULL }, - { "White", NULL }, - { "Red", NULL }, - { "Green", NULL }, - { "Blue", NULL }, - { NULL, NULL }, - }, - "disabled", - }, { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL }, }; @@ -1611,6 +1621,12 @@ static INLINE void libretro_set_core_options(retro_environment_t environ_cb, values_buf[i] = NULL; + /* Skip options that are irrelevant when using the + * old style core options interface */ + if (!strcmp(key, CORE_OPTION_NAME "_show_vmu_screen_settings") || + !strcmp(key, CORE_OPTION_NAME "_show_lightgun_settings")) + continue; + if (desc) { size_t num_values = 0;