mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 18:20:27 +00:00
(RARCH_CONSOLE) Use new unzip code and remove console-centric
stuff
This commit is contained in:
parent
84e48fd3ed
commit
8efc01b321
@ -47,7 +47,6 @@ CONSOLE EXTENSIONS
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "../rarch_zlib.c"
|
||||
#include "../../file_extract.c"
|
||||
#endif
|
||||
|
||||
|
@ -1,227 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2013 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "../compat/posix_string.h"
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "../general.h"
|
||||
#include "../file.h"
|
||||
|
||||
#include "rarch_zlib.h"
|
||||
|
||||
#ifdef WANT_RZLIB
|
||||
#include "../deps/rzlib/zlib.h"
|
||||
#else
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_HDD_CACHE_PARTITION)
|
||||
#include "rarch_console.h"
|
||||
#endif
|
||||
|
||||
#define WRITEBUFFERSIZE (1024 * 512)
|
||||
|
||||
static int rarch_zlib_extract_file(unzFile uf,
|
||||
const char *current_dir, char *out_fname,
|
||||
size_t out_fname_size)
|
||||
{
|
||||
char fname_inzip[PATH_MAX];
|
||||
bool is_dir = false;
|
||||
FILE *fp = NULL;
|
||||
|
||||
unz_file_info file_info;
|
||||
int ret = unzGetCurrentFileInfo(uf, &file_info, fname_inzip,
|
||||
sizeof(fname_inzip), NULL, 0, NULL, 0);
|
||||
|
||||
if (ret != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Error %d while trying to get ZIP file information.\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t size_buf = WRITEBUFFERSIZE;
|
||||
void *buf = malloc(size_buf);
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
RARCH_ERR("Error allocating memory for ZIP extract operation.\n");
|
||||
return UNZ_INTERNALERROR;
|
||||
}
|
||||
|
||||
if ((g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR)) ||
|
||||
(g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE)) ||
|
||||
(g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN))
|
||||
)
|
||||
fill_pathname_join(out_fname, current_dir, fname_inzip, out_fname_size);
|
||||
#if defined(HAVE_HDD_CACHE_PARTITION) && defined(RARCH_CONSOLE)
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << 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 = '\\';
|
||||
#else
|
||||
slash = '/';
|
||||
#endif
|
||||
|
||||
if (fname_inzip[strlen(fname_inzip) - 1] == slash)
|
||||
is_dir = true;
|
||||
|
||||
ret = unzOpenCurrentFile(uf);
|
||||
|
||||
if (ret != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to open ZIP file.\n", ret);
|
||||
else
|
||||
{
|
||||
/* success */
|
||||
if (is_dir)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_mkdir(out_fname);
|
||||
#else
|
||||
mkdir(out_fname, S_IRWXU | S_IRWXG | S_IRWXO | S_IFDIR);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
fp = fopen(out_fname, "wb");
|
||||
|
||||
if (!fp)
|
||||
RARCH_ERR("Error opening %s.\n", out_fname);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dir || fp)
|
||||
{
|
||||
RARCH_LOG("Extracting: %s..\n", out_fname);
|
||||
|
||||
do
|
||||
{
|
||||
ret = unzReadCurrentFile(uf, buf, size_buf);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
RARCH_ERR("Error %d while reading from ZIP file.\n", ret);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret > 0 && !is_dir)
|
||||
{
|
||||
if (fwrite(buf, ret, 1, fp) != 1)
|
||||
{
|
||||
RARCH_ERR("Error while extracting file(s) from ZIP.\n");
|
||||
ret = UNZ_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}while (ret > 0);
|
||||
|
||||
if (!is_dir && fp)
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
if (ret == UNZ_OK)
|
||||
{
|
||||
ret = unzCloseCurrentFile (uf);
|
||||
|
||||
if (ret != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to close ZIP file.\n", ret);
|
||||
}
|
||||
else
|
||||
unzCloseCurrentFile(uf);
|
||||
|
||||
free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rarch_zlib_extract_archive(const char *zip_path, char *first_file,
|
||||
size_t first_file_size)
|
||||
{
|
||||
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;
|
||||
memset(&gi, 0, sizeof(unz_global_info));
|
||||
|
||||
int ret = unzGetGlobalInfo(uf, &gi);
|
||||
|
||||
if (ret != UNZ_OK)
|
||||
RARCH_ERR("Error %d while trying to get ZIP file global info.\n", ret);
|
||||
|
||||
for (unsigned i = 0; i < gi.number_entry; i++)
|
||||
{
|
||||
char in_fname[PATH_MAX];
|
||||
|
||||
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;
|
||||
}
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
else if (!found_first_file)
|
||||
{
|
||||
// is the extension of the file supported by the libretro core?
|
||||
struct string_list *ext_list = NULL;
|
||||
const char *file_ext = path_get_extension(in_fname);
|
||||
|
||||
if (g_extern.system.valid_extensions)
|
||||
{
|
||||
RARCH_LOG("valid extensions: %s.\n", g_extern.system.valid_extensions);
|
||||
ext_list = string_split(g_extern.system.valid_extensions, "|");
|
||||
}
|
||||
|
||||
if (ext_list && string_list_find_elem(ext_list, file_ext))
|
||||
found_first_file = true;
|
||||
|
||||
if (found_first_file)
|
||||
{
|
||||
strlcpy(first_file, in_fname, first_file_size);
|
||||
RARCH_LOG("first found ZIP file is: %s.\n", in_fname);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((i + 1) < gi.number_entry)
|
||||
{
|
||||
ret = unzGoToNextFile(uf);
|
||||
|
||||
if (ret != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Error %d while trying to go to the next file in the ZIP archive.\n", ret);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
RARCH_ERR("Error occurred while trying to unzip file, ret code: %d.\n", ret);
|
||||
return -1;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2013 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RARCH_ZLIB_H__
|
||||
#define RARCH_ZLIB_H__
|
||||
|
||||
int rarch_zlib_extract_archive(const char *zip_path, char *first_file,
|
||||
size_t first_file_size);
|
||||
|
||||
#endif
|
@ -104,42 +104,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
void console_load_game(const char *path)
|
||||
{
|
||||
#ifdef HAVE_ZLIB
|
||||
if ((strstr(path, ".zip") || strstr(path, ".ZIP"))
|
||||
&& !g_extern.system.block_extract)
|
||||
{
|
||||
char first_file[PATH_MAX];
|
||||
first_file[0] = '\0';
|
||||
|
||||
rarch_zlib_extract_archive(path, first_file, sizeof(first_file));
|
||||
if(g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW))
|
||||
rmenu_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180);
|
||||
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_FILEBROWSER_REFRESH_PENDING);
|
||||
|
||||
if ((g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE)) ||
|
||||
(g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN)))
|
||||
{
|
||||
if (first_file[0] != 0)
|
||||
{
|
||||
RARCH_LOG("Found compatible game, loading it...\n");
|
||||
strlcpy(g_extern.fullpath, first_file, sizeof(g_extern.fullpath));
|
||||
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN))
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_DELETE_PENDING);
|
||||
|
||||
goto do_init;
|
||||
}
|
||||
else
|
||||
msg_queue_push(g_extern.msg_queue, "Could not find compatible game, not loading first file.\n", 1, 100);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
|
||||
|
||||
do_init:
|
||||
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
|
||||
}
|
||||
|
||||
@ -352,17 +317,6 @@ begin_loop:
|
||||
rmenu_settings_msg(S_MSG_ROM_LOADING_ERROR, S_DELAY_180);
|
||||
}
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_INIT);
|
||||
#ifdef HAVE_ZLIB
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_DELETE_PENDING))
|
||||
{
|
||||
int ret = remove(g_extern.fullpath);
|
||||
|
||||
if (ret == 0)
|
||||
RARCH_LOG("Removed temporary unzipped ROM file: [%s].\n", g_extern.fullpath);
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_UNZIP_DELETE_PENDING);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_FILEBROWSER_REFRESH_PENDING);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(g_extern.lifecycle_mode_state & (1ULL << MODE_MENU))
|
||||
{
|
||||
|
@ -458,16 +458,6 @@ static void render_text(rgui_handle_t *rgui)
|
||||
case RGUI_SETTINGS_AUDIO_CONTROL_RATE:
|
||||
snprintf(type_str, sizeof(type_str), "%.3f", g_settings.audio.rate_control_delta);
|
||||
break;
|
||||
case RGUI_SETTINGS_ZIP_EXTRACT:
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR))
|
||||
snprintf(type_str, sizeof(type_str), "Current");
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
snprintf(type_str, sizeof(type_str), "Current + Load");
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN))
|
||||
snprintf(type_str, sizeof(type_str), "Current + Load +_Clean");
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << 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.lifecycle_mode_state & (1ULL << MODE_LOAD_GAME_SRAM_DIR_ENABLE)) ? "ON" : "OFF");
|
||||
break;
|
||||
@ -751,14 +741,6 @@ static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
||||
else if (action == RGUI_ACTION_RIGHT)
|
||||
rmenu_settings_set(S_AUDIO_CONTROL_RATE_INCREMENT);
|
||||
break;
|
||||
case RGUI_SETTINGS_ZIP_EXTRACT:
|
||||
if (action == RGUI_ACTION_START)
|
||||
rmenu_settings_set_default(S_DEF_UNZIP_MODE);
|
||||
else if (action == RGUI_ACTION_LEFT)
|
||||
rmenu_settings_set(S_UNZIP_MODE_DECREMENT);
|
||||
else if (action == RGUI_ACTION_RIGHT)
|
||||
rmenu_settings_set(S_UNZIP_MODE_INCREMENT);
|
||||
break;
|
||||
case RGUI_SETTINGS_SRAM_DIR:
|
||||
if (action == RGUI_ACTION_START || action == RGUI_ACTION_LEFT)
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_LOAD_GAME_SRAM_DIR_ENABLE);
|
||||
@ -888,7 +870,6 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui)
|
||||
RGUI_MENU_ITEM("Rotation", RGUI_SETTINGS_VIDEO_ROTATION);
|
||||
RGUI_MENU_ITEM("Mute Audio", RGUI_SETTINGS_AUDIO_MUTE);
|
||||
RGUI_MENU_ITEM("Audio Control Rate", RGUI_SETTINGS_AUDIO_CONTROL_RATE);
|
||||
RGUI_MENU_ITEM("Zip Extract Directory", RGUI_SETTINGS_ZIP_EXTRACT);
|
||||
RGUI_MENU_ITEM("SRAM Saves in \"sram\" Dir", RGUI_SETTINGS_SRAM_DIR);
|
||||
RGUI_MENU_ITEM("State Saves in \"state\" Dir", RGUI_SETTINGS_STATE_DIR);
|
||||
RGUI_MENU_ITEM("Core", RGUI_SETTINGS_CORE);
|
||||
|
@ -313,31 +313,6 @@ static void populate_setting_item(void *data, unsigned input)
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%d", g_settings.rewind_granularity);
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Set the amount of frames to 'rewind'.\nIncrease this to lower CPU usage.");
|
||||
break;
|
||||
#ifdef HAVE_ZLIB
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
snprintf(current_item->text, sizeof(current_item->text), "Unzip mode");
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR))
|
||||
{
|
||||
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_mode_state & (1ULL <<MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Current dir, 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_mode_state & (1ULL <<MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN))
|
||||
{
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Current dir, load first file and cleanup");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - ZIP files are extracted to current dir, auto-loaded and then\n removed afterwards.");
|
||||
}
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << 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
|
||||
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));
|
||||
@ -1410,16 +1385,6 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
|
||||
if(input & (1ULL << RMENU_DEVICE_NAV_START))
|
||||
g_settings.rewind_granularity = 1;
|
||||
break;
|
||||
#ifdef HAVE_ZLIB
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)))
|
||||
rmenu_settings_set(S_UNZIP_MODE_DECREMENT);
|
||||
if((input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B)))
|
||||
rmenu_settings_set(S_UNZIP_MODE_INCREMENT);
|
||||
if(input & (1ULL << RMENU_DEVICE_NAV_START))
|
||||
rmenu_settings_set_default(S_DEF_UNZIP_MODE);
|
||||
break;
|
||||
#endif
|
||||
case SETTING_RARCH_DEFAULT_EMU:
|
||||
if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B)))
|
||||
{
|
||||
|
@ -139,9 +139,6 @@ 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,
|
||||
|
@ -135,59 +135,6 @@ void rmenu_settings_set(unsigned setting)
|
||||
case S_REFRESH_RATE_INCREMENT:
|
||||
g_settings.video.refresh_rate += 0.01f;
|
||||
break;
|
||||
case S_UNZIP_MODE_DECREMENT:
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CACHEDIR))
|
||||
{
|
||||
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_UNZIP_TO_CACHEDIR) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR));
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN);
|
||||
}
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_UNZIP_TO_CACHEDIR) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR));
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR);
|
||||
}
|
||||
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN))
|
||||
{
|
||||
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_UNZIP_TO_CACHEDIR) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR));
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
break;
|
||||
case S_UNZIP_MODE_INCREMENT:
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR))
|
||||
{
|
||||
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_UNZIP_TO_CACHEDIR) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR));
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
}
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
{
|
||||
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_UNZIP_TO_CACHEDIR) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR));
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN);
|
||||
}
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN))
|
||||
{
|
||||
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_UNZIP_TO_CACHEDIR) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR));
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CACHEDIR);
|
||||
}
|
||||
break;
|
||||
case S_INFO_DEBUG_MSG_TOGGLE:
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW))
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_FPS_DRAW);
|
||||
@ -263,13 +210,6 @@ void rmenu_settings_set_default(unsigned setting)
|
||||
g_settings.video.refresh_rate = 59.95;
|
||||
#endif
|
||||
break;
|
||||
case S_DEF_UNZIP_MODE:
|
||||
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_UNZIP_TO_CURDIR) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN) |
|
||||
(1ULL << MODE_UNZIP_TO_CACHEDIR));
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
break;
|
||||
case S_DEF_INFO_DEBUG_MSG:
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_FPS_DRAW);
|
||||
break;
|
||||
@ -296,16 +236,6 @@ void rmenu_settings_msg(unsigned setting, unsigned delay)
|
||||
case S_MSG_CHANGE_CONTROLS:
|
||||
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:
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR))
|
||||
snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to current directory.");
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << 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
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << 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));
|
||||
snprintf(str, sizeof(str), "INFO - Loading %s...", tmp);
|
||||
@ -378,17 +308,5 @@ void rmenu_settings_create_menu_item_label(char * str, unsigned setting, size_t
|
||||
case S_LBL_REWIND_GRANULARITY:
|
||||
snprintf(str, size, "Rewind granularity: %d", g_settings.rewind_granularity);
|
||||
break;
|
||||
case S_LBL_ZIP_EXTRACT:
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR))
|
||||
snprintf(str, size, "INFO - Unzip Mode: Current dir.");
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
snprintf(str, size, "INFO - Unzip Mode: Current dir, load first file.");
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN))
|
||||
snprintf(str, size, "INFO - Unzip Mode: Current dir, load first file, and clean.");
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CACHEDIR))
|
||||
snprintf(str, size, "INFO - Unzip Mode: Cache dir.");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -53,8 +53,6 @@ enum
|
||||
S_TRIPLE_BUFFERING,
|
||||
S_REFRESH_RATE_DECREMENT,
|
||||
S_REFRESH_RATE_INCREMENT,
|
||||
S_UNZIP_MODE_DECREMENT,
|
||||
S_UNZIP_MODE_INCREMENT,
|
||||
S_INFO_DEBUG_MSG_TOGGLE,
|
||||
S_INFO_MSG_TOGGLE,
|
||||
};
|
||||
@ -74,7 +72,6 @@ enum
|
||||
S_DEF_SCALE_ENABLED,
|
||||
S_DEF_SCALE_FACTOR,
|
||||
S_DEF_REFRESH_RATE,
|
||||
S_DEF_UNZIP_MODE,
|
||||
S_DEF_INFO_DEBUG_MSG,
|
||||
S_DEF_INFO_MSG,
|
||||
};
|
||||
@ -83,7 +80,6 @@ enum
|
||||
{
|
||||
S_MSG_CACHE_PARTITION = 0,
|
||||
S_MSG_CHANGE_CONTROLS,
|
||||
S_MSG_EXTRACTED_ZIPFILE,
|
||||
S_MSG_LOADING_ROM,
|
||||
S_MSG_DIR_LOADING_ERROR,
|
||||
S_MSG_ROM_LOADING_ERROR,
|
||||
@ -105,7 +101,6 @@ enum
|
||||
S_LBL_SCALE_FACTOR,
|
||||
S_LBL_LOAD_STATE_SLOT,
|
||||
S_LBL_SAVE_STATE_SLOT,
|
||||
S_LBL_ZIP_EXTRACT,
|
||||
S_LBL_REWIND_GRANULARITY,
|
||||
};
|
||||
|
||||
|
@ -397,8 +397,6 @@ HRESULT CRetroArchSettings::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
||||
m_settingslist.SetText(SETTING_SHADER_2, strw_buffer);
|
||||
rmenu_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
|
||||
m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer);
|
||||
rmenu_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer));
|
||||
m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer);
|
||||
rmenu_settings_create_menu_item_label_w(strw_buffer, S_LBL_REWIND_GRANULARITY, sizeof(strw_buffer));
|
||||
m_settingslist.SetText(SETTING_EMU_REWIND_GRANULARITY, strw_buffer);
|
||||
m_settingslist.SetText(SETTING_ENABLE_SRAM_PATH, (g_extern.lifecycle_mode_state & (1ULL << MODE_LOAD_GAME_SRAM_DIR_ENABLE)) ? L"SRAM Path Enable: ON" : L"SRAM Path Enable: OFF");
|
||||
@ -517,11 +515,6 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
|
||||
else
|
||||
device_ptr->ctx_driver->set_fbo(FBO_DEINIT);
|
||||
break;
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
rmenu_settings_set(S_UNZIP_MODE_INCREMENT);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -607,11 +600,6 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
rmenu_settings_set(S_UNZIP_MODE_DECREMENT);
|
||||
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;
|
||||
case SETTING_HW_TEXTURE_FILTER:
|
||||
g_settings.video.smooth = !g_settings.video.smooth;
|
||||
m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER, g_settings.video.smooth ? L"Hardware filtering shader #1: Linear interpolation" : L"Hardware filtering shader #1: Point filtering");
|
||||
@ -700,11 +688,6 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SETTING_ZIP_EXTRACT:
|
||||
rmenu_settings_set(S_UNZIP_MODE_INCREMENT);
|
||||
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;
|
||||
case SETTING_HW_TEXTURE_FILTER:
|
||||
g_settings.video.smooth = !g_settings.video.smooth;
|
||||
m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER, g_settings.video.smooth ? L"Hardware filtering shader #1: Linear interpolation" : L"Hardware filtering shader #1: Point filtering");
|
||||
|
@ -34,7 +34,6 @@ enum
|
||||
SETTING_HW_TEXTURE_FILTER_2,
|
||||
SETTING_SCALE_ENABLED,
|
||||
SETTING_SCALE_FACTOR,
|
||||
SETTING_ZIP_EXTRACT,
|
||||
SETTING_ENABLE_SRAM_PATH,
|
||||
SETTING_ENABLE_STATE_PATH,
|
||||
};
|
||||
|
@ -133,11 +133,6 @@ enum menu_enums
|
||||
MODE_VIDEO_PAL_TEMPORAL_ENABLE,
|
||||
MODE_VIDEO_PAL_VSYNC_BLOCK,
|
||||
MODE_AUDIO_CUSTOM_BGM_ENABLE,
|
||||
MODE_UNZIP_TO_CURDIR,
|
||||
MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE,
|
||||
MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN,
|
||||
MODE_UNZIP_TO_CACHEDIR,
|
||||
MODE_UNZIP_DELETE_PENDING,
|
||||
MODE_FILEBROWSER_REFRESH_PENDING,
|
||||
MODE_OSK_DRAW,
|
||||
MODE_OSK_ENTRY_SUCCESS,
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../ps3/sdk_defines.h"
|
||||
#include "../../console/rarch_console.h"
|
||||
|
||||
#ifndef __PSL1GHT__
|
||||
#include <sys/spu_initialize.h>
|
||||
|
@ -42,7 +42,6 @@ Hardware filtering shader #1:
|
||||
Hardware filtering shader #2:
|
||||
Custom Scaling/Dual Shaders:
|
||||
Custom Scaling Factor:
|
||||
Extract ZIP:
|
||||
SRAM Path Enable:
|
||||
Savestate Path Enable:
|
||||
</ItemsText>
|
||||
|
@ -42,7 +42,6 @@ Hardware filtering shader #1:
|
||||
Hardware filtering shader #2:
|
||||
Cutom Scaling/Dual Shaders:
|
||||
Cutom Scaling Factor:
|
||||
Extract ZIP:
|
||||
SRAM Path Enable:
|
||||
Savestate Path Enable:
|
||||
</ItemsText>
|
||||
|
34
settings.c
34
settings.c
@ -265,7 +265,6 @@ void config_set_defaults(void)
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
|
||||
g_extern.console.screen.orientation = ORIENTATION_NORMAL;
|
||||
g_extern.console.screen.resolutions.current.id = 0;
|
||||
@ -478,7 +477,6 @@ bool config_load_file(const char *path)
|
||||
bool soft_filter_enable = false;
|
||||
bool sram_dir_enable = false;
|
||||
bool state_dir_enable = false;
|
||||
int zip_extract_mode = 0;
|
||||
|
||||
if (config_get_path(conf, "default_rom_startup_dir", tmp_str, sizeof(tmp_str)))
|
||||
strlcpy(g_extern.console.main_wrap.default_rom_startup_dir, tmp_str, sizeof(g_extern.console.main_wrap.default_rom_startup_dir));
|
||||
@ -547,29 +545,6 @@ bool config_load_file(const char *path)
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
||||
}
|
||||
|
||||
if (config_get_int(conf, "unzip_mode", &zip_extract_mode))
|
||||
{
|
||||
g_extern.lifecycle_mode_state &= ~((1ULL << MODE_UNZIP_TO_CURDIR) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE) |
|
||||
(1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN) |
|
||||
(1ULL << MODE_UNZIP_TO_CACHEDIR));
|
||||
switch(zip_extract_mode)
|
||||
{
|
||||
case 0:
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR);
|
||||
break;
|
||||
case 1:
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
|
||||
break;
|
||||
case 2:
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN);
|
||||
break;
|
||||
case 3:
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CACHEDIR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (config_get_bool(conf, "sram_dir_enable", &sram_dir_enable))
|
||||
{
|
||||
if (sram_dir_enable)
|
||||
@ -1225,15 +1200,6 @@ bool config_save_file(const char *path)
|
||||
else
|
||||
config_set_bool(conf, "flicker_filter_enable", false);
|
||||
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR))
|
||||
config_set_int(conf, "unzip_mode", 0);
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE))
|
||||
config_set_int(conf, "unzip_mode", 1);
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE_AND_CLEAN))
|
||||
config_set_int(conf, "unzip_mode", 2);
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_UNZIP_TO_CACHEDIR))
|
||||
config_set_int(conf, "unzip_mode", 3);
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user