(360) ZIP files can now be unzipped - press X on a ZIP file to

unzip the files to the cache: partition - from the filebrowser
you can then go to the cache partition and load the unzipped ROM.
This commit is contained in:
TwinAphex51224 2012-03-07 20:33:14 +01:00
parent ee806a0e2c
commit 428050904c
8 changed files with 97 additions and 45 deletions

View File

@ -17,6 +17,7 @@
*/
#include <xtl.h>
#include <xfilecache.h>
#include <stddef.h>
#include <stdint.h>
#include <string>
@ -376,12 +377,15 @@ static void get_environment_settings (void)
{
SSNES_ERR("Couldn't change number of bytes reserved for file system cache.\n");
}
unsigned long result = XMountUtilityDriveEx(XMOUNTUTILITYDRIVE_FORMAT0,8192, 0);
if(result != ERROR_SUCCESS)
{
SSNES_ERR("Couldn't mount/format utility drive.\n");
}
XFileCacheInit(XFILECACHE_CLEAR_ALL, 0x100000, XFILECACHE_DEFAULT_THREAD, 0, 1);
XFlushUtilityDrive();
//unsigned long result = XMountUtilityDriveEx(XMOUNTUTILITYDRIVE_FORMAT0,8192, 0);
//if(result != ERROR_SUCCESS)
//{
// SSNES_ERR("Couldn't mount/format utility drive.\n");
//}
// detect install environment
unsigned long license_mask;

View File

@ -32,8 +32,8 @@
<Position>22.799980,81.600006,0.000000</Position>
<NavLeft>XuiBackButton1</NavLeft>
<NavRight>XuiBackButton1</NavRight>
<NavUp>XuiBackButton1</NavUp>
<NavDown>XuiBackButton1</NavDown>
<NavUp>XuiBtnGameDir</NavUp>
<NavDown>XuiBtnGameDir</NavDown>
</Properties>
<XuiListItem>
<Properties>
@ -83,15 +83,27 @@
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
<XuiListItem>
<Properties>
<Id>control_ListItem</Id>
<Width>226.000000</Width>
<Height>45.000000</Height>
<Position>7.000000,22.000000,0.000000</Position>
<Anchor>5</Anchor>
<Show>false</Show>
<Visual>XuiButton</Visual>
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
</Properties>
</XuiListItem>
</XuiCommonList>
<XuiBackButton>
<Properties>
<Id>XuiBackButton1</Id>
<Width>219.000000</Width>
<Width>204.599976</Width>
<Height>36.000000</Height>
<Position>338.715210,281.396820,0.000000</Position>
<NavLeft>XuiRomList</NavLeft>
<NavRight>XuiRomList</NavRight>
<Position>353.115234,281.396820,0.000000</Position>
<NavLeft>XuiBtnCacheDir</NavLeft>
<NavRight>XuiBtnGameDir</NavRight>
<NavUp>XuiRomList</NavUp>
<NavDown>XuiRomList</NavDown>
<Text>Go back to menu</Text>
@ -117,5 +129,31 @@
<Text>PATH:</Text>
</Properties>
</XuiLabel>
<XuiButton>
<Properties>
<Id>XuiBtnGameDir</Id>
<Width>115.640007</Width>
<Height>38.000000</Height>
<Position>30.000000,277.000000,0.000000</Position>
<NavLeft>XuiBackButton1</NavLeft>
<NavRight>XuiBtnCacheDir</NavRight>
<NavUp>XuiRomList</NavUp>
<NavDown>XuiRomList</NavDown>
<Text>game:</Text>
</Properties>
</XuiButton>
<XuiButton>
<Properties>
<Id>XuiBtnCacheDir</Id>
<Width>119.960014</Width>
<Height>38.000000</Height>
<Position>160.000000,277.000000,0.000000</Position>
<NavLeft>XuiBtnGameDir</NavLeft>
<NavRight>XuiBackButton1</NavRight>
<NavUp>XuiRomList</NavUp>
<NavDown>XuiRomList</NavDown>
<Text>cache:</Text>
</Properties>
</XuiButton>
</XuiScene>
</XuiCanvas>

View File

@ -96,6 +96,8 @@ HRESULT CSSNESFileBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
GetChildById(L"XuiRomList", &m_romlist);
GetChildById(L"XuiBackButton1", &m_back);
GetChildById(L"XuiTxtRomPath", &m_rompathtitle);
GetChildById(L"XuiBtnGameDir", &m_dir_game);
GetChildById(L"XuiBtnCacheDir", &m_dir_cache);
filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle);
@ -257,11 +259,19 @@ HRESULT CSSNESFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
{
memset(strbuffer, 0, sizeof(strbuffer));
wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer));
memset(g_console.rom_path, 0, sizeof(g_console.rom_path));
sprintf(g_console.rom_path, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer);
return_to_game();
g_console.initialize_ssnes_enable = 1;
if(strstr(strbuffer, ".zip") || strstr(strbuffer, ".ZIP"))
{
char path_tmp[1024];
sprintf(path_tmp, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer);
ssnes_extract_zipfile(path_tmp);
}
else
{
memset(g_console.rom_path, 0, sizeof(g_console.rom_path));
sprintf(g_console.rom_path, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer);
return_to_game();
g_console.initialize_ssnes_enable = 1;
}
}
else if(browser.cur[index].d_type == FILE_ATTRIBUTE_DIRECTORY)
{
@ -271,6 +281,16 @@ HRESULT CSSNESFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
filebrowser_fetch_directory_entries(path, &browser, &m_romlist, &m_rompathtitle);
}
}
else if (hObjPressed == m_dir_game)
{
filebrowser_new(&browser, g_console.default_rom_startup_dir, ssnes_console_get_rom_ext());
filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle);
}
else if (hObjPressed == m_dir_cache)
{
filebrowser_new(&browser, "cache:", ssnes_console_get_rom_ext());
filebrowser_fetch_directory_entries("cache:", &browser, &m_romlist, &m_rompathtitle);
}
else if(hObjPressed == m_back)
NavigateBack(app.hMainScene);

View File

@ -65,6 +65,8 @@ class CSSNESFileBrowser: public CXuiSceneImpl
protected:
CXuiList m_romlist;
CXuiControl m_back;
CXuiControl m_dir_game;
CXuiControl m_dir_cache;
CXuiTextElement m_rompathtitle;
public:
HRESULT OnInit( XUIMessageInit* pInitData, int & bHandled );

View File

@ -17,7 +17,6 @@
#include <stdio.h>
#include <string.h>
#include "console_ext.h"
#include "../boolean.h"
#include "../libsnes.hpp"
#include "../input/input_luts.h"
@ -25,16 +24,14 @@
#include <string.h>
#include <ctype.h>
#ifdef HAVE_ZLIB
#include "szlib/zlib.h"
#define WRITEBUFFERSIZE (1024 * 512)
#endif
#ifdef _WIN32
#include "../posix_string.h"
#endif
const char *ssnes_console_get_rom_ext(void)
const char * ssnes_console_get_rom_ext(void)
{
const char *id = snes_library_id();
@ -108,7 +105,6 @@ void ssnes_console_set_default_keybind_names_for_emulator(void)
}
}
#ifdef HAVE_ZLIB
static int ssnes_extract_currentfile_in_zip(unzFile uf)
{
char filename_inzip[PATH_MAX];
@ -135,8 +131,11 @@ static int ssnes_extract_currentfile_in_zip(unzFile uf)
char write_filename[PATH_MAX];
/* TODO: currently hardcoded for PS3, fix this */
#if defined(__CELLOS_LV2__)
snprintf(write_filename, sizeof(write_filename), "/dev_hdd1/%s", filename_inzip);
#elif defined(_XBOX)
snprintf(write_filename, sizeof(write_filename), "cache:\\%s", filename_inzip);
#endif
err = unzOpenCurrentFile(uf);
if (err != UNZ_OK)
@ -218,6 +217,3 @@ int ssnes_extract_zipfile(const char *zip_path)
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
// Get rom extensions for current library.
// Infers info from snes_library_id().
// Returns NULL if library doesn't have any preferences in particular.
const char *ssnes_console_get_rom_ext(void);
const char * ssnes_console_get_rom_ext(void);
// Transforms a library id to a name suitable as a pathname.
void ssnes_console_name_from_id(char *name, size_t size);

View File

@ -9,7 +9,7 @@
#ifndef _SZLIB_H
#define _SZLIB_H
#ifdef __cplusplus
#if defined(__cplusplus)
extern "C" {
#endif
@ -437,7 +437,6 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
typedef uint64_t ZPOS64_T;
#else
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ZPOS64_T;
#else
@ -446,13 +445,6 @@ typedef unsigned long long int ZPOS64_T;
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define ZLIB_FILEFUNC_SEEK_CUR (1)
#define ZLIB_FILEFUNC_SEEK_END (2)
#define ZLIB_FILEFUNC_SEEK_SET (0)
@ -686,7 +678,7 @@ extern unsigned long unzGetOffset (unzFile file);
extern int unzSetOffset64 (unzFile file, ZPOS64_T pos);
extern int unzSetOffset (unzFile file, unsigned long pos);
#ifdef __cplusplus
#if defined(__cplusplus)
}
#endif

View File

@ -112,7 +112,7 @@
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.4.1";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.4.1";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -149,7 +149,7 @@
<PREfast>AnalyzeOnly</PREfast>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;SSNES_CONSOLE</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;SSNES_CONSOLE;HAVE_ZLIB</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -187,7 +187,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -230,7 +230,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -270,7 +270,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE=1;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE=1;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -310,7 +310,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.4.1";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>