Android: apply the device's drivers on Reset to Default Configuration too

A fresh install picks Vulkan, AAudio and 64 ms when the device has
them, but "Reset to Default Configuration" went back to the built-in
OpenGL ES, OpenSL ES and 128 ms, the defaults the oldest devices need.

Reset now sets the same device-dependent values a fresh install gets.
The built-in defaults are still not changed, so a config saved with
"save minimal" keeps meaning what it did; the values are set as the
config's own and saved whatever the save mode.  A device whose Vulkan
driver fails is reset to Vulkan like any other, and the next start
falls back to OpenGL ES again.

android_apply_first_run_defaults() is now android_apply_device_defaults(),
declared in configuration.h instead of locally in configuration.c.
This commit is contained in:
LibretroAdmin authored and libretroadmin committed 2026-11-02 19:52:24 +01:00
1 parent 9c820ad77b
commit 2b530acbac
4 files changed
+27 -12

No files matched your search

+1 -2
View File
@@ -81,7 +81,6 @@
* cannot preprocess. */
void android_app_set_window_settings(bool notch_write_over,
bool auto_mouse_grab);
void android_apply_first_run_defaults(settings_t *settings);
#endif
#include "list_special.h"
@@ -8712,7 +8711,7 @@ static void config_parse_file(void)
* that exists but would not open is not one, and keeps the
* built-in defaults. */
if (config_path && *config_path && !path_is_valid(config_path))
android_apply_first_run_defaults(config_st);
android_apply_device_defaults(config_st);
#endif
}
}
+8
View File
@@ -1771,6 +1771,14 @@ void config_set_video_menu_xr(const struct video_screen_xr *values);
void config_set_defaults(settings_t *target);
#ifdef ANDROID
/* Defined in frontend/drivers/platform_unix.c. Sets the drivers and
* audio latency the device is best served by, as the settings' own
* values over the built-in defaults: on a fresh install's first start,
* and on "Reset to Default Configuration". */
void android_apply_device_defaults(settings_t *settings);
#endif
void config_load(void);
#if !defined(HAVE_DYNAMIC)
+13 -10
View File
@@ -4553,13 +4553,16 @@ static bool android_has_vulkan_1_1(JNIEnv *env, jobject activity)
}
#endif
/* First start: no config file exists yet. The built-in defaults stay
* what they always were (OpenGL ES, OpenSL ES, 128 ms), since a config
* saved with "save minimal" leaves out every key that matches them and
* changing them would change those installs on update. A fresh
* install instead gets the modern drivers set as its own values when
* the device has them, and they are saved with the rest of its
* config. Nothing here runs again once a config exists.
/* The drivers and audio latency this device is best served by, set as
* the settings' own values. Applied on a fresh install's first start,
* when no config file exists yet, and on "Reset to Default
* Configuration"; never to a config that is only being loaded.
*
* The built-in defaults stay what they always were (OpenGL ES, OpenSL
* ES, 128 ms): a config saved with "save minimal" leaves out every key
* that matches them, so changing them would move those installs to new
* drivers on update. Set as values, these are saved with the rest of
* the config whatever the save mode.
*
* - Vulkan when the device declares Vulkan 1.1. Devices with only a
* 1.0 driver, or none, keep OpenGL ES, as before.
@@ -4567,7 +4570,7 @@ static bool android_has_vulkan_1_1(JNIEnv *env, jobject activity)
* bugs that make Oboe use OpenSL ES there; older releases keep
* OpenSL ES, as before. With AAudio the latency drops to 64 ms,
* unless a device quirk above chose one. */
void android_apply_first_run_defaults(settings_t *settings)
void android_apply_device_defaults(settings_t *settings)
{
int32_t sdk = 0;
@@ -4587,7 +4590,7 @@ void android_apply_first_run_defaults(settings_t *settings)
{
configuration_set_string(settings,
settings->arrays.video_driver, "vulkan");
RARCH_LOG("[Config] First start: device has Vulkan 1.1, "
RARCH_LOG("[Config] Device defaults: Vulkan 1.1, "
"video driver \"vulkan\".\n");
}
}
@@ -4602,7 +4605,7 @@ void android_apply_first_run_defaults(settings_t *settings)
if (!(g_platform_android_flags & PLAT_ANDROID_FLAG_LATENCY_QUIRK))
configuration_set_uint(settings,
settings->uints.audio_latency, 64);
RARCH_LOG("[Config] First start: Android API %d, audio driver "
RARCH_LOG("[Config] Device defaults: Android API %d, audio driver "
"\"aaudio\", latency %u ms.\n",
(int)sdk, settings->uints.audio_latency);
}
+5
View File
@@ -5641,6 +5641,11 @@ bool command_event(enum event_command cmd, void *data)
#endif
case CMD_EVENT_MENU_RESET_TO_DEFAULT_CONFIG:
config_set_defaults(config_get_ptr());
#ifdef ANDROID
/* The same drivers a fresh install on this device gets, not
* the built-in ones the oldest devices need. */
android_apply_device_defaults(config_get_ptr());
#endif
/* a reset forgets the controllers too, which they get back
* when the joypad driver next starts */
input_config_forget_controllers();