mirror of
https://github.com/libretro/RetroArch
synced 2025-03-05 19:13:45 +00:00
Create menu_entries.h
This commit is contained in:
parent
d66db000c6
commit
3fe0b3c4d9
@ -247,8 +247,9 @@ static size_t xmb_list_get_size(void *data, menu_list_type_t type)
|
||||
{
|
||||
size_t list_size = 0;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
menu_list_t *menu_list = menu ? menu->menu_list : NULL;
|
||||
xmb_handle_t *xmb = menu ? (xmb_handle_t*)menu->userdata : NULL;
|
||||
menu_entries_t *entries = menu ? &menu->entries : NULL;
|
||||
menu_list_t *menu_list = entries ? entries->menu_list : NULL;
|
||||
xmb_handle_t *xmb = menu ? (xmb_handle_t*)menu->userdata : NULL;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
32
menu/menu.c
32
menu/menu.c
@ -144,6 +144,14 @@ void menu_common_load_content(bool persist)
|
||||
disp->msg_force = true;
|
||||
}
|
||||
|
||||
static int menu_init_entries(menu_entries_t *entries)
|
||||
{
|
||||
if (!(entries->menu_list = (menu_list_t*)menu_list_new()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* menu_init:
|
||||
* @data : Menu context handle.
|
||||
@ -169,7 +177,7 @@ void *menu_init(const void *data)
|
||||
strlcpy(settings->menu.driver, menu_ctx->ident,
|
||||
sizeof(settings->menu.driver));
|
||||
|
||||
if (!(menu->menu_list = (menu_list_t*)menu_list_new()))
|
||||
if (menu_init_entries(&menu->entries) != 0)
|
||||
goto error;
|
||||
|
||||
global->core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
||||
@ -199,9 +207,9 @@ void *menu_init(const void *data)
|
||||
|
||||
return menu;
|
||||
error:
|
||||
if (menu->menu_list)
|
||||
menu_list_free(menu->menu_list);
|
||||
menu->menu_list = NULL;
|
||||
if (menu->entries.menu_list)
|
||||
menu_list_free(menu->entries.menu_list);
|
||||
menu->entries.menu_list = NULL;
|
||||
if (global->core_info_current)
|
||||
free(global->core_info_current);
|
||||
global->core_info_current = NULL;
|
||||
@ -220,16 +228,16 @@ error:
|
||||
*
|
||||
* Frees menu lists.
|
||||
**/
|
||||
static void menu_free_list(menu_handle_t *menu)
|
||||
static void menu_free_list(menu_entries_t *entries)
|
||||
{
|
||||
if (!menu)
|
||||
if (!entries)
|
||||
return;
|
||||
|
||||
menu_setting_free(menu->list_settings);
|
||||
menu->list_settings = NULL;
|
||||
menu_setting_free(entries->list_settings);
|
||||
entries->list_settings = NULL;
|
||||
|
||||
menu_list_free(menu->menu_list);
|
||||
menu->menu_list = NULL;
|
||||
menu_list_free(entries->menu_list);
|
||||
entries->menu_list = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -246,7 +254,6 @@ void menu_free(menu_handle_t *menu)
|
||||
if (!menu || !disp)
|
||||
return;
|
||||
|
||||
menu_free_list(menu);
|
||||
|
||||
if (menu->playlist)
|
||||
content_playlist_free(menu->playlist);
|
||||
@ -262,8 +269,7 @@ void menu_free(menu_handle_t *menu)
|
||||
|
||||
menu_display_free(menu);
|
||||
|
||||
menu_list_free(menu->menu_list);
|
||||
menu->menu_list = NULL;
|
||||
menu_free_list(&menu->entries);
|
||||
|
||||
event_command(EVENT_CMD_HISTORY_DEINIT);
|
||||
|
||||
|
@ -1152,16 +1152,25 @@ static int deferred_push_video_shader_parameters_common(
|
||||
}
|
||||
#endif
|
||||
|
||||
static void menu_displaylist_realloc_settings(menu_entries_t *entries, unsigned flags)
|
||||
{
|
||||
if (!entries)
|
||||
return;
|
||||
|
||||
if (entries->list_settings)
|
||||
menu_setting_free(entries->list_settings);
|
||||
|
||||
entries->list_settings = menu_setting_new(flags);
|
||||
}
|
||||
|
||||
static int menu_displaylist_parse_settings(menu_handle_t *menu,
|
||||
menu_displaylist_info_t *info, unsigned setting_flags)
|
||||
{
|
||||
rarch_setting_t *setting = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (menu && menu->list_settings)
|
||||
menu_setting_free(menu->list_settings);
|
||||
menu_displaylist_realloc_settings(&menu->entries, setting_flags);
|
||||
|
||||
menu->list_settings = menu_setting_new(setting_flags);
|
||||
setting = menu_setting_find(info->label);
|
||||
|
||||
if (!setting)
|
||||
@ -1217,9 +1226,7 @@ static int menu_displaylist_parse_settings_in_subgroup(menu_displaylist_info_t *
|
||||
}
|
||||
}
|
||||
|
||||
if (menu->list_settings)
|
||||
menu_setting_free(menu->list_settings);
|
||||
menu->list_settings = menu_setting_new(SL_FLAG_ALL_SETTINGS);
|
||||
menu_displaylist_realloc_settings(&menu->entries, SL_FLAG_ALL_SETTINGS);
|
||||
|
||||
info->setting = menu_setting_find(elem0);
|
||||
|
||||
@ -1822,9 +1829,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
break;
|
||||
case DISPLAYLIST_SETTINGS_ALL:
|
||||
menu_list_clear(info->list);
|
||||
if (menu->list_settings)
|
||||
menu_setting_free(menu->list_settings);
|
||||
menu->list_settings = menu_setting_new(SL_FLAG_ALL_SETTINGS);
|
||||
menu_displaylist_realloc_settings(&menu->entries, SL_FLAG_ALL_SETTINGS);
|
||||
|
||||
setting = menu_setting_find(menu_hash_to_str(MENU_LABEL_DRIVER_SETTINGS));
|
||||
|
||||
@ -2043,9 +2048,9 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
|
||||
uint32_t hash_label = 0;
|
||||
unsigned type = 0;
|
||||
menu_displaylist_info_t info = {0};
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
|
||||
menu_list_get_last_stack(menu->menu_list, &path, &label, &type, NULL);
|
||||
menu_list_get_last_stack(entries->menu_list, &path, &label, &type, NULL);
|
||||
|
||||
info.list = list;
|
||||
info.menu_list = menu_list;
|
||||
@ -2068,7 +2073,7 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
|
||||
}
|
||||
|
||||
cbs = (menu_file_list_cbs_t*)
|
||||
menu_list_get_last_stack_actiondata(menu->menu_list);
|
||||
menu_list_get_last_stack_actiondata(entries->menu_list);
|
||||
|
||||
if (cbs->action_deferred_push)
|
||||
return cbs->action_deferred_push(&info);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "menu_animation.h"
|
||||
#include "menu_display.h"
|
||||
#include "menu_displaylist.h"
|
||||
#include "menu_entries.h"
|
||||
#include "menu_list.h"
|
||||
#include "menu_input.h"
|
||||
#include "menu_navigation.h"
|
||||
@ -49,9 +50,6 @@ typedef struct
|
||||
size_t begin;
|
||||
float scroll_y;
|
||||
|
||||
menu_list_t *menu_list;
|
||||
menu_navigation_t navigation;
|
||||
|
||||
bool need_refresh;
|
||||
bool nonblocking_refresh;
|
||||
bool push_start_screen;
|
||||
@ -62,6 +60,9 @@ typedef struct
|
||||
/* Menu display */
|
||||
menu_display_t display;
|
||||
|
||||
/* Menu entries */
|
||||
menu_entries_t entries;
|
||||
|
||||
bool load_no_content;
|
||||
|
||||
/* Menu shader */
|
||||
@ -71,7 +72,6 @@ typedef struct
|
||||
|
||||
menu_input_t input;
|
||||
|
||||
rarch_setting_t *list_settings;
|
||||
|
||||
content_playlist_t *playlist;
|
||||
char db_playlist_file[PATH_MAX_LENGTH];
|
||||
|
@ -20,8 +20,19 @@
|
||||
#include "menu_setting.h"
|
||||
#include "menu_input.h"
|
||||
|
||||
#include "menu_entries.h"
|
||||
|
||||
#include "../general.h"
|
||||
|
||||
menu_entries_t *menu_entries_get_ptr(void)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
return NULL;
|
||||
|
||||
return &menu->entries;
|
||||
}
|
||||
|
||||
/* Sets the starting index of the menu entry list. */
|
||||
void menu_entries_set_start(size_t i)
|
||||
{
|
||||
|
55
menu/menu_entries.h
Normal file
55
menu/menu_entries.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2015 - 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __MENU_ENTRIES_H__
|
||||
#define __MENU_ENTRIES_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "menu_navigation.h"
|
||||
#include "menu_list.h"
|
||||
#include "menu_setting.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct menu_entries
|
||||
{
|
||||
menu_list_t *menu_list;
|
||||
rarch_setting_t *list_settings;
|
||||
menu_navigation_t navigation;
|
||||
} menu_entries_t;
|
||||
|
||||
void menu_entries_set_start(size_t i);
|
||||
|
||||
size_t menu_entries_get_start(void);
|
||||
|
||||
size_t menu_entries_get_end(void);
|
||||
|
||||
int menu_entries_get_title(char *title, size_t title_len);
|
||||
|
||||
bool menu_entries_show_back(void);
|
||||
|
||||
void menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
|
||||
|
||||
menu_entries_t *menu_entries_get_ptr(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -51,7 +51,6 @@ typedef struct menu_entry
|
||||
unsigned spacing;
|
||||
} menu_entry_t;
|
||||
|
||||
|
||||
int menu_entry_go_back(void);
|
||||
|
||||
enum menu_entry_type menu_entry_get_type(uint32_t i);
|
||||
@ -118,18 +117,6 @@ int menu_entry_select(uint32_t i);
|
||||
int menu_entry_action(menu_entry_t *entry,
|
||||
unsigned i, enum menu_action action);
|
||||
|
||||
void menu_entries_set_start(size_t i);
|
||||
|
||||
size_t menu_entries_get_start(void);
|
||||
|
||||
size_t menu_entries_get_end(void);
|
||||
|
||||
int menu_entries_get_title(char *title, size_t title_len);
|
||||
|
||||
bool menu_entries_show_back(void);
|
||||
|
||||
void menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -26,10 +26,10 @@
|
||||
|
||||
menu_list_t *menu_list_get_ptr(void)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return menu->menu_list;
|
||||
return entries->menu_list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,17 +23,18 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "menu_displaylist.h"
|
||||
#include "menu_navigation.h"
|
||||
#include "menu_driver.h"
|
||||
#include "menu_entries.h"
|
||||
|
||||
#include "../configuration.h"
|
||||
|
||||
menu_navigation_t *menu_navigation_get_ptr(void)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return &menu->navigation;
|
||||
return &entries->navigation;
|
||||
}
|
||||
/**
|
||||
* menu_navigation_clear:
|
||||
|
@ -292,11 +292,11 @@ int menu_action_handle_setting(rarch_setting_t *setting,
|
||||
|
||||
static rarch_setting_t *menu_setting_get_ptr(void)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return menu->list_settings;
|
||||
return entries->list_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user