From 3717414e2e522b8367a9f0f5e344cdb1652c2507 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 10:55:23 +0200 Subject: [PATCH] Setting recordings from the menu works now --- menu/menu.h | 1 + menu/menu_entries_cbs_deferred_push.c | 9 +++++++++ menu/menu_entries_cbs_ok.c | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/menu/menu.h b/menu/menu.h index a457cd0c7c..81e35cbb4d 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -87,6 +87,7 @@ typedef enum MENU_FILE_RDB, MENU_FILE_RDB_ENTRY, MENU_FILE_CURSOR, + MENU_FILE_RECORD_CONFIG, MENU_SETTINGS, MENU_SETTING_DRIVER, MENU_SETTING_ACTION, diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index bb3d39061c..768cd2389d 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -1759,6 +1759,13 @@ static int deferred_push_remap_file_load(void *data, void *userdata, MENU_FILE_REMAP, "rmp", NULL); } +static int deferred_push_record_configfile(void *data, void *userdata, + const char *path, const char *label, unsigned type) +{ + return menu_entries_parse_list((file_list_t*)data, (file_list_t*)userdata, path, label, type, + MENU_FILE_RECORD_CONFIG, "cfg", NULL); +} + static int deferred_push_input_overlay(void *data, void *userdata, const char *path, const char *label, unsigned type) { @@ -1871,6 +1878,8 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, cbs->action_deferred_push = deferred_push_cheat_file_load; else if (!strcmp(label, "remap_file_load")) cbs->action_deferred_push = deferred_push_remap_file_load; + else if (!strcmp(label, "record_config")) + cbs->action_deferred_push = deferred_push_record_configfile; else if (!strcmp(label, "content_actions")) cbs->action_deferred_push = deferred_push_content_actions; else if (!strcmp(label, "shader_options")) diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index da16225ac2..7c78468f15 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -349,6 +349,25 @@ static int action_ok_core_list(const char *path, label, type, idx); } +static int action_ok_record_configfile_load(const char *path, + const char *label, unsigned type, size_t idx) +{ + const char *menu_path = NULL; + char record_configpath[PATH_MAX_LENGTH]; + global_t *global = global_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); + if (!menu || !global) + return -1; + + menu_list_get_last_stack(menu->menu_list, &menu_path, NULL, + NULL); + + fill_pathname_join(global->record.config, menu_path, path, sizeof(global->record.config)); + + menu_list_flush_stack_by_needle(menu->menu_list, "Recording Settings"); + return 0; +} + static int action_ok_remap_file_load(const char *path, const char *label, unsigned type, size_t idx) { @@ -1371,6 +1390,9 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, case MENU_FILE_CHEAT: cbs->action_ok = action_ok_cheat_file_load; break; + case MENU_FILE_RECORD_CONFIG: + cbs->action_ok = action_ok_record_configfile_load; + break; case MENU_FILE_REMAP: cbs->action_ok = action_ok_remap_file_load; break;