mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 08:25:18 +01:00
major code audit - bugs fixed, vars made static, file browser memory dynamically allocated
This commit is contained in:
parent
212bedc1ee
commit
0775cc95b2
@ -8,6 +8,8 @@
|
|||||||
* Gamecube Audio RAM storage
|
* Gamecube Audio RAM storage
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HW_DOL
|
||||||
|
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -27,9 +29,9 @@ static char tempbuffer[TEMPSIZE] ATTRIBUTE_ALIGN (32);
|
|||||||
void
|
void
|
||||||
ARAMPut (char *src, char *dst, int len)
|
ARAMPut (char *src, char *dst, int len)
|
||||||
{
|
{
|
||||||
DCFlushRange (src, len);
|
DCFlushRange (src, len);
|
||||||
AR_StartDMA (ARAM_WRITE, (u32) src, (u32) dst, len);
|
AR_StartDMA (ARAM_WRITE, (u32) src, (u32) dst, len);
|
||||||
while (AR_GetDMAStatus());
|
while (AR_GetDMAStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -40,9 +42,9 @@ ARAMPut (char *src, char *dst, int len)
|
|||||||
void
|
void
|
||||||
ARAMFetch (char *dst, char *src, int len)
|
ARAMFetch (char *dst, char *src, int len)
|
||||||
{
|
{
|
||||||
DCInvalidateRange (dst, len);
|
DCInvalidateRange (dst, len);
|
||||||
AR_StartDMA (ARAM_READ, (u32) dst, (u32) src, len);
|
AR_StartDMA (ARAM_READ, (u32) dst, (u32) src, len);
|
||||||
while (AR_GetDMAStatus ());
|
while (AR_GetDMAStatus ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -50,32 +52,32 @@ ARAMFetch (char *dst, char *src, int len)
|
|||||||
*
|
*
|
||||||
* Required as SNES memory may NOT be 32-byte aligned
|
* Required as SNES memory may NOT be 32-byte aligned
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void
|
void ARAMFetchSlow(char *dst, char *src, int len)
|
||||||
ARAMFetchSlow (char *dst, char *src, int len)
|
|
||||||
{
|
{
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
if (len > TEMPSIZE)
|
if (len > TEMPSIZE)
|
||||||
{
|
|
||||||
t = 0;
|
|
||||||
while (t < len)
|
|
||||||
{
|
{
|
||||||
ARAMFetch (tempbuffer, src + t, TEMPSIZE);
|
t = 0;
|
||||||
|
while (t < len)
|
||||||
|
{
|
||||||
|
ARAMFetch(tempbuffer, src + t, TEMPSIZE);
|
||||||
|
|
||||||
if (t + TEMPSIZE > len)
|
if (t + TEMPSIZE > len)
|
||||||
{
|
{
|
||||||
memcpy (dst + t, tempbuffer, len - t);
|
memcpy(dst + t, tempbuffer, len - t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
memcpy (dst + t, tempbuffer, TEMPSIZE);
|
memcpy(dst + t, tempbuffer, TEMPSIZE);
|
||||||
|
|
||||||
|
t += TEMPSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
t += TEMPSIZE;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
}
|
{
|
||||||
else
|
ARAMFetch(tempbuffer, src, len);
|
||||||
{
|
memcpy(dst, tempbuffer, len);
|
||||||
ARAMFetch (tempbuffer, src, len);
|
}
|
||||||
memcpy (dst, tempbuffer, len);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -31,16 +31,16 @@
|
|||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
|
|
||||||
/*** Double buffered audio ***/
|
|
||||||
#define AUDIOBUFFER 2048
|
|
||||||
static unsigned char soundbuffer[2][AUDIOBUFFER]
|
|
||||||
__attribute__ ((__aligned__ (32)));
|
|
||||||
static int whichab = 0; /*** Audio buffer flip switch ***/
|
|
||||||
extern int ConfigRequested;
|
extern int ConfigRequested;
|
||||||
|
|
||||||
|
/*** Double buffered audio ***/
|
||||||
|
#define AUDIOBUFFER 2048
|
||||||
|
static unsigned char soundbuffer[2][AUDIOBUFFER] __attribute__ ((__aligned__ (32)));
|
||||||
|
static int whichab = 0; /*** Audio buffer flip switch ***/
|
||||||
|
|
||||||
#define AUDIOSTACK 16384
|
#define AUDIOSTACK 16384
|
||||||
lwpq_t audioqueue;
|
static lwpq_t audioqueue;
|
||||||
lwp_t athread;
|
static lwp_t athread;
|
||||||
static uint8 astack[AUDIOSTACK];
|
static uint8 astack[AUDIOSTACK];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -24,7 +24,7 @@ extern SCheatData Cheat;
|
|||||||
* Custom version of S9xLoadCheatFile()
|
* Custom version of S9xLoadCheatFile()
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
bool NGCLoadCheatFile (int length)
|
static bool NGCLoadCheatFile (int length)
|
||||||
{
|
{
|
||||||
Cheat.num_cheats = 0;
|
Cheat.num_cheats = 0;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
#ifdef WII_DVD
|
#ifdef HW_RVL
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
}
|
}
|
||||||
@ -28,11 +28,14 @@ extern "C" {
|
|||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
|
|
||||||
u64 dvddir = 0; // offset of currently selected file or folder
|
#define MAXDVDFILES 2000
|
||||||
int dvddirlength = 0; // length of currently selected file or folder
|
|
||||||
u64 dvdrootdir = 0; // offset of DVD root
|
static int diroffset = 0;
|
||||||
int dvdrootlength = 0; // length of DVD root
|
static u64 dvddir = 0; // offset of currently selected file or folder
|
||||||
bool isWii = false;
|
static int dvddirlength = 0; // length of currently selected file or folder
|
||||||
|
static u64 dvdrootdir = 0; // offset of DVD root
|
||||||
|
static int dvdrootlength = 0; // length of DVD root
|
||||||
|
static bool isWii = false;
|
||||||
|
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
/** DVD I/O Address base **/
|
/** DVD I/O Address base **/
|
||||||
@ -48,7 +51,7 @@ volatile unsigned long *dvd = (volatile unsigned long *) 0xCC006000;
|
|||||||
#define ALIGN_FORWARD(x,align) ((typeof(x))((((uint32_t)(x)) + (align) - 1) & (~(align-1))))
|
#define ALIGN_FORWARD(x,align) ((typeof(x))((((uint32_t)(x)) + (align) - 1) & (~(align-1))))
|
||||||
#define ALIGN_BACKWARD(x,align) ((typeof(x))(((uint32_t)(x)) & (~(align-1))))
|
#define ALIGN_BACKWARD(x,align) ((typeof(x))(((uint32_t)(x)) & (~(align-1))))
|
||||||
|
|
||||||
int
|
static int
|
||||||
dvd_read (void *dst, unsigned int len, u64 offset)
|
dvd_read (void *dst, unsigned int len, u64 offset)
|
||||||
{
|
{
|
||||||
if (len > 2048)
|
if (len > 2048)
|
||||||
@ -112,30 +115,40 @@ dvd_read (void *dst, unsigned int len, u64 offset)
|
|||||||
#define DVD_MAX_READ_LENGTH 2048
|
#define DVD_MAX_READ_LENGTH 2048
|
||||||
#define DVD_SECTOR_SIZE 2048
|
#define DVD_SECTOR_SIZE 2048
|
||||||
|
|
||||||
unsigned char dvdsf_buffer[DVD_SECTOR_SIZE];
|
static unsigned char dvdsf_buffer[DVD_SECTOR_SIZE];
|
||||||
u64 dvdsf_last_offset = 0;
|
static u64 dvdsf_last_offset = 0;
|
||||||
u64 dvdsf_last_length = 0;
|
static u64 dvdsf_last_length = 0;
|
||||||
|
|
||||||
int dvd_buffered_read(void *dst, u32 len, u64 offset)
|
static int dvd_buffered_read(void *dst, u32 len, u64 offset)
|
||||||
{
|
{
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
// only read data if the data inside dvdsf_buffer cannot be used
|
// only read data if the data inside dvdsf_buffer cannot be used
|
||||||
if(offset != dvdsf_last_offset || len > dvdsf_last_length)
|
if(offset != dvdsf_last_offset || len > dvdsf_last_length)
|
||||||
{
|
{
|
||||||
memset(&dvdsf_buffer, '\0', DVD_SECTOR_SIZE);
|
memset(&dvdsf_buffer, '\0', DVD_SECTOR_SIZE);
|
||||||
ret = dvd_read(&dvdsf_buffer, len, offset);
|
ret = dvd_read(&dvdsf_buffer, len, offset);
|
||||||
dvdsf_last_offset = offset;
|
dvdsf_last_offset = offset;
|
||||||
dvdsf_last_length = len;
|
dvdsf_last_length = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(dst, &dvdsf_buffer, len);
|
memcpy(dst, &dvdsf_buffer, len);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dvd_safe_read(void *dst_v, u32 len, u64 offset)
|
/****************************************************************************
|
||||||
|
* dvd_safe_read
|
||||||
|
*
|
||||||
|
* A 'safer' DVD read function
|
||||||
|
* This function relies on dvddir (file offset) being prepopulated!
|
||||||
|
* returns: 1 - ok ; 0 - error
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
int dvd_safe_read(void *dst_v, u32 len, u64 fileoffset)
|
||||||
{
|
{
|
||||||
unsigned char buffer[DVD_SECTOR_SIZE]; // buffer for one dvd sector
|
u64 offset = dvddir + fileoffset;
|
||||||
|
|
||||||
|
unsigned char buffer[DVD_SECTOR_SIZE]; // buffer for one dvd sector
|
||||||
|
|
||||||
// if read size and length are a multiply of DVD_(OFFSET,LENGTH)_MULTIPLY and length < DVD_MAX_READ_LENGTH
|
// if read size and length are a multiply of DVD_(OFFSET,LENGTH)_MULTIPLY and length < DVD_MAX_READ_LENGTH
|
||||||
// we don't need to fix anything
|
// we don't need to fix anything
|
||||||
@ -241,7 +254,7 @@ static int IsJoliet = 0;
|
|||||||
* The PVD should reside between sector 16 and 31.
|
* The PVD should reside between sector 16 and 31.
|
||||||
* This is for single session DVD only.
|
* This is for single session DVD only.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
static int
|
||||||
getpvd ()
|
getpvd ()
|
||||||
{
|
{
|
||||||
int sector = 16;
|
int sector = 16;
|
||||||
@ -315,7 +328,7 @@ bool MountDVD(bool silent)
|
|||||||
ShowAction("Loading DVD...");
|
ShowAction("Loading DVD...");
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
DVD_Mount(); // mount the DVD unit again
|
DVD_Mount(); // mount the DVD unit again
|
||||||
#elif WII_DVD
|
#elif HW_RVL
|
||||||
u32 val;
|
u32 val;
|
||||||
DI_GetCoverRegister(&val);
|
DI_GetCoverRegister(&val);
|
||||||
if(val & 0x1) // True if no disc inside, use (val & 0x2) for true if disc inside.
|
if(val & 0x1) // True if no disc inside, use (val & 0x2) for true if disc inside.
|
||||||
@ -344,7 +357,7 @@ bool MountDVD(bool silent)
|
|||||||
* Support function to return the next file entry, if any
|
* Support function to return the next file entry, if any
|
||||||
* Declared static to avoid accidental external entry.
|
* Declared static to avoid accidental external entry.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static int diroffset = 0;
|
|
||||||
static int
|
static int
|
||||||
getentry (int entrycount, unsigned char dvdbuffer[])
|
getentry (int entrycount, unsigned char dvdbuffer[])
|
||||||
{
|
{
|
||||||
@ -358,7 +371,7 @@ getentry (int entrycount, unsigned char dvdbuffer[])
|
|||||||
u32 offset32;
|
u32 offset32;
|
||||||
|
|
||||||
/* Basic checks */
|
/* Basic checks */
|
||||||
if (entrycount >= MAXFILES)
|
if (entrycount >= MAXDVDFILES)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (diroffset >= 2048)
|
if (diroffset >= 2048)
|
||||||
@ -428,19 +441,26 @@ getentry (int entrycount, unsigned char dvdbuffer[])
|
|||||||
if (rr != NULL)
|
if (rr != NULL)
|
||||||
*rr = 0;
|
*rr = 0;
|
||||||
|
|
||||||
strcpy (filelist[entrycount].filename, fname);
|
browserList = (BROWSERENTRY *)realloc(browserList, (entrycount+1) * sizeof(BROWSERENTRY));
|
||||||
|
if(!browserList) // failed to allocate required memory
|
||||||
|
{
|
||||||
|
WaitPrompt("Out of memory: too many files!");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memset(&(browserList[entrycount]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||||
|
|
||||||
|
strcpy (browserList[entrycount].filename, fname);
|
||||||
StripExt(tmpname, fname); // hide file extension
|
StripExt(tmpname, fname); // hide file extension
|
||||||
tmpname[MAXDISPLAY - 1] = 0;
|
strcpy (browserList[entrycount].displayname, tmpname);
|
||||||
strcpy (filelist[entrycount].displayname, tmpname);
|
|
||||||
|
|
||||||
memcpy (&offset32, &dvdbuffer[diroffset + EXTENT], 4);
|
memcpy (&offset32, &dvdbuffer[diroffset + EXTENT], 4);
|
||||||
|
|
||||||
filelist[entrycount].offset = (u64)offset32;
|
browserList[entrycount].offset = (u64)offset32;
|
||||||
memcpy (&filelist[entrycount].length, &dvdbuffer[diroffset + FILE_LENGTH], 4);
|
memcpy (&(browserList[entrycount].length), &dvdbuffer[diroffset + FILE_LENGTH], 4);
|
||||||
memcpy (&filelist[entrycount].flags, &dvdbuffer[diroffset + FILE_FLAGS], 1);
|
memcpy (&(browserList[entrycount].isdir), &dvdbuffer[diroffset + FILE_FLAGS], 1);
|
||||||
|
|
||||||
filelist[entrycount].offset <<= 11;
|
browserList[entrycount].offset <<= 11;
|
||||||
filelist[entrycount].flags = filelist[entrycount].flags & 2;
|
browserList[entrycount].isdir = browserList[entrycount].isdir & 2;
|
||||||
|
|
||||||
/*** Prepare for next entry ***/
|
/*** Prepare for next entry ***/
|
||||||
|
|
||||||
@ -452,7 +472,7 @@ getentry (int entrycount, unsigned char dvdbuffer[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* parseDVDdirectory
|
* ParseDVDdirectory
|
||||||
*
|
*
|
||||||
* This function will parse the directory tree.
|
* This function will parse the directory tree.
|
||||||
* It relies on dvddir and dvddirlength being pre-populated by a call to
|
* It relies on dvddir and dvddirlength being pre-populated by a call to
|
||||||
@ -470,16 +490,13 @@ ParseDVDdirectory ()
|
|||||||
int filecount = 0;
|
int filecount = 0;
|
||||||
unsigned char dvdbuffer[2048];
|
unsigned char dvdbuffer[2048];
|
||||||
|
|
||||||
// initialize selection
|
// reset browser
|
||||||
selection = offset = 0;
|
ResetBrowser();
|
||||||
|
|
||||||
pdoffset = rdoffset = dvddir;
|
pdoffset = rdoffset = dvddir;
|
||||||
pdlength = dvddirlength;
|
pdlength = dvddirlength;
|
||||||
filecount = 0;
|
filecount = 0;
|
||||||
|
|
||||||
// Clear any existing values
|
|
||||||
memset (&filelist, 0, sizeof (FILEENTRIES) * MAXFILES);
|
|
||||||
|
|
||||||
/*** Get as many files as possible ***/
|
/*** Get as many files as possible ***/
|
||||||
while (len < pdlength)
|
while (len < pdlength)
|
||||||
{
|
{
|
||||||
@ -490,7 +507,7 @@ ParseDVDdirectory ()
|
|||||||
|
|
||||||
while (getentry (filecount, dvdbuffer))
|
while (getentry (filecount, dvdbuffer))
|
||||||
{
|
{
|
||||||
if(strlen(filelist[filecount].filename) > 0 && filecount < MAXFILES)
|
if(strlen(browserList[filecount].filename) > 0 && filecount < MAXDVDFILES)
|
||||||
filecount++;
|
filecount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,34 +516,45 @@ ParseDVDdirectory ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sort the file list
|
// Sort the file list
|
||||||
qsort(filelist, filecount, sizeof(FILEENTRIES), FileSortCallback);
|
qsort(browserList, filecount, sizeof(BROWSERENTRY), FileSortCallback);
|
||||||
|
|
||||||
return filecount;
|
return filecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* SetDVDdirectory
|
||||||
|
* Set the current DVD file offset
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
void SetDVDdirectory(u64 dir, int length)
|
||||||
|
{
|
||||||
|
dvddir = dir;
|
||||||
|
dvddirlength = length;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* DirectorySearch
|
* DirectorySearch
|
||||||
*
|
*
|
||||||
* Searches for the directory name specified within the current directory
|
* Searches for the directory name specified within the current directory
|
||||||
* Returns the index of the directory, or -1 if not found
|
* Returns the index of the directory, or -1 if not found
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DirectorySearch(char dir[512])
|
static int DirectorySearch(char dir[512])
|
||||||
{
|
{
|
||||||
for (int i = 0; i < maxfiles; i++ )
|
for (int i = 0; i < browser.numEntries; i++ )
|
||||||
if (strcmp(filelist[i].filename, dir) == 0)
|
if (strcmp(browserList[i].filename, dir) == 0)
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* SwitchDVDFolder
|
* SwitchDVDFolderR
|
||||||
*
|
*
|
||||||
* Recursively searches for any directory path 'dir' specified
|
* Recursively searches for any directory path 'dir' specified
|
||||||
* Also can be used to find and set the offset for a file
|
* Also can be used to find and set the offset for a file
|
||||||
* Also loads the directory contents via ParseDVDdirectory()
|
* Also loads the directory contents via ParseDVDdirectory()
|
||||||
* It relies on dvddir, dvddirlength, and filelist being pre-populated
|
* It relies on dvddir, dvddirlength, and filelist being pre-populated
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
bool SwitchDVDFolder(char * dir, int maxDepth)
|
static bool SwitchDVDFolderR(char * dir, int maxDepth)
|
||||||
{
|
{
|
||||||
if(maxDepth > 8) // only search to a max depth of 8 levels
|
if(maxDepth > 8) // only search to a max depth of 8 levels
|
||||||
return false;
|
return false;
|
||||||
@ -546,17 +574,17 @@ bool SwitchDVDFolder(char * dir, int maxDepth)
|
|||||||
|
|
||||||
if(dirindex >= 0)
|
if(dirindex >= 0)
|
||||||
{
|
{
|
||||||
dvddir = filelist[dirindex].offset;
|
dvddir = browserList[dirindex].offset;
|
||||||
dvddirlength = filelist[dirindex].length;
|
dvddirlength = browserList[dirindex].length;
|
||||||
selection = dirindex;
|
browser.selIndex = dirindex;
|
||||||
|
|
||||||
if(filelist[dirindex].flags) // only parse directories
|
if(browserList[dirindex].isdir) // only parse directories
|
||||||
maxfiles = ParseDVDdirectory();
|
browser.numEntries = ParseDVDdirectory();
|
||||||
|
|
||||||
if(lastdir)
|
if(lastdir)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return SwitchDVDFolder(nextdir, maxDepth++);
|
return SwitchDVDFolderR(nextdir, maxDepth++);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -581,16 +609,13 @@ bool SwitchDVDFolder(char origdir[])
|
|||||||
dvddirlength = dvdrootlength;
|
dvddirlength = dvdrootlength;
|
||||||
ParseDVDdirectory();
|
ParseDVDdirectory();
|
||||||
|
|
||||||
return SwitchDVDFolder(dirptr, 0);
|
return SwitchDVDFolderR(dirptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* LoadDVDFile
|
* LoadDVDFileOffset
|
||||||
* This function will load a file from DVD
|
* This function will load a file from DVD
|
||||||
* The values for offset and length are inherited from dvddir and
|
* It assumes dvddir and dvddirlength are prepopulated
|
||||||
* dvddirlength.
|
|
||||||
*
|
|
||||||
* The buffer parameter should re-use the initial ROM buffer
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -652,6 +677,13 @@ LoadDVDFileOffset (unsigned char *buffer, int length)
|
|||||||
return dvddirlength;
|
return dvddirlength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* LoadDVDFile
|
||||||
|
* This function will load a file from DVD, given a filepath
|
||||||
|
* It will attempt to find the offset of the file, and if successful it
|
||||||
|
* will populate dvddir and dvddirlength, and load the file
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
LoadDVDFile(char * buffer, char *filepath, int datasize, bool silent)
|
LoadDVDFile(char * buffer, char *filepath, int datasize, bool silent)
|
||||||
{
|
{
|
||||||
|
@ -13,20 +13,18 @@
|
|||||||
#ifndef _NGCDVD_
|
#ifndef _NGCDVD_
|
||||||
#define _NGCDVD_
|
#define _NGCDVD_
|
||||||
|
|
||||||
int getpvd ();
|
|
||||||
bool MountDVD(bool silent);
|
bool MountDVD(bool silent);
|
||||||
int ParseDVDdirectory ();
|
int ParseDVDdirectory();
|
||||||
|
void SetDVDdirectory(u64 dir, int length);
|
||||||
|
bool SwitchDVDFolder(char dir[]);
|
||||||
|
|
||||||
int LoadDVDFileOffset(unsigned char *buffer, int length);
|
int LoadDVDFileOffset(unsigned char *buffer, int length);
|
||||||
int LoadDVDFile(char * buffer, char *filepath, int datasize, bool silent);
|
int LoadDVDFile(char * buffer, char *filepath, int datasize, bool silent);
|
||||||
int dvd_read (void *dst, unsigned int len, u64 offset);
|
|
||||||
int dvd_safe_read (void *dst, unsigned int len, u64 offset);
|
int dvd_safe_read (void *dst, unsigned int len, u64 offset);
|
||||||
bool SwitchDVDFolder(char dir[]);
|
|
||||||
void SetDVDDriveType();
|
void SetDVDDriveType();
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
void dvd_motor_off ();
|
void dvd_motor_off ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern u64 dvddir;
|
|
||||||
extern int dvddirlength;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
#include <sdcard/wiisd_io.h>
|
#include <sdcard/wiisd_io.h>
|
||||||
#include <sdcard/gcsd.h>
|
#include <sdcard/gcsd.h>
|
||||||
#include <ogc/usbstorage.h>
|
#include <ogc/usbstorage.h>
|
||||||
@ -34,8 +35,8 @@
|
|||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
|
||||||
// file pointer - the only one we should ever use!
|
unsigned char * savebuffer = NULL;
|
||||||
FILE * file;
|
FILE * file; // file pointer - the only one we should ever use!
|
||||||
bool unmountRequired[9] = { false, false, false, false, false, false, false, false, false };
|
bool unmountRequired[9] = { false, false, false, false, false, false, false, false, false };
|
||||||
bool isMounted[9] = { false, false, false, false, false, false, false, false, false };
|
bool isMounted[9] = { false, false, false, false, false, false, false, false, false };
|
||||||
|
|
||||||
@ -256,7 +257,6 @@ bool ChangeInterface(int method, bool silent)
|
|||||||
int
|
int
|
||||||
ParseDirectory()
|
ParseDirectory()
|
||||||
{
|
{
|
||||||
int nbfiles = 0;
|
|
||||||
DIR_ITER *dir;
|
DIR_ITER *dir;
|
||||||
char fulldir[MAXPATHLEN];
|
char fulldir[MAXPATHLEN];
|
||||||
char filename[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
@ -264,14 +264,11 @@ ParseDirectory()
|
|||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
char msg[128];
|
char msg[128];
|
||||||
|
|
||||||
// initialize selection
|
// reset browser
|
||||||
selection = offset = 0;
|
ResetBrowser();
|
||||||
|
|
||||||
// Clear any existing values
|
|
||||||
memset (&filelist, 0, sizeof (FILEENTRIES) * MAXFILES);
|
|
||||||
|
|
||||||
// add device to path
|
// add device to path
|
||||||
sprintf(fulldir, "%s%s", rootdir, currentdir);
|
sprintf(fulldir, "%s%s", rootdir, browser.dir);
|
||||||
|
|
||||||
// open the directory
|
// open the directory
|
||||||
dir = diropen(fulldir);
|
dir = diropen(fulldir);
|
||||||
@ -284,7 +281,7 @@ ParseDirectory()
|
|||||||
// if we can't open the dir, open root dir
|
// if we can't open the dir, open root dir
|
||||||
sprintf(fulldir,"%s",rootdir);
|
sprintf(fulldir,"%s",rootdir);
|
||||||
|
|
||||||
dir = diropen(currentdir);
|
dir = diropen(browser.dir);
|
||||||
|
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
{
|
{
|
||||||
@ -295,17 +292,29 @@ ParseDirectory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// index files/folders
|
// index files/folders
|
||||||
|
int entryNum = 0;
|
||||||
|
|
||||||
while(dirnext(dir,filename,&filestat) == 0)
|
while(dirnext(dir,filename,&filestat) == 0)
|
||||||
{
|
{
|
||||||
if(strcmp(filename,".") != 0)
|
if(strcmp(filename,".") != 0)
|
||||||
{
|
{
|
||||||
memset(&filelist[nbfiles], 0, sizeof(FILEENTRIES));
|
browserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
||||||
strncpy(filelist[nbfiles].filename, filename, MAXPATHLEN);
|
|
||||||
|
if(!browserList) // failed to allocate required memory
|
||||||
|
{
|
||||||
|
WaitPrompt("Out of memory: too many files!");
|
||||||
|
entryNum = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||||
|
|
||||||
|
strncpy(browserList[entryNum].filename, filename, MAXJOLIET);
|
||||||
StripExt(tmpname, filename); // hide file extension
|
StripExt(tmpname, filename); // hide file extension
|
||||||
strncpy(filelist[nbfiles].displayname, tmpname, MAXDISPLAY+1); // crop name for display
|
strncpy(browserList[entryNum].displayname, tmpname, MAXDISPLAY); // crop name for display
|
||||||
filelist[nbfiles].length = filestat.st_size;
|
browserList[entryNum].length = filestat.st_size;
|
||||||
filelist[nbfiles].flags = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
browserList[entryNum].isdir = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
||||||
nbfiles++;
|
|
||||||
|
entryNum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,9 +322,36 @@ ParseDirectory()
|
|||||||
dirclose(dir);
|
dirclose(dir);
|
||||||
|
|
||||||
// Sort the file list
|
// Sort the file list
|
||||||
qsort(filelist, nbfiles, sizeof(FILEENTRIES), FileSortCallback);
|
qsort(browserList, entryNum, sizeof(BROWSERENTRY), FileSortCallback);
|
||||||
|
|
||||||
return nbfiles;
|
return entryNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* AllocSaveBuffer ()
|
||||||
|
* Clear and allocate the savebuffer
|
||||||
|
***************************************************************************/
|
||||||
|
void
|
||||||
|
AllocSaveBuffer ()
|
||||||
|
{
|
||||||
|
if (savebuffer != NULL)
|
||||||
|
free(savebuffer);
|
||||||
|
|
||||||
|
savebuffer = (unsigned char *) memalign(32, SAVEBUFFERSIZE);
|
||||||
|
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* FreeSaveBuffer ()
|
||||||
|
* Free the savebuffer memory
|
||||||
|
***************************************************************************/
|
||||||
|
void
|
||||||
|
FreeSaveBuffer ()
|
||||||
|
{
|
||||||
|
if (savebuffer != NULL)
|
||||||
|
free(savebuffer);
|
||||||
|
|
||||||
|
savebuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -335,7 +371,7 @@ LoadSzFile(char * filepath, unsigned char * rbuffer)
|
|||||||
file = fopen (filepath, "rb");
|
file = fopen (filepath, "rb");
|
||||||
if (file > 0)
|
if (file > 0)
|
||||||
{
|
{
|
||||||
size = SzExtractFile(filelist[selection].offset, rbuffer);
|
size = SzExtractFile(browserList[browser.selIndex].offset, rbuffer);
|
||||||
fclose (file);
|
fclose (file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -21,18 +21,22 @@
|
|||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define SAVEBUFFERSIZE (1024 * 512)
|
||||||
|
|
||||||
void InitDeviceThread();
|
void InitDeviceThread();
|
||||||
void MountAllFAT();
|
void MountAllFAT();
|
||||||
void UnmountAllFAT();
|
void UnmountAllFAT();
|
||||||
bool ChangeInterface(int method, bool silent);
|
bool ChangeInterface(int method, bool silent);
|
||||||
int ParseDirectory();
|
int ParseDirectory();
|
||||||
|
void AllocSaveBuffer();
|
||||||
|
void FreeSaveBuffer();
|
||||||
u32 LoadFile(char * rbuffer, char *filepath, u32 length, int method, bool silent);
|
u32 LoadFile(char * rbuffer, char *filepath, u32 length, int method, bool silent);
|
||||||
u32 LoadFile(char filepath[], int method, bool silent);
|
u32 LoadFile(char filepath[], int method, bool silent);
|
||||||
u32 LoadSzFile(char * filepath, unsigned char * rbuffer);
|
u32 LoadSzFile(char * filepath, unsigned char * rbuffer);
|
||||||
u32 SaveFile(char * buffer, char *filepath, u32 datasize, int method, bool silent);
|
u32 SaveFile(char * buffer, char *filepath, u32 datasize, int method, bool silent);
|
||||||
u32 SaveFile(char filepath[], u32 datasize, int method, bool silent);
|
u32 SaveFile(char filepath[], u32 datasize, int method, bool silent);
|
||||||
|
|
||||||
extern char currFATdir[MAXPATHLEN];
|
extern unsigned char * savebuffer;
|
||||||
extern FILE * file;
|
extern FILE * file;
|
||||||
extern bool unmountRequired[];
|
extern bool unmountRequired[];
|
||||||
extern bool isMounted[];
|
extern bool isMounted[];
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
#ifdef WII_DVD
|
#ifdef HW_RVL
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
}
|
}
|
||||||
@ -40,52 +40,15 @@ extern "C" {
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
|
|
||||||
int offset;
|
BROWSERINFO browser;
|
||||||
int selection;
|
BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
||||||
|
|
||||||
char rootdir[10];
|
char rootdir[10];
|
||||||
char currentdir[MAXPATHLEN];
|
static char szpath[MAXPATHLEN];
|
||||||
char szpath[MAXPATHLEN];
|
static bool inSz = false;
|
||||||
int maxfiles;
|
|
||||||
extern int screenheight;
|
|
||||||
unsigned long SNESROMSize = 0;
|
unsigned long SNESROMSize = 0;
|
||||||
|
|
||||||
int havedir = -1;
|
|
||||||
extern u64 dvddir;
|
|
||||||
extern int dvddirlength;
|
|
||||||
|
|
||||||
// Global file entry table
|
|
||||||
FILEENTRIES filelist[MAXFILES];
|
|
||||||
bool inSz = false;
|
|
||||||
|
|
||||||
unsigned char *savebuffer = NULL;
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* AllocSaveBuffer ()
|
|
||||||
* Allocate and clear the savebuffer
|
|
||||||
***************************************************************************/
|
|
||||||
void
|
|
||||||
AllocSaveBuffer ()
|
|
||||||
{
|
|
||||||
if (savebuffer != NULL)
|
|
||||||
free(savebuffer);
|
|
||||||
|
|
||||||
savebuffer = (unsigned char *) malloc(SAVEBUFFERSIZE);
|
|
||||||
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* FreeSaveBuffer ()
|
|
||||||
* Free the savebuffer memory
|
|
||||||
***************************************************************************/
|
|
||||||
void
|
|
||||||
FreeSaveBuffer ()
|
|
||||||
{
|
|
||||||
if (savebuffer != NULL)
|
|
||||||
free(savebuffer);
|
|
||||||
|
|
||||||
savebuffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* autoLoadMethod()
|
* autoLoadMethod()
|
||||||
* Auto-determines and sets the load method
|
* Auto-determines and sets the load method
|
||||||
@ -143,6 +106,25 @@ int autoSaveMethod(bool silent)
|
|||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* ResetBrowser()
|
||||||
|
* Clears the file browser memory, and allocates one initial entry
|
||||||
|
***************************************************************************/
|
||||||
|
void ResetBrowser()
|
||||||
|
{
|
||||||
|
browser.selIndex = browser.pageIndex = 0;
|
||||||
|
|
||||||
|
// Clear any existing values
|
||||||
|
if(browserList != NULL)
|
||||||
|
{
|
||||||
|
free(browserList);
|
||||||
|
browserList = NULL;
|
||||||
|
}
|
||||||
|
// set aside space for 1 entry
|
||||||
|
browserList = (BROWSERENTRY *)malloc(sizeof(BROWSERENTRY));
|
||||||
|
memset(browserList, 0, sizeof(BROWSERENTRY));
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* UpdateDirName()
|
* UpdateDirName()
|
||||||
* Update curent directory name for file browser
|
* Update curent directory name for file browser
|
||||||
@ -155,21 +137,18 @@ int UpdateDirName(int method)
|
|||||||
|
|
||||||
// update DVD directory
|
// update DVD directory
|
||||||
if(method == METHOD_DVD)
|
if(method == METHOD_DVD)
|
||||||
{
|
SetDVDdirectory(browserList[browser.selIndex].offset, browserList[browser.selIndex].length);
|
||||||
dvddir = filelist[selection].offset;
|
|
||||||
dvddirlength = filelist[selection].length;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* current directory doesn't change */
|
/* current directory doesn't change */
|
||||||
if (strcmp(filelist[selection].filename,".") == 0)
|
if (strcmp(browserList[browser.selIndex].filename,".") == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* go up to parent directory */
|
/* go up to parent directory */
|
||||||
else if (strcmp(filelist[selection].filename,"..") == 0)
|
else if (strcmp(browserList[browser.selIndex].filename,"..") == 0)
|
||||||
{
|
{
|
||||||
/* determine last subdirectory namelength */
|
/* determine last subdirectory namelength */
|
||||||
sprintf(temp,"%s",currentdir);
|
sprintf(temp,"%s",browser.dir);
|
||||||
test = strtok(temp,"/");
|
test = strtok(temp,"/");
|
||||||
while (test != NULL)
|
while (test != NULL)
|
||||||
{
|
{
|
||||||
@ -178,8 +157,8 @@ int UpdateDirName(int method)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* remove last subdirectory name */
|
/* remove last subdirectory name */
|
||||||
size = strlen(currentdir) - size - 1;
|
size = strlen(browser.dir) - size - 1;
|
||||||
currentdir[size] = 0;
|
browser.dir[size] = 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -187,10 +166,10 @@ int UpdateDirName(int method)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* test new directory namelength */
|
/* test new directory namelength */
|
||||||
if ((strlen(currentdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN)
|
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) < MAXPATHLEN)
|
||||||
{
|
{
|
||||||
/* update current directory name */
|
/* update current directory name */
|
||||||
sprintf(currentdir, "%s/%s",currentdir, filelist[selection].filename);
|
sprintf(browser.dir, "%s/%s",browser.dir, browserList[browser.selIndex].filename);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -210,7 +189,7 @@ bool MakeFilePath(char filepath[], int type, int method)
|
|||||||
if(type == FILE_ROM)
|
if(type == FILE_ROM)
|
||||||
{
|
{
|
||||||
// Check path length
|
// Check path length
|
||||||
if ((strlen(currentdir)+1+strlen(filelist[selection].filename)) >= MAXPATHLEN)
|
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) >= MAXPATHLEN)
|
||||||
{
|
{
|
||||||
WaitPrompt("Maximum filepath length reached!");
|
WaitPrompt("Maximum filepath length reached!");
|
||||||
filepath[0] = 0;
|
filepath[0] = 0;
|
||||||
@ -218,7 +197,7 @@ bool MakeFilePath(char filepath[], int type, int method)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(temppath, "%s/%s",currentdir,filelist[selection].filename);
|
sprintf(temppath, "%s/%s",browser.dir,browserList[browser.selIndex].filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -270,19 +249,19 @@ bool MakeFilePath(char filepath[], int type, int method)
|
|||||||
int FileSortCallback(const void *f1, const void *f2)
|
int FileSortCallback(const void *f1, const void *f2)
|
||||||
{
|
{
|
||||||
/* Special case for implicit directories */
|
/* Special case for implicit directories */
|
||||||
if(((FILEENTRIES *)f1)->filename[0] == '.' || ((FILEENTRIES *)f2)->filename[0] == '.')
|
if(((BROWSERENTRY *)f1)->filename[0] == '.' || ((BROWSERENTRY *)f2)->filename[0] == '.')
|
||||||
{
|
{
|
||||||
if(strcmp(((FILEENTRIES *)f1)->filename, ".") == 0) { return -1; }
|
if(strcmp(((BROWSERENTRY *)f1)->filename, ".") == 0) { return -1; }
|
||||||
if(strcmp(((FILEENTRIES *)f2)->filename, ".") == 0) { return 1; }
|
if(strcmp(((BROWSERENTRY *)f2)->filename, ".") == 0) { return 1; }
|
||||||
if(strcmp(((FILEENTRIES *)f1)->filename, "..") == 0) { return -1; }
|
if(strcmp(((BROWSERENTRY *)f1)->filename, "..") == 0) { return -1; }
|
||||||
if(strcmp(((FILEENTRIES *)f2)->filename, "..") == 0) { return 1; }
|
if(strcmp(((BROWSERENTRY *)f2)->filename, "..") == 0) { return 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If one is a file and one is a directory the directory is first. */
|
/* If one is a file and one is a directory the directory is first. */
|
||||||
if(((FILEENTRIES *)f1)->flags && !(((FILEENTRIES *)f2)->flags)) return -1;
|
if(((BROWSERENTRY *)f1)->isdir && !(((BROWSERENTRY *)f2)->isdir)) return -1;
|
||||||
if(!(((FILEENTRIES *)f1)->flags) && ((FILEENTRIES *)f2)->flags) return 1;
|
if(!(((BROWSERENTRY *)f1)->isdir) && ((BROWSERENTRY *)f2)->isdir) return 1;
|
||||||
|
|
||||||
return stricmp(((FILEENTRIES *)f1)->filename, ((FILEENTRIES *)f2)->filename);
|
return stricmp(((BROWSERENTRY *)f1)->filename, ((BROWSERENTRY *)f2)->filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -297,16 +276,16 @@ int FileSortCallback(const void *f1, const void *f2)
|
|||||||
bool IsValidROM(int method)
|
bool IsValidROM(int method)
|
||||||
{
|
{
|
||||||
// file size should be between 96K and 8MB
|
// file size should be between 96K and 8MB
|
||||||
if(filelist[selection].length < (1024*96) ||
|
if(browserList[browser.selIndex].length < (1024*96) ||
|
||||||
filelist[selection].length > (1024*1024*8))
|
browserList[browser.selIndex].length > (1024*1024*8))
|
||||||
{
|
{
|
||||||
WaitPrompt("Invalid file size!");
|
WaitPrompt("Invalid file size!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(filelist[selection].filename) > 4)
|
if (strlen(browserList[browser.selIndex].filename) > 4)
|
||||||
{
|
{
|
||||||
char * p = strrchr(filelist[selection].filename, '.');
|
char * p = strrchr(browserList[browser.selIndex].filename, '.');
|
||||||
|
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
@ -347,9 +326,9 @@ bool IsValidROM(int method)
|
|||||||
|
|
||||||
bool IsSz()
|
bool IsSz()
|
||||||
{
|
{
|
||||||
if (strlen(filelist[selection].filename) > 4)
|
if (strlen(browserList[browser.selIndex].filename) > 4)
|
||||||
{
|
{
|
||||||
char * p = strrchr(filelist[selection].filename, '.');
|
char * p = strrchr(browserList[browser.selIndex].filename, '.');
|
||||||
|
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
if(stricmp(p, ".7z") == 0)
|
if(stricmp(p, ".7z") == 0)
|
||||||
@ -402,7 +381,7 @@ int FileSelector (int method)
|
|||||||
while (haverom == 0)
|
while (haverom == 0)
|
||||||
{
|
{
|
||||||
if (redraw)
|
if (redraw)
|
||||||
ShowFiles (filelist, maxfiles, offset, selection);
|
ShowFiles (browserList, browser.numEntries, browser.pageIndex, browser.selIndex);
|
||||||
redraw = 0;
|
redraw = 0;
|
||||||
|
|
||||||
VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
||||||
@ -429,19 +408,16 @@ int FileSelector (int method)
|
|||||||
{
|
{
|
||||||
if ( selectit )
|
if ( selectit )
|
||||||
selectit = 0;
|
selectit = 0;
|
||||||
if (filelist[selection].flags) // This is directory
|
if (browserList[browser.selIndex].isdir) // This is directory
|
||||||
{
|
{
|
||||||
/* update current directory and set new entry list if directory has changed */
|
/* update current directory and set new entry list if directory has changed */
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if(inSz && selection == 0) // inside a 7z, requesting to leave
|
if(inSz && browser.selIndex == 0) // inside a 7z, requesting to leave
|
||||||
{
|
{
|
||||||
if(method == METHOD_DVD)
|
if(method == METHOD_DVD)
|
||||||
{
|
SetDVDdirectory(browserList[0].offset, browserList[0].length);
|
||||||
// go to directory the 7z was in
|
|
||||||
dvddir = filelist[0].offset;
|
|
||||||
dvddirlength = filelist[0].length;
|
|
||||||
}
|
|
||||||
inSz = false;
|
inSz = false;
|
||||||
status = 1;
|
status = 1;
|
||||||
SzClose();
|
SzClose();
|
||||||
@ -456,15 +432,15 @@ int FileSelector (int method)
|
|||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
case METHOD_DVD:
|
case METHOD_DVD:
|
||||||
maxfiles = ParseDVDdirectory();
|
browser.numEntries = ParseDVDdirectory();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
maxfiles = ParseDirectory();
|
browser.numEntries = ParseDirectory();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!maxfiles)
|
if (!browser.numEntries)
|
||||||
{
|
{
|
||||||
WaitPrompt ("Error reading directory!");
|
WaitPrompt ("Error reading directory!");
|
||||||
haverom = 1; // quit menu
|
haverom = 1; // quit menu
|
||||||
@ -492,7 +468,7 @@ int FileSelector (int method)
|
|||||||
int szfiles = SzParse(szpath, method);
|
int szfiles = SzParse(szpath, method);
|
||||||
if(szfiles)
|
if(szfiles)
|
||||||
{
|
{
|
||||||
maxfiles = szfiles;
|
browser.numEntries = szfiles;
|
||||||
inSz = true;
|
inSz = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -505,7 +481,7 @@ int FileSelector (int method)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// store the filename (w/o ext) - used for sram/freeze naming
|
// store the filename (w/o ext) - used for sram/freeze naming
|
||||||
StripExt(Memory.ROMFilename, filelist[selection].filename);
|
StripExt(Memory.ROMFilename, browserList[browser.selIndex].filename);
|
||||||
|
|
||||||
ShowAction ("Loading...");
|
ShowAction ("Loading...");
|
||||||
|
|
||||||
@ -518,14 +494,14 @@ int FileSelector (int method)
|
|||||||
if(!MakeFilePath(filepath, FILE_ROM, method))
|
if(!MakeFilePath(filepath, FILE_ROM, method))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
SNESROMSize = LoadFile ((char *)Memory.ROM, filepath, filelist[selection].length, method, NOTSILENT);
|
SNESROMSize = LoadFile ((char *)Memory.ROM, filepath, browserList[browser.selIndex].length, method, NOTSILENT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
case METHOD_DVD:
|
case METHOD_DVD:
|
||||||
SNESROMSize = SzExtractFile(filelist[selection].offset, (unsigned char *)Memory.ROM);
|
SNESROMSize = SzExtractFile(browserList[browser.selIndex].offset, (unsigned char *)Memory.ROM);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SNESROMSize = LoadSzFile(szpath, (unsigned char *)Memory.ROM);
|
SNESROMSize = LoadSzFile(szpath, (unsigned char *)Memory.ROM);
|
||||||
@ -542,107 +518,125 @@ int FileSelector (int method)
|
|||||||
}
|
}
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
} // End of A
|
} // End of A
|
||||||
if ( (p & PAD_BUTTON_B) || (wp & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B)) )
|
if ((p & PAD_BUTTON_B)
|
||||||
{
|
|| (wp & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B)))
|
||||||
while ( (PAD_ButtonsDown(0) & PAD_BUTTON_B)
|
{
|
||||||
|
while ((PAD_ButtonsDown(0) & PAD_BUTTON_B)
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|| (WPAD_ButtonsDown(0) & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B))
|
|| (WPAD_ButtonsDown(0) & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B))
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
if ( strcmp(filelist[0].filename,"..") == 0 )
|
if (strcmp(browserList[0].filename, "..") == 0)
|
||||||
{
|
{
|
||||||
selection = 0;
|
browser.selIndex = 0;
|
||||||
selectit = 1;
|
selectit = 1;
|
||||||
}
|
}
|
||||||
else if ( strcmp(filelist[1].filename,"..") == 0 )
|
else if (strcmp(browserList[1].filename, "..") == 0)
|
||||||
{
|
{
|
||||||
selection = selectit = 1;
|
browser.selIndex = selectit = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} // End of B
|
} // End of B
|
||||||
if ( ((p | ph) & PAD_BUTTON_DOWN) || ((wp | wh) & (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN)) || (gc_ay < -PADCAL) || (wm_ay < -PADCAL) )
|
if (((p | ph) & PAD_BUTTON_DOWN) || ((wp | wh) & (WPAD_BUTTON_DOWN
|
||||||
{
|
| WPAD_CLASSIC_BUTTON_DOWN)) || (gc_ay < -PADCAL) || (wm_ay
|
||||||
if ( (p & PAD_BUTTON_DOWN) || (wp & (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN)) ) { /*** Button just pressed ***/
|
< -PADCAL))
|
||||||
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
{
|
||||||
move_selection = 1; //continue (move selection)
|
if ((p & PAD_BUTTON_DOWN) || (wp & (WPAD_BUTTON_DOWN
|
||||||
|
| WPAD_CLASSIC_BUTTON_DOWN)))
|
||||||
|
{ /*** Button just pressed ***/
|
||||||
|
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
||||||
|
move_selection = 1; //continue (move selection)
|
||||||
}
|
}
|
||||||
else if (scroll_delay == 0) { /*** Button is held ***/
|
else if (scroll_delay == 0)
|
||||||
|
{ /*** Button is held ***/
|
||||||
scroll_delay = SCROLL_LOOP_DELAY;
|
scroll_delay = SCROLL_LOOP_DELAY;
|
||||||
move_selection = 1; //continue (move selection)
|
move_selection = 1; //continue (move selection)
|
||||||
} else {
|
}
|
||||||
scroll_delay--; // wait
|
else
|
||||||
|
{
|
||||||
|
scroll_delay--; // wait
|
||||||
}
|
}
|
||||||
|
|
||||||
if (move_selection)
|
if (move_selection)
|
||||||
{
|
{
|
||||||
selection++;
|
browser.selIndex++;
|
||||||
if (selection == maxfiles)
|
if (browser.selIndex == browser.numEntries)
|
||||||
selection = offset = 0;
|
browser.selIndex = browser.pageIndex = 0;
|
||||||
if ((selection - offset) >= PAGESIZE)
|
if ((browser.selIndex - browser.pageIndex) >= PAGESIZE)
|
||||||
offset += PAGESIZE;
|
browser.pageIndex += PAGESIZE;
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
move_selection = 0;
|
move_selection = 0;
|
||||||
}
|
}
|
||||||
} // End of down
|
} // End of down
|
||||||
if ( ((p | ph) & PAD_BUTTON_UP) || ((wp | wh) & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP)) || (gc_ay > PADCAL) || (wm_ay > PADCAL) )
|
if (((p | ph) & PAD_BUTTON_UP) || ((wp | wh) & (WPAD_BUTTON_UP
|
||||||
{
|
| WPAD_CLASSIC_BUTTON_UP)) || (gc_ay > PADCAL) || (wm_ay
|
||||||
if ( (p & PAD_BUTTON_UP) || (wp & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP)) ) { /*** Button just pressed***/
|
> PADCAL))
|
||||||
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
{
|
||||||
move_selection = 1; //continue (move selection)
|
if ((p & PAD_BUTTON_UP) || (wp & (WPAD_BUTTON_UP
|
||||||
|
| WPAD_CLASSIC_BUTTON_UP)))
|
||||||
|
{ /*** Button just pressed***/
|
||||||
|
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
||||||
|
move_selection = 1; //continue (move selection)
|
||||||
}
|
}
|
||||||
else if (scroll_delay == 0) { /*** Button is held ***/
|
else if (scroll_delay == 0)
|
||||||
|
{ /*** Button is held ***/
|
||||||
scroll_delay = SCROLL_LOOP_DELAY;
|
scroll_delay = SCROLL_LOOP_DELAY;
|
||||||
move_selection = 1; //continue (move selection)
|
move_selection = 1; //continue (move selection)
|
||||||
} else {
|
}
|
||||||
scroll_delay--; // wait
|
else
|
||||||
|
{
|
||||||
|
scroll_delay--; // wait
|
||||||
}
|
}
|
||||||
|
|
||||||
if (move_selection)
|
if (move_selection)
|
||||||
{
|
{
|
||||||
selection--;
|
browser.selIndex--;
|
||||||
if (selection < 0) {
|
if (browser.selIndex < 0)
|
||||||
selection = maxfiles - 1;
|
{
|
||||||
offset = selection - PAGESIZE + 1;
|
browser.selIndex = browser.numEntries - 1;
|
||||||
}
|
browser.pageIndex = browser.selIndex - PAGESIZE + 1;
|
||||||
if (selection < offset)
|
}
|
||||||
offset -= PAGESIZE;
|
if (browser.selIndex < browser.pageIndex)
|
||||||
if (offset < 0)
|
browser.pageIndex -= PAGESIZE;
|
||||||
offset = 0;
|
if (browser.pageIndex < 0)
|
||||||
redraw = 1;
|
browser.pageIndex = 0;
|
||||||
|
redraw = 1;
|
||||||
move_selection = 0;
|
move_selection = 0;
|
||||||
}
|
}
|
||||||
} // End of Up
|
} // End of Up
|
||||||
if ( (p & PAD_BUTTON_LEFT) || (wp & (WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT)) )
|
if ((p & PAD_BUTTON_LEFT) || (wp & (WPAD_BUTTON_LEFT
|
||||||
{
|
| WPAD_CLASSIC_BUTTON_LEFT)))
|
||||||
/*** Go back a page ***/
|
{
|
||||||
selection -= PAGESIZE;
|
/*** Go back a page ***/
|
||||||
if (selection < 0)
|
browser.selIndex -= PAGESIZE;
|
||||||
{
|
if (browser.selIndex < 0)
|
||||||
selection = maxfiles - 1;
|
{
|
||||||
offset = selection - PAGESIZE + 1;
|
browser.selIndex = browser.numEntries - 1;
|
||||||
}
|
browser.pageIndex = browser.selIndex - PAGESIZE + 1;
|
||||||
if (selection < offset)
|
}
|
||||||
offset -= PAGESIZE;
|
if (browser.selIndex < browser.pageIndex)
|
||||||
if (offset < 0)
|
browser.pageIndex -= PAGESIZE;
|
||||||
offset = 0;
|
if (browser.pageIndex < 0)
|
||||||
redraw = 1;
|
browser.pageIndex = 0;
|
||||||
}
|
redraw = 1;
|
||||||
if ( (p & PAD_BUTTON_RIGHT) || (wp & (WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT)) )
|
}
|
||||||
{
|
if ((p & PAD_BUTTON_RIGHT) || (wp & (WPAD_BUTTON_RIGHT
|
||||||
/*** Go forward a page ***/
|
| WPAD_CLASSIC_BUTTON_RIGHT)))
|
||||||
selection += PAGESIZE;
|
{
|
||||||
if (selection > maxfiles - 1)
|
/*** Go forward a page ***/
|
||||||
selection = offset = 0;
|
browser.selIndex += PAGESIZE;
|
||||||
if ((selection - offset) >= PAGESIZE)
|
if (browser.selIndex > browser.numEntries - 1)
|
||||||
offset += PAGESIZE;
|
browser.selIndex = browser.pageIndex = 0;
|
||||||
redraw = 1;
|
if ((browser.selIndex - browser.pageIndex) >= PAGESIZE)
|
||||||
}
|
browser.pageIndex += PAGESIZE;
|
||||||
}
|
redraw = 1;
|
||||||
return 0;
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -662,17 +656,17 @@ OpenROM (int method)
|
|||||||
switch(method)
|
switch(method)
|
||||||
{
|
{
|
||||||
case METHOD_DVD:
|
case METHOD_DVD:
|
||||||
currentdir[0] = 0;
|
browser.dir[0] = 0;
|
||||||
maxfiles = ParseDVDdirectory (); // Parse root directory
|
browser.numEntries = ParseDVDdirectory(); // Parse root directory
|
||||||
SwitchDVDFolder(GCSettings.LoadFolder); // switch to ROM folder
|
SwitchDVDFolder(GCSettings.LoadFolder); // switch to ROM folder
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(currentdir, "/%s", GCSettings.LoadFolder);
|
sprintf(browser.dir, "/%s", GCSettings.LoadFolder);
|
||||||
maxfiles = ParseDirectory(); // Parse root directory
|
browser.numEntries = ParseDirectory(); // Parse root directory
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxfiles > 0)
|
if (browser.numEntries > 0)
|
||||||
{
|
{
|
||||||
// Select an entry
|
// Select an entry
|
||||||
return FileSelector (method);
|
return FileSelector (method);
|
||||||
|
@ -17,36 +17,38 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
|
|
||||||
#define SAVEBUFFERSIZE (512 * 1024)
|
|
||||||
#define MAXJOLIET 255
|
#define MAXJOLIET 255
|
||||||
#define MAXDISPLAY 50
|
#define MAXDISPLAY 50
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u64 offset;
|
char dir[MAXPATHLEN]; // directory path of browserList
|
||||||
unsigned int length;
|
int numEntries; // # of entries in browserList
|
||||||
char flags;
|
int selIndex; // currently selected index of browserList
|
||||||
char filename[MAXJOLIET + 1];
|
int pageIndex; // starting index of browserList page display
|
||||||
char displayname[MAXDISPLAY + 1];
|
} BROWSERINFO;
|
||||||
} FILEENTRIES;
|
|
||||||
|
|
||||||
#define MAXFILES 2000 // Restrict to 2000 files per dir
|
typedef struct
|
||||||
extern FILEENTRIES filelist[MAXFILES];
|
{
|
||||||
extern unsigned char *savebuffer;
|
u64 offset; // DVD offset
|
||||||
extern int offset;
|
unsigned int length; // file length
|
||||||
extern int selection;
|
char isdir; // 0 - file, 1 - directory
|
||||||
|
char filename[MAXJOLIET + 1]; // full filename
|
||||||
|
char displayname[MAXDISPLAY + 1]; // name for browser display
|
||||||
|
} BROWSERENTRY;
|
||||||
|
|
||||||
|
extern BROWSERINFO browser;
|
||||||
|
extern BROWSERENTRY * browserList;
|
||||||
extern char rootdir[10];
|
extern char rootdir[10];
|
||||||
extern char currentdir[MAXPATHLEN];
|
|
||||||
extern int maxfiles;
|
|
||||||
extern unsigned long SNESROMSize;
|
extern unsigned long SNESROMSize;
|
||||||
|
|
||||||
void AllocSaveBuffer();
|
|
||||||
void FreeSaveBuffer();
|
|
||||||
bool MakeFilePath(char filepath[], int type, int method);
|
bool MakeFilePath(char filepath[], int type, int method);
|
||||||
int OpenROM (int method);
|
int OpenROM (int method);
|
||||||
int autoLoadMethod();
|
int autoLoadMethod();
|
||||||
int autoSaveMethod(bool silent);
|
int autoSaveMethod(bool silent);
|
||||||
int FileSortCallback(const void *f1, const void *f2);
|
int FileSortCallback(const void *f1, const void *f2);
|
||||||
void StripExt(char* returnstring, char * inputstring);
|
void StripExt(char* returnstring, char * inputstring);
|
||||||
|
void ResetBrowser();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,9 +38,7 @@ extern void NGCFreezeStruct ();
|
|||||||
extern bool8 S9xUnfreezeGame (const char *filename);
|
extern bool8 S9xUnfreezeGame (const char *filename);
|
||||||
|
|
||||||
static int bufoffset;
|
static int bufoffset;
|
||||||
|
static char freezecomment[2][32];
|
||||||
char freezecomment[2][32];
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* GetMem
|
* GetMem
|
||||||
|
@ -30,18 +30,32 @@ extern "C" {
|
|||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* PKWare Zip Header - adopted into zip standard
|
|
||||||
*/
|
|
||||||
#define PKZIPID 0x504b0304
|
|
||||||
#define MAXROM 0x500000
|
|
||||||
#define ZIPCHUNK 2048
|
#define ZIPCHUNK 2048
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Zip file header definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned int zipid __attribute__ ((__packed__)); // 0x04034b50
|
||||||
|
unsigned short zipversion __attribute__ ((__packed__));
|
||||||
|
unsigned short zipflags __attribute__ ((__packed__));
|
||||||
|
unsigned short compressionMethod __attribute__ ((__packed__));
|
||||||
|
unsigned short lastmodtime __attribute__ ((__packed__));
|
||||||
|
unsigned short lastmoddate __attribute__ ((__packed__));
|
||||||
|
unsigned int crc32 __attribute__ ((__packed__));
|
||||||
|
unsigned int compressedSize __attribute__ ((__packed__));
|
||||||
|
unsigned int uncompressedSize __attribute__ ((__packed__));
|
||||||
|
unsigned short filenameLength __attribute__ ((__packed__));
|
||||||
|
unsigned short extraDataLength __attribute__ ((__packed__));
|
||||||
|
}
|
||||||
|
PKZIPHEADER;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zip files are stored little endian
|
* Zip files are stored little endian
|
||||||
* Support functions for short and int types
|
* Support functions for short and int types
|
||||||
*/
|
*/
|
||||||
u32
|
static u32
|
||||||
FLIP32 (u32 b)
|
FLIP32 (u32 b)
|
||||||
{
|
{
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
@ -54,7 +68,7 @@ FLIP32 (u32 b)
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16
|
static u16
|
||||||
FLIP16 (u16 b)
|
FLIP16 (u16 b)
|
||||||
{
|
{
|
||||||
u16 c;
|
u16 c;
|
||||||
@ -68,8 +82,8 @@ FLIP16 (u16 b)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* IsZipFile
|
* IsZipFile
|
||||||
*
|
*
|
||||||
* Returns TRUE when PKZIPID is first four characters of buffer
|
* Returns TRUE when 0x504b0304 is first four characters of buffer
|
||||||
****************************************************************************/
|
***************************************************************************/
|
||||||
int
|
int
|
||||||
IsZipFile (char *buffer)
|
IsZipFile (char *buffer)
|
||||||
{
|
{
|
||||||
@ -77,7 +91,7 @@ IsZipFile (char *buffer)
|
|||||||
|
|
||||||
check = (unsigned int *) buffer;
|
check = (unsigned int *) buffer;
|
||||||
|
|
||||||
if (check[0] == PKZIPID)
|
if (check[0] == 0x504b0304)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -85,8 +99,6 @@ IsZipFile (char *buffer)
|
|||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* UnZipBuffer
|
* UnZipBuffer
|
||||||
*
|
|
||||||
* It should be noted that there is a limit of 5MB total size for any ROM
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -102,15 +114,13 @@ UnZipBuffer (unsigned char *outbuffer, int method)
|
|||||||
int readoffset = 0;
|
int readoffset = 0;
|
||||||
int have = 0;
|
int have = 0;
|
||||||
char readbuffer[ZIPCHUNK];
|
char readbuffer[ZIPCHUNK];
|
||||||
u64 discoffset = 0;
|
|
||||||
int sizeread = 0;
|
int sizeread = 0;
|
||||||
|
|
||||||
// Read Zip Header
|
// Read Zip Header
|
||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
case METHOD_DVD:
|
case METHOD_DVD:
|
||||||
discoffset = dvddir;
|
sizeread = dvd_safe_read (readbuffer, ZIPCHUNK, 0);
|
||||||
sizeread = dvd_safe_read (readbuffer, ZIPCHUNK, discoffset);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fseek(file, 0, SEEK_SET);
|
fseek(file, 0, SEEK_SET);
|
||||||
@ -184,7 +194,7 @@ UnZipBuffer (unsigned char *outbuffer, int method)
|
|||||||
{
|
{
|
||||||
case METHOD_DVD:
|
case METHOD_DVD:
|
||||||
readoffset += ZIPCHUNK;
|
readoffset += ZIPCHUNK;
|
||||||
sizeread = dvd_safe_read (readbuffer, ZIPCHUNK, discoffset+readoffset);
|
sizeread = dvd_safe_read (readbuffer, ZIPCHUNK, readoffset);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sizeread = fread (readbuffer, 1, ZIPCHUNK, file);
|
sizeread = fread (readbuffer, 1, ZIPCHUNK, file);
|
||||||
@ -260,7 +270,7 @@ typedef struct _SzFileInStream
|
|||||||
} SzFileInStream;
|
} SzFileInStream;
|
||||||
|
|
||||||
// 7zip error list
|
// 7zip error list
|
||||||
char szerrormsg[][30] = {
|
static char szerrormsg[][30] = {
|
||||||
"7z: Data error",
|
"7z: Data error",
|
||||||
"7z: Out of memory",
|
"7z: Out of memory",
|
||||||
"7z: CRC Error",
|
"7z: CRC Error",
|
||||||
@ -271,20 +281,19 @@ char szerrormsg[][30] = {
|
|||||||
"7z: Dictionary too large",
|
"7z: Dictionary too large",
|
||||||
};
|
};
|
||||||
|
|
||||||
SZ_RESULT SzRes;
|
static SZ_RESULT SzRes;
|
||||||
|
static SzFileInStream SzArchiveStream;
|
||||||
|
static CArchiveDatabaseEx SzDb;
|
||||||
|
static ISzAlloc SzAllocImp;
|
||||||
|
static ISzAlloc SzAllocTempImp;
|
||||||
|
static UInt32 SzBlockIndex = 0xFFFFFFFF;
|
||||||
|
static size_t SzBufferSize;
|
||||||
|
static size_t SzOffset;
|
||||||
|
static size_t SzOutSizeProcessed;
|
||||||
|
static CFileItem *SzF;
|
||||||
|
|
||||||
SzFileInStream SzArchiveStream;
|
static char sz_buffer[2048];
|
||||||
CArchiveDatabaseEx SzDb;
|
static int szMethod = 0;
|
||||||
ISzAlloc SzAllocImp;
|
|
||||||
ISzAlloc SzAllocTempImp;
|
|
||||||
UInt32 SzBlockIndex = 0xFFFFFFFF;
|
|
||||||
size_t SzBufferSize;
|
|
||||||
size_t SzOffset;
|
|
||||||
size_t SzOutSizeProcessed;
|
|
||||||
CFileItem *SzF;
|
|
||||||
|
|
||||||
char sz_buffer[2048];
|
|
||||||
int szMethod = 0;
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Is7ZipFile
|
* Is7ZipFile
|
||||||
@ -309,16 +318,16 @@ Is7ZipFile (char *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// display an error message
|
// display an error message
|
||||||
void SzDisplayError(SZ_RESULT res)
|
static void SzDisplayError(SZ_RESULT res)
|
||||||
{
|
{
|
||||||
WaitPrompt(szerrormsg[(res - 1)]);
|
WaitPrompt(szerrormsg[(res - 1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// function used by the 7zip SDK to read data from SD/USB/DVD/SMB
|
// function used by the 7zip SDK to read data from SD/USB/DVD/SMB
|
||||||
SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, size_t *processedSize)
|
static SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, size_t *processedSize)
|
||||||
{
|
{
|
||||||
int seekok = 0;
|
u32 seekok = 0;
|
||||||
int sizeread = 0;
|
u32 sizeread = 0;
|
||||||
|
|
||||||
// the void* object is a SzFileInStream
|
// the void* object is a SzFileInStream
|
||||||
SzFileInStream *s = (SzFileInStream *) object;
|
SzFileInStream *s = (SzFileInStream *) object;
|
||||||
@ -350,13 +359,13 @@ SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, siz
|
|||||||
|
|
||||||
if(maxRequiredSize > 1024) // only show progress for large reads
|
if(maxRequiredSize > 1024) // only show progress for large reads
|
||||||
// this isn't quite right, but oh well
|
// this isn't quite right, but oh well
|
||||||
ShowProgress ("Loading...", s->pos, filelist[selection].length);
|
ShowProgress ("Loading...", s->pos, browserList[browser.selIndex].length);
|
||||||
|
|
||||||
return SZ_OK;
|
return SZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// function used by the 7zip SDK to change the filepointer
|
// function used by the 7zip SDK to change the filepointer
|
||||||
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
static SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
||||||
{
|
{
|
||||||
// the void* object is a SzFileInStream
|
// the void* object is a SzFileInStream
|
||||||
SzFileInStream *s = (SzFileInStream *) object;
|
SzFileInStream *s = (SzFileInStream *) object;
|
||||||
@ -374,17 +383,23 @@ SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
|||||||
* SzParse
|
* SzParse
|
||||||
*
|
*
|
||||||
* Opens a 7z file, and parses it
|
* Opens a 7z file, and parses it
|
||||||
* Right now doesn't parse 7z, since we'll always use the first file
|
* It parses the entire 7z for full browsing capability
|
||||||
* But it could parse the entire 7z for full browsing capability
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
int SzParse(char * filepath, int method)
|
int SzParse(char * filepath, int method)
|
||||||
{
|
{
|
||||||
|
if(!filepath)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int nbfiles = 0;
|
int nbfiles = 0;
|
||||||
|
|
||||||
// save the offset and the length of this file inside the archive stream structure
|
// save the length/offset of this file
|
||||||
SzArchiveStream.offset = filelist[selection].offset;
|
unsigned int filelen = browserList[browser.selIndex].length;
|
||||||
SzArchiveStream.len = filelist[selection].length;
|
u64 fileoff = browserList[browser.selIndex].offset;
|
||||||
|
|
||||||
|
// setup archive stream
|
||||||
|
SzArchiveStream.offset = 0;
|
||||||
|
SzArchiveStream.len = filelen;
|
||||||
SzArchiveStream.pos = 0;
|
SzArchiveStream.pos = 0;
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
@ -397,6 +412,9 @@ int SzParse(char * filepath, int method)
|
|||||||
if(!file)
|
if(!file)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
case METHOD_DVD:
|
||||||
|
SwitchDVDFolder(filepath);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set szMethod to current chosen load method
|
// set szMethod to current chosen load method
|
||||||
@ -432,14 +450,14 @@ int SzParse(char * filepath, int method)
|
|||||||
{
|
{
|
||||||
// Parses the 7z into a full file listing
|
// Parses the 7z into a full file listing
|
||||||
|
|
||||||
// erase all previous entries
|
// reset browser
|
||||||
memset(&filelist, 0, sizeof(FILEENTRIES) * MAXFILES);
|
ResetBrowser();
|
||||||
|
|
||||||
// add '..' folder in case the user wants exit the 7z
|
// add '..' folder in case the user wants exit the 7z
|
||||||
strncpy(filelist[0].displayname, "..", 2);
|
strncpy(browserList[0].displayname, "..", 2);
|
||||||
filelist[0].flags = 1;
|
browserList[0].isdir = 1;
|
||||||
filelist[0].offset = dvddir;
|
browserList[0].offset = fileoff;
|
||||||
filelist[0].length = dvddirlength;
|
browserList[0].length = filelen;
|
||||||
|
|
||||||
// get contents and parse them into file list structure
|
// get contents and parse them into file list structure
|
||||||
unsigned int SzI, SzJ;
|
unsigned int SzI, SzJ;
|
||||||
@ -452,22 +470,25 @@ int SzParse(char * filepath, int method)
|
|||||||
if (SzF->IsDirectory)
|
if (SzF->IsDirectory)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// do not exceed MAXFILES to avoid possible buffer overflows
|
browserList = (BROWSERENTRY *)realloc(browserList, (SzJ+1) * sizeof(BROWSERENTRY));
|
||||||
if (SzJ == (MAXFILES - 1))
|
|
||||||
|
if(!browserList) // failed to allocate required memory
|
||||||
|
{
|
||||||
|
WaitPrompt("Out of memory: too many files!");
|
||||||
|
nbfiles = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
memset(&(browserList[SzJ]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||||
|
|
||||||
// parse information about this file to the dvd file list structure
|
// parse information about this file to the dvd file list structure
|
||||||
strncpy(filelist[SzJ].filename, SzF->Name, MAXJOLIET); // copy joliet name (useless...)
|
strncpy(browserList[SzJ].filename, SzF->Name, MAXJOLIET); // copy joliet name (useless...)
|
||||||
filelist[SzJ].filename[MAXJOLIET] = 0; // terminate string
|
strncpy(browserList[SzJ].displayname, SzF->Name, MAXDISPLAY); // crop name for display
|
||||||
strncpy(filelist[SzJ].displayname, SzF->Name, MAXDISPLAY+1); // crop name for display
|
browserList[SzJ].length = SzF->Size; // filesize
|
||||||
filelist[SzJ].length = SzF->Size; // filesize
|
browserList[SzJ].offset = SzI; // the extraction function identifies the file with this number
|
||||||
filelist[SzJ].offset = SzI; // the extraction function identifies the file with this number
|
browserList[SzJ].isdir = 0; // only files will be displayed (-> no flags)
|
||||||
filelist[SzJ].flags = 0; // only files will be displayed (-> no flags)
|
|
||||||
SzJ++;
|
SzJ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update maxfiles and select the first entry
|
|
||||||
offset = selection = 0;
|
|
||||||
nbfiles = SzJ;
|
nbfiles = SzJ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -12,33 +12,11 @@
|
|||||||
#ifndef _GCUNZIP_H_
|
#ifndef _GCUNZIP_H_
|
||||||
#define _GCUNZIP_H_
|
#define _GCUNZIP_H_
|
||||||
|
|
||||||
extern int IsZipFile (char *buffer);
|
int IsZipFile (char *buffer);
|
||||||
char * GetFirstZipFilename(int method);
|
char * GetFirstZipFilename(int method);
|
||||||
int UnZipBuffer (unsigned char *outbuffer, int method);
|
int UnZipBuffer (unsigned char *outbuffer, int method);
|
||||||
int SzParse(char * filepath, int method);
|
int SzParse(char * filepath, int method);
|
||||||
int SzExtractFile(int i, unsigned char *buffer);
|
int SzExtractFile(int i, unsigned char *buffer);
|
||||||
void SzClose();
|
void SzClose();
|
||||||
|
|
||||||
/*
|
|
||||||
* Zip file header definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned int zipid __attribute__ ((__packed__)); // 0x04034b50
|
|
||||||
unsigned short zipversion __attribute__ ((__packed__));
|
|
||||||
unsigned short zipflags __attribute__ ((__packed__));
|
|
||||||
unsigned short compressionMethod __attribute__ ((__packed__));
|
|
||||||
unsigned short lastmodtime __attribute__ ((__packed__));
|
|
||||||
unsigned short lastmoddate __attribute__ ((__packed__));
|
|
||||||
unsigned int crc32 __attribute__ ((__packed__));
|
|
||||||
unsigned int compressedSize __attribute__ ((__packed__));
|
|
||||||
unsigned int uncompressedSize __attribute__ ((__packed__));
|
|
||||||
unsigned short filenameLength __attribute__ ((__packed__));
|
|
||||||
unsigned short extraDataLength __attribute__ ((__packed__));
|
|
||||||
}
|
|
||||||
PKZIPHEADER;
|
|
||||||
|
|
||||||
u32 FLIP32 (u32 b);
|
|
||||||
u16 FLIP16 (u16 b);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -386,7 +386,7 @@ gui_drawbox (int x1, int y1, int width, int height, int r, int g, int b, int a)
|
|||||||
* DrawCharacter
|
* DrawCharacter
|
||||||
* Draws a single character on the screen
|
* Draws a single character on the screen
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static void
|
/*static void
|
||||||
gui_DrawCharacter (FT_Bitmap * bmp, FT_Int x, FT_Int y)
|
gui_DrawCharacter (FT_Bitmap * bmp, FT_Int x, FT_Int y)
|
||||||
{
|
{
|
||||||
FT_Int i, j, p, q;
|
FT_Int i, j, p, q;
|
||||||
@ -404,12 +404,12 @@ gui_DrawCharacter (FT_Bitmap * bmp, FT_Int x, FT_Int y)
|
|||||||
|
|
||||||
c = bmp->buffer[q * bmp->width + p];
|
c = bmp->buffer[q * bmp->width + p];
|
||||||
|
|
||||||
/*** Cool Anti-Aliasing doesn't work too well at hires on GC ***/
|
// Cool Anti-Aliasing doesn't work too well at hires on GC
|
||||||
if (c > 128)
|
if (c > 128)
|
||||||
memory[(j * 640) + i] = Gui.fontcolour;
|
memory[(j * 640) + i] = Gui.fontcolour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* DrawText
|
* DrawText
|
||||||
@ -421,7 +421,7 @@ gui_DrawText (int x, int y, const char *text)
|
|||||||
{
|
{
|
||||||
int px, n;
|
int px, n;
|
||||||
int i;
|
int i;
|
||||||
int err;
|
int err = 0;
|
||||||
int value, count;
|
int value, count;
|
||||||
|
|
||||||
n = strlen (text);
|
n = strlen (text);
|
||||||
@ -445,7 +445,7 @@ gui_DrawText (int x, int y, const char *text)
|
|||||||
/*** Draw the string ***/
|
/*** Draw the string ***/
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
err = FT_Load_Char (face, text[i], FT_LOAD_RENDER);
|
//err = FT_Load_Char (face, text[i], FT_LOAD_RENDER);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
@ -453,10 +453,10 @@ gui_DrawText (int x, int y, const char *text)
|
|||||||
continue; /*** Skip unprintable characters ***/
|
continue; /*** Skip unprintable characters ***/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count)
|
//if (count)
|
||||||
gui_DrawCharacter (&slot->bitmap, px + slot->bitmap_left, y - slot->bitmap_top);
|
// gui_DrawCharacter (&slot->bitmap, px + slot->bitmap_left, y - slot->bitmap_top);
|
||||||
|
|
||||||
px += slot->advance.x >> 6;
|
// px += slot->advance.x >> 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
px = (640 - px) >> 1;
|
px = (640 - px) >> 1;
|
||||||
|
@ -20,21 +20,9 @@
|
|||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "s9xconfig.h"
|
|
||||||
#include "audio.h"
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "sram.h"
|
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "memcardop.h"
|
|
||||||
#include "fileop.h"
|
#include "fileop.h"
|
||||||
#include "filesel.h"
|
|
||||||
|
|
||||||
#define VERIFBUFFERSIZE 65536
|
|
||||||
static u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
|
||||||
unsigned char verifbuffer[VERIFBUFFERSIZE] ATTRIBUTE_ALIGN (32);
|
|
||||||
card_dir CardDir;
|
|
||||||
card_file CardFile;
|
|
||||||
card_stat CardStatus;
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* CardFileExists
|
* CardFileExists
|
||||||
@ -42,9 +30,10 @@ card_stat CardStatus;
|
|||||||
* Wrapper to search through the files on the card.
|
* Wrapper to search through the files on the card.
|
||||||
* Returns TRUE if found.
|
* Returns TRUE if found.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
static int
|
||||||
CardFileExists (char *filename, int slot)
|
CardFileExists (char *filename, int slot)
|
||||||
{
|
{
|
||||||
|
card_dir CardDir;
|
||||||
int CardError;
|
int CardError;
|
||||||
|
|
||||||
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
||||||
@ -59,6 +48,28 @@ CardFileExists (char *filename, int slot)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* MountCard
|
||||||
|
*
|
||||||
|
* Mounts the memory card in the given slot.
|
||||||
|
* Returns the result of the last attempted CARD_Mount command.
|
||||||
|
***************************************************************************/
|
||||||
|
static int MountCard(int cslot, bool silent, u8 * SysArea)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
int tries = 0;
|
||||||
|
|
||||||
|
// Mount the card
|
||||||
|
while ( tries < 10 && ret != 0)
|
||||||
|
{
|
||||||
|
EXI_ProbeReset ();
|
||||||
|
ret = CARD_Mount (cslot, &SysArea, NULL);
|
||||||
|
VIDEO_WaitVSync ();
|
||||||
|
tries++;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* TestCard
|
* TestCard
|
||||||
*
|
*
|
||||||
@ -72,11 +83,12 @@ bool TestCard(int slot, bool silent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*** Initialize Card System ***/
|
/*** Initialize Card System ***/
|
||||||
|
u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
||||||
memset (SysArea, 0, CARD_WORKAREA);
|
memset (SysArea, 0, CARD_WORKAREA);
|
||||||
CARD_Init ("SNES", "00");
|
CARD_Init ("SNES", "00");
|
||||||
|
|
||||||
/*** Try to mount the card ***/
|
/*** Try to mount the card ***/
|
||||||
if (MountCard(slot, silent) == 0)
|
if (MountCard(slot, silent, (u8 *)SysArea) == 0)
|
||||||
{
|
{
|
||||||
// Mount successful!
|
// Mount successful!
|
||||||
if(!silent)
|
if(!silent)
|
||||||
@ -103,35 +115,14 @@ bool TestCard(int slot, bool silent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* MountCard
|
|
||||||
*
|
|
||||||
* Mounts the memory card in the given slot.
|
|
||||||
* Returns the result of the last attempted CARD_Mount command.
|
|
||||||
***************************************************************************/
|
|
||||||
int MountCard(int cslot, bool silent)
|
|
||||||
{
|
|
||||||
int ret = -1;
|
|
||||||
int tries = 0;
|
|
||||||
|
|
||||||
// Mount the card
|
|
||||||
while ( tries < 10 && ret != 0)
|
|
||||||
{
|
|
||||||
EXI_ProbeReset ();
|
|
||||||
ret = CARD_Mount (cslot, SysArea, NULL);
|
|
||||||
VIDEO_WaitVSync ();
|
|
||||||
tries++;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Verify Memory Card file against buffer
|
* Verify Memory Card file against buffer
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
static int
|
||||||
VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
||||||
{
|
{
|
||||||
|
card_file CardFile;
|
||||||
|
unsigned char verifbuffer[65536] ATTRIBUTE_ALIGN (32);
|
||||||
int CardError;
|
int CardError;
|
||||||
unsigned int blocks;
|
unsigned int blocks;
|
||||||
unsigned int SectorSize;
|
unsigned int SectorSize;
|
||||||
@ -140,11 +131,12 @@ VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
|||||||
int bytesread = 0;
|
int bytesread = 0;
|
||||||
|
|
||||||
/*** Initialize Card System ***/
|
/*** Initialize Card System ***/
|
||||||
|
u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
||||||
memset (SysArea, 0, CARD_WORKAREA);
|
memset (SysArea, 0, CARD_WORKAREA);
|
||||||
CARD_Init ("SNES", "00");
|
CARD_Init ("SNES", "00");
|
||||||
|
|
||||||
/*** Try to mount the card ***/
|
/*** Try to mount the card ***/
|
||||||
CardError = MountCard(slot, NOTSILENT);
|
CardError = MountCard(slot, NOTSILENT, (u8 *)SysArea);
|
||||||
|
|
||||||
if (CardError == 0)
|
if (CardError == 0)
|
||||||
{
|
{
|
||||||
@ -172,7 +164,7 @@ VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
|||||||
if (blocks > (unsigned int)datasize)
|
if (blocks > (unsigned int)datasize)
|
||||||
blocks = datasize;
|
blocks = datasize;
|
||||||
|
|
||||||
memset (verifbuffer, 0, VERIFBUFFERSIZE);
|
memset (verifbuffer, 0, 65536);
|
||||||
bytesleft = blocks;
|
bytesleft = blocks;
|
||||||
bytesread = 0;
|
bytesread = 0;
|
||||||
while (bytesleft > 0)
|
while (bytesleft > 0)
|
||||||
@ -213,6 +205,7 @@ VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
|||||||
int
|
int
|
||||||
LoadMCFile (char *buf, int slot, char *filename, bool silent)
|
LoadMCFile (char *buf, int slot, char *filename, bool silent)
|
||||||
{
|
{
|
||||||
|
card_file CardFile;
|
||||||
int CardError;
|
int CardError;
|
||||||
unsigned int blocks;
|
unsigned int blocks;
|
||||||
unsigned int SectorSize;
|
unsigned int SectorSize;
|
||||||
@ -220,11 +213,12 @@ LoadMCFile (char *buf, int slot, char *filename, bool silent)
|
|||||||
int bytesread = 0;
|
int bytesread = 0;
|
||||||
|
|
||||||
/*** Initialize Card System ***/
|
/*** Initialize Card System ***/
|
||||||
|
u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
||||||
memset (SysArea, 0, CARD_WORKAREA);
|
memset (SysArea, 0, CARD_WORKAREA);
|
||||||
CARD_Init ("SNES", "00");
|
CARD_Init ("SNES", "00");
|
||||||
|
|
||||||
/*** Try to mount the card ***/
|
/*** Try to mount the card ***/
|
||||||
CardError = MountCard(slot, NOTSILENT);
|
CardError = MountCard(slot, NOTSILENT, (u8 *)SysArea);
|
||||||
|
|
||||||
if (CardError == 0)
|
if (CardError == 0)
|
||||||
{
|
{
|
||||||
@ -278,6 +272,8 @@ LoadMCFile (char *buf, int slot, char *filename, bool silent)
|
|||||||
int
|
int
|
||||||
SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent)
|
SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent)
|
||||||
{
|
{
|
||||||
|
card_file CardFile;
|
||||||
|
card_stat CardStatus;
|
||||||
int CardError;
|
int CardError;
|
||||||
unsigned int blocks;
|
unsigned int blocks;
|
||||||
unsigned int SectorSize;
|
unsigned int SectorSize;
|
||||||
@ -287,11 +283,12 @@ SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*** Initialize Card System ***/
|
/*** Initialize Card System ***/
|
||||||
|
u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
||||||
memset (SysArea, 0, CARD_WORKAREA);
|
memset (SysArea, 0, CARD_WORKAREA);
|
||||||
CARD_Init ("SNES", "00");
|
CARD_Init ("SNES", "00");
|
||||||
|
|
||||||
/*** Try to mount the card ***/
|
/*** Try to mount the card ***/
|
||||||
CardError = MountCard(slot, NOTSILENT);
|
CardError = MountCard(slot, NOTSILENT, (u8 *)SysArea);
|
||||||
|
|
||||||
if (CardError == 0)
|
if (CardError == 0)
|
||||||
{
|
{
|
||||||
|
@ -13,10 +13,8 @@
|
|||||||
#ifndef _NGCMCSAVE_
|
#ifndef _NGCMCSAVE_
|
||||||
#define _NGCMCSAVE_
|
#define _NGCMCSAVE_
|
||||||
|
|
||||||
int VerifyMCFile (char *buf, int slot, char *filename, int datasize);
|
|
||||||
int LoadMCFile (char *buf, int slot, char *filename, bool silent);
|
int LoadMCFile (char *buf, int slot, char *filename, bool silent);
|
||||||
int SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent);
|
int SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent);
|
||||||
int MountCard(int cslot, bool silent);
|
|
||||||
bool TestCard(int slot, bool silent);
|
bool TestCard(int slot, bool silent);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
|
||||||
#ifdef WII_DVD
|
#ifdef HW_RVL
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
}
|
}
|
||||||
@ -56,6 +56,8 @@ extern "C" {
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
|
|
||||||
|
extern int menu;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Load Manager
|
* Load Manager
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -666,8 +668,8 @@ GetInput (u16 ctrlr_type)
|
|||||||
return pressed;
|
return pressed;
|
||||||
} // end GetInput()
|
} // end GetInput()
|
||||||
|
|
||||||
int cfg_text_count = 7;
|
static int cfg_text_count = 7;
|
||||||
char cfg_text[][50] = {
|
static char cfg_text[][50] = {
|
||||||
"Remapping ",
|
"Remapping ",
|
||||||
"Press Any Button",
|
"Press Any Button",
|
||||||
"on the",
|
"on the",
|
||||||
@ -717,8 +719,8 @@ GetButtonMap(u16 ctrlr_type, char* btn_name)
|
|||||||
return pressed;
|
return pressed;
|
||||||
} // end getButtonMap()
|
} // end getButtonMap()
|
||||||
|
|
||||||
int cfg_btns_count = 13;
|
static int cfg_btns_count = 13;
|
||||||
char cfg_btns_menu[][50] = {
|
static char cfg_btns_menu[][50] = {
|
||||||
"A - ",
|
"A - ",
|
||||||
"B - ",
|
"B - ",
|
||||||
"X - ",
|
"X - ",
|
||||||
@ -734,11 +736,6 @@ char cfg_btns_menu[][50] = {
|
|||||||
"Return to previous"
|
"Return to previous"
|
||||||
};
|
};
|
||||||
|
|
||||||
extern unsigned int gcpadmap[];
|
|
||||||
extern unsigned int wmpadmap[];
|
|
||||||
extern unsigned int ccpadmap[];
|
|
||||||
extern unsigned int ncpadmap[];
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConfigureButtons (u16 ctrlr_type)
|
ConfigureButtons (u16 ctrlr_type)
|
||||||
{
|
{
|
||||||
@ -988,8 +985,8 @@ PreferencesMenu ()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Main Menu
|
* Main Menu
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int menucount = 7;
|
static int menucount = 7;
|
||||||
char menuitems[][50] = {
|
static char menuitems[][50] = {
|
||||||
"Choose Game",
|
"Choose Game",
|
||||||
"Preferences",
|
"Preferences",
|
||||||
"Game Menu",
|
"Game Menu",
|
||||||
|
@ -35,10 +35,9 @@
|
|||||||
#include "networkop.h"
|
#include "networkop.h"
|
||||||
|
|
||||||
/*** Globals ***/
|
/*** Globals ***/
|
||||||
FT_Library ftlibrary;
|
static FT_Library ftlibrary;
|
||||||
FT_Face face;
|
static FT_Face face;
|
||||||
FT_GlyphSlot slot;
|
static FT_GlyphSlot slot;
|
||||||
FT_UInt glyph_index;
|
|
||||||
static unsigned int fonthi, fontlo;
|
static unsigned int fonthi, fontlo;
|
||||||
|
|
||||||
extern char fontface[]; /*** From fontface.s ***/
|
extern char fontface[]; /*** From fontface.s ***/
|
||||||
@ -652,7 +651,7 @@ RunMenu (char items[][50], int maxitems, const char *title, int fontsize, int x)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
|
ShowFiles (BROWSERENTRY * browserList, int maxfiles, int offset, int selection)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char text[MAXPATHLEN];
|
char text[MAXPATHLEN];
|
||||||
@ -676,15 +675,15 @@ ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
|
|||||||
j = 0;
|
j = 0;
|
||||||
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
||||||
{
|
{
|
||||||
if (filelist[i].flags) // if a dir
|
if (browserList[i].isdir) // if a dir
|
||||||
{
|
{
|
||||||
strcpy (text, "[");
|
strcpy (text, "[");
|
||||||
strcat (text, filelist[i].displayname);
|
strcat (text, browserList[i].displayname);
|
||||||
strcat (text, "]");
|
strcat (text, "]");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(text, filelist[i].displayname);
|
sprintf(text, browserList[i].displayname);
|
||||||
}
|
}
|
||||||
if (j == (selection - offset))
|
if (j == (selection - offset))
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
int FT_Init ();
|
int FT_Init ();
|
||||||
void setfontsize (int pixelsize);
|
void setfontsize (int pixelsize);
|
||||||
void setfontcolour (u8 r, u8 g, u8 b);
|
void setfontcolour (u8 r, u8 g, u8 b);
|
||||||
void DrawText (int x, int y, const char *text);
|
|
||||||
void unpackbackdrop ();
|
void unpackbackdrop ();
|
||||||
void Credits ();
|
void Credits ();
|
||||||
void RomInfo ();
|
void RomInfo ();
|
||||||
@ -35,7 +34,7 @@ void WaitButtonA ();
|
|||||||
int RunMenu (char items[][50], int maxitems, const char *title, int fontsize = 20, int x = -1);
|
int RunMenu (char items[][50], int maxitems, const char *title, int fontsize = 20, int x = -1);
|
||||||
void DrawMenu (char items[][50], const char *title, int maxitems, int selected, int fontsize = 20, int x = -1);
|
void DrawMenu (char items[][50], const char *title, int maxitems, int selected, int fontsize = 20, int x = -1);
|
||||||
void ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, int selection);
|
void ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, int selection);
|
||||||
void ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection);
|
void ShowFiles (BROWSERENTRY * browserList, int maxfiles, int offset, int selection);
|
||||||
|
|
||||||
void WaitPrompt (const char *msg);
|
void WaitPrompt (const char *msg);
|
||||||
int WaitPromptChoice (const char *msg, const char* bmsg, const char* amsg);
|
int WaitPromptChoice (const char *msg, const char* bmsg, const char* amsg);
|
||||||
@ -44,6 +43,4 @@ void ShowProgress (const char *msg, int done, int total);
|
|||||||
void DrawPolygon (int vertices, int *varray, u8 r, u8 g, u8 b);
|
void DrawPolygon (int vertices, int *varray, u8 r, u8 g, u8 b);
|
||||||
void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b );
|
void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b );
|
||||||
|
|
||||||
extern int menu;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include "fileop.h"
|
#include "fileop.h"
|
||||||
#include "http.h"
|
#include "http.h"
|
||||||
|
|
||||||
bool networkInit = false;
|
static bool networkInit = false;
|
||||||
bool autoNetworkInit = true;
|
static bool autoNetworkInit = true;
|
||||||
bool networkShareInit = false;
|
static bool networkShareInit = false;
|
||||||
bool updateChecked = false; // true if checked for app update
|
static bool updateChecked = false; // true if checked for app update
|
||||||
static char updateURL[128]; // URL of app update
|
static char updateURL[128]; // URL of app update
|
||||||
bool updateFound = false; // true if an app update was found
|
bool updateFound = false; // true if an app update was found
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ void UpdateCheck()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool unzipArchive(char * zipfilepath, char * unzipfolderpath)
|
static bool unzipArchive(char * zipfilepath, char * unzipfolderpath)
|
||||||
{
|
{
|
||||||
unzFile uf = unzOpen(zipfilepath);
|
unzFile uf = unzOpen(zipfilepath);
|
||||||
if (uf==NULL)
|
if (uf==NULL)
|
||||||
|
@ -414,9 +414,9 @@ void LoadPatch(int method)
|
|||||||
AllocSaveBuffer ();
|
AllocSaveBuffer ();
|
||||||
|
|
||||||
memset(patchpath, 0, sizeof(patchpath));
|
memset(patchpath, 0, sizeof(patchpath));
|
||||||
sprintf(patchpath[0], "%s/%s.ips", currentdir, Memory.ROMFilename);
|
sprintf(patchpath[0], "%s/%s.ips", browser.dir, Memory.ROMFilename);
|
||||||
sprintf(patchpath[1], "%s/%s.ups", currentdir, Memory.ROMFilename);
|
sprintf(patchpath[1], "%s/%s.ups", browser.dir, Memory.ROMFilename);
|
||||||
sprintf(patchpath[2], "%s/%s.ppf", currentdir, Memory.ROMFilename);
|
sprintf(patchpath[2], "%s/%s.ppf", browser.dir, Memory.ROMFilename);
|
||||||
|
|
||||||
for(patchtype=0; patchtype<3; patchtype++)
|
for(patchtype=0; patchtype<3; patchtype++)
|
||||||
{
|
{
|
||||||
|
@ -22,42 +22,40 @@
|
|||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
extern int currconfig[4];
|
static char prefscomment[2][32];
|
||||||
|
|
||||||
char prefscomment[2][32];
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Prepare Preferences Data
|
* Prepare Preferences Data
|
||||||
*
|
*
|
||||||
* This sets up the save buffer for saving.
|
* This sets up the save buffer for saving.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
mxml_node_t *xml;
|
static mxml_node_t *xml;
|
||||||
mxml_node_t *data;
|
static mxml_node_t *data;
|
||||||
mxml_node_t *section;
|
static mxml_node_t *section;
|
||||||
mxml_node_t *item;
|
static mxml_node_t *item;
|
||||||
mxml_node_t *elem;
|
static mxml_node_t *elem;
|
||||||
|
|
||||||
char temp[20];
|
static char temp[20];
|
||||||
|
|
||||||
const char * toStr(int i)
|
static const char * toStr(int i)
|
||||||
{
|
{
|
||||||
sprintf(temp, "%d", i);
|
sprintf(temp, "%d", i);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
const char * FtoStr(float i)
|
static const char * FtoStr(float i)
|
||||||
{
|
{
|
||||||
sprintf(temp, "%.2f", i);
|
sprintf(temp, "%.2f", i);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void createXMLSection(const char * name, const char * description)
|
static void createXMLSection(const char * name, const char * description)
|
||||||
{
|
{
|
||||||
section = mxmlNewElement(data, "section");
|
section = mxmlNewElement(data, "section");
|
||||||
mxmlElementSetAttr(section, "name", name);
|
mxmlElementSetAttr(section, "name", name);
|
||||||
mxmlElementSetAttr(section, "description", description);
|
mxmlElementSetAttr(section, "description", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createXMLSetting(const char * name, const char * description, const char * value)
|
static void createXMLSetting(const char * name, const char * description, const char * value)
|
||||||
{
|
{
|
||||||
item = mxmlNewElement(section, "setting");
|
item = mxmlNewElement(section, "setting");
|
||||||
mxmlElementSetAttr(item, "name", name);
|
mxmlElementSetAttr(item, "name", name);
|
||||||
@ -65,7 +63,7 @@ void createXMLSetting(const char * name, const char * description, const char *
|
|||||||
mxmlElementSetAttr(item, "description", description);
|
mxmlElementSetAttr(item, "description", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createXMLController(unsigned int controller[], const char * name, const char * description)
|
static void createXMLController(unsigned int controller[], const char * name, const char * description)
|
||||||
{
|
{
|
||||||
item = mxmlNewElement(section, "controller");
|
item = mxmlNewElement(section, "controller");
|
||||||
mxmlElementSetAttr(item, "name", name);
|
mxmlElementSetAttr(item, "name", name);
|
||||||
@ -80,7 +78,7 @@ void createXMLController(unsigned int controller[], const char * name, const cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * XMLSaveCallback(mxml_node_t *node, int where)
|
static const char * XMLSaveCallback(mxml_node_t *node, int where)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
@ -108,7 +106,7 @@ const char * XMLSaveCallback(mxml_node_t *node, int where)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
static int
|
||||||
preparePrefsData (int method)
|
preparePrefsData (int method)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@ -189,25 +187,25 @@ preparePrefsData (int method)
|
|||||||
* Load XML elements into variables for an individual variable
|
* Load XML elements into variables for an individual variable
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void loadXMLSetting(char * var, const char * name, int maxsize)
|
static void loadXMLSetting(char * var, const char * name, int maxsize)
|
||||||
{
|
{
|
||||||
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||||
if(item)
|
if(item)
|
||||||
snprintf(var, maxsize, "%s", mxmlElementGetAttr(item, "value"));
|
snprintf(var, maxsize, "%s", mxmlElementGetAttr(item, "value"));
|
||||||
}
|
}
|
||||||
void loadXMLSetting(int * var, const char * name)
|
static void loadXMLSetting(int * var, const char * name)
|
||||||
{
|
{
|
||||||
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||||
if(item)
|
if(item)
|
||||||
*var = atoi(mxmlElementGetAttr(item, "value"));
|
*var = atoi(mxmlElementGetAttr(item, "value"));
|
||||||
}
|
}
|
||||||
void loadXMLSetting(float * var, const char * name)
|
static void loadXMLSetting(float * var, const char * name)
|
||||||
{
|
{
|
||||||
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||||
if(item)
|
if(item)
|
||||||
*var = atof(mxmlElementGetAttr(item, "value"));
|
*var = atof(mxmlElementGetAttr(item, "value"));
|
||||||
}
|
}
|
||||||
void loadXMLSetting(bool8 * var, const char * name)
|
static void loadXMLSetting(bool8 * var, const char * name)
|
||||||
{
|
{
|
||||||
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||||
if(item)
|
if(item)
|
||||||
@ -220,7 +218,7 @@ void loadXMLSetting(bool8 * var, const char * name)
|
|||||||
* Load XML elements into variables for a controller mapping
|
* Load XML elements into variables for a controller mapping
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void loadXMLController(unsigned int controller[], const char * name)
|
static void loadXMLController(unsigned int controller[], const char * name)
|
||||||
{
|
{
|
||||||
item = mxmlFindElement(xml, xml, "controller", "name", name, MXML_DESCEND);
|
item = mxmlFindElement(xml, xml, "controller", "name", name, MXML_DESCEND);
|
||||||
|
|
||||||
@ -242,7 +240,7 @@ void loadXMLController(unsigned int controller[], const char * name)
|
|||||||
* Decodes preferences - parses XML and loads preferences into the variables
|
* Decodes preferences - parses XML and loads preferences into the variables
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
bool
|
static bool
|
||||||
decodePrefsData (int method)
|
decodePrefsData (int method)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
@ -342,6 +342,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Initialise video
|
// Initialise video
|
||||||
InitGCVideo();
|
InitGCVideo();
|
||||||
|
ResetVideo_Menu (); // change to menu video mode
|
||||||
|
|
||||||
// Controllers
|
// Controllers
|
||||||
PAD_Init ();
|
PAD_Init ();
|
||||||
|
@ -44,10 +44,10 @@ static unsigned char gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN (32);
|
|||||||
static unsigned char texturemem[TEX_WIDTH * (TEX_HEIGHT + 8)] ATTRIBUTE_ALIGN (32);
|
static unsigned char texturemem[TEX_WIDTH * (TEX_HEIGHT + 8)] ATTRIBUTE_ALIGN (32);
|
||||||
GXTexObj texobj;
|
GXTexObj texobj;
|
||||||
Mtx view;
|
Mtx view;
|
||||||
int vwidth, vheight, oldvwidth, oldvheight;
|
static int vwidth, vheight, oldvwidth, oldvheight;
|
||||||
|
|
||||||
int zoom_xshift = 0;
|
static int zoom_xshift = 0;
|
||||||
int zoom_yshift = 0;
|
static int zoom_yshift = 0;
|
||||||
|
|
||||||
u32 FrameTimer = 0;
|
u32 FrameTimer = 0;
|
||||||
|
|
||||||
@ -249,8 +249,8 @@ GXRModeObj *tvmodes[4] = {
|
|||||||
* VideoThreading
|
* VideoThreading
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define TSTACK 16384
|
#define TSTACK 16384
|
||||||
lwpq_t videoblankqueue;
|
static lwpq_t videoblankqueue;
|
||||||
lwp_t vbthread;
|
static lwp_t vbthread;
|
||||||
static unsigned char vbstack[TSTACK];
|
static unsigned char vbstack[TSTACK];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -656,7 +656,7 @@ ResetVideo_Menu ()
|
|||||||
*
|
*
|
||||||
* Proper GNU Asm rendition of the above, converted by shagkur. - Thanks!
|
* Proper GNU Asm rendition of the above, converted by shagkur. - Thanks!
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void
|
static void
|
||||||
MakeTexture (const void *src, void *dst, s32 width, s32 height)
|
MakeTexture (const void *src, void *dst, s32 width, s32 height)
|
||||||
{
|
{
|
||||||
register u32 tmp0 = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0;
|
register u32 tmp0 = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0;
|
||||||
|
@ -29,9 +29,4 @@ void zoom_reset ();
|
|||||||
|
|
||||||
extern bool progressive;
|
extern bool progressive;
|
||||||
|
|
||||||
#ifdef _DEBUG_VIDEO
|
|
||||||
// log stuff
|
|
||||||
extern FILE * debughandle;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,12 +84,6 @@ woven in by Terry Thorsen 1/2003.
|
|||||||
#define SIZECENTRALDIRITEM (0x2e)
|
#define SIZECENTRALDIRITEM (0x2e)
|
||||||
#define SIZEZIPLOCALHEADER (0x1e)
|
#define SIZEZIPLOCALHEADER (0x1e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char unz_copyright[] =
|
|
||||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
|
||||||
|
|
||||||
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
||||||
typedef struct unz_file_info_internal_s
|
typedef struct unz_file_info_internal_s
|
||||||
{
|
{
|
||||||
@ -412,9 +406,6 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
|
|||||||
|
|
||||||
int err=UNZ_OK;
|
int err=UNZ_OK;
|
||||||
|
|
||||||
if (unz_copyright[0]!=' ')
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (pzlib_filefunc_def==NULL)
|
if (pzlib_filefunc_def==NULL)
|
||||||
fill_fopen_filefunc(&us.z_filefunc);
|
fill_fopen_filefunc(&us.z_filefunc);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user