From 3e6a10ffb6d5d5c1d382eee043d7a99bebc7bb52 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Wed, 30 May 2012 17:02:38 +0200 Subject: [PATCH] (PS3) Add some Griffin overrides --- console/griffin/hook.h | 7 +++++++ gfx/context/ps3_ctx.c | 8 +++++--- gfx/context/xdk360_ctx.c | 2 ++ gfx/fonts/ps3_libdbgfont.c | 1 - gfx/gfx_context.h | 6 ++++-- gfx/gl.c | 28 +++++++++++++--------------- gfx/gl_font.h | 1 + 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/console/griffin/hook.h b/console/griffin/hook.h index 00748010a0..a7b6890503 100644 --- a/console/griffin/hook.h +++ b/console/griffin/hook.h @@ -40,6 +40,9 @@ #define video_set_rotation_func(rotation) gl_set_rotation(driver.video_data, rotation) #define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx) +#define gfx_ctx_window_has_focus() (true) +#define gfx_ctx_swap_buffers() (psglSwap()) + #define input_init_func() ps3_input_initialize() #define input_poll_func() ps3_input_poll(driver.input_data) #define input_input_state_func(snes_keybinds, port, device, index, id) \ @@ -65,6 +68,9 @@ #define video_set_rotation_func(rotation) xdk360_set_rotation(driver.video_data, rotation) #define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx) +#define gfx_ctx_window_has_focus() (true) +#define gfx_ctx_swap_buffers() (d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL)) + #define input_init_func() xdk360_input_initialize() #define input_poll_func() xdk360_input_poll(driver.input_data) #define input_input_state_func(snes_keybinds, port, device, index, id) \ @@ -95,5 +101,6 @@ wii_input_state(driver.input_data, snes_keybinds, port, device, index, id) #define input_key_pressed_func(key) wii_key_pressed(driver.input_data, key) #define input_free_func() wii_free_input(driver.input_data) +#define gfx_ctx_window_has_focus() (true) #endif diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 9ceb59059b..4d137d574f 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -95,17 +95,20 @@ void gfx_ctx_check_window(bool *quit, *resize = true; } +#ifndef HAVE_GRIFFIN bool gfx_ctx_window_has_focus(void) { return true; } -void gfx_ctx_set_resize(unsigned width, unsigned height) { } - void gfx_ctx_swap_buffers(void) { psglSwap(); } +#endif + +void gfx_ctx_set_resize(unsigned width, unsigned height) { } + bool gfx_ctx_menu_init(void) { @@ -408,4 +411,3 @@ void gfx_ctx_set_overscan(void) gl->should_resize = true; } - diff --git a/gfx/context/xdk360_ctx.c b/gfx/context/xdk360_ctx.c index 0d4bbc4241..2d74278040 100644 --- a/gfx/context/xdk360_ctx.c +++ b/gfx/context/xdk360_ctx.c @@ -58,11 +58,13 @@ bool gfx_ctx_window_has_focus(void) void gfx_ctx_set_resize(unsigned width, unsigned height) { } +#ifndef HAVE_GRIFFIN void gfx_ctx_swap_buffers(void) { xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data; d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL); } +#endif bool gfx_ctx_menu_init(void) { diff --git a/gfx/fonts/ps3_libdbgfont.c b/gfx/fonts/ps3_libdbgfont.c index 3279d9fc0b..9ed58d8f34 100644 --- a/gfx/fonts/ps3_libdbgfont.c +++ b/gfx/fonts/ps3_libdbgfont.c @@ -46,4 +46,3 @@ void gl_render_msg_post(gl_t *gl) { cellDbgFontDraw(); } - diff --git a/gfx/gfx_context.h b/gfx/gfx_context.h index b71bedd1ff..56961e97e3 100644 --- a/gfx/gfx_context.h +++ b/gfx/gfx_context.h @@ -49,8 +49,6 @@ void gfx_ctx_destroy(void); void gfx_ctx_get_video_size(unsigned *width, unsigned *height); void gfx_ctx_update_window_title(bool reset); -void gfx_ctx_swap_buffers(void); - bool gfx_ctx_key_pressed(int key); void gfx_ctx_check_window(bool *quit, @@ -62,8 +60,12 @@ void gfx_ctx_set_resize(unsigned width, unsigned height); bool gfx_ctx_get_wm_info(SDL_SysWMinfo *info); #endif +#ifndef HAVE_GRIFFIN bool gfx_ctx_window_has_focus(void); +void gfx_ctx_swap_buffers(void); +#endif + void gfx_ctx_input_driver(const input_driver_t **input, void **input_data); #ifdef HAVE_CG_MENU diff --git a/gfx/gl.c b/gfx/gl.c index dc34406b41..1b3352bb43 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -542,20 +542,6 @@ static inline void set_texture_coords(GLfloat *coords, GLfloat xamt, GLfloat yam coords[7] = yamt; } -static void check_window(gl_t *gl) -{ - bool quit, resize; - - gfx_ctx_check_window(&quit, - &resize, &gl->win_width, &gl->win_height, - gl->frame_count); - - if (quit) - gl->quitting = true; - else if (resize) - gl->should_resize = true; -} - #ifdef HAVE_FBO static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height, unsigned vp_width, unsigned vp_height) @@ -958,7 +944,9 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei gl_render_msg_post(gl); } +#ifndef RARCH_CONSOLE gfx_ctx_update_window_title(false); +#endif #ifdef RARCH_CONSOLE if (!gl->block_swap) @@ -1189,7 +1177,17 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo static bool gl_alive(void *data) { gl_t *gl = (gl_t*)data; - check_window(gl); + bool quit, resize; + + gfx_ctx_check_window(&quit, + &resize, &gl->win_width, &gl->win_height, + gl->frame_count); + + if (quit) + gl->quitting = true; + else if (resize) + gl->should_resize = true; + return !gl->quitting; } diff --git a/gfx/gl_font.h b/gfx/gl_font.h index cc74950e93..b355b91642 100644 --- a/gfx/gl_font.h +++ b/gfx/gl_font.h @@ -22,6 +22,7 @@ void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size); void gl_deinit_font(gl_t *gl); void gl_render_msg(gl_t *gl, const char *msg); + void gl_render_msg_post(gl_t *gl); #endif