From 48e2c62e105c91aae9a956b6e51b6ac542de3396 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 12 Oct 2014 00:45:42 +0200 Subject: [PATCH] Add stub menu_entries_cbs.c/menu_entries_cbs.h --- Makefile.common | 1 + file_list.c | 3 +- frontend/menu/backend/menu_backend.h | 8 ++++- frontend/menu/backend/menu_common_backend.c | 10 +++--- frontend/menu/disp/menu_display.h | 5 --- frontend/menu/menu_entries_cbs.c | 34 +++++++++++++++++++++ frontend/menu/menu_entries_cbs.h | 25 +++++++++++++++ griffin/griffin.c | 1 + 8 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 frontend/menu/menu_entries_cbs.c create mode 100644 frontend/menu/menu_entries_cbs.h diff --git a/Makefile.common b/Makefile.common index 268c117c90..e714c99a5e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -280,6 +280,7 @@ ifeq ($(HAVE_MENU_COMMON), 1) frontend/menu/menu_action.o \ frontend/menu/menu_shader.o \ frontend/menu/menu_entries.o \ + frontend/menu/menu_entries_cbs.o \ frontend/menu/menu_animation.o endif diff --git a/file_list.c b/file_list.c index e9f0db2019..fbb24e8fb2 100644 --- a/file_list.c +++ b/file_list.c @@ -41,7 +41,8 @@ void file_list_push(file_list_t *list, driver.menu_ctx->list_insert(list, path, label, list->size); if (driver.menu_ctx->backend->list_insert) - driver.menu_ctx->backend->list_insert(list, path, label, list->size); + driver.menu_ctx->backend->list_insert(list, path, + label, type,list->size); } #endif diff --git a/frontend/menu/backend/menu_backend.h b/frontend/menu/backend/menu_backend.h index dcc7762043..90ea2a6b32 100644 --- a/frontend/menu/backend/menu_backend.h +++ b/frontend/menu/backend/menu_backend.h @@ -5,13 +5,19 @@ extern "C" { #endif +typedef struct menu_file_list_cbs +{ + int (*action_ok)(const char *path, const char *label, unsigned type, + size_t index); +} menu_file_list_cbs_t; + typedef struct menu_ctx_driver_backend { int (*iterate)(unsigned); unsigned (*type_is)(const char *, unsigned); void (*setting_set_label)(char *, size_t, unsigned *, unsigned, const char *, const char *, unsigned); - void (*list_insert)(void *, const char *, const char *, size_t); + void (*list_insert)(void *, const char *, const char *, unsigned, size_t); void (*list_delete)(void *, size_t, size_t); void (*list_clear)(void *); void (*list_set_selection)(void *); diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index cc8c522ebc..95d9f1580d 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -25,6 +25,7 @@ #include "menu_backend.h" #include "../menu_action.h" #include "../menu_entries.h" +#include "../menu_entries_cbs.h" #include "../menu_navigation.h" #include "../menu_input_line_cb.h" @@ -1119,23 +1120,24 @@ static void menu_common_setting_set_label(char *type_str, } static void menu_common_list_insert(void *data, - const char *path, const char *unused, size_t list_size) + const char *path, const char *label, + unsigned type, size_t index) { - int i = list_size; file_list_t *list = (file_list_t*)data; if (!list) return; - list->list[i].actiondata = (menu_file_list_cbs_t*) + list->list[index].actiondata = (menu_file_list_cbs_t*) calloc(1, sizeof(menu_file_list_cbs_t)); - if (!list->list[i].actiondata) + if (!list->list[index].actiondata) { RARCH_ERR("Action data could not be allocated.\n"); return; } + menu_entries_cbs_init(list, path, label, type, index); } static void menu_common_list_delete(void *data, size_t index, diff --git a/frontend/menu/disp/menu_display.h b/frontend/menu/disp/menu_display.h index e211888f75..8aa06de2a4 100644 --- a/frontend/menu/disp/menu_display.h +++ b/frontend/menu/disp/menu_display.h @@ -5,11 +5,6 @@ extern "C" { #endif -typedef struct menu_file_list_cbs -{ - int (*action_ok)(const char *path, const char *label, unsigned type); -} menu_file_list_cbs_t; - typedef struct menu_ctx_driver { void (*set_texture)(void*); diff --git a/frontend/menu/menu_entries_cbs.c b/frontend/menu/menu_entries_cbs.c new file mode 100644 index 0000000000..e925144d5a --- /dev/null +++ b/frontend/menu/menu_entries_cbs.c @@ -0,0 +1,34 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2014 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "menu_common.h" +#include "backend/menu_backend.h" + +void menu_entries_cbs_init(void *data, + const char *path, const char *label, + unsigned type, size_t index) +{ + menu_file_list_cbs_t *cbs = NULL; + file_list_t *list = (file_list_t*)data; + + if (!list) + return; + + cbs = (menu_file_list_cbs_t*)list->list[index].actiondata; + + if (!cbs) + return; + +} diff --git a/frontend/menu/menu_entries_cbs.h b/frontend/menu/menu_entries_cbs.h new file mode 100644 index 0000000000..ec2b77c6fd --- /dev/null +++ b/frontend/menu/menu_entries_cbs.h @@ -0,0 +1,25 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2014 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef MENU_ENTRIES_CBS_H__ +#define MENU_ENTRIES_CBS_H__ + +#include + +void menu_entries_cbs_init(void *data, + const char *path, const char *label, + unsigned type, size_t index); + +#endif diff --git a/griffin/griffin.c b/griffin/griffin.c index 8d522f8001..399a66a23e 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -648,6 +648,7 @@ MENU #include "../frontend/menu/menu_common.c" #include "../frontend/menu/menu_action.c" #include "../frontend/menu/menu_entries.c" +#include "../frontend/menu/menu_entries_cbs.c" #include "../frontend/menu/menu_shader.c" #include "../frontend/menu/menu_navigation.c" #include "../frontend/menu/menu_animation.c"