g_extern.console.rmenu.mode becomes g_extern.lifecycle_menu_state

This commit is contained in:
twinaphex 2013-01-10 18:04:04 +01:00
parent 6795d74025
commit 7a3b021b17
13 changed files with 45 additions and 43 deletions

View File

@ -73,6 +73,8 @@ enum
MODE_INIT = 1 << 2, MODE_INIT = 1 << 2,
MODE_MENU = 1 << 3, MODE_MENU = 1 << 3,
MODE_EXIT = 1 << 4, MODE_EXIT = 1 << 4,
MODE_LOAD_FIRST_SHADER = 1 << 5,
MODE_LOAD_SECOND_SHADER = 1 << 6,
}; };
enum enum

View File

@ -250,5 +250,5 @@ void rarch_console_load_game_wrap(const char *path, unsigned extract_zip_mode)
snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), path); snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), path);
do_init: do_init:
g_extern.console.rmenu.mode |= (1ULL << MODE_LOAD_GAME); g_extern.lifecycle_menu_state |= (1 << MODE_LOAD_GAME);
} }

View File

@ -52,7 +52,7 @@ void rarch_settings_change(unsigned setting)
break; break;
case S_FRAME_ADVANCE: case S_FRAME_ADVANCE:
g_extern.lifecycle_state |= (1ULL << RARCH_FRAMEADVANCE); g_extern.lifecycle_state |= (1ULL << RARCH_FRAMEADVANCE);
g_extern.console.rmenu.mode = (1ULL << MODE_EMULATION); g_extern.lifecycle_menu_state = (1 << MODE_EMULATION);
break; break;
case S_HW_TEXTURE_FILTER: case S_HW_TEXTURE_FILTER:
g_settings.video.smooth = !g_settings.video.smooth; g_settings.video.smooth = !g_settings.video.smooth;
@ -88,20 +88,20 @@ void rarch_settings_change(unsigned setting)
break; break;
case S_QUIT: case S_QUIT:
g_extern.console.rmenu.state.ingame_menu.enable = false; g_extern.console.rmenu.state.ingame_menu.enable = false;
g_extern.console.rmenu.mode = (1ULL << MODE_EXIT); g_extern.lifecycle_menu_state = (1 << MODE_EXIT);
break; break;
case S_QUIT_RARCH: case S_QUIT_RARCH:
g_extern.console.rmenu.mode = (1ULL << MODE_EXIT); g_extern.lifecycle_menu_state = (1 << MODE_EXIT);
break; break;
case S_RETURN_TO_GAME: case S_RETURN_TO_GAME:
g_extern.console.rmenu.mode = (1ULL << MODE_EMULATION); g_extern.lifecycle_menu_state = (1 << MODE_EMULATION);
break; break;
case S_RETURN_TO_LAUNCHER: case S_RETURN_TO_LAUNCHER:
g_extern.console.external_launch.enable = true; g_extern.console.external_launch.enable = true;
g_extern.console.rmenu.mode = (1ULL << MODE_EXIT); g_extern.lifecycle_menu_state = (1 << MODE_EXIT);
break; break;
case S_RETURN_TO_MENU: case S_RETURN_TO_MENU:
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
break; break;
case S_ROTATION_DECREMENT: case S_ROTATION_DECREMENT:
if(g_extern.console.screen.orientation > 0) if(g_extern.console.screen.orientation > 0)
@ -112,7 +112,7 @@ void rarch_settings_change(unsigned setting)
g_extern.console.screen.orientation++; g_extern.console.screen.orientation++;
break; break;
case S_START_RARCH: case S_START_RARCH:
g_extern.console.rmenu.mode = (1ULL << MODE_INIT); g_extern.lifecycle_menu_state = (1 << MODE_INIT);
break; break;
case S_REWIND: case S_REWIND:
g_settings.rewind_enable = !g_settings.rewind_enable; g_settings.rewind_enable = !g_settings.rewind_enable;

View File

@ -268,7 +268,7 @@ int main(int argc, char *argv[])
system_process_args(argc, argv); system_process_args(argc, argv);
begin_loop: begin_loop:
if(g_extern.console.rmenu.mode & (1ULL << MODE_EMULATION)) if(g_extern.lifecycle_menu_state & (1 << MODE_EMULATION))
{ {
driver.input->poll(NULL); driver.input->poll(NULL);
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx); driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
@ -276,7 +276,7 @@ begin_loop:
while(rarch_main_iterate()); while(rarch_main_iterate());
audio_stop_func(); audio_stop_func();
} }
else if (g_extern.console.rmenu.mode & (1ULL << MODE_INIT)) else if (g_extern.lifecycle_menu_state & (1 << MODE_INIT))
{ {
if(g_extern.main_is_init) if(g_extern.main_is_init)
rarch_main_deinit(); rarch_main_deinit();
@ -295,16 +295,16 @@ begin_loop:
if (init_ret == 0) if (init_ret == 0)
{ {
RARCH_LOG("rarch_main_init succeeded.\n"); RARCH_LOG("rarch_main_init succeeded.\n");
g_extern.console.rmenu.mode = (1ULL << MODE_EMULATION); g_extern.lifecycle_menu_state = (1 << MODE_EMULATION);
} }
else else
{ {
RARCH_ERR("rarch_main_init failed.\n"); RARCH_ERR("rarch_main_init failed.\n");
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
rarch_settings_msg(S_MSG_ROM_LOADING_ERROR, S_DELAY_180); rarch_settings_msg(S_MSG_ROM_LOADING_ERROR, S_DELAY_180);
} }
} }
else if(g_extern.console.rmenu.mode & (1ULL << MODE_MENU)) else if(g_extern.lifecycle_menu_state & (1 << MODE_MENU))
while(rmenu_iterate()); while(rmenu_iterate());
else else
goto begin_shutdown; goto begin_shutdown;

View File

@ -2340,21 +2340,21 @@ void rmenu_input_process(void *data, void *state)
(void)data; (void)data;
rmenu_state_t *rstate = (rmenu_state_t*)state; rmenu_state_t *rstate = (rmenu_state_t*)state;
if (g_extern.console.rmenu.mode & (1ULL << MODE_LOAD_GAME)) if (g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME))
{ {
if(g_extern.console.rmenu.state.msg_info.enable) if(g_extern.console.rmenu.state.msg_info.enable)
rarch_settings_msg(S_MSG_LOADING_ROM, 100); rarch_settings_msg(S_MSG_LOADING_ROM, 100);
g_extern.console.rmenu.mode = (1ULL << MODE_INIT); g_extern.lifecycle_menu_state = (1 << MODE_INIT);
} }
if (!(g_extern.frame_count < g_extern.delay_timer[0])) if (!(g_extern.frame_count < g_extern.delay_timer[0]))
{ {
bool rmenu_enable = (((rstate->old_state & (1ULL << RMENU_DEVICE_NAV_L3)) && (rstate->old_state & (1ULL << RMENU_DEVICE_NAV_R3)) && g_extern.main_is_init)); bool rmenu_enable = (((rstate->old_state & (1ULL << RMENU_DEVICE_NAV_L3)) && (rstate->old_state & (1ULL << RMENU_DEVICE_NAV_R3)) && g_extern.main_is_init));
if (g_extern.console.rmenu.mode & (1ULL << MODE_MENU)) if (g_extern.lifecycle_menu_state & (1 << MODE_MENU))
if (rmenu_enable) if (rmenu_enable)
g_extern.console.rmenu.mode = (1ULL << MODE_EMULATION); g_extern.lifecycle_menu_state = (1 << MODE_EMULATION);
} }
} }
@ -2486,10 +2486,10 @@ bool rmenu_iterate(void)
device_ptr->ctx_driver->set_blend(false); device_ptr->ctx_driver->set_blend(false);
if (quit) if (quit)
g_extern.console.rmenu.mode = (1ULL << MODE_EXIT); g_extern.lifecycle_menu_state = (1 << MODE_EXIT);
if((!(g_extern.console.rmenu.mode & (1ULL << MODE_MENU)) if((!(g_extern.lifecycle_menu_state & (1 << MODE_MENU))
&& !(g_extern.console.rmenu.mode & (1ULL << MODE_LOAD_GAME))) || && !(g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME))) ||
repeat == 0) repeat == 0)
goto deinit; goto deinit;

View File

@ -156,7 +156,7 @@ void menu_init(void)
menu_framebuf, RGUI_WIDTH * sizeof(uint16_t), menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
NULL /* _binary_console_font_bmp_start */, bitmap_bin, folder_cb, NULL); NULL /* _binary_console_font_bmp_start */, bitmap_bin, folder_cb, NULL);
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
rgui_iterate(rgui, RGUI_ACTION_REFRESH); rgui_iterate(rgui, RGUI_ACTION_REFRESH);
} }
@ -235,13 +235,13 @@ bool rmenu_iterate(void)
old_input_state = input_state; old_input_state = input_state;
if (g_extern.console.rmenu.mode & (1ULL << MODE_LOAD_GAME)) if (g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME))
{ {
if(g_extern.console.rmenu.state.msg_info.enable) if(g_extern.console.rmenu.state.msg_info.enable)
rarch_settings_msg(S_MSG_LOADING_ROM, 100); rarch_settings_msg(S_MSG_LOADING_ROM, 100);
if (g_extern.fullpath) if (g_extern.fullpath)
g_extern.console.rmenu.mode = (1ULL << MODE_INIT); g_extern.lifecycle_menu_state = (1 << MODE_INIT);
} }
if (!(g_extern.frame_count < g_extern.delay_timer[0])) if (!(g_extern.frame_count < g_extern.delay_timer[0]))
@ -249,12 +249,12 @@ bool rmenu_iterate(void)
bool rmenu_enable = ((trigger_state & (1ULL << GX_DEVICE_NAV_MENU)) && g_extern.main_is_init); bool rmenu_enable = ((trigger_state & (1ULL << GX_DEVICE_NAV_MENU)) && g_extern.main_is_init);
bool quit_key_pressed = (trigger_state & (1ULL << GX_DEVICE_NAV_QUIT)); bool quit_key_pressed = (trigger_state & (1ULL << GX_DEVICE_NAV_QUIT));
if (g_extern.console.rmenu.mode & (1ULL << MODE_MENU)) if (g_extern.lifecycle_menu_state & (1 << MODE_MENU))
g_extern.console.rmenu.mode = quit_key_pressed ? (1ULL << MODE_EXIT) : rmenu_enable ? (1ULL << MODE_EMULATION) : (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = quit_key_pressed ? (1 << MODE_EXIT) : rmenu_enable ? (1 << MODE_EMULATION) : (1 << MODE_MENU);
} }
if(!(g_extern.console.rmenu.mode & (1ULL << MODE_MENU)) if(!(g_extern.lifecycle_menu_state & (1 << MODE_MENU))
&& !(g_extern.console.rmenu.mode & (1ULL << MODE_LOAD_GAME))) && !(g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME)))
goto deinit; goto deinit;
return true; return true;

View File

@ -1116,7 +1116,7 @@ void menu_init (void)
browser = (filebrowser_t*)filebrowser_init(default_paths.filebrowser_startup_dir, g_extern.system.valid_extensions); browser = (filebrowser_t*)filebrowser_init(default_paths.filebrowser_startup_dir, g_extern.system.valid_extensions);
tmp_browser = (filebrowser_t*)filebrowser_init(default_paths.filebrowser_startup_dir, ""); tmp_browser = (filebrowser_t*)filebrowser_init(default_paths.filebrowser_startup_dir, "");
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
} }
void menu_free (void) void menu_free (void)
@ -1182,13 +1182,13 @@ bool rmenu_iterate(void)
XINPUT_STATE state; XINPUT_STATE state;
XInputGetState(0, &state); XInputGetState(0, &state);
if (g_extern.console.rmenu.mode & (1ULL << MODE_LOAD_GAME)) if (g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME))
{ {
if(g_extern.console.rmenu.state.msg_info.enable) if(g_extern.console.rmenu.state.msg_info.enable)
rarch_settings_msg(S_MSG_LOADING_ROM, 100); rarch_settings_msg(S_MSG_LOADING_ROM, 100);
if (g_extern.fullpath) if (g_extern.fullpath)
g_extern.console.rmenu.mode = (1ULL << MODE_INIT); g_extern.lifecycle_menu_state = (1 << MODE_INIT);
} }
@ -1198,9 +1198,9 @@ bool rmenu_iterate(void)
&& (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) && (g_extern.main_is_init)); && (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) && (g_extern.main_is_init));
if (g_extern.console.rmenu.mode & (1ULL << MODE_MENU)) if (g_extern.lifecycle_menu_state & (1 << MODE_MENU))
if (rmenu_enable) if (rmenu_enable)
g_extern.console.rmenu.mode = (1ULL << MODE_EMULATION); g_extern.lifecycle_menu_state = (1 << MODE_EMULATION);
} }
rarch_render_cached_frame(); rarch_render_cached_frame();
@ -1227,8 +1227,8 @@ bool rmenu_iterate(void)
device_ptr->ctx_driver->swap_buffers(); device_ptr->ctx_driver->swap_buffers();
if(!(g_extern.console.rmenu.mode & (1ULL << MODE_MENU)) if(!(g_extern.lifecycle_menu_state & (1 << MODE_MENU))
&& !(g_extern.console.rmenu.mode & (1ULL << MODE_LOAD_GAME))) && !(g_extern.lifecycle_menu_state & (1 << MODE_LOAD_GAME)))
goto deinit; goto deinit;
return true; return true;

View File

@ -382,7 +382,7 @@ static void system_process_args(int argc, char *argv[])
rarch_render_cached_frame(); rarch_render_cached_frame();
g_extern.draw_menu = false; g_extern.draw_menu = false;
g_extern.console.rmenu.mode = (1ULL << MODE_INIT); g_extern.lifecycle_menu_state = (1 << MODE_INIT);
} }
else else
g_extern.console.external_launch.support = EXTERN_LAUNCHER_SALAMANDER; g_extern.console.external_launch.support = EXTERN_LAUNCHER_SALAMANDER;

View File

@ -387,7 +387,7 @@ static void system_process_args(int argc, char *argv[])
switch(g_extern.console.external_launch.support) switch(g_extern.console.external_launch.support)
{ {
case EXTERN_LAUNCHER_SALAMANDER: case EXTERN_LAUNCHER_SALAMANDER:
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
break; break;
#ifdef HAVE_MULTIMAN #ifdef HAVE_MULTIMAN
case EXTERN_LAUNCHER_MULTIMAN: case EXTERN_LAUNCHER_MULTIMAN:

View File

@ -94,7 +94,7 @@ static int setup_callback(void)
void menu_init (void) void menu_init (void)
{ {
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
} }
bool rmenu_iterate(void) bool rmenu_iterate(void)
@ -103,7 +103,7 @@ bool rmenu_iterate(void)
snprintf(game_rom, sizeof(game_rom), "%s%s", default_paths.port_dir, "dkc.sfc"); snprintf(game_rom, sizeof(game_rom), "%s%s", default_paths.port_dir, "dkc.sfc");
RARCH_LOG("game ROM: %s\n", game_rom); RARCH_LOG("game ROM: %s\n", game_rom);
rarch_console_load_game_wrap(game_rom, 0); rarch_console_load_game_wrap(game_rom, 0);
g_extern.console.rmenu.mode = (1ULL << MODE_INIT); g_extern.lifecycle_menu_state = (1 << MODE_INIT);
return false; return false;
} }

View File

@ -477,7 +477,6 @@ struct global
{ {
struct struct
{ {
unsigned mode;
unsigned input_loop; unsigned input_loop;
float font_size; float font_size;
@ -565,6 +564,7 @@ struct global
bool draw_menu; bool draw_menu;
uint64_t lifecycle_state; uint64_t lifecycle_state;
unsigned lifecycle_menu_state;
struct struct
{ {

View File

@ -2782,7 +2782,7 @@ bool rarch_main_iterate(void)
if (g_extern.system.shutdown) if (g_extern.system.shutdown)
{ {
#ifdef HAVE_RMENU #ifdef HAVE_RMENU
g_extern.console.rmenu.mode = (1ULL << MODE_EXIT); g_extern.lifecycle_menu_state = (1 << MODE_EXIT);
#endif #endif
return false; return false;
} }
@ -2797,7 +2797,7 @@ bool rarch_main_iterate(void)
if (rmenu_enable || (g_extern.console.rmenu.state.ingame_menu.enable && !rmenu_enable)) if (rmenu_enable || (g_extern.console.rmenu.state.ingame_menu.enable && !rmenu_enable))
{ {
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
g_extern.delay_timer[0] = g_extern.frame_count + 30; g_extern.delay_timer[0] = g_extern.frame_count + 30;
} }
#endif #endif
@ -2849,7 +2849,7 @@ bool rarch_main_iterate(void)
{ {
g_extern.lifecycle_state &= ~(1ULL << RARCH_FRAMEADVANCE); g_extern.lifecycle_state &= ~(1ULL << RARCH_FRAMEADVANCE);
g_extern.console.rmenu.state.ingame_menu.enable = true; g_extern.console.rmenu.state.ingame_menu.enable = true;
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
return false; return false;
} }
#endif #endif

View File

@ -294,7 +294,7 @@ void config_set_defaults(void)
g_extern.audio_data.mute = 0; g_extern.audio_data.mute = 0;
g_extern.verbose = true; g_extern.verbose = true;
g_extern.console.rmenu.mode = (1ULL << MODE_MENU); g_extern.lifecycle_menu_state = (1 << MODE_MENU);
g_extern.console.rmenu.font_size = 1.0f; g_extern.console.rmenu.font_size = 1.0f;
g_extern.console.sound.mode = SOUND_MODE_NORMAL; g_extern.console.sound.mode = SOUND_MODE_NORMAL;
g_extern.console.screen.viewports.custom_vp.width = 0; g_extern.console.screen.viewports.custom_vp.width = 0;