Move zip_extract_mode from g_console to g_extern.filebrowser_state

This commit is contained in:
twinaphex 2012-10-14 20:45:30 +02:00
parent dee990b267
commit f4b197784c
8 changed files with 34 additions and 30 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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;