From fabceb0e84facfd4d55464b24335e1e763e2329f Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Sat, 21 Jan 2012 17:24:25 +0100 Subject: [PATCH 1/3] (PS3) Rewind can be set now --- ps3/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ps3/main.c b/ps3/main.c index 48b8fe763f..63370193b3 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -496,6 +496,9 @@ int main(int argc, char *argv[]) memset(&g_settings, 0, sizeof(g_settings)); memset(&g_console, 0, sizeof(g_console)); + g_console.block_config_read = true; + config_set_defaults(); + SSNES_LOG("Registering Callback\n"); cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); From 3695cf78b9ed609c3c6a1bd38bc9db880b961a72 Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Sat, 21 Jan 2012 17:50:21 +0100 Subject: [PATCH 2/3] (PS3) Swap is blocked before going into ingame menu - and unblocked after exiting ingame menu --- ps3/main.c | 4 ++++ ps3/ps3_video_psgl.c | 18 +++++++++++++++++- ps3/ps3_video_psgl.h | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ps3/main.c b/ps3/main.c index 63370193b3..01e1966dc9 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -225,6 +225,8 @@ static void ingame_menu(void) uint32_t menuitem_colors[MENU_ITEM_LAST]; char comment[256], msg_temp[256]; + ps3_block_swap(); + do { uint64_t state = cell_pad_input_poll_device(0); @@ -481,6 +483,8 @@ static void ingame_menu(void) old_state = state; cellSysutilCheckCallback(); }while(g_console.in_game_menu); + + ps3_unblock_swap(); } // Temporary, a more sane implementation should go here. diff --git a/ps3/ps3_video_psgl.c b/ps3/ps3_video_psgl.c index 4c7244ee99..c5a4173dbc 100644 --- a/ps3/ps3_video_psgl.c +++ b/ps3/ps3_video_psgl.c @@ -93,6 +93,7 @@ typedef struct gl PSGLdevice* gl_device; PSGLcontext* gl_context; bool vsync; + bool block_swap; GLuint texture[TEXTURES]; unsigned tex_index; // For use with PREV. struct gl_tex_info prev_info[TEXTURES]; @@ -723,7 +724,8 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei cellDbgFontDraw(); } - psglSwap(); + if(!gl->block_swap) + psglSwap(); return true; } @@ -1094,6 +1096,20 @@ const char * ps3_get_resolution_label(uint32_t resolution) } } +void ps3_block_swap (void) +{ + gl_t *gl = g_gl; + gl->block_swap = true; + SSNES_LOG("Swap is set to blocked\n"); +} + +void ps3_unblock_swap (void) +{ + gl_t *gl = g_gl; + gl->block_swap = false; + SSNES_LOG("Swap is set to non-blocked\n"); +} + // PS3 needs a working graphics stack before SSNES even starts. // To deal with this main.c, // the top level module owns the instance, and is created beforehand. diff --git a/ps3/ps3_video_psgl.h b/ps3/ps3_video_psgl.h index 855aa191d2..7f9a2c9cc6 100644 --- a/ps3/ps3_video_psgl.h +++ b/ps3/ps3_video_psgl.h @@ -31,6 +31,8 @@ void ps3_next_resolution (void); void ps3_previous_resolution (void); const char * ps3_get_resolution_label(uint32_t resolution); int ps3_check_resolution(uint32_t resolution_id); +void ps3_block_swap (void); +void ps3_unblock_swap (void); extern void *g_gl; From d55c86bc4158fcbb890d097d319e6d93a50777a7 Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Sat, 21 Jan 2012 18:00:07 +0100 Subject: [PATCH 3/3] (PS3) Use ssnes_main_clear_state() --- ps3/main.c | 5 +---- ssnes.c | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ps3/main.c b/ps3/main.c index 01e1966dc9..cf23d40920 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -487,7 +487,6 @@ static void ingame_menu(void) ps3_unblock_swap(); } -// Temporary, a more sane implementation should go here. int main(int argc, char *argv[]) { // Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL @@ -496,9 +495,7 @@ int main(int argc, char *argv[]) cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME); - memset(&g_extern, 0, sizeof(g_extern)); - memset(&g_settings, 0, sizeof(g_settings)); - memset(&g_console, 0, sizeof(g_console)); + ssnes_main_clear_state(); g_console.block_config_read = true; config_set_defaults(); diff --git a/ssnes.c b/ssnes.c index fffe7885a8..38ac01ef74 100644 --- a/ssnes.c +++ b/ssnes.c @@ -2058,6 +2058,9 @@ void ssnes_main_clear_state(void) { memset(&g_settings, 0, sizeof(g_settings)); memset(&g_extern, 0, sizeof(g_extern)); +#ifdef SSNES_CONSOLE + memset(&g_console, 0, sizeof(g_console)); +#endif init_state(); }