(RARCH_CONSOLE) Renamed console_rom_ext.c to rarch_zlib.c -

compiled it in for HAVE_ZLIB (for griffin) - moved rarch_console_load_game_wrap
to frontend_console.c and renamed it console_load_game
This commit is contained in:
twinaphex 2013-01-11 22:46:14 +01:00
parent cba3b80925
commit 81fecc88ea
14 changed files with 76 additions and 66 deletions

View File

@ -185,6 +185,12 @@ enum
// Video
////////////////
#if defined(_XBOX360)
#define DEFAULT_GAMMA 1
#else
#define DEFAULT_GAMMA 0
#endif
// Windowed
static const float xscale = 3.0; // Real x res = aspect * base_size * xscale
static const float yscale = 3.0; // Real y res = base_size * yscale

View File

@ -33,7 +33,6 @@ CONSOLE EXTENSIONS
============================================================ */
#ifdef RARCH_CONSOLE
#include "../rarch_console_rom_ext.c"
#include "../rarch_console_video.c"
#ifdef HW_DOL
@ -49,10 +48,10 @@ CONSOLE EXTENSIONS
#include "../rarch_console_input.c"
#endif
#ifdef HAVE_RMENU
#include "../../frontend/menu/rmenu_settings.c"
#endif
#ifdef HAVE_ZLIB
#include "../rarch_zlib.c"
#endif
@ -424,6 +423,7 @@ MENU
#endif
#ifdef HAVE_RMENU
#include "../../frontend/menu/rmenu_settings.c"
#if defined(_XBOX360)
#include "../../frontend/menu/rmenu_xui.cpp"

View File

@ -14,7 +14,9 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdio.h>
#include "../general.h"
#include "rarch_console_video.h"

View File

@ -27,16 +27,23 @@
#include "../general.h"
#include "../file.h"
#include "../frontend/menu/rmenu_settings.h"
#include "rarch_console.h"
#include "rarch_console_rom_ext.h"
#include "rarch_zlib.h"
#ifdef HAVE_ZLIB
#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_extract_currentfile_in_zip(unzFile uf, const char *current_dir, char *slash, char *write_filename, size_t write_filename_size, unsigned extract_zip_mode)
static int rarch_zlib_extract_file(unzFile uf,
const char *current_dir, char *slash, char *write_filename,
size_t write_filename_size, unsigned extract_zip_mode)
{
char filename_inzip[PATH_MAX];
bool is_dir = false;
@ -67,7 +74,7 @@ static int rarch_extract_currentfile_in_zip(unzFile uf, const char *current_dir,
case ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE:
snprintf(write_filename, write_filename_size, "%s%s%s", current_dir, slash, filename_inzip);
break;
#ifdef HAVE_HDD_CACHE_PARTITION
#if defined(HAVE_HDD_CACHE_PARTITION)
case ZIP_EXTRACT_TO_CACHE_DIR:
snprintf(write_filename, write_filename_size, "%s%s", default_paths.cache_dir, filename_inzip);
break;
@ -141,7 +148,8 @@ static int rarch_extract_currentfile_in_zip(unzFile uf, const char *current_dir,
return ret;
}
int rarch_extract_zipfile(const char *zip_path, char *first_file, size_t first_file_size, unsigned extract_zip_mode)
int rarch_zlib_extract_archive(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;
@ -167,7 +175,7 @@ int rarch_extract_zipfile(const char *zip_path, char *first_file, size_t first_f
#else
snprintf(slash, sizeof(slash), "/");
#endif
if (rarch_extract_currentfile_in_zip(uf, dir_path, slash, write_filename, sizeof(write_filename), extract_zip_mode) != UNZ_OK)
if (rarch_zlib_extract_file(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;
@ -212,39 +220,3 @@ int rarch_extract_zipfile(const char *zip_path, char *first_file, size_t first_f
return 0;
}
#endif
void rarch_console_load_game_wrap(const char *path, unsigned extract_zip_mode)
{
#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_extract_zipfile(path, first_file, sizeof(first_file), extract_zip_mode);
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 (first_file[0] != 0)
{
RARCH_LOG("Found compatible game, loading it...\n");
snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), first_file);
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
snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), path);
do_init:
g_extern.lifecycle_menu_state |= (1 << MODE_LOAD_GAME);
}

View File

@ -14,18 +14,17 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RARCH_ROM_EXT_H__
#define RARCH_ROM_EXT_H__
#ifndef RARCH_ZLIB_H__
#define RARCH_ZLIB_H__
#ifdef HAVE_ZLIB
enum
{
ZIP_EXTRACT_TO_CURRENT_DIR = 0,
ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE,
ZIP_EXTRACT_TO_CACHE_DIR
};
#endif
void rarch_console_load_game_wrap(const char *path, unsigned extract_zip_mode);
int rarch_rzlib_extract_archive(const char *zip_path, char *first_file,
size_t first_file_size, unsigned extract_zip_mode);
#endif

View File

@ -21,6 +21,7 @@
#include "frontend_console.h"
#include "menu/rmenu.h"
#include "menu/rmenu_settings.h"
#if defined(__CELLOS_LV2__)
#include "platform/platform_ps3.c"
@ -101,6 +102,40 @@ int main(int argc, char *argv[])
#else
void console_load_game(const char *path, unsigned extract_zip_mode)
{
#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), extract_zip_mode);
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 (first_file[0] != 0)
{
RARCH_LOG("Found compatible game, loading it...\n");
snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), first_file);
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
snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), path);
do_init:
g_extern.lifecycle_menu_state |= (1 << MODE_LOAD_GAME);
}
static void verbose_log_init(void)
{
if (!g_extern.verbose)

View File

@ -26,6 +26,8 @@ static void verbose_log_init(void);
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);
#endif
#ifdef HAVE_LIBRETRO_MANAGEMENT
@ -36,4 +38,5 @@ static bool install_libretro_core(const char *core_exe_path, const char *tmp_pat
#endif
#endif

View File

@ -1217,7 +1217,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);
rarch_console_load_game_wrap(rgui->path_buf, g_extern.file_state.zip_extract_mode);
console_load_game(rgui->path_buf, g_extern.file_state.zip_extract_mode);
rgui->need_refresh = true; // in case of zip extract
rgui->msg_force = true;
return -1;

View File

@ -28,7 +28,6 @@
#endif
#include "../../console/rarch_console.h"
#include "../../console/rarch_console_rom_ext.h"
#include "../../console/rarch_console_input.h"
#include "rmenu_settings.h"
@ -1831,7 +1830,7 @@ int select_rom(void *data, void *state)
rmenu_settings_msg(S_MSG_DIR_LOADING_ERROR, S_DELAY_180);
}
else
rarch_console_load_game_wrap(filebrowser_get_current_path(filebrowser), g_extern.file_state.zip_extract_mode);
console_load_game(filebrowser_get_current_path(filebrowser), g_extern.file_state.zip_extract_mode);
}
else if (input & (1ULL << RMENU_DEVICE_NAV_L1))
{

View File

@ -306,9 +306,3 @@ void rmenu_settings_create_menu_item_label(char * str, unsigned setting, size_t
break;
}
}
#if defined(_XBOX360)
#define DEFAULT_GAMMA 1
#else
#define DEFAULT_GAMMA 0
#endif

View File

@ -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);
rarch_console_load_game_wrap(path, g_extern.file_state.zip_extract_mode);
console_load_game(path, g_extern.file_state.zip_extract_mode);
}
else if(browser->current_dir.list->elems[index].attr.b)
{

View File

@ -372,7 +372,7 @@ static void system_process_args(int argc, char *argv[])
g_extern.lifecycle_menu_state |= (1 << MODE_EXTLAUNCH_CHANNEL);
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;
rarch_console_load_game_wrap(rom, g_extern.file_state.zip_extract_mode);
console_load_game(rom, g_extern.file_state.zip_extract_mode);
rgui_iterate(rgui, RGUI_ACTION_MESSAGE);
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);

View File

@ -179,7 +179,7 @@ void menu_init (void)
bool rmenu_iterate(void)
{
rarch_console_load_game_wrap("/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes", 0, 0);
console_load_game("/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes", 0, 0);
return false;
}

View File

@ -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);
rarch_console_load_game_wrap(game_rom, 0);
console_load_game(game_rom, 0);
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU);
g_extern.lifecycle_menu_state |= (1 << MODE_INIT);