From 4f9b284c6d2db5c764e380f51908d4098975835b Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 27 May 2012 21:52:52 +0200 Subject: [PATCH] (PS3) Restructure / move set functions to ps3_ctx.c --- console/griffin/hook.h | 2 +- gfx/context/ps3_ctx.c | 23 +++++++++++++++++++++++ ps3/menu.c | 26 +++++++++++++------------- ps3/ps3_video_psgl.c | 25 ------------------------- ps3/ps3_video_psgl.h | 2 -- 5 files changed, 37 insertions(+), 41 deletions(-) diff --git a/console/griffin/hook.h b/console/griffin/hook.h index 561a03b959..8f6a31ef14 100644 --- a/console/griffin/hook.h +++ b/console/griffin/hook.h @@ -38,7 +38,7 @@ #define video_xml_shader_func(path) driver.video->xml_shader(driver.video_data, path) #define video_free_func() gl_free(driver.video_data) #define video_set_rotation_func(rotation) gl_set_rotation(driver.video_data, rotation) -#define video_set_aspect_ratio_func(aspectratio_idx) ps3graphics_set_aspect_ratio(driver.video_data, aspectratio_idx) +#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx) #define input_init_func() ps3_input_initialize() #define input_poll_func() ps3_input_poll(driver.input_data) diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 01522551e6..87b833e35f 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -368,3 +368,26 @@ void gfx_ctx_set_projection(gl_t *gl, bool allow_rotate) glVertexPointer(2, GL_FLOAT, 0, vertex_ptr); } + +void gfx_ctx_set_aspect_ratio(void * data, unsigned aspectratio_index) +{ + (void)data; + gl_t * gl = driver.video_data; + + if(g_console.aspect_ratio_index == ASPECT_RATIO_AUTO) + rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height); + + g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value; + g_settings.video.force_aspect = false; + gl->keep_aspect = true; + gl->should_resize = true; +} + +void gfx_ctx_set_overscan(void) +{ + gl_t * gl = driver.video_data; + if(!gl) + return; + + gl->should_resize = true; +} diff --git a/ps3/menu.c b/ps3/menu.c index 32d7f95cd3..072131f05f 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -1303,7 +1303,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(g_console.aspect_ratio_index > 0) { g_console.aspect_ratio_index--; - video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index); + gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index); set_delay = DELAY_SMALL; } } @@ -1312,7 +1312,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) g_console.aspect_ratio_index++; if(g_console.aspect_ratio_index < ASPECT_RATIO_END) { - video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index); + gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index); set_delay = DELAY_SMALL; } else @@ -1321,7 +1321,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(CTRL_START(state)) { g_console.aspect_ratio_index = ASPECT_RATIO_4_3; - video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index); + gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index); } break; case SETTING_HW_TEXTURE_FILTER: @@ -1412,7 +1412,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(g_console.overscan_amount == 0.0f) g_console.overscan_enable = false; - ps3graphics_set_overscan(); + gfx_ctx_set_overscan(); set_delay = DELAY_SMALLEST; } if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state)) @@ -1423,14 +1423,14 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(g_console.overscan_amount == 0.0f) g_console.overscan_enable = 0; - ps3graphics_set_overscan(); + gfx_ctx_set_overscan(); set_delay = DELAY_SMALLEST; } if(CTRL_START(state)) { g_console.overscan_amount = 0.0f; g_console.overscan_enable = false; - ps3graphics_set_overscan(); + gfx_ctx_set_overscan(); } break; case SETTING_THROTTLE_MODE: @@ -2111,7 +2111,7 @@ static void ingame_menu(uint32_t menu_id) if(g_console.aspect_ratio_index > 0) { g_console.aspect_ratio_index--; - video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index); + gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index); set_delay = DELAY_LONG; } } @@ -2120,7 +2120,7 @@ static void ingame_menu(uint32_t menu_id) g_console.aspect_ratio_index++; if(g_console.aspect_ratio_index < ASPECT_RATIO_END) { - video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index); + gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index); set_delay = DELAY_LONG; } else @@ -2129,7 +2129,7 @@ static void ingame_menu(uint32_t menu_id) if(CTRL_START(state)) { g_console.aspect_ratio_index = ASPECT_RATIO_4_3; - video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index); + gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index); } strlcpy(comment, "Press LEFT or RIGHT to change the [Aspect Ratio].\nPress START to reset back to default values.", sizeof(comment)); break; @@ -2142,7 +2142,7 @@ static void ingame_menu(uint32_t menu_id) if(g_console.overscan_amount == 0.00f) g_console.overscan_enable = false; - ps3graphics_set_overscan(); + gfx_ctx_set_overscan(); set_delay = DELAY_SMALLEST; } if(CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state) || CTRL_LSTICK_RIGHT(state)) @@ -2152,14 +2152,14 @@ static void ingame_menu(uint32_t menu_id) if(g_console.overscan_amount == 0.0f) g_console.overscan_amount = false; - ps3graphics_set_overscan(); + gfx_ctx_set_overscan(); set_delay = DELAY_SMALLEST; } if(CTRL_START(state)) { g_console.overscan_amount = 0.0f; g_console.overscan_enable = false; - ps3graphics_set_overscan(); + gfx_ctx_set_overscan(); } strlcpy(comment, "Press LEFT or RIGHT to change the [Overscan] settings.\nPress START to reset back to default values.", sizeof(comment)); break; @@ -2240,7 +2240,7 @@ static void ingame_menu(uint32_t menu_id) if(CTRL_CROSS(state)) { g_console.aspect_ratio_index = ASPECT_RATIO_CUSTOM; - video_gl.set_aspect_ratio(NULL, g_console.aspect_ratio_index); + gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index); while(stuck_in_loop && g_console.ingame_menu_enable) { state = cell_pad_input_poll_device(0); diff --git a/ps3/ps3_video_psgl.c b/ps3/ps3_video_psgl.c index c175921fcd..d4686a873d 100644 --- a/ps3/ps3_video_psgl.c +++ b/ps3/ps3_video_psgl.c @@ -1109,22 +1109,6 @@ static bool gl_focus(void *data) return gfx_ctx_window_has_focus(); } -static void ps3graphics_set_aspect_ratio(void * data, uint32_t aspectratio_index) -{ - (void)data; - gl_t * gl = driver.video_data; - - if(g_console.aspect_ratio_index == ASPECT_RATIO_AUTO) - rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height); - - g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value; - g_settings.video.force_aspect = false; - gl->keep_aspect = true; - - - set_viewport(gl, gl->win_width, gl->win_height, false, true); -} - #ifdef RARCH_CONSOLE static void gl_start(void) { @@ -1184,7 +1168,6 @@ const video_driver_t video_gl = .free = gl_free, .ident = "gl", .set_rotation = gl_set_rotation, - .set_aspect_ratio = ps3graphics_set_aspect_ratio, #ifdef RARCH_CONSOLE .start = gl_start, .restart = gl_restart, @@ -1192,12 +1175,4 @@ const video_driver_t video_gl = #endif }; -void ps3graphics_set_overscan(void) -{ - gl_t * gl = driver.video_data; - if(!gl) - return; - - set_viewport(gl, gl->win_width, gl->win_height, false, true); -} diff --git a/ps3/ps3_video_psgl.h b/ps3/ps3_video_psgl.h index 4ac47a6441..b1f8039b5d 100644 --- a/ps3/ps3_video_psgl.h +++ b/ps3/ps3_video_psgl.h @@ -44,8 +44,6 @@ void ps3_next_resolution (void); void gl_deinit_fbo(gl_t * gl); void gl_init_fbo(gl_t * gl, unsigned width, unsigned height); void ps3graphics_reinit_fbos(void); -void ps3graphics_set_overscan(void); -void ps3graphics_set_vsync(uint32_t vsync); bool gl_cg_reinit(const char *path); bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info);