implement driver.current_msg

fix RGUI to no longer use driver.video_data casting
This commit is contained in:
ToadKing 2013-03-10 16:02:10 -04:00
parent 5b5264f2c5
commit eb82bd2127
5 changed files with 11 additions and 20 deletions

View File

@ -337,6 +337,9 @@ typedef struct driver
// Interface for "poking".
const video_poke_interface_t *video_poke;
// last message given to the video driver
const char *current_msg;
} driver_t;
void init_drivers(void);

View File

@ -37,14 +37,6 @@
#define TERM_WIDTH (((RGUI_WIDTH - TERM_START_X - 15) / (FONT_WIDTH_STRIDE)))
#define TERM_HEIGHT (((RGUI_HEIGHT - TERM_START_Y - 15) / (FONT_HEIGHT_STRIDE)) - 1)
#if defined(HAVE_OPENGL)
#define DECLARE_DEVICE_PTR() gl_t *device_ptr = (gl_t*)driver.video_data
#elif defined(GEKKO)
#define DECLARE_DEVICE_PTR() gx_video_t *device_ptr = (gx_video_t*)driver.video_data
#elif defined(HAVE_D3D8) || defined(HAVE_D3D9)
#define DECLARE_DEVICE_PTR() xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data
#endif
#ifdef GEKKO
enum
{
@ -586,7 +578,6 @@ static void render_text(rgui_handle_t *rgui)
#ifdef GEKKO
const char *message_queue;
DECLARE_DEVICE_PTR();
if (rgui->msg_force)
{
@ -595,7 +586,7 @@ static void render_text(rgui_handle_t *rgui)
}
else
{
message_queue = device_ptr->msg;
message_queue = driver.current_msg;
}
render_messagebox(rgui, message_queue);
#endif
@ -1042,9 +1033,10 @@ static void rgui_settings_controller_populate_entries(rgui_handle_t *rgui)
static int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
{
#ifdef GEKKO
DECLARE_DEVICE_PTR();
#endif
rarch_viewport_t vp;
driver.video->viewport_info(driver.video_data, &vp);
unsigned win_width = vp.full_width;
unsigned win_height = vp.full_height;
unsigned menu_type = 0;
rgui_list_back(rgui->path_stack, NULL, &menu_type, NULL);
@ -1133,8 +1125,8 @@ static int rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
}
else
{
g_extern.console.screen.viewports.custom_vp.width = device_ptr->win_width - g_extern.console.screen.viewports.custom_vp.x;
g_extern.console.screen.viewports.custom_vp.height = device_ptr->win_height - g_extern.console.screen.viewports.custom_vp.y;
g_extern.console.screen.viewports.custom_vp.width = win_width - g_extern.console.screen.viewports.custom_vp.x;
g_extern.console.screen.viewports.custom_vp.height = win_height - g_extern.console.screen.viewports.custom_vp.y;
}
#endif
if (driver.video_poke->apply_state_changes)

View File

@ -976,10 +976,6 @@ static bool gx_frame(void *data, const void *frame,
gx_blit_line(x, y, msg);
clear_efb = GX_TRUE;
}
else if (msg)
snprintf(gx->msg, sizeof(gx->msg), "%s", msg);
else
gx->msg[0] = 0;
GX_CopyDisp(g_framebuf[g_current_framebuf], clear_efb);
GX_Flush();

View File

@ -27,7 +27,6 @@ typedef struct gx_video
uint32_t *menu_data; // FIXME: Should be const uint16_t*.
rarch_viewport_t vp;
unsigned scale;
char msg[128];
} gx_video_t;
void gx_set_video_mode(unsigned fbWidth, unsigned lines);

View File

@ -281,6 +281,7 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_
#endif
const char *msg = msg_queue_pull(g_extern.msg_queue);
driver.current_msg = msg;
#ifdef HAVE_DYLIB
if (g_extern.filter.active && data)