From 594aaa46001585594968d66180c52380bf1f63c8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 30 Sep 2012 18:37:27 +0200 Subject: [PATCH] (PS3) Some more refactorings to do with RMenu context files --- console/rmenu/context/rmenu_ctx_ps3.c | 12 ++++++++++++ console/rmenu/context/rmenu_ctx_xdk.c | 8 +++++++- console/rmenu/rmenu.c | 22 +++++++++++----------- console/rmenu/rmenu.h | 1 + 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/console/rmenu/context/rmenu_ctx_ps3.c b/console/rmenu/context/rmenu_ctx_ps3.c index 02b4c39762..9857cc5ed2 100644 --- a/console/rmenu/context/rmenu_ctx_ps3.c +++ b/console/rmenu/context/rmenu_ctx_ps3.c @@ -187,11 +187,23 @@ static void rmenu_ctx_ps3_set_aspect_ratio(unsigned aspectratio_index) driver.video->set_aspect_ratio(NULL, aspectratio_index); } +static void rmenu_ctx_ps3_set_fbo_enable(bool enable) +{ + gfx_ctx_set_fbo(enable); +} + +static void rmenu_ctx_ps3_apply_fbo_state_changes(unsigned i) +{ + gfx_ctx_apply_fbo_state_changes(i); +} + const rmenu_context_t rmenu_ctx_ps3 = { .clear = rmenu_ctx_ps3_clear, .set_filtering = rmenu_ctx_ps3_set_filtering, .set_aspect_ratio = rmenu_ctx_ps3_set_aspect_ratio, .blend = rmenu_ctx_ps3_blend, + .set_fbo_enable = rmenu_ctx_ps3_set_fbo_enable, + .apply_fbo_state_changes = rmenu_ctx_ps3_apply_fbo_state_changes, .free_textures = rmenu_ctx_ps3_free_textures, .init_textures = rmenu_ctx_ps3_init_textures, .render_selection_panel = rmenu_ctx_ps3_render_selection_panel, diff --git a/console/rmenu/context/rmenu_ctx_xdk.c b/console/rmenu/context/rmenu_ctx_xdk.c index 4ab71dbb3b..efe5bd8316 100644 --- a/console/rmenu/context/rmenu_ctx_xdk.c +++ b/console/rmenu/context/rmenu_ctx_xdk.c @@ -226,7 +226,12 @@ static void rmenu_ctx_xdk_set_aspect_ratio(unsigned aspectratio_index) static void rmenu_ctx_xdk_set_fbo_enable(bool enable) { - gfx_ctx_xdk_set_fbo(enable); + gfx_ctx_xdk_set_fbo(enable); +} + +static void rmenu_ctx_xdk_apply_fbo_state_changes(unsigned i) +{ + gfx_ctx_xdk_apply_fbo_state_changes(i); } const rmenu_context_t rmenu_ctx_xdk = { @@ -235,6 +240,7 @@ const rmenu_context_t rmenu_ctx_xdk = { rmenu_ctx_xdk_set_aspect_ratio, rmenu_ctx_xdk_blend, rmenu_ctx_xdk_set_fbo_enable, + rmenu_ctx_xdk_apply_fbo_state_changes, rmenu_ctx_xdk_free_textures, rmenu_ctx_xdk_init_textures, rmenu_ctx_xdk_render_selection_panel, diff --git a/console/rmenu/rmenu.c b/console/rmenu/rmenu.c index bed8433785..f881dfbd53 100644 --- a/console/rmenu/rmenu.c +++ b/console/rmenu/rmenu.c @@ -691,11 +691,11 @@ static void select_file(menu *current_menu, uint64_t input) break; case PRESET_CHOICE: strlcpy(g_console.cgp_path, path, sizeof(g_console.cgp_path)); - gfx_ctx_apply_fbo_state_changes(FBO_DEINIT); + context->apply_fbo_state_changes(FBO_DEINIT); #ifdef HAVE_OPENGL gl_cg_reinit(path); #endif - gfx_ctx_apply_fbo_state_changes(FBO_INIT); + context->apply_fbo_state_changes(FBO_INIT); break; #endif case INPUT_PRESET_CHOICE: @@ -1052,25 +1052,25 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_ if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B))) { rarch_settings_change(S_HW_TEXTURE_FILTER_2); - gfx_ctx_set_filtering(2, g_settings.video.second_pass_smooth); + context->set_filtering(2, g_settings.video.second_pass_smooth); } if(input & (1 << RMENU_DEVICE_NAV_START)) { rarch_settings_change(S_DEF_HW_TEXTURE_FILTER_2); - gfx_ctx_set_filtering(2, g_settings.video.second_pass_smooth); + context->set_filtering(2, g_settings.video.second_pass_smooth); } break; case SETTING_SCALE_ENABLED: if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B))) { rarch_settings_change(S_SCALE_ENABLED); - gfx_ctx_set_fbo(g_console.fbo_enabled); + context->set_fbo_enable(g_console.fbo_enabled); } if(input & (1 << RMENU_DEVICE_NAV_START)) { rarch_settings_default(S_DEF_SCALE_ENABLED); - gfx_ctx_apply_fbo_state_changes(FBO_DEINIT); - gfx_ctx_apply_fbo_state_changes(FBO_INIT); + context->apply_fbo_state_changes(FBO_DEINIT); + context->apply_fbo_state_changes(FBO_INIT); } break; case SETTING_SCALE_FACTOR: @@ -1083,7 +1083,7 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_ if(should_decrement) { rarch_settings_change(S_SCALE_FACTOR_DECREMENT); - gfx_ctx_apply_fbo_state_changes(FBO_REINIT); + context->apply_fbo_state_changes(FBO_REINIT); } } } @@ -1095,15 +1095,15 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_ if(should_increment) { rarch_settings_change(S_SCALE_FACTOR_INCREMENT); - gfx_ctx_apply_fbo_state_changes(FBO_REINIT); + context->apply_fbo_state_changes(FBO_REINIT); } } } if(input & (1 << RMENU_DEVICE_NAV_START)) { rarch_settings_default(S_DEF_SCALE_FACTOR); - gfx_ctx_apply_fbo_state_changes(FBO_DEINIT); - gfx_ctx_apply_fbo_state_changes(FBO_INIT); + context->apply_fbo_state_changes(FBO_DEINIT); + context->apply_fbo_state_changes(FBO_INIT); } break; #endif diff --git a/console/rmenu/rmenu.h b/console/rmenu/rmenu.h index 5e04f838ae..fac35a210f 100644 --- a/console/rmenu/rmenu.h +++ b/console/rmenu/rmenu.h @@ -76,6 +76,7 @@ typedef struct rmenu_context void (*set_aspect_ratio)(unsigned aspectratio_index); void (*blend)(bool enable); void (*set_fbo_enable)(bool enable); + void (*apply_fbo_state_changes)(unsigned i); void (*free_textures)(void); void (*init_textures)(void); void (*render_selection_panel)(rmenu_position_t *position);