From de53f9980da33728952e77095e1174db7b622516 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 19 Jan 2015 07:43:28 +0100 Subject: [PATCH] Add config_save_keybinds_file --- settings.c | 34 +++++++++++++++++++++++++++++++++- settings.h | 12 +++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/settings.c b/settings.c index 8e46c26b27..45868dc0b7 100644 --- a/settings.c +++ b/settings.c @@ -1699,6 +1699,8 @@ static void save_keybind(config_file_t *conf, const char *prefix, save_keybind_axis(conf, prefix, base, bind); } + + /** * save_keybinds_user: * @conf : pointer to config file object @@ -1747,6 +1749,36 @@ void config_load(void) config_load_core_specific(); } +/** + * config_save_keybinds_file: + * @path : Path that shall be written to. + * + * Writes a keybinds config file to disk. + * + * Returns: true (1) on success, otherwise returns false (0). + **/ +bool config_save_keybinds_file(const char *path) +{ + unsigned i = 0; + bool ret = false; + config_file_t *conf = config_file_new(path); + + if (!conf) + conf = config_file_new(NULL); + + if (!conf) + return false; + + RARCH_LOG("Saving keybinds config at path: \"%s\"\n", path); + + for (i = 0; i < MAX_USERS; i++) + save_keybinds_user(conf, i); + + ret = config_file_write(conf, path); + config_file_free(conf); + return ret; +} + /** * config_save_file: * @path : Path that shall be written to. @@ -1754,7 +1786,7 @@ void config_load(void) * Writes a config file to disk. * * Returns: true (1) on success, otherwise returns false (0). - */ + **/ bool config_save_file(const char *path) { unsigned i = 0; diff --git a/settings.h b/settings.h index d44f153800..f5ef00e6bf 100644 --- a/settings.h +++ b/settings.h @@ -112,6 +112,16 @@ const char *config_get_default_menu(void); */ void config_load(void); +/** + * config_save_keybinds_file: + * @path : Path that shall be written to. + * + * Writes a keybinds config file to disk. + * + * Returns: true (1) on success, otherwise returns false (0). + **/ +bool config_save_keybinds_file(const char *path); + /** * config_save_file: * @path : Path that shall be written to. @@ -119,7 +129,7 @@ void config_load(void); * Writes a config file to disk. * * Returns: true (1) on success, otherwise returns false (0). - */ + **/ bool config_save_file(const char *path); #ifdef __cplusplus