(Rzlib) Cleanups to rzlib frontend code

This commit is contained in:
twinaphex 2013-01-07 19:22:35 +01:00
parent 58d3aa8b72
commit 06be0e521d
5 changed files with 18 additions and 22 deletions

View File

@ -34,7 +34,9 @@ void rarch_console_name_from_id(char *name, size_t size);
//We need to set libretro to the first entry in the cores
//directory so that it will be saved to the config file
void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext);
void rarch_manage_libretro_set_first_file(char *first_file,
size_t size_of_first_file, const char *libretro_path,
const char * exe_ext);
#ifndef IS_SALAMANDER

View File

@ -36,28 +36,20 @@ void rarch_console_load_game_wrap(const char *path, unsigned extract_zip_mode, u
{
const char *game_to_load;
char first_file_inzip[PATH_MAX];
char rom_path_temp[PATH_MAX];
char dir_path_temp[PATH_MAX];
struct retro_system_info info;
bool block_zip_extract = false;
bool extract_zip_cond = false;
bool extract_zip_and_load_game_cond = false;
bool load_game = !extract_zip_cond;
retro_get_system_info(&info);
block_zip_extract = info.block_extract;
snprintf(rom_path_temp, sizeof(rom_path_temp), path);
#ifdef HAVE_ZLIB
extract_zip_cond = (strstr(rom_path_temp, ".zip") || strstr(rom_path_temp, ".ZIP"))
&& !block_zip_extract;
extract_zip_cond = (strstr(path, ".zip") || strstr(path, ".ZIP"))
&& !info.block_extract;
if(extract_zip_cond)
{
fill_pathname_basedir(dir_path_temp, rom_path_temp, sizeof(dir_path_temp));
rarch_extract_zipfile(rom_path_temp, dir_path_temp, first_file_inzip, sizeof(first_file_inzip), extract_zip_mode);
rarch_extract_zipfile(path, first_file_inzip, sizeof(first_file_inzip), extract_zip_mode);
if(g_extern.console.rmenu.state.msg_info.enable)
rarch_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180);
}

View File

@ -138,10 +138,14 @@ static int rarch_extract_currentfile_in_zip(unzFile uf, const char *current_dir,
return ret;
}
int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *first_file, size_t first_file_size, unsigned extract_zip_mode)
int rarch_extract_zipfile(const char *zip_path, char *first_file, size_t first_file_size, unsigned extract_zip_mode)
{
char dir_path[PATH_MAX];
bool found_first_file = false;
(void)found_first_file;
fill_pathname_basedir(dir_path, zip_path, sizeof(dir_path));
unzFile uf = unzOpen(zip_path);
unz_global_info gi;
@ -160,14 +164,14 @@ int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *f
#else
snprintf(slash, sizeof(slash), "/");
#endif
if (rarch_extract_currentfile_in_zip(uf, current_dir, slash, write_filename, sizeof(write_filename), extract_zip_mode) != UNZ_OK)
if (rarch_extract_currentfile_in_zip(uf, dir_path, slash, write_filename, sizeof(write_filename), extract_zip_mode) != UNZ_OK)
{
RARCH_ERR("Failed to extract current file from ZIP archive.\n");
break;
}
#ifdef HAVE_LIBRETRO_MANAGEMENT
else
{
#ifdef HAVE_LIBRETRO_MANAGEMENT
if(!found_first_file)
{
found_first_file = rarch_manage_libretro_extension_supported(write_filename);
@ -175,8 +179,8 @@ int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *f
if(found_first_file)
snprintf(first_file, first_file_size, write_filename);
}
#endif
}
#endif
if ((i + 1) < gi.number_entry)
{

View File

@ -28,6 +28,6 @@ enum
ZIP_EXTRACT_TO_CACHE_DIR
};
int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *first_file, size_t first_file_size, unsigned extract_zip_mode);
int rarch_extract_zipfile(const char *zip_path, char *first_file, size_t first_file_size, unsigned extract_zip_mode);
#endif

View File

@ -399,17 +399,15 @@ begin_shutdown:
#if defined(HAVE_SYSMODULES)
/* Freetype font PRX */
#ifdef HAVE_FREETYPE
/* Freetype font PRX */
cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT);
cellSysmoduleUnloadModule(CELL_SYSMODULE_FREETYPE);
cellSysmoduleUnloadModule(CELL_SYSMODULE_FONT);
#endif
/* screenshot PRX */
#ifndef __PSL1GHT__
/* screenshot PRX */
if(g_extern.console.screen.state.screenshots.enable)
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
#endif
@ -417,8 +415,8 @@ begin_shutdown:
cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC);
cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC);
/* system game utility PRX */
#ifndef __PSL1GHT__
/* system game utility PRX */
cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT);
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
#endif