From f64b3618f208f83e98379b453bd581f5ed233d48 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 17 Dec 2021 22:20:56 +0000 Subject: [PATCH 1/6] Fetch translations & Recreate libretro_core_options_intl.h --- shell/libretro/libretro_core_options_intl.h | 34 ++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/shell/libretro/libretro_core_options_intl.h b/shell/libretro/libretro_core_options_intl.h index 7068a6f4e..450dc3785 100644 --- a/shell/libretro/libretro_core_options_intl.h +++ b/shell/libretro/libretro_core_options_intl.h @@ -44667,18 +44667,18 @@ struct retro_core_options_v2 options_ro = { #define CATEGORY_VMU_INFO_0_RU NULL #define CATEGORY_HACKS_LABEL_RU "Хаки эмуляции" #define CATEGORY_HACKS_INFO_0_RU NULL -#define CORE_OPTION_NAME_BOOT_TO_BIOS_LABEL_RU NULL -#define CORE_OPTION_NAME_BOOT_TO_BIOS_INFO_0_RU NULL +#define CORE_OPTION_NAME_BOOT_TO_BIOS_LABEL_RU "Загрузка в BIOS (требуется перезапуск)" +#define CORE_OPTION_NAME_BOOT_TO_BIOS_INFO_0_RU "Загружаться непосредственно в меню Dreamcast BIOS." #define CORE_OPTION_NAME_HLE_BIOS_LABEL_RU NULL -#define CORE_OPTION_NAME_HLE_BIOS_INFO_0_RU NULL -#define CORE_OPTION_NAME_OIT_ABUFFER_SIZE_LABEL_RU NULL +#define CORE_OPTION_NAME_HLE_BIOS_INFO_0_RU "Принудительно использовать высокоуровневую эмуляцию BIOS." +#define CORE_OPTION_NAME_OIT_ABUFFER_SIZE_LABEL_RU "Размер накопительного пикс. буфера (требуется перезапуск)" #define CORE_OPTION_NAME_OIT_ABUFFER_SIZE_INFO_0_RU "Большие значения могут требоваться для правильного отображения высоких разрешений." -#define OPTION_VAL_512MB_RU NULL -#define OPTION_VAL_1GB_RU NULL -#define OPTION_VAL_2GB_RU NULL -#define OPTION_VAL_4GB_RU NULL -#define CORE_OPTION_NAME_INTERNAL_RESOLUTION_LABEL_RU NULL -#define CORE_OPTION_NAME_INTERNAL_RESOLUTION_INFO_0_RU NULL +#define OPTION_VAL_512MB_RU "512 МБ" +#define OPTION_VAL_1GB_RU "1 ГБ" +#define OPTION_VAL_2GB_RU "2 ГБ" +#define OPTION_VAL_4GB_RU "4 ГБ" +#define CORE_OPTION_NAME_INTERNAL_RESOLUTION_LABEL_RU "Внутреннее разрешение (требуется перезапуск)" +#define CORE_OPTION_NAME_INTERNAL_RESOLUTION_INFO_0_RU "Настройка разрешения рендеринга." #define OPTION_VAL_320X240_RU NULL #define OPTION_VAL_640X480_RU NULL #define OPTION_VAL_800X600_RU NULL @@ -44707,9 +44707,9 @@ struct retro_core_options_v2 options_ro = { #define OPTION_VAL_12160X9120_RU NULL #define OPTION_VAL_12800X9600_RU NULL #define CORE_OPTION_NAME_SCREEN_ROTATION_LABEL_RU "Положение экрана" -#define OPTION_VAL_HORIZONTAL_RU NULL -#define OPTION_VAL_VERTICAL_RU NULL -#define CORE_OPTION_NAME_ALPHA_SORTING_LABEL_RU NULL +#define OPTION_VAL_HORIZONTAL_RU "Горизонтальная" +#define OPTION_VAL_VERTICAL_RU "Вертикальная" +#define CORE_OPTION_NAME_ALPHA_SORTING_LABEL_RU "Альфа-сортировка" #define OPTION_VAL_PER_STRIP_FAST_LEAST_ACCURATE_RU NULL #define OPTION_VAL_PER_TRIANGLE_NORMAL_RU NULL #define OPTION_VAL_PER_PIXEL_ACCURATE_RU NULL @@ -44838,7 +44838,7 @@ struct retro_core_options_v2 options_ro = { #define OPTION_VAL_LIGHT_YELLOW_26_RU NULL #define OPTION_VAL_LIGHT_YELLOW_2_27_RU NULL #define OPTION_VAL_WHITE_28_RU "Белый" -#define CORE_OPTION_NAME_VMU1_PIXEL_OFF_COLOR_LABEL_RU NULL +#define CORE_OPTION_NAME_VMU1_PIXEL_OFF_COLOR_LABEL_RU "Цвет выкл. пикселей VMU 1" #define CORE_OPTION_NAME_VMU1_SCREEN_OPACITY_LABEL_RU NULL #define OPTION_VAL_40_RU NULL #define OPTION_VAL_50_RU NULL @@ -44851,19 +44851,19 @@ struct retro_core_options_v2 options_ro = { #define CORE_OPTION_NAME_VMU2_SCREEN_POSITION_LABEL_RU NULL #define CORE_OPTION_NAME_VMU2_SCREEN_SIZE_MULT_LABEL_RU NULL #define CORE_OPTION_NAME_VMU2_PIXEL_ON_COLOR_LABEL_RU NULL -#define CORE_OPTION_NAME_VMU2_PIXEL_OFF_COLOR_LABEL_RU NULL +#define CORE_OPTION_NAME_VMU2_PIXEL_OFF_COLOR_LABEL_RU "Цвет выкл. пикселей VMU 2" #define CORE_OPTION_NAME_VMU2_SCREEN_OPACITY_LABEL_RU NULL #define CORE_OPTION_NAME_VMU3_SCREEN_DISPLAY_LABEL_RU NULL #define CORE_OPTION_NAME_VMU3_SCREEN_POSITION_LABEL_RU NULL #define CORE_OPTION_NAME_VMU3_SCREEN_SIZE_MULT_LABEL_RU NULL #define CORE_OPTION_NAME_VMU3_PIXEL_ON_COLOR_LABEL_RU NULL -#define CORE_OPTION_NAME_VMU3_PIXEL_OFF_COLOR_LABEL_RU NULL +#define CORE_OPTION_NAME_VMU3_PIXEL_OFF_COLOR_LABEL_RU "Цвет выкл. пикселей VMU 3" #define CORE_OPTION_NAME_VMU3_SCREEN_OPACITY_LABEL_RU NULL #define CORE_OPTION_NAME_VMU4_SCREEN_DISPLAY_LABEL_RU NULL #define CORE_OPTION_NAME_VMU4_SCREEN_POSITION_LABEL_RU NULL #define CORE_OPTION_NAME_VMU4_SCREEN_SIZE_MULT_LABEL_RU NULL #define CORE_OPTION_NAME_VMU4_PIXEL_ON_COLOR_LABEL_RU NULL -#define CORE_OPTION_NAME_VMU4_PIXEL_OFF_COLOR_LABEL_RU NULL +#define CORE_OPTION_NAME_VMU4_PIXEL_OFF_COLOR_LABEL_RU "Цвет выкл. пикселей VMU 4" #define CORE_OPTION_NAME_VMU4_SCREEN_OPACITY_LABEL_RU NULL #define CORE_OPTION_NAME_SHOW_LIGHTGUN_SETTINGS_LABEL_RU NULL #define CORE_OPTION_NAME_SHOW_LIGHTGUN_SETTINGS_INFO_0_RU NULL From 833eccb6c47558a1e1fe1ae12d2b9f31cc2e143a Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Fri, 17 Dec 2021 18:04:22 +0000 Subject: [PATCH 2/6] (libretro) Sanitise core options --- shell/libretro/libretro.cpp | 293 +++++++--- shell/libretro/libretro_core_options.h | 772 +++++++++++++------------ 2 files changed, 600 insertions(+), 465 deletions(-) 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; From e706368225d7c9a77713e6ee6614616401745cf0 Mon Sep 17 00:00:00 2001 From: cmitu <31816814+cmitu@users.noreply.github.com> Date: Sat, 18 Dec 2021 18:05:37 +0000 Subject: [PATCH 3/6] cmake: add support for legacy RPI GLES2 libs Raspberry Pi 3 can use the legacy Broadcom GLES2 libraries from /opt/vc/lib. They are the default GLESv2 libraries on Raspberry PI OS 10 (Buster) and older. --- CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d2c174c7..4517d3f09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ option(USE_HOST_LIBZIP "Use host libzip" ON) option(USE_OPENMP "Use OpenMP if available" ON) option(USE_VULKAN "Build with Vulkan support" ON) option(LIBRETRO "Build libretro core" OFF) +option(USE_VIDEOCORE "RPI: use the legacy Broadcom GLES libraries" OFF) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/shell/cmake") @@ -97,7 +98,12 @@ elseif(LIBRETRO) target_link_libraries(${PROJECT_NAME} PRIVATE "-lGLESv3") elseif(USE_GLES2) target_compile_definitions(${PROJECT_NAME} PRIVATE GLES GLES2 HAVE_OPENGLES HAVE_OPENGLES2) - target_link_libraries(${PROJECT_NAME} PRIVATE "-lGLESv2") + if(USE_VIDEOCORE) + target_link_libraries(${PROJECT_NAME} PRIVATE "-lbrcmGLESv2") + target_link_directories(${PROJECT_NAME} PRIVATE "/opt/vc/lib") + else() + target_link_libraries(${PROJECT_NAME} PRIVATE "-GLESv2") + endif() else() target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_OPENGL) if(APPLE) @@ -346,7 +352,12 @@ if(UNIX AND NOT APPLE AND NOT ANDROID) if(USE_GLES2) target_compile_definitions(${PROJECT_NAME} PRIVATE GLES GLES2) - target_link_libraries(${PROJECT_NAME} PRIVATE GLESv2) + if(USE_VIDEOCORE) + target_link_libraries(${PROJECT_NAME} PRIVATE "-lbrcmGLESv2") + target_link_directories(${PROJECT_NAME} PRIVATE "/opt/vc/lib") + else() + target_link_libraries(${PROJECT_NAME} PRIVATE GLESv2) + endif() elseif(USE_GLES) target_compile_definitions(${PROJECT_NAME} PRIVATE GLES GLES3) if(NOT SDL2_FOUND) From 2b827e43d7517732b8983a62a83d89bca686da5a Mon Sep 17 00:00:00 2001 From: cmitu <31816814+cmitu@users.noreply.github.com> Date: Sat, 18 Dec 2021 18:50:08 +0000 Subject: [PATCH 4/6] cmake: add more GLES3 library names Some systems provide the GLES3 implementation in the same GLESv2 library file, most notably Mesa. Added the alternative library name when GLES3 is requested. This makes the build work on the Pi4 - I've only tested it with the libretro core and the GLES 3.1 context is succesfully used. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4517d3f09..f46c50dd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,8 @@ elseif(LIBRETRO) target_compile_definitions(${PROJECT_NAME} PRIVATE LIBRETRO) if(ANDROID OR USE_GLES) target_compile_definitions(${PROJECT_NAME} PRIVATE GLES GLES3 HAVE_OPENGLES HAVE_OPENGLES3) - target_link_libraries(${PROJECT_NAME} PRIVATE "-lGLESv3") + find_library(GLES3_LIBRARIES NAMES GLESv3 GLESv2 NO_CACHE REQUIRED) + target_link_libraries(${PROJECT_NAME} PRIVATE ${GLES3_LIBRARIES}) elseif(USE_GLES2) target_compile_definitions(${PROJECT_NAME} PRIVATE GLES GLES2 HAVE_OPENGLES HAVE_OPENGLES2) if(USE_VIDEOCORE) @@ -363,6 +364,8 @@ if(UNIX AND NOT APPLE AND NOT ANDROID) if(NOT SDL2_FOUND) target_link_libraries(${PROJECT_NAME} PRIVATE EGL) endif() + find_library(${GLES3_LIBRARIES} NAMES GLESv3 GLESv2 NO_CACHE REQUIRED) + target_link_libraries(${PROJECT_NAME} PRIVATE ${GLES3_LIBRARIES}) else() set(OpenGL_GL_PREFERENCE LEGACY) find_package(OpenGL REQUIRED) From c10c3a1cfe9901844b05e3b3528bc5431df8901c Mon Sep 17 00:00:00 2001 From: cmitu <31816814+cmitu@users.noreply.github.com> Date: Sun, 19 Dec 2021 12:05:52 +0000 Subject: [PATCH 5/6] cmake: amend 2b827e43, fix the typo for GLES3_LIBRARIES --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f46c50dd2..a77594f74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,7 +364,7 @@ if(UNIX AND NOT APPLE AND NOT ANDROID) if(NOT SDL2_FOUND) target_link_libraries(${PROJECT_NAME} PRIVATE EGL) endif() - find_library(${GLES3_LIBRARIES} NAMES GLESv3 GLESv2 NO_CACHE REQUIRED) + find_library(GLES3_LIBRARIES NAMES GLESv3 GLESv2 NO_CACHE REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE ${GLES3_LIBRARIES}) else() set(OpenGL_GL_PREFERENCE LEGACY) From bf87f7ba8403ee394233438b68177e0caf18ab1d Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 20 Dec 2021 14:27:19 +0100 Subject: [PATCH 6/6] Compilation error on armv7 with gcc 9 --- core/hw/arm7/arm7_rec_arm32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/hw/arm7/arm7_rec_arm32.cpp b/core/hw/arm7/arm7_rec_arm32.cpp index 90dcc17b9..8114313a9 100644 --- a/core/hw/arm7/arm7_rec_arm32.cpp +++ b/core/hw/arm7/arm7_rec_arm32.cpp @@ -59,9 +59,9 @@ const std::array alloc_regs{ r5, r6, r7, r9, r10, r11 }; -class Arm32ArmRegAlloc : public ArmRegAlloc +class Arm32ArmRegAlloc : public ArmRegAlloc { - using super = ArmRegAlloc; + using super = ArmRegAlloc; void LoadReg(int host_reg, Arm7Reg armreg, ArmOp::Condition cc = ArmOp::AL) {