(PS3) Moved some setting variables to g_console

This commit is contained in:
TwinAphex51224 2012-02-02 16:59:06 +01:00
parent 3eaa942e58
commit 09a6566be0
5 changed files with 26 additions and 27 deletions

View File

@ -174,6 +174,7 @@ struct console_settings
bool default_sram_dir_enable; bool default_sram_dir_enable;
bool default_savestate_dir_enable; bool default_savestate_dir_enable;
bool ingame_menu_enable; bool ingame_menu_enable;
bool menu_enable;
bool return_to_multiman_enable; bool return_to_multiman_enable;
bool screenshots_enable; bool screenshots_enable;
bool throttle_enable; bool throttle_enable;
@ -183,6 +184,7 @@ struct console_settings
uint32_t current_resolution_index; uint32_t current_resolution_index;
uint32_t current_resolution_id; uint32_t current_resolution_id;
uint32_t initial_resolution_id; uint32_t initial_resolution_id;
uint32_t mode_switch;
uint32_t *supported_resolutions; uint32_t *supported_resolutions;
uint32_t supported_resolutions_count; uint32_t supported_resolutions_count;
char rom_path[PATH_MAX]; char rom_path[PATH_MAX];

View File

@ -49,7 +49,6 @@ uint32_t g_emulator_initialized = 0;
char special_action_msg[256]; /* message which should be overlaid on top of the screen*/ char special_action_msg[256]; /* message which should be overlaid on top of the screen*/
uint32_t special_action_msg_expired; /* time at which the message no longer needs to be overlaid onscreen*/ uint32_t special_action_msg_expired; /* time at which the message no longer needs to be overlaid onscreen*/
uint32_t mode_switch = MODE_MENU;
bool init_ssnes = false; bool init_ssnes = false;
uint64_t ingame_menu_item = 0; uint64_t ingame_menu_item = 0;
@ -331,10 +330,10 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
switch (status) switch (status)
{ {
case CELL_SYSUTIL_REQUEST_EXITGAME: case CELL_SYSUTIL_REQUEST_EXITGAME:
menu_is_running = 0; g_console.menu_enable = false;
g_quitting = true; g_quitting = true;
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
mode_switch = MODE_EXIT; g_console.mode_switch = MODE_EXIT;
if(g_emulator_initialized) if(g_emulator_initialized)
ssnes_main_deinit(); ssnes_main_deinit();
break; break;
@ -376,7 +375,7 @@ static void ingame_menu(void)
frame_advance_disabled = true; frame_advance_disabled = true;
ingame_menu_item = 0; ingame_menu_item = 0;
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
} }
switch(ingame_menu_item) switch(ingame_menu_item)
@ -397,7 +396,7 @@ static void ingame_menu(void)
ingame_menu_item = 0; ingame_menu_item = 0;
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
} }
if(CTRL_LEFT(button_was_pressed) || CTRL_LSTICK_LEFT(button_was_pressed)) if(CTRL_LEFT(button_was_pressed) || CTRL_LSTICK_LEFT(button_was_pressed))
{ {
@ -434,7 +433,7 @@ static void ingame_menu(void)
msg_queue_push(g_extern.msg_queue, msg, 1, 180); msg_queue_push(g_extern.msg_queue, msg, 1, 180);
ingame_menu_item = 0; ingame_menu_item = 0;
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
} }
if(CTRL_LEFT(button_was_pressed) || CTRL_LSTICK_LEFT(button_was_pressed)) if(CTRL_LEFT(button_was_pressed) || CTRL_LSTICK_LEFT(button_was_pressed))
{ {
@ -530,7 +529,7 @@ static void ingame_menu(void)
frame_advance_disabled = false; frame_advance_disabled = false;
ingame_menu_item = MENU_ITEM_FRAME_ADVANCE; ingame_menu_item = MENU_ITEM_FRAME_ADVANCE;
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
} }
ingame_menu_reset_entry_colors (ingame_menu_item); ingame_menu_reset_entry_colors (ingame_menu_item);
strcpy(comment, "Press 'CROSS', 'L2' or 'R2' button to step one frame.\nNOTE: Pressing the button rapidly will advance the frame more slowly\nand prevent buttons from being input."); strcpy(comment, "Press 'CROSS', 'L2' or 'R2' button to step one frame.\nNOTE: Pressing the button rapidly will advance the frame more slowly\nand prevent buttons from being input.");
@ -556,7 +555,7 @@ static void ingame_menu(void)
frame_advance_disabled = true; frame_advance_disabled = true;
ingame_menu_item = 0; ingame_menu_item = 0;
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
} }
ingame_menu_reset_entry_colors (ingame_menu_item); ingame_menu_reset_entry_colors (ingame_menu_item);
strcpy(comment, "Press 'CROSS' to return back to the game."); strcpy(comment, "Press 'CROSS' to return back to the game.");
@ -566,7 +565,7 @@ static void ingame_menu(void)
{ {
ingame_menu_item = 0; ingame_menu_item = 0;
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
perform_reset(); perform_reset();
} }
ingame_menu_reset_entry_colors (ingame_menu_item); ingame_menu_reset_entry_colors (ingame_menu_item);
@ -577,8 +576,8 @@ static void ingame_menu(void)
{ {
ingame_menu_item = 0; ingame_menu_item = 0;
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
menu_is_running = 0; g_console.menu_enable = false;
mode_switch = MODE_MENU; g_console.mode_switch = MODE_MENU;
} }
ingame_menu_reset_entry_colors (ingame_menu_item); ingame_menu_reset_entry_colors (ingame_menu_item);
@ -589,7 +588,7 @@ static void ingame_menu(void)
if(CTRL_CROSS(button_was_pressed)) if(CTRL_CROSS(button_was_pressed))
{ {
g_console.ingame_menu_enable = false; g_console.ingame_menu_enable = false;
mode_switch = MODE_EXIT; g_console.mode_switch = MODE_EXIT;
} }
ingame_menu_reset_entry_colors (ingame_menu_item); ingame_menu_reset_entry_colors (ingame_menu_item);
@ -603,7 +602,7 @@ static void ingame_menu(void)
#ifdef MULTIMAN_SUPPORT #ifdef MULTIMAN_SUPPORT
return_to_MM = false; return_to_MM = false;
#endif #endif
mode_switch = MODE_EXIT; g_console.mode_switch = MODE_EXIT;
} }
ingame_menu_reset_entry_colors (ingame_menu_item); ingame_menu_reset_entry_colors (ingame_menu_item);
@ -765,9 +764,10 @@ int main(int argc, char *argv[])
ps3_input_init(); ps3_input_init();
menu_init(); menu_init();
g_console.mode_switch = MODE_MENU;
begin_loop: begin_loop:
if(mode_switch == MODE_EMULATION) if(g_console.mode_switch == MODE_EMULATION)
{ {
bool repeat = false; bool repeat = false;
if(ingame_menu_item != 0) if(ingame_menu_item != 0)
@ -784,7 +784,7 @@ begin_loop:
if(g_console.ingame_menu_enable) if(g_console.ingame_menu_enable)
ingame_menu(); ingame_menu();
} }
else if(mode_switch == MODE_MENU) else if(g_console.mode_switch == MODE_MENU)
{ {
menu_loop(); menu_loop();
if(init_ssnes) if(init_ssnes)
@ -806,7 +806,7 @@ begin_loop:
} }
} }
#ifdef MULTIMAN_SUPPORT #ifdef MULTIMAN_SUPPORT
else if(mode_switch == MODE_MULTIMAN_STARTUP) else if(g_console.mode_switch == MODE_MULTIMAN_STARTUP)
{ {
} }
#endif #endif

View File

@ -43,7 +43,6 @@
menu menuStack[25]; menu menuStack[25];
int menuStackindex = 0; int menuStackindex = 0;
uint32_t menu_is_running = false; /* is the menu running?*/
static bool set_initial_dir_tmpbrowser; static bool set_initial_dir_tmpbrowser;
filebrowser_t browser; /* main file browser->for rom browser*/ filebrowser_t browser; /* main file browser->for rom browser*/
filebrowser_t tmpBrowser; /* tmp file browser->for everything else*/ filebrowser_t tmpBrowser; /* tmp file browser->for everything else*/
@ -282,8 +281,8 @@ static void browser_update(filebrowser_t * b)
/* if a rom is loaded then resume it */ /* if a rom is loaded then resume it */
if (g_emulator_initialized) if (g_emulator_initialized)
{ {
menu_is_running = 0; g_console.menu_enable = false;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
set_text_message("", 15); set_text_message("", 15);
} }
} }
@ -1477,8 +1476,8 @@ static void select_setting(menu * menu_obj)
{ {
if (g_emulator_initialized) if (g_emulator_initialized)
{ {
menu_is_running = 0; g_console.menu_enable = false;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
set_text_message("", 15); set_text_message("", 15);
} }
old_state = state; old_state = state;
@ -1556,10 +1555,10 @@ static void select_rom(void)
snprintf(rom_path_temp, sizeof(rom_path_temp), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); snprintf(rom_path_temp, sizeof(rom_path_temp), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser));
menu_is_running = 0; g_console.menu_enable = false;
snprintf(g_console.rom_path, sizeof(g_console.rom_path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); snprintf(g_console.rom_path, sizeof(g_console.rom_path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser));
init_ssnes = 1; init_ssnes = 1;
mode_switch = MODE_EMULATION; g_console.mode_switch = MODE_EMULATION;
old_state = state; old_state = state;
return; return;
@ -1603,7 +1602,7 @@ void menu_loop(void)
menuStack[0] = menu_filebrowser; menuStack[0] = menu_filebrowser;
menuStack[0].enum_id = FILE_BROWSER_MENU; menuStack[0].enum_id = FILE_BROWSER_MENU;
menu_is_running = true; g_console.menu_enable = true;
menu_reinit_settings(); menu_reinit_settings();
ssnes_render_cached_frame(); ssnes_render_cached_frame();
@ -1645,5 +1644,5 @@ void menu_loop(void)
psglSwap(); psglSwap();
cell_console_poll(); cell_console_poll();
cellSysutilCheckCallback(); cellSysutilCheckCallback();
}while (menu_is_running); }while (g_console.menu_enable);
} }

View File

@ -167,5 +167,4 @@ enum
void menu_init (void); void menu_init (void);
void menu_loop (void); void menu_loop (void);
extern uint32_t menu_is_running;
#endif /* MENU_H_ */ #endif /* MENU_H_ */

View File

@ -59,7 +59,6 @@ enum {
extern char special_action_msg[256]; extern char special_action_msg[256];
extern uint32_t g_emulator_initialized; extern uint32_t g_emulator_initialized;
extern uint32_t special_action_msg_expired; extern uint32_t special_action_msg_expired;
extern uint32_t mode_switch;
extern unsigned g_frame_count; extern unsigned g_frame_count;
extern bool init_ssnes; extern bool init_ssnes;
extern bool g_quitting; extern bool g_quitting;