(PS3) Implement start/stop/restart

This commit is contained in:
Twinaphex 2012-05-27 19:29:10 +02:00
parent 448bf2cdc8
commit 29ba19bc73
7 changed files with 59 additions and 47 deletions

View File

@ -198,6 +198,7 @@ struct console_settings
#ifdef __CELLOS_LV2__
bool custom_bgm_enable;
#endif
bool check_available_resolutions;
bool block_config_read;
bool default_sram_dir_enable;
bool default_savestate_dir_enable;

View File

@ -219,12 +219,15 @@ void gfx_ctx_set_fbo(bool enable)
TODO: Refactor
============================================================ */
static void get_all_available_resolutions (void)
void gfx_ctx_get_available_resolutions (void)
{
bool defaultresolution;
uint32_t i, resolution_count;
uint16_t num_videomodes;
if(g_console.check_available_resolutions)
return;
defaultresolution = true;
uint32_t videomode[] = {
@ -263,6 +266,8 @@ static void get_all_available_resolutions (void)
that was added to the list (the highest resolution) the default resolution*/
if (g_console.current_resolution_id > num_videomodes || defaultresolution)
g_console.current_resolution_index = g_console.supported_resolutions_count-1;
g_console.check_available_resolutions = true;
}
void ps3_next_resolution (void)

View File

@ -64,6 +64,7 @@ bool gfx_ctx_menu_init(void)
#ifdef RARCH_CONSOLE
void gfx_ctx_set_filtering(unsigned index, bool set_smooth);
void gfx_ctx_get_available_resolutions (void);
#endif
#endif

View File

@ -508,7 +508,8 @@ int main(int argc, char *argv[])
#endif
#endif
ps3graphics_video_init(true);
video_gl.start();
ps3_input_init();
oskutil_init(&g_console.oskutil_handle, 0);
@ -559,7 +560,9 @@ begin_shutdown:
if(g_console.emulator_initialized)
rarch_main_deinit();
cell_pad_input_deinit();
ps3_video_deinit();
video_gl.stop();
if(g_console.oskutil_handle.is_running)
oskutil_unload(&g_console.oskutil_handle);
#ifdef HAVE_LOGGER

View File

@ -1199,13 +1199,13 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(ps3_check_resolution(CELL_VIDEO_OUT_RESOLUTION_576))
{
//ps3graphics_set_pal60hz(Settings.PS3PALTemporalMode60Hz);
ps3graphics_video_reinit();
video_gl.restart();
}
}
else
{
//ps3graphics_set_pal60hz(0);
ps3graphics_video_reinit();
video_gl.restart();
}
}
break;
@ -1451,7 +1451,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state))
{
g_console.triple_buffering_enable = !g_console.triple_buffering_enable;
ps3graphics_video_reinit();
video_gl.restart();
set_delay = DELAY_MEDIUM;
}
if(CTRL_START(state))
@ -1459,7 +1459,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
if(!g_console.triple_buffering_enable)
{
g_console.triple_buffering_enable = true;
ps3graphics_video_reinit();
video_gl.restart();
}
}
break;

View File

@ -1161,30 +1161,8 @@ static void ps3graphics_set_aspect_ratio(void * data, uint32_t aspectratio_index
set_viewport(gl, gl->win_width, gl->win_height, false, true);
}
const video_driver_t video_gl =
{
.init = gl_init,
.frame = gl_frame,
.alive = gl_alive,
.set_nonblock_state = gl_set_nonblock_state,
.focus = gl_focus,
.free = gl_free,
.ident = "gl",
.set_swap_block_state = ps3graphics_set_swap_block_swap,
.set_rotation = ps3graphics_set_orientation,
.set_aspect_ratio = ps3graphics_set_aspect_ratio,
};
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);
}
void ps3graphics_video_init(bool get_all_resolutions)
#ifdef RARCH_CONSOLE
static void gl_start(void)
{
video_info_t video_info = {0};
@ -1205,31 +1183,57 @@ void ps3graphics_video_init(bool get_all_resolutions)
gfx_ctx_set_fbo(g_console.fbo_enabled);
#endif
if(get_all_resolutions)
get_all_available_resolutions();
gfx_ctx_get_available_resolutions();
CellVideoOutState g_video_state;
cellVideoOutGetState(CELL_VIDEO_OUT_PRIMARY, 0, &g_video_state);
#ifdef HAVE_CG_MENU
gfx_ctx_menu_init();
#endif
}
void ps3graphics_video_reinit(void)
static void gl_stop(void)
{
void *data = driver.video_data;
driver.video_data = NULL;
gl_free(data);
}
static void gl_restart(void)
{
gl_t * gl = driver.video_data;
if(!gl)
return;
ps3_video_deinit();
gl_stop();
gl_cg_invalidate_context();
ps3graphics_video_init(false);
gl_start();
}
void ps3_video_deinit(void)
#endif
const video_driver_t video_gl =
{
void *data = driver.video_data;
driver.video_data = NULL;
gl_free(data);
.init = gl_init,
.frame = gl_frame,
.alive = gl_alive,
.set_nonblock_state = gl_set_nonblock_state,
.focus = gl_focus,
.free = gl_free,
.ident = "gl",
.set_swap_block_state = ps3graphics_set_swap_block_swap,
.set_rotation = ps3graphics_set_orientation,
.set_aspect_ratio = ps3graphics_set_aspect_ratio,
.start = gl_start,
.restart = gl_restart,
.stop = gl_stop,
};
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

@ -38,16 +38,14 @@ enum
const char * ps3_get_resolution_label(uint32_t resolution);
int ps3_check_resolution(uint32_t resolution_id);
void gl_deinit_fbo(gl_t * gl);
void gl_init_fbo(gl_t * gl, unsigned width, unsigned height);
void ps3_previous_resolution (void);
void ps3_next_resolution (void);
void ps3_video_deinit(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);
void ps3graphics_video_init(bool get_all_resolutions);
void ps3graphics_video_reinit(void);
bool gl_cg_reinit(const char *path);
bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info);