diff --git a/360/frontend-xdk/menu.cpp b/360/frontend-xdk/menu.cpp index cc33824868..5072b153ac 100644 --- a/360/frontend-xdk/menu.cpp +++ b/360/frontend-xdk/menu.cpp @@ -179,7 +179,7 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle if(path_file_exists(browser->current_dir.list->elems[index].data)) { snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(browser), str_buffer); - rarch_console_load_game_wrap(path, g_console.zip_extract_mode, S_DELAY_45); + rarch_console_load_game_wrap(path, g_extern.filebrowser_state.zip_extract_mode, S_DELAY_45); } else if(browser->current_dir.list->elems[index].attr.b) { @@ -477,10 +477,10 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled context->set_fbo_enable(g_console.fbo_enabled); break; case SETTING_ZIP_EXTRACT: - if(g_console.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR) - g_console.zip_extract_mode++; + if(g_extern.filebrowser_state.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR) + g_extern.filebrowser_state.zip_extract_mode++; else - g_console.zip_extract_mode = 0; + g_extern.filebrowser_state.zip_extract_mode = 0; rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer); break; @@ -543,8 +543,8 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro } break; case SETTING_ZIP_EXTRACT: - if(g_console.zip_extract_mode) - g_console.zip_extract_mode--; + if(g_extern.filebrowser_state.zip_extract_mode) + g_extern.filebrowser_state.zip_extract_mode--; rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer); break; @@ -608,8 +608,8 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro } break; case SETTING_ZIP_EXTRACT: - if(g_console.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR) - g_console.zip_extract_mode++; + if(g_extern.filebrowser_state.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR) + g_extern.filebrowser_state.zip_extract_mode++; rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer); break; @@ -1160,7 +1160,7 @@ void menu_loop(void) && (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) && (g_console.emulator_initialized) && IS_TIMER_EXPIRED(d3d)); - g_console.mode_switch = g_console.menu_enable ? MODE_MENU : MODE_EMULATION; + g_extern.console.mode = g_console.menu_enable ? MODE_MENU : MODE_EMULATION; switch(g_console.input_loop) { @@ -1188,7 +1188,7 @@ void menu_loop(void) hr = app.Render(); /* Render XUI */ hr = XuiTimersRun(); /* Update XUI timers */ - if(g_console.mode_switch == MODE_EMULATION && !g_console.frame_advance_enable) + if(g_extern.console.mode == MODE_EMULATION && !g_console.frame_advance_enable) { SET_TIMER_EXPIRATION(d3d, 30); } diff --git a/console/rarch_console_config.c b/console/rarch_console_config.c index e4cbeaa848..9aa51d113f 100644 --- a/console/rarch_console_config.c +++ b/console/rarch_console_config.c @@ -97,7 +97,7 @@ void rarch_config_load(const char *conf_name, bool upgrade_core_succeeded) CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation"); CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode"); #ifdef HAVE_ZLIB - CONFIG_GET_INT_CONSOLE(zip_extract_mode, "zip_extract_mode"); + CONFIG_GET_INT_EXTERN(filebrowser_state.zip_extract_mode, "zip_extract_mode"); #endif #ifdef _XBOX360 CONFIG_GET_INT_CONSOLE(color_format, "color_format"); @@ -195,7 +195,7 @@ void rarch_config_save(const char * conf_name) config_set_float(conf, "menu_font_size", g_extern.console.font_size); config_set_float(conf, "overscan_amount", g_console.overscan_amount); #ifdef HAVE_ZLIB - config_set_int(conf, "zip_extract_mode", g_console.zip_extract_mode); + config_set_int(conf, "zip_extract_mode", g_extern.filebrowser_state.zip_extract_mode); #endif #endif diff --git a/console/rarch_console_rom_ext.c b/console/rarch_console_rom_ext.c index ba98b2a356..4e18a98c62 100644 --- a/console/rarch_console_rom_ext.c +++ b/console/rarch_console_rom_ext.c @@ -73,7 +73,7 @@ void rarch_console_load_game_wrap(const char *path, unsigned extract_zip_mode, u } extract_zip_and_load_game_cond = (extract_zip_cond && - g_console.zip_extract_mode == ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE); + g_extern.filebrowser_state.zip_extract_mode == ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE); load_game = (extract_zip_and_load_game_cond) || (!extract_zip_cond); if(extract_zip_and_load_game_cond) diff --git a/console/rarch_console_settings.c b/console/rarch_console_settings.c index 3be7e9b7c2..22d8c68af7 100644 --- a/console/rarch_console_settings.c +++ b/console/rarch_console_settings.c @@ -227,7 +227,7 @@ void rarch_settings_msg(unsigned setting, unsigned delay) snprintf(str, sizeof(str), "INFO - Press LEFT/RIGHT to change the controls, and press\n[RetroPad Start] to reset a button to default values."); break; case S_MSG_EXTRACTED_ZIPFILE: - switch(g_console.zip_extract_mode) + switch(g_extern.filebrowser_state.zip_extract_mode) { case ZIP_EXTRACT_TO_CURRENT_DIR: snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to current directory."); @@ -314,7 +314,7 @@ void rarch_settings_create_menu_item_label(char * str, unsigned setting, size_t case S_LBL_ZIP_EXTRACT: { char msg[128]; - switch(g_console.zip_extract_mode) + switch(g_extern.filebrowser_state.zip_extract_mode) { case ZIP_EXTRACT_TO_CURRENT_DIR: snprintf(msg, sizeof(msg), "Current dir"); @@ -417,7 +417,7 @@ void rarch_settings_set_default(void) #endif g_console.soft_display_filter_enable = true; #ifdef HAVE_ZLIB - g_console.zip_extract_mode = 0; + g_extern.filebrowser_state.zip_extract_mode = 0; #endif // g_extern diff --git a/console/rmenu/rmenu.c b/console/rmenu/rmenu.c index d4e4de9222..8bb6d2a283 100644 --- a/console/rmenu/rmenu.c +++ b/console/rmenu/rmenu.c @@ -322,9 +322,10 @@ static void populate_setting_item(unsigned i, item *current_item) else snprintf(current_item->comment, sizeof(current_item->comment), "INFO - [Rewind] feature is set to 'OFF'."); break; +#ifdef HAVE_ZLIB case SETTING_ZIP_EXTRACT: snprintf(current_item->text, sizeof(current_item->text), "ZIP Extract Option"); - switch(g_console.zip_extract_mode) + switch(g_extern.filebrowser_state.zip_extract_mode) { case ZIP_EXTRACT_TO_CURRENT_DIR: snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Current dir"); @@ -340,6 +341,7 @@ static void populate_setting_item(unsigned i, item *current_item) break; } break; +#endif case SETTING_RARCH_DEFAULT_EMU: snprintf(current_item->text, sizeof(current_item->text), "Default libretro core"); fill_pathname_base(fname, g_settings.libretro, sizeof(fname)); @@ -1275,22 +1277,22 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_ if(input & (1 << RMENU_DEVICE_NAV_START)) g_settings.rewind_enable = false; break; +#ifdef HAVE_ZLIB case SETTING_ZIP_EXTRACT: if((input & (1 << RMENU_DEVICE_NAV_LEFT))) { - if(g_console.zip_extract_mode > 0) - g_console.zip_extract_mode--; + if(g_extern.filebrowser_state.zip_extract_mode > 0) + g_extern.filebrowser_state.zip_extract_mode--; } if((input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B))) { - if(g_console.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR) - g_console.zip_extract_mode++; + if(g_extern.filebrowser_state.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR) + g_extern.filebrowser_state.zip_extract_mode++; } if(input & (1 << RMENU_DEVICE_NAV_START)) - { - g_console.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR; - } + g_extern.filebrowser_state.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR; break; +#endif case SETTING_RARCH_DEFAULT_EMU: if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B))) { @@ -1698,7 +1700,7 @@ static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_ac if(filebrowser_get_current_path_isdir(filebrowser)) ret = filebrowser_iterate(filebrowser, FILEBROWSER_ACTION_OK); else - rarch_console_load_game_wrap(filebrowser_get_current_path(filebrowser), g_console.zip_extract_mode, S_DELAY_45); + rarch_console_load_game_wrap(filebrowser_get_current_path(filebrowser), g_extern.filebrowser_state.zip_extract_mode, S_DELAY_45); break; case MENU_ROMSELECT_ACTION_GOTO_SETTINGS: menu_stack_push(GENERAL_VIDEO_MENU); diff --git a/console/rmenu/rmenu.h b/console/rmenu/rmenu.h index fac35a210f..8935791700 100644 --- a/console/rmenu/rmenu.h +++ b/console/rmenu/rmenu.h @@ -167,7 +167,9 @@ enum SETTING_EMU_CURRENT_SAVE_STATE_SLOT, SETTING_EMU_SHOW_DEBUG_INFO_MSG, SETTING_EMU_SHOW_INFO_MSG, +#ifdef HAVE_ZLIB SETTING_ZIP_EXTRACT, +#endif SETTING_RARCH_DEFAULT_EMU, SETTING_QUIT_RARCH, SETTING_EMU_DEFAULT_ALL, diff --git a/general.h b/general.h index 2cd85afa35..aa4121122e 100644 --- a/general.h +++ b/general.h @@ -239,9 +239,6 @@ struct console_settings unsigned control_timer_expiration_frame_count; unsigned timer_expiration_frame_count; unsigned input_loop; -#ifdef HAVE_ZLIB - unsigned zip_extract_mode; -#endif #ifdef _XBOX unsigned color_format; DWORD volume_device_type; @@ -484,6 +481,9 @@ struct global struct { char rom_path[PATH_MAX]; +#ifdef HAVE_ZLIB + unsigned zip_extract_mode; +#endif } filebrowser_state; #ifdef HAVE_XML diff --git a/gx/frontend/main.c b/gx/frontend/main.c index 6506063390..f17fdd5dad 100644 --- a/gx/frontend/main.c +++ b/gx/frontend/main.c @@ -550,8 +550,8 @@ int main(int argc, char *argv[]) char rom[PATH_MAX]; g_console.external_launcher_support = EXTERN_LAUNCHER_CHANNEL; snprintf(rom, sizeof(rom), "%s%s", argv[1], argv[2]); - g_console.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE; - rarch_console_load_game_wrap(rom, g_console.zip_extract_mode, S_DELAY_1); + g_extern.filebrowser_state.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE; + rarch_console_load_game_wrap(rom, g_extern.filebrowser_state.zip_extract_mode, S_DELAY_1); rgui_iterate(rgui, RGUI_ACTION_MESSAGE); gx->menu_render = true;