mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
write to game options files if created instead of the main options file
This commit is contained in:
parent
f5b7add383
commit
659a3ef5d8
@ -536,6 +536,7 @@ void uninit_libretro_sym(struct retro_core_t *current_core)
|
||||
|
||||
memset(current_core, 0, sizeof(struct retro_core_t));
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_DEINIT, NULL);
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_FREE, NULL);
|
||||
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
|
||||
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
|
||||
|
@ -1329,6 +1329,7 @@ static int action_ok_option_create(const char *path,
|
||||
{
|
||||
char game_path[PATH_MAX_LENGTH];
|
||||
rarch_system_info_t *system = NULL;
|
||||
config_file_t *conf = NULL;
|
||||
|
||||
if (!rarch_option_create(game_path, sizeof(game_path)))
|
||||
{
|
||||
@ -1337,12 +1338,23 @@ static int action_ok_option_create(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
conf = config_file_new(game_path);
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
conf = config_file_new(NULL);
|
||||
if (!conf)
|
||||
return false;
|
||||
}
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if(core_option_flush_game_specific(system->core_options,
|
||||
game_path))
|
||||
menu_display_msg_queue_push("Core options file saved successfully",
|
||||
if(config_file_write(conf, game_path))
|
||||
{
|
||||
menu_display_msg_queue_push("Core options file created successfully",
|
||||
1, 100, true);
|
||||
strlcpy(system->game_options_path, game_path, sizeof(system->game_options_path));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
14
runloop.c
14
runloop.c
@ -1093,9 +1093,21 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
if (!runloop_system.core_options)
|
||||
return false;
|
||||
|
||||
core_option_flush(runloop_system.core_options);
|
||||
/* check if game options file was just created and flush
|
||||
to that file instead */
|
||||
if(!string_is_empty(runloop_system.game_options_path))
|
||||
{
|
||||
core_option_flush_game_specific(runloop_system.core_options, runloop_system.game_options_path);
|
||||
runloop_system.game_options_path[0] = '\0';
|
||||
}
|
||||
else
|
||||
core_option_flush(runloop_system.core_options);
|
||||
|
||||
core_option_free(runloop_system.core_options);
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_GAME_OPTIONS_ACTIVE, NULL))
|
||||
runloop_ctl(RUNLOOP_CTL_UNSET_GAME_OPTIONS_ACTIVE, NULL);
|
||||
|
||||
runloop_system.core_options = NULL;
|
||||
return true;
|
||||
case RUNLOOP_CTL_KEY_EVENT_GET:
|
||||
|
Loading…
x
Reference in New Issue
Block a user