(PS3) Restructure / move set functions to ps3_ctx.c

This commit is contained in:
Twinaphex 2012-05-27 21:52:52 +02:00
parent 232a3850d1
commit 4f9b284c6d
5 changed files with 37 additions and 41 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);