From dd8b1faac46d3dc4faa41cd823bc62f0a7684a4d Mon Sep 17 00:00:00 2001 From: radius Date: Tue, 7 Apr 2015 22:40:42 -0500 Subject: [PATCH] add OSD message for remap saving too --- input/input_remapping.c | 15 ++++++++++----- input/input_remapping.h | 4 +++- menu/menu_entries_cbs_ok.c | 12 ++++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/input/input_remapping.c b/input/input_remapping.c index 32e401c4fd..b2937957a4 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -69,9 +69,12 @@ bool input_remapping_load_file(const char *path) * @path : Path to remapping file (relative path). * * Saves remapping values to file. + * + * Returns: true (1) if successfull, otherwise false (0). **/ -void input_remapping_save_file(const char *path) +bool input_remapping_save_file(const char *path) { + bool ret; unsigned i, j; char buf[PATH_MAX_LENGTH]; char remap_file[PATH_MAX_LENGTH]; @@ -86,10 +89,10 @@ void input_remapping_save_file(const char *path) conf = config_file_new(remap_file); if (!conf) + { conf = config_file_new(NULL); - - if (!conf) - return; + return false; + } for (i = 0; i < settings->input.max_users; i++) { @@ -106,8 +109,10 @@ void input_remapping_save_file(const char *path) } } - config_file_write(conf, remap_file); + ret = config_file_write(conf, remap_file); config_file_free(conf); + + return ret; } void input_remapping_set_defaults(void) diff --git a/input/input_remapping.h b/input/input_remapping.h index 7a1ab57278..60bd10a190 100644 --- a/input/input_remapping.h +++ b/input/input_remapping.h @@ -39,8 +39,10 @@ bool input_remapping_load_file(const char *path); * @path : Path to remapping file (relative path). * * Saves remapping values to file. + * + * Returns: true (1) if successfull, otherwise false (0). **/ -void input_remapping_save_file(const char *path); +bool input_remapping_save_file(const char *path); void input_remapping_set_defaults(void); diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index b6f48e0d38..e471421142 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -535,7 +535,11 @@ static int action_ok_remap_file_save_core(const char *path, if(!path_file_exists(directory)) path_mkdir(directory); - input_remapping_save_file(file); + if(input_remapping_save_file(file)) + rarch_main_msg_queue_push("Remap file saved successfully", 1, 100, true); + else + rarch_main_msg_queue_push("Error saving remap file", 1, 100, true); + return 0; } @@ -560,7 +564,11 @@ static int action_ok_remap_file_save_game(const char *path, if(!path_file_exists(directory)) path_mkdir(directory); - input_remapping_save_file(file); + if(input_remapping_save_file(file)) + rarch_main_msg_queue_push("Remap file saved successfully", 1, 100, true); + else + rarch_main_msg_queue_push("Error saving remap file", 1, 100, true); + return 0; }