mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Implement action_ok for one function already
This commit is contained in:
parent
48e2c62e10
commit
d09d0eb0bf
@ -46,6 +46,9 @@ typedef struct file_list
|
||||
void *file_list_get_userdata_at_offset(const file_list_t *list,
|
||||
size_t index);
|
||||
|
||||
void *file_list_get_actiondata_at_offset(const file_list_t *list,
|
||||
size_t index);
|
||||
|
||||
void file_list_free(file_list_t *list);
|
||||
|
||||
void file_list_push(file_list_t *userdata, const char *path,
|
||||
|
@ -185,6 +185,12 @@ static int menu_setting_ok_toggle(unsigned type,
|
||||
const char *dir, const char *label,
|
||||
unsigned action)
|
||||
{
|
||||
menu_file_list_cbs_t *cbs = file_list_get_actiondata_at_offset(driver.menu->selection_buf,
|
||||
driver.menu->selection_ptr);
|
||||
|
||||
if (cbs && cbs->action_ok)
|
||||
return cbs->action_ok(dir, label, type, action);
|
||||
|
||||
if (type == MENU_SETTINGS_CUSTOM_BIND_ALL)
|
||||
{
|
||||
driver.menu->binds.target = &g_settings.input.binds
|
||||
@ -277,16 +283,6 @@ static int menu_setting_ok_toggle(unsigned type,
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (
|
||||
!strcmp(label, "load_content") ||
|
||||
!strcmp(label, "detect_core_list")
|
||||
)
|
||||
{
|
||||
menu_entries_push(driver.menu->menu_stack,
|
||||
g_settings.menu_content_directory, label, MENU_FILE_DIRECTORY,
|
||||
driver.menu->selection_ptr);
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp(label, "history_list") ||
|
||||
menu_common_type_is(label, type) == MENU_FILE_DIRECTORY
|
||||
)
|
||||
@ -1143,13 +1139,19 @@ static void menu_common_list_insert(void *data,
|
||||
static void menu_common_list_delete(void *data, size_t index,
|
||||
size_t list_size)
|
||||
{
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
if (list->list[index].actiondata)
|
||||
cbs = (menu_file_list_cbs_t*)list->list[index].actiondata;
|
||||
|
||||
if (cbs)
|
||||
{
|
||||
cbs->action_ok = NULL;
|
||||
free(list->list[index].actiondata);
|
||||
}
|
||||
list->list[index].actiondata = NULL;
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,18 @@
|
||||
*/
|
||||
|
||||
#include "menu_common.h"
|
||||
#include "menu_entries.h"
|
||||
#include "backend/menu_backend.h"
|
||||
|
||||
static int action_ok_push_content_list(const char *path,
|
||||
const char *label, unsigned type, size_t index)
|
||||
{
|
||||
menu_entries_push(driver.menu->menu_stack,
|
||||
g_settings.menu_content_directory, label, MENU_FILE_DIRECTORY,
|
||||
driver.menu->selection_ptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_entries_cbs_init(void *data,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t index)
|
||||
@ -31,4 +41,11 @@ void menu_entries_cbs_init(void *data,
|
||||
if (!cbs)
|
||||
return;
|
||||
|
||||
cbs->action_ok = NULL;
|
||||
|
||||
if (
|
||||
!strcmp(label, "load_content") ||
|
||||
!strcmp(label, "detect_core_list")
|
||||
)
|
||||
cbs->action_ok = action_ok_push_content_list;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user