(RARCH_CONSOLE) Refactored zip_extract variable
This commit is contained in:
parent
2bd93932e6
commit
ba51ff51f7
|
@ -43,7 +43,7 @@
|
|||
|
||||
static int rarch_zlib_extract_file(unzFile uf,
|
||||
const char *current_dir, char *out_fname,
|
||||
size_t out_fname_size, unsigned unzip_mode)
|
||||
size_t out_fname_size)
|
||||
{
|
||||
char fname_inzip[PATH_MAX];
|
||||
bool is_dir = false;
|
||||
|
@ -68,18 +68,14 @@ static int rarch_zlib_extract_file(unzFile uf,
|
|||
return UNZ_INTERNALERROR;
|
||||
}
|
||||
|
||||
switch(unzip_mode)
|
||||
{
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR:
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
|
||||
fill_pathname_join(out_fname, current_dir, fname_inzip, out_fname_size);
|
||||
break;
|
||||
if ((g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR)) ||
|
||||
(g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE)))
|
||||
fill_pathname_join(out_fname, current_dir, fname_inzip, out_fname_size);
|
||||
#if defined(HAVE_HDD_CACHE_PARTITION) && defined(RARCH_CONSOLE)
|
||||
case ZIP_EXTRACT_TO_CACHE_DIR:
|
||||
fill_pathname_join(out_fname, default_paths.cache_dir, fname_inzip, out_fname_size);
|
||||
break;
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
fill_pathname_join(out_fname, default_paths.cache_dir, fname_inzip, out_fname_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
char slash;
|
||||
#if defined(_WIN32)
|
||||
slash = '\\';
|
||||
|
@ -158,7 +154,7 @@ static int rarch_zlib_extract_file(unzFile uf,
|
|||
}
|
||||
|
||||
int rarch_zlib_extract_archive(const char *zip_path, char *first_file,
|
||||
size_t first_file_size, unsigned unzip_mode)
|
||||
size_t first_file_size)
|
||||
{
|
||||
char dir_path[PATH_MAX];
|
||||
bool found_first_file = false;
|
||||
|
@ -180,7 +176,7 @@ int rarch_zlib_extract_archive(const char *zip_path, char *first_file,
|
|||
{
|
||||
char in_fname[PATH_MAX];
|
||||
|
||||
if (rarch_zlib_extract_file(uf, dir_path, in_fname, sizeof(in_fname), unzip_mode) != UNZ_OK)
|
||||
if (rarch_zlib_extract_file(uf, dir_path, in_fname, sizeof(in_fname)) != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Failed to extract current file from ZIP archive.\n");
|
||||
goto error;
|
||||
|
|
|
@ -17,13 +17,6 @@
|
|||
#ifndef RARCH_ZLIB_H__
|
||||
#define RARCH_ZLIB_H__
|
||||
|
||||
enum
|
||||
{
|
||||
ZIP_EXTRACT_TO_CURRENT_DIR = 0,
|
||||
ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE,
|
||||
ZIP_EXTRACT_TO_CACHE_DIR
|
||||
};
|
||||
|
||||
int rarch_rzlib_extract_archive(const char *zip_path, char *first_file,
|
||||
size_t first_file_size, unsigned extract_zip_mode);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
#else
|
||||
|
||||
void console_load_game(const char *path, unsigned extract_zip_mode)
|
||||
void console_load_game(const char *path)
|
||||
{
|
||||
#ifdef HAVE_ZLIB
|
||||
if ((strstr(path, ".zip") || strstr(path, ".ZIP"))
|
||||
|
@ -111,11 +111,11 @@ void console_load_game(const char *path, unsigned extract_zip_mode)
|
|||
char first_file[PATH_MAX];
|
||||
first_file[0] = '\0';
|
||||
|
||||
rarch_zlib_extract_archive(path, first_file, sizeof(first_file), extract_zip_mode);
|
||||
rarch_zlib_extract_archive(path, first_file, sizeof(first_file));
|
||||
if(g_extern.lifecycle_menu_state & (1 << MODE_INFO_DRAW))
|
||||
rmenu_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180);
|
||||
|
||||
if(g_extern.file_state.zip_extract_mode == ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE)
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
if (first_file[0] != 0)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ static void find_first_libretro_core(char *first_file,
|
|||
size_t size_of_first_file, const char *dir,
|
||||
const char * ext);
|
||||
#else
|
||||
void console_load_game(const char *path, unsigned extract_zip_mode);
|
||||
void console_load_game(const char *path);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
|
|
|
@ -459,18 +459,12 @@ static void render_text(rgui_handle_t *rgui)
|
|||
snprintf(type_str, sizeof(type_str), "%.3f", g_settings.audio.rate_control_delta);
|
||||
break;
|
||||
case RGUI_SETTINGS_ZIP_EXTRACT:
|
||||
switch(g_extern.file_state.zip_extract_mode)
|
||||
{
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR:
|
||||
snprintf(type_str, sizeof(type_str), "Current");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
|
||||
snprintf(type_str, sizeof(type_str), "Current + Load");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CACHE_DIR:
|
||||
snprintf(type_str, sizeof(type_str), "Cache");
|
||||
break;
|
||||
}
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
snprintf(type_str, sizeof(type_str), "Current");
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
snprintf(type_str, sizeof(type_str), "Current + Load");
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
snprintf(type_str, sizeof(type_str), "Cache");
|
||||
break;
|
||||
case RGUI_SETTINGS_SRAM_DIR:
|
||||
snprintf(type_str, sizeof(type_str), g_extern.console.main_wrap.state.default_sram_dir.enable ? "ON" : "OFF");
|
||||
|
@ -735,11 +729,38 @@ static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
|||
break;
|
||||
case RGUI_SETTINGS_ZIP_EXTRACT:
|
||||
if (action == RGUI_ACTION_START)
|
||||
g_extern.file_state.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR;
|
||||
else if (action == RGUI_ACTION_LEFT && g_extern.file_state.zip_extract_mode > 0)
|
||||
g_extern.file_state.zip_extract_mode--;
|
||||
else if (action == RGUI_ACTION_RIGHT && g_extern.file_state.zip_extract_mode < LAST_ZIP_EXTRACT)
|
||||
g_extern.file_state.zip_extract_mode++;
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~((1 << MODE_UNZIP_TO_CURDIR) |
|
||||
(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1 << MODE_UNZIP_TO_CACHEDIR));
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (action == RGUI_ACTION_LEFT)
|
||||
{
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CACHEDIR);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR);
|
||||
}
|
||||
}
|
||||
else if (action == RGUI_ACTION_RIGHT)
|
||||
{
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CACHEDIR);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RGUI_SETTINGS_SRAM_DIR:
|
||||
if (action == RGUI_ACTION_START || action == RGUI_ACTION_LEFT)
|
||||
|
@ -1217,7 +1238,7 @@ int rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
|
|||
else
|
||||
{
|
||||
snprintf(rgui->path_buf, sizeof(rgui->path_buf), "%s/%s", dir, path);
|
||||
console_load_game(rgui->path_buf, g_extern.file_state.zip_extract_mode);
|
||||
console_load_game(rgui->path_buf);
|
||||
rgui->need_refresh = true; // in case of zip extract
|
||||
rgui->msg_force = true;
|
||||
return -1;
|
||||
|
|
|
@ -304,20 +304,20 @@ static void populate_setting_item(void *data, unsigned input)
|
|||
#ifdef HAVE_ZLIB
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
snprintf(current_item->text, sizeof(current_item->text), "ZIP Extract Option");
|
||||
switch(g_extern.file_state.zip_extract_mode)
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
{
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR:
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Current dir");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - ZIP files are extracted to the current dir.");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Current dir and load first file");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - ZIP files are extracted to current dir, and auto-loaded.");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CACHE_DIR:
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Cache dir");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - ZIP files are extracted to the cache dir.");
|
||||
break;
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Current dir");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - ZIP files are extracted to the current dir.");
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 <<MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Current dir and load first file");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - ZIP files are extracted to current dir, and auto-loaded.");
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
{
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Cache dir");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - ZIP files are extracted to the cache dir.");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -1407,16 +1407,37 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
|
|||
case SETTING_ZIP_EXTRACT:
|
||||
if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)))
|
||||
{
|
||||
if(g_extern.file_state.zip_extract_mode > 0)
|
||||
g_extern.file_state.zip_extract_mode--;
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CACHEDIR);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR);
|
||||
}
|
||||
}
|
||||
if((input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B)))
|
||||
{
|
||||
if(g_extern.file_state.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR)
|
||||
g_extern.file_state.zip_extract_mode++;
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CACHEDIR);
|
||||
}
|
||||
}
|
||||
if(input & (1ULL << RMENU_DEVICE_NAV_START))
|
||||
g_extern.file_state.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR;
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~((1 << MODE_UNZIP_TO_CURDIR) |
|
||||
(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1 << MODE_UNZIP_TO_CACHEDIR));
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case SETTING_RARCH_DEFAULT_EMU:
|
||||
|
@ -1830,7 +1851,7 @@ int select_rom(void *data, void *state)
|
|||
rmenu_settings_msg(S_MSG_DIR_LOADING_ERROR, S_DELAY_180);
|
||||
}
|
||||
else
|
||||
console_load_game(filebrowser_get_current_path(filebrowser), g_extern.file_state.zip_extract_mode);
|
||||
console_load_game(filebrowser_get_current_path(filebrowser));
|
||||
}
|
||||
else if (input & (1ULL << RMENU_DEVICE_NAV_L1))
|
||||
{
|
||||
|
|
|
@ -202,20 +202,14 @@ void rmenu_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_extern.file_state.zip_extract_mode)
|
||||
{
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR:
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to current directory.");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted, now loading first file.");
|
||||
break;
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to current directory.");
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted, now loading first file.");
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
case ZIP_EXTRACT_TO_CACHE_DIR:
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to cache partition.");
|
||||
break;
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to cache partition.");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case S_MSG_LOADING_ROM:
|
||||
fill_pathname_base(tmp, g_extern.fullpath, sizeof(tmp));
|
||||
|
@ -287,22 +281,14 @@ void rmenu_settings_create_menu_item_label(char * str, unsigned setting, size_t
|
|||
snprintf(str, size, "Save State #%d", g_extern.state_slot);
|
||||
break;
|
||||
case S_LBL_ZIP_EXTRACT:
|
||||
{
|
||||
char msg[128];
|
||||
switch(g_extern.file_state.zip_extract_mode)
|
||||
{
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR:
|
||||
snprintf(msg, sizeof(msg), "Current dir");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
|
||||
snprintf(msg, sizeof(msg), "Current dir and load first file");
|
||||
break;
|
||||
case ZIP_EXTRACT_TO_CACHE_DIR:
|
||||
snprintf(msg, sizeof(msg), "Cache dir");
|
||||
break;
|
||||
}
|
||||
snprintf(str, size, "ZIP Extract: %s", msg);
|
||||
}
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
snprintf(str, sizeof(size), "INFO - ZIP Extract: Current dir.");
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
snprintf(str, sizeof(size), "INFO - ZIP Extract: Current dir and load first file.");
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
snprintf(str, sizeof(size), "INFO - ZIP Extract: Cache dir.");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,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);
|
||||
console_load_game(path, g_extern.file_state.zip_extract_mode);
|
||||
console_load_game(path);
|
||||
}
|
||||
else if(browser->current_dir.list->elems[index].attr.b)
|
||||
{
|
||||
|
@ -495,10 +495,16 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
|
|||
device_ptr->ctx_driver->set_fbo(FBO_DEINIT);
|
||||
break;
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
if(g_extern.file_state.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR)
|
||||
g_extern.file_state.zip_extract_mode++;
|
||||
else
|
||||
g_extern.file_state.zip_extract_mode = 0;
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CACHEDIR);
|
||||
}
|
||||
rmenu_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer));
|
||||
m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer);
|
||||
break;
|
||||
|
@ -568,8 +574,16 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
|||
}
|
||||
break;
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
if(g_extern.file_state.zip_extract_mode)
|
||||
g_extern.file_state.zip_extract_mode--;
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CACHEDIR);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR);
|
||||
}
|
||||
rmenu_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer));
|
||||
m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer);
|
||||
break;
|
||||
|
@ -643,8 +657,16 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
|||
}
|
||||
break;
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
if(g_extern.file_state.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR)
|
||||
g_extern.file_state.zip_extract_mode++;
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CACHEDIR);
|
||||
}
|
||||
rmenu_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer));
|
||||
m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer);
|
||||
break;
|
||||
|
|
|
@ -369,10 +369,13 @@ static void system_process_args(int argc, char *argv[])
|
|||
if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||
{
|
||||
char rom[PATH_MAX];
|
||||
g_extern.lifecycle_menu_state &= ~((1 << MODE_UNZIP_TO_CURDIR) |
|
||||
(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) | (1 << MODE_UNZIP_TO_CACHEDIR));
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_EXTLAUNCH_CHANNEL);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
snprintf(rom, sizeof(rom), "%s%s", argv[1], argv[2]);
|
||||
g_extern.file_state.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE;
|
||||
console_load_game(rom, g_extern.file_state.zip_extract_mode);
|
||||
|
||||
console_load_game(rom);
|
||||
|
||||
rgui_iterate(rgui, RGUI_ACTION_MESSAGE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);
|
||||
|
|
|
@ -179,7 +179,7 @@ void menu_init (void)
|
|||
|
||||
bool rmenu_iterate(void)
|
||||
{
|
||||
console_load_game("/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes", 0, 0);
|
||||
console_load_game("/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ bool rmenu_iterate(void)
|
|||
char game_rom[256];
|
||||
snprintf(game_rom, sizeof(game_rom), "%s%s", default_paths.port_dir, "dkc.sfc");
|
||||
RARCH_LOG("game ROM: %s\n", game_rom);
|
||||
console_load_game(game_rom, 0);
|
||||
console_load_game(game_rom);
|
||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_INIT);
|
||||
|
||||
|
|
|
@ -127,6 +127,9 @@ enum menu_enums
|
|||
MODE_VIDEO_THROTTLE_ENABLE,
|
||||
MODE_VIDEO_OVERSCAN_ENABLE,
|
||||
MODE_AUDIO_CUSTOM_BGM_ENABLE,
|
||||
MODE_UNZIP_TO_CURDIR,
|
||||
MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE,
|
||||
MODE_UNZIP_TO_CACHEDIR,
|
||||
};
|
||||
|
||||
// All config related settings go here.
|
||||
|
@ -569,9 +572,6 @@ struct global
|
|||
{
|
||||
char cgp_path[PATH_MAX];
|
||||
char input_cfg_path[PATH_MAX];
|
||||
#ifdef HAVE_ZLIB
|
||||
unsigned zip_extract_mode;
|
||||
#endif
|
||||
} file_state;
|
||||
|
||||
// If this is non-NULL. RARCH_LOG and friends will write to this file.
|
||||
|
|
37
settings.c
37
settings.c
|
@ -265,6 +265,7 @@ void config_set_defaults(void)
|
|||
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
|
||||
g_extern.console.main_wrap.state.default_savestate_dir.enable = false;
|
||||
g_extern.console.main_wrap.state.default_sram_dir.enable = false;
|
||||
|
@ -285,9 +286,6 @@ void config_set_defaults(void)
|
|||
#ifdef _XBOX1
|
||||
g_extern.console.sound.volume_level = 0;
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
g_extern.file_state.zip_extract_mode = 0;
|
||||
#endif
|
||||
|
||||
g_extern.block_config_read = true;
|
||||
#endif
|
||||
|
@ -480,6 +478,7 @@ bool config_load_file(const char *path)
|
|||
bool screenshots_enable = false;
|
||||
bool flicker_filter_enable = false;
|
||||
bool soft_filter_enable = false;
|
||||
int zip_extract_mode = 0;
|
||||
|
||||
if (config_get_bool(conf, "info_msg_enable", &msg_enable))
|
||||
{
|
||||
|
@ -545,6 +544,25 @@ bool config_load_file(const char *path)
|
|||
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
||||
}
|
||||
|
||||
if (config_get_int(conf, "unzip_mode", &zip_extract_mode))
|
||||
{
|
||||
g_extern.lifecycle_menu_state &= ~((1 << MODE_UNZIP_TO_CURDIR) |
|
||||
(1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1 << MODE_UNZIP_TO_CACHEDIR));
|
||||
switch(zip_extract_mode)
|
||||
{
|
||||
case 0:
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR);
|
||||
break;
|
||||
case 1:
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
break;
|
||||
case 2:
|
||||
g_extern.lifecycle_menu_state |= (1 << MODE_UNZIP_TO_CACHEDIR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG_GET_BOOL_EXTERN(console.main_wrap.state.default_sram_dir.enable, "sram_dir_enable");
|
||||
CONFIG_GET_BOOL_EXTERN(console.main_wrap.state.default_savestate_dir.enable, "savestate_dir_enable");
|
||||
CONFIG_GET_FLOAT_EXTERN(console.screen.overscan_amount, "overscan_amount");
|
||||
|
@ -552,9 +570,6 @@ bool config_load_file(const char *path)
|
|||
CONFIG_GET_INT_EXTERN(console.screen.soft_filter_index, "soft_filter_index");
|
||||
#ifdef _XBOX1
|
||||
CONFIG_GET_INT_EXTERN(console.sound.volume_level, "sound_volume_level");
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
CONFIG_GET_INT_EXTERN(file_state.zip_extract_mode, "zip_extract_mode");
|
||||
#endif
|
||||
CONFIG_GET_INT_EXTERN(console.screen.resolutions.current.id, "current_resolution_id");
|
||||
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
||||
|
@ -1188,6 +1203,13 @@ bool config_save_file(const char *path)
|
|||
else
|
||||
config_set_bool(conf, "flicker_filter_enable", false);
|
||||
|
||||
if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR))
|
||||
config_set_int(conf, "unzip_mode", 0);
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
config_set_int(conf, "unzip_mode", 1);
|
||||
else if (g_extern.lifecycle_menu_state & (1 << MODE_UNZIP_TO_CACHEDIR))
|
||||
config_set_int(conf, "unzip_mode", 2);
|
||||
|
||||
config_set_int(conf, "flicker_filter_index", g_extern.console.screen.flicker_filter_index);
|
||||
config_set_int(conf, "soft_filter_index", g_extern.console.screen.soft_filter_index);
|
||||
config_set_int(conf, "current_resolution_id", g_extern.console.screen.resolutions.current.id);
|
||||
|
@ -1197,9 +1219,6 @@ bool config_save_file(const char *path)
|
|||
config_set_int(conf, "custom_viewport_y", g_extern.console.screen.viewports.custom_vp.y);
|
||||
config_set_string(conf, "default_rom_startup_dir", g_extern.console.main_wrap.paths.default_rom_startup_dir);
|
||||
config_set_float(conf, "overscan_amount", g_extern.console.screen.overscan_amount);
|
||||
#ifdef HAVE_ZLIB
|
||||
config_set_int(conf, "zip_extract_mode", g_extern.file_state.zip_extract_mode);
|
||||
#endif
|
||||
|
||||
config_set_float(conf, "video_font_size", g_settings.video.font_size);
|
||||
|
||||
|
|
Loading…
Reference in New Issue