mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-22 04:31:17 +00:00
Cleanups
This commit is contained in:
parent
8a42deb189
commit
a3cedc05d7
@ -344,7 +344,7 @@ static void glui_render_menu_list(glui_handle_t *glui,
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
size_t end = menu_entries_get_end();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
|
||||
if (!menu_display_update_pending())
|
||||
return;
|
||||
@ -365,7 +365,7 @@ static void glui_render_menu_list(glui_handle_t *glui,
|
||||
|
||||
menu_entries_get(i, &entry);
|
||||
|
||||
entry_selected = entries->navigation.selection_ptr == i;
|
||||
entry_selected = nav->selection_ptr == i;
|
||||
|
||||
glui_render_label_value(glui, y, width, *frame_count / 40,
|
||||
entry_selected ? hover_color : normal_color, entry_selected,
|
||||
|
@ -260,8 +260,7 @@ 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_entries_t *entries = menu ? &menu->entries : NULL;
|
||||
menu_list_t *menu_list = entries ? entries->menu_list : NULL;
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
xmb_handle_t *xmb = menu ? (xmb_handle_t*)menu->userdata : NULL;
|
||||
|
||||
switch (type)
|
||||
|
15
menu/menu.c
15
menu/menu.c
@ -190,7 +190,6 @@ void menu_free(menu_handle_t *menu)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
menu_entries_t *entries = menu ? &menu->entries : NULL;
|
||||
if (!menu || !disp)
|
||||
return;
|
||||
|
||||
@ -208,14 +207,7 @@ void menu_free(menu_handle_t *menu)
|
||||
|
||||
menu_display_free(menu);
|
||||
|
||||
if (entries)
|
||||
{
|
||||
menu_setting_free(entries->list_settings);
|
||||
entries->list_settings = NULL;
|
||||
|
||||
menu_list_free(entries->menu_list);
|
||||
entries->menu_list = NULL;
|
||||
}
|
||||
menu_entries_free();
|
||||
|
||||
event_command(EVENT_CMD_HISTORY_DEINIT);
|
||||
|
||||
@ -243,7 +235,6 @@ void *menu_init(const void *data)
|
||||
{
|
||||
menu_handle_t *menu = NULL;
|
||||
menu_display_t *disp = NULL;
|
||||
menu_entries_t *entries = NULL;
|
||||
menu_ctx_driver_t *menu_ctx = (menu_ctx_driver_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -254,12 +245,10 @@ void *menu_init(const void *data)
|
||||
if (!(menu = (menu_handle_t*)menu_ctx->init()))
|
||||
return NULL;
|
||||
|
||||
entries = &menu->entries;
|
||||
|
||||
strlcpy(settings->menu.driver, menu_ctx->ident,
|
||||
sizeof(settings->menu.driver));
|
||||
|
||||
if (!(entries->menu_list = (menu_list_t*)menu_list_new()))
|
||||
if (!menu_entries_init(menu))
|
||||
goto error;
|
||||
|
||||
global->core_info.current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
||||
|
@ -2824,9 +2824,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_entries_t *entries = menu_entries_get_ptr();
|
||||
menu_list_t *_menu_list = menu_list_get_ptr();
|
||||
|
||||
menu_list_get_last_stack(entries->menu_list, &path, &label, &type, NULL);
|
||||
menu_list_get_last_stack(_menu_list, &path, &label, &type, NULL);
|
||||
|
||||
info.list = list;
|
||||
info.menu_list = menu_list;
|
||||
@ -2849,7 +2849,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(entries->menu_list);
|
||||
menu_list_get_last_stack_actiondata(_menu_list);
|
||||
|
||||
if (cbs->action_deferred_push)
|
||||
return cbs->action_deferred_push(&info);
|
||||
|
@ -16,17 +16,13 @@
|
||||
#include "menu.h"
|
||||
#include "menu_hash.h"
|
||||
#include "menu_display.h"
|
||||
#include "menu_entry.h"
|
||||
#include "menu_navigation.h"
|
||||
#include "menu_setting.h"
|
||||
#include "menu_input.h"
|
||||
|
||||
#include "menu_entries.h"
|
||||
|
||||
#include "../general.h"
|
||||
#include "../system.h"
|
||||
|
||||
menu_entries_t *menu_entries_get_ptr(void)
|
||||
static menu_entries_t *menu_entries_get_ptr(void)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
@ -35,6 +31,31 @@ menu_entries_t *menu_entries_get_ptr(void)
|
||||
return &menu->entries;
|
||||
}
|
||||
|
||||
rarch_setting_t *menu_setting_get_ptr(void)
|
||||
{
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return entries->list_settings;
|
||||
}
|
||||
|
||||
menu_list_t *menu_list_get_ptr(void)
|
||||
{
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return entries->menu_list;
|
||||
}
|
||||
|
||||
menu_navigation_t *menu_navigation_get_ptr(void)
|
||||
{
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return &entries->navigation;
|
||||
}
|
||||
|
||||
/* Sets the starting index of the menu entry list. */
|
||||
void menu_entries_set_start(size_t i)
|
||||
{
|
||||
@ -198,3 +219,32 @@ void menu_entries_unset_refresh(bool nonblocking)
|
||||
entries->need_refresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool menu_entries_init(void *data)
|
||||
{
|
||||
menu_entries_t *entries = NULL;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
if (!menu)
|
||||
return false;
|
||||
|
||||
entries = &menu->entries;
|
||||
|
||||
if (!(entries->menu_list = (menu_list_t*)menu_list_new()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void menu_entries_free(void)
|
||||
{
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
|
||||
if (!entries)
|
||||
return;
|
||||
|
||||
menu_setting_free(entries->list_settings);
|
||||
entries->list_settings = NULL;
|
||||
|
||||
menu_list_free(entries->menu_list);
|
||||
entries->menu_list = NULL;
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "menu_navigation.h"
|
||||
#include "menu_list.h"
|
||||
#include "menu_setting.h"
|
||||
@ -54,7 +56,9 @@ bool menu_entries_show_back(void);
|
||||
|
||||
int menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
|
||||
|
||||
menu_entries_t *menu_entries_get_ptr(void);
|
||||
rarch_setting_t *menu_setting_get_ptr(void);
|
||||
|
||||
menu_navigation_t *menu_navigation_get_ptr(void);
|
||||
|
||||
bool menu_entries_needs_refresh(void);
|
||||
|
||||
@ -62,6 +66,10 @@ void menu_entries_set_refresh(bool nonblocking);
|
||||
|
||||
void menu_entries_unset_refresh(bool nonblocking);
|
||||
|
||||
bool menu_entries_init(void *data);
|
||||
|
||||
void menu_entries_free(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -48,14 +48,6 @@ static void menu_driver_list_insert(file_list_t *list, const char *path,
|
||||
menu_cbs_init(list, path, label, type, idx);
|
||||
}
|
||||
|
||||
menu_list_t *menu_list_get_ptr(void)
|
||||
{
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return entries->menu_list;
|
||||
}
|
||||
|
||||
size_t menu_list_get_size(menu_list_t *list)
|
||||
{
|
||||
if (!list)
|
||||
|
@ -85,13 +85,6 @@ static void menu_driver_navigation_ascend_alphabet(size_t *ptr_out)
|
||||
driver->navigation_ascend_alphabet(ptr_out);
|
||||
}
|
||||
|
||||
menu_navigation_t *menu_navigation_get_ptr(void)
|
||||
{
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return &entries->navigation;
|
||||
}
|
||||
/**
|
||||
* menu_navigation_clear:
|
||||
* @pending_push : pending push ?
|
||||
|
@ -37,8 +37,6 @@ typedef struct menu_navigation
|
||||
size_t selection_ptr;
|
||||
} menu_navigation_t;
|
||||
|
||||
menu_navigation_t *menu_navigation_get_ptr(void);
|
||||
|
||||
/**
|
||||
* menu_navigation_clear:
|
||||
* @pending_push : pending push ?
|
||||
|
@ -225,15 +225,6 @@ int menu_action_handle_setting(rarch_setting_t *setting,
|
||||
return -1;
|
||||
}
|
||||
|
||||
static rarch_setting_t *menu_setting_get_ptr(void)
|
||||
{
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
|
||||
if (!entries)
|
||||
return NULL;
|
||||
return entries->list_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* menu_setting_find:
|
||||
* @settings : pointer to settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user