Move more variables to menu_display_t

This commit is contained in:
twinaphex 2015-06-15 02:08:25 +02:00
parent 0ee9e06f8c
commit b2a7000519
5 changed files with 31 additions and 22 deletions

View File

@ -509,6 +509,7 @@ static int action_iterate_main(const char *label, unsigned action)
int ret = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
uint32_t hash = djb2_calculate(label);
if (!menu || !menu_list)
@ -543,7 +544,7 @@ static int action_iterate_main(const char *label, unsigned action)
ret = action_iterate_load_open_zip(label, msg, sizeof(msg), action);
break;
case ITERATE_TYPE_MESSAGE:
strlcpy(msg, menu->message_contents, sizeof(msg));
strlcpy(msg, disp->message_contents, sizeof(msg));
pop_selected = &nav->selection_ptr;
do_messagebox = true;
do_pop_stack = true;

View File

@ -154,6 +154,7 @@ void menu_common_load_content(bool persist)
void *menu_init(const void *data)
{
menu_handle_t *menu = NULL;
menu_display_t *disp = NULL;
menu_ctx_driver_t *menu_ctx = (menu_ctx_driver_t*)data;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
@ -179,6 +180,7 @@ void *menu_init(const void *data)
if (!menu->shader)
goto error;
#endif
menu->push_start_screen = settings->menu_show_start_screen;
settings->menu_show_start_screen = false;
@ -187,7 +189,9 @@ void *menu_init(const void *data)
if (!menu_display_init(menu))
goto error;
rarch_assert(menu->msg_queue = msg_queue_new(8));
disp = &menu->display;
rarch_assert(disp->msg_queue = msg_queue_new(8));
menu_display_fb_set_dirty();
menu_driver_set_alive();
@ -236,8 +240,9 @@ static void menu_free_list(menu_handle_t *menu)
void menu_free(menu_handle_t *menu)
{
global_t *global = global_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
if (!menu)
if (!menu || !disp)
return;
menu_free_list(menu);
@ -258,10 +263,6 @@ void menu_free(menu_handle_t *menu)
libretro_free_system_info(&global->menu.info);
#endif
if (menu->msg_queue)
msg_queue_free(menu->msg_queue);
menu->msg_queue = NULL;
menu_display_free(menu);
menu_list_free(menu->menu_list);

View File

@ -117,13 +117,18 @@ static void menu_display_fb_free(menu_framebuf_t *frame_buf)
void menu_display_free(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
if (!menu)
menu_display_t *disp = menu ? &menu->display : NULL;
if (!menu || !disp)
return;
if (disp->msg_queue)
msg_queue_free(disp->msg_queue);
disp->msg_queue = NULL;
menu_animation_free(menu->animation);
menu->animation = NULL;
menu_display_fb_free(&menu->display.frame_buf);
menu_display_fb_free(&disp->frame_buf);
}
bool menu_display_init(void *data)

View File

@ -20,6 +20,8 @@
#include <stdlib.h>
#include <boolean.h>
#include <queues/message_queue.h>
#include "../gfx/font_renderer_driver.h"
#ifdef __cplusplus
@ -49,6 +51,14 @@ typedef struct menu_display
} font;
unsigned header_height;
/* This buffer can be used to display generic OK messages to the user.
* Fill it and call
* menu_list_push(driver->menu->menu_stack, "", "message", 0, 0);
*/
char message_contents[PATH_MAX_LENGTH];
msg_queue_t *msg_queue;
} menu_display_t;
menu_display_t *menu_display_get_ptr(void);

View File

@ -21,7 +21,6 @@
#include <stdint.h>
#include <boolean.h>
#include <retro_miscellaneous.h>
#include <queues/message_queue.h>
#include "menu_animation.h"
#include "menu_display.h"
#include "menu_displaylist.h"
@ -73,21 +72,14 @@ typedef struct
bool defer_core;
char deferred_path[PATH_MAX_LENGTH];
/* This buffer can be used to display generic OK messages to the user.
* Fill it and call
* menu_list_push(driver->menu->menu_stack, "", "message", 0, 0);
*/
char message_contents[PATH_MAX_LENGTH];
msg_queue_t *msg_queue;
char default_glslp[PATH_MAX_LENGTH];
char default_cgp[PATH_MAX_LENGTH];
/* Menu display */
menu_display_t display;
bool load_no_content;
/* Menu shader */
char default_glslp[PATH_MAX_LENGTH];
char default_cgp[PATH_MAX_LENGTH];
struct video_shader *shader;
menu_input_t input;