diff --git a/config.def.h b/config.def.h
index 637d3397b0..a56560c4c0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -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
diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c
index d29e589804..0a4627814f 100644
--- a/console/griffin/griffin.c
+++ b/console/griffin/griffin.c
@@ -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"
diff --git a/console/rarch_console_video.c b/console/rarch_console_video.c
index a5d0eae15d..ba504c6c9e 100644
--- a/console/rarch_console_video.c
+++ b/console/rarch_console_video.c
@@ -14,7 +14,9 @@
* If not, see .
*/
-#include
+#include
+
+#include "../general.h"
#include "rarch_console_video.h"
diff --git a/console/rarch_console_rom_ext.c b/console/rarch_zlib.c
similarity index 76%
rename from console/rarch_console_rom_ext.c
rename to console/rarch_zlib.c
index 965d0f75ab..f3b2c6ce69 100644
--- a/console/rarch_console_rom_ext.c
+++ b/console/rarch_zlib.c
@@ -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
+#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);
-}
diff --git a/console/rarch_console_rom_ext.h b/console/rarch_zlib.h
similarity index 84%
rename from console/rarch_console_rom_ext.h
rename to console/rarch_zlib.h
index f9cb4fdb27..149882a602 100644
--- a/console/rarch_console_rom_ext.h
+++ b/console/rarch_zlib.h
@@ -14,18 +14,17 @@
* If not, see .
*/
-#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
diff --git a/frontend/frontend_console.c b/frontend/frontend_console.c
index 9b688e99cc..2dfc22b741 100644
--- a/frontend/frontend_console.c
+++ b/frontend/frontend_console.c
@@ -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)
diff --git a/frontend/frontend_console.h b/frontend/frontend_console.h
index ff19775c6a..63a27de96e 100644
--- a/frontend/frontend_console.h
+++ b/frontend/frontend_console.h
@@ -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
diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c
index adecb24641..6ef28c3b95 100644
--- a/frontend/menu/rgui.c
+++ b/frontend/menu/rgui.c
@@ -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;
diff --git a/frontend/menu/rmenu.c b/frontend/menu/rmenu.c
index b598de4a2d..547af5767f 100644
--- a/frontend/menu/rmenu.c
+++ b/frontend/menu/rmenu.c
@@ -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))
{
diff --git a/frontend/menu/rmenu_settings.c b/frontend/menu/rmenu_settings.c
index f0b8efdff4..7144eab8ac 100644
--- a/frontend/menu/rmenu_settings.c
+++ b/frontend/menu/rmenu_settings.c
@@ -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
diff --git a/frontend/menu/rmenu_xui.cpp b/frontend/menu/rmenu_xui.cpp
index c9ce7fda8d..7ce19d459b 100644
--- a/frontend/menu/rmenu_xui.cpp
+++ b/frontend/menu/rmenu_xui.cpp
@@ -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)
{
diff --git a/frontend/platform/platform_gx.c b/frontend/platform/platform_gx.c
index 88b35ba247..185eded438 100644
--- a/frontend/platform/platform_gx.c
+++ b/frontend/platform/platform_gx.c
@@ -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);
diff --git a/frontend/platform/platform_ps3.c b/frontend/platform/platform_ps3.c
index c35818eb5d..b1c638c036 100644
--- a/frontend/platform/platform_ps3.c
+++ b/frontend/platform/platform_ps3.c
@@ -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;
}
diff --git a/frontend/platform/platform_psp.c b/frontend/platform/platform_psp.c
index ce9007241a..8e08bd462c 100644
--- a/frontend/platform/platform_psp.c
+++ b/frontend/platform/platform_psp.c
@@ -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);