mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 18:49:18 +01:00
rewritten code, many bugfixes
This commit is contained in:
parent
1fac866d18
commit
ff78bdfaa5
@ -632,7 +632,7 @@ OpenGameList ()
|
|||||||
{
|
{
|
||||||
int device = GCSettings.LoadMethod;
|
int device = GCSettings.LoadMethod;
|
||||||
|
|
||||||
if(device == DEVICE_AUTO)
|
if(device == DEVICE_AUTO && strlen(GCSettings.LoadFolder) > 0)
|
||||||
device = autoLoadMethod();
|
device = autoLoadMethod();
|
||||||
|
|
||||||
// change current dir to roms directory
|
// change current dir to roms directory
|
||||||
|
@ -240,7 +240,8 @@ void UnmountAllFAT()
|
|||||||
|
|
||||||
static bool MountFAT(int device, int silent)
|
static bool MountFAT(int device, int silent)
|
||||||
{
|
{
|
||||||
bool mounted = true; // assume our disc is already mounted
|
bool mounted = false;
|
||||||
|
int retry = 1;
|
||||||
char name[10], name2[10];
|
char name[10], name2[10];
|
||||||
const DISC_INTERFACE* disc = NULL;
|
const DISC_INTERFACE* disc = NULL;
|
||||||
|
|
||||||
@ -281,20 +282,19 @@ static bool MountFAT(int device, int silent)
|
|||||||
disc->shutdown();
|
disc->shutdown();
|
||||||
isMounted[device] = false;
|
isMounted[device] = false;
|
||||||
}
|
}
|
||||||
if(!isMounted[device])
|
|
||||||
{
|
|
||||||
if(!disc->startup())
|
|
||||||
mounted = false;
|
|
||||||
else if(!fatMountSimple(name, disc))
|
|
||||||
mounted = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mounted && !silent)
|
while(retry)
|
||||||
{
|
{
|
||||||
|
if(disc->startup() && fatMountSimple(name, disc))
|
||||||
|
mounted = true;
|
||||||
|
|
||||||
|
if(mounted || silent)
|
||||||
|
break;
|
||||||
|
|
||||||
if(device == DEVICE_SD)
|
if(device == DEVICE_SD)
|
||||||
ErrorPrompt("SD card not found!");
|
retry = ErrorPromptRetry("SD card not found!");
|
||||||
else
|
else
|
||||||
ErrorPrompt("USB drive not found!");
|
retry = ErrorPromptRetry("USB drive not found!");
|
||||||
}
|
}
|
||||||
|
|
||||||
isMounted[device] = mounted;
|
isMounted[device] = mounted;
|
||||||
@ -319,12 +319,8 @@ void MountAllFAT()
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
bool MountDVD(bool silent)
|
bool MountDVD(bool silent)
|
||||||
{
|
{
|
||||||
if(isMounted[DEVICE_DVD])
|
|
||||||
return true;
|
|
||||||
|
|
||||||
ShowAction("Loading DVD...");
|
|
||||||
|
|
||||||
bool mounted = false;
|
bool mounted = false;
|
||||||
|
int retry = 1;
|
||||||
|
|
||||||
if(unmountRequired[DEVICE_DVD])
|
if(unmountRequired[DEVICE_DVD])
|
||||||
{
|
{
|
||||||
@ -332,19 +328,29 @@ bool MountDVD(bool silent)
|
|||||||
ISO9660_Unmount();
|
ISO9660_Unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
mounted = dvd->isInserted();
|
while(retry)
|
||||||
|
|
||||||
if(!mounted)
|
|
||||||
{
|
{
|
||||||
if(!silent)
|
ShowAction("Loading DVD...");
|
||||||
ErrorPrompt("No disc inserted!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mounted = ISO9660_Mount();
|
|
||||||
|
|
||||||
if(!mounted && !silent)
|
if(!dvd->isInserted())
|
||||||
ErrorPrompt("Invalid DVD.");
|
{
|
||||||
|
if(silent)
|
||||||
|
break;
|
||||||
|
|
||||||
|
retry = ErrorPromptRetry("No disc inserted!");
|
||||||
|
}
|
||||||
|
else if(!ISO9660_Mount())
|
||||||
|
{
|
||||||
|
if(silent)
|
||||||
|
break;
|
||||||
|
|
||||||
|
retry = ErrorPromptRetry("Invalid DVD.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mounted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CancelAction();
|
CancelAction();
|
||||||
isMounted[DEVICE_DVD] = mounted;
|
isMounted[DEVICE_DVD] = mounted;
|
||||||
@ -418,6 +424,9 @@ char * StripDevice(char * path)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
bool ChangeInterface(int device, bool silent)
|
bool ChangeInterface(int device, bool silent)
|
||||||
{
|
{
|
||||||
|
if(isMounted[device])
|
||||||
|
return true;
|
||||||
|
|
||||||
bool mounted = false;
|
bool mounted = false;
|
||||||
|
|
||||||
switch(device)
|
switch(device)
|
||||||
@ -576,14 +585,17 @@ ParseDirectory(bool waitParse)
|
|||||||
// if we can't open the dir, try higher levels
|
// if we can't open the dir, try higher levels
|
||||||
if (dirIter == NULL)
|
if (dirIter == NULL)
|
||||||
{
|
{
|
||||||
|
char * devEnd = strrchr(browser.dir, '/');
|
||||||
|
|
||||||
while(!IsDeviceRoot(browser.dir))
|
while(!IsDeviceRoot(browser.dir))
|
||||||
{
|
{
|
||||||
char * devEnd = strrchr(browser.dir, '/');
|
devEnd[0] = 0; // strip slash
|
||||||
|
devEnd = strrchr(browser.dir, '/');
|
||||||
|
|
||||||
if(devEnd == NULL)
|
if(devEnd == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
devEnd[0] = 0; // strip remaining file listing
|
devEnd[1] = 0; // strip remaining file listing
|
||||||
dirIter = diropen(browser.dir);
|
dirIter = diropen(browser.dir);
|
||||||
if (dirIter)
|
if (dirIter)
|
||||||
break;
|
break;
|
||||||
@ -688,8 +700,7 @@ size_t
|
|||||||
LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
|
LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
|
||||||
{
|
{
|
||||||
char zipbuffer[2048];
|
char zipbuffer[2048];
|
||||||
size_t size = 0;
|
size_t size = 0, offset = 0, readsize = 0;
|
||||||
size_t readsize = 0;
|
|
||||||
int retry = 1;
|
int retry = 1;
|
||||||
int device;
|
int device;
|
||||||
|
|
||||||
@ -714,75 +725,62 @@ LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// open the file
|
// open the file
|
||||||
while(!size && retry == 1)
|
while(!size && retry)
|
||||||
{
|
{
|
||||||
if(ChangeInterface(device, silent))
|
if(!ChangeInterface(device, silent))
|
||||||
|
break;
|
||||||
|
|
||||||
|
file = fopen (filepath, "rb");
|
||||||
|
|
||||||
|
if(!file)
|
||||||
{
|
{
|
||||||
file = fopen (filepath, "rb");
|
if(silent)
|
||||||
|
break;
|
||||||
|
|
||||||
if(file > 0)
|
retry = ErrorPromptRetry("Error opening file!");
|
||||||
{
|
continue;
|
||||||
if(length > 0 && length <= 2048) // do a partial read (eg: to check file header)
|
|
||||||
{
|
|
||||||
size = fread (rbuffer, 1, length, file);
|
|
||||||
}
|
|
||||||
else // load whole file
|
|
||||||
{
|
|
||||||
readsize = fread (zipbuffer, 1, 2048, file);
|
|
||||||
|
|
||||||
if(readsize > 0)
|
|
||||||
{
|
|
||||||
if (IsZipFile (zipbuffer))
|
|
||||||
{
|
|
||||||
size = UnZipBuffer ((unsigned char *)rbuffer); // unzip
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct stat fileinfo;
|
|
||||||
if(fstat(file->_file, &fileinfo) == 0)
|
|
||||||
{
|
|
||||||
size = fileinfo.st_size;
|
|
||||||
|
|
||||||
memcpy (rbuffer, zipbuffer, readsize); // copy what we already read
|
|
||||||
|
|
||||||
size_t offset = readsize;
|
|
||||||
size_t nextread = 0;
|
|
||||||
while(offset < size)
|
|
||||||
{
|
|
||||||
if(size - offset > 4*1024) nextread = 4*1024;
|
|
||||||
else nextread = size-offset;
|
|
||||||
ShowProgress ("Loading...", offset, size);
|
|
||||||
readsize = fread (rbuffer + offset, 1, nextread, file); // read in next chunk
|
|
||||||
|
|
||||||
if(readsize <= 0 || readsize > nextread)
|
|
||||||
break; // read failure
|
|
||||||
|
|
||||||
if(readsize > 0)
|
|
||||||
offset += readsize;
|
|
||||||
}
|
|
||||||
CancelAction();
|
|
||||||
|
|
||||||
if(offset != size) // # bytes read doesn't match # expected
|
|
||||||
size = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose (file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(!size)
|
|
||||||
|
if(length > 0 && length <= 2048) // do a partial read (eg: to check file header)
|
||||||
{
|
{
|
||||||
if(!silent)
|
size = fread (rbuffer, 1, length, file);
|
||||||
|
}
|
||||||
|
else // load whole file
|
||||||
|
{
|
||||||
|
readsize = fread (zipbuffer, 1, 32, file);
|
||||||
|
|
||||||
|
if(!readsize)
|
||||||
{
|
{
|
||||||
unmountRequired[device] = true;
|
unmountRequired[device] = true;
|
||||||
retry = ErrorPromptRetry("Error loading file!");
|
retry = ErrorPromptRetry("Error reading file!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsZipFile (zipbuffer))
|
||||||
|
{
|
||||||
|
size = UnZipBuffer ((unsigned char *)rbuffer); // unzip
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
retry = 0;
|
fseeko(file,0,SEEK_END);
|
||||||
|
size = ftello(file);
|
||||||
|
fseeko(file,0,SEEK_SET);
|
||||||
|
|
||||||
|
while(!feof(file))
|
||||||
|
{
|
||||||
|
ShowProgress ("Loading...", offset, size);
|
||||||
|
readsize = fread (rbuffer + offset, 1, 4096, file); // read in next chunk
|
||||||
|
|
||||||
|
if(readsize <= 0)
|
||||||
|
break; // reading finished (or failed)
|
||||||
|
|
||||||
|
offset += readsize;
|
||||||
|
}
|
||||||
|
size = offset;
|
||||||
|
CancelAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fclose (file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,6 +803,7 @@ size_t
|
|||||||
SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
||||||
{
|
{
|
||||||
size_t written = 0;
|
size_t written = 0;
|
||||||
|
size_t writesize, nextwrite;
|
||||||
int retry = 1;
|
int retry = 1;
|
||||||
int device;
|
int device;
|
||||||
|
|
||||||
@ -815,7 +814,7 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// stop checking if devices were removed/inserted
|
// stop checking if devices were removed/inserted
|
||||||
// since we're loading a file
|
// since we're saving a file
|
||||||
HaltDeviceThread();
|
HaltDeviceThread();
|
||||||
|
|
||||||
// halt parsing
|
// halt parsing
|
||||||
@ -835,33 +834,35 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
|||||||
{
|
{
|
||||||
while(!written && retry == 1)
|
while(!written && retry == 1)
|
||||||
{
|
{
|
||||||
if(ChangeInterface(device, silent))
|
if(!ChangeInterface(device, silent))
|
||||||
|
break;
|
||||||
|
|
||||||
|
file = fopen (filepath, "wb");
|
||||||
|
|
||||||
|
if(!file)
|
||||||
{
|
{
|
||||||
file = fopen (filepath, "wb");
|
if(silent)
|
||||||
|
break;
|
||||||
|
|
||||||
if (file > 0)
|
retry = ErrorPromptRetry("Error creating file!");
|
||||||
{
|
continue;
|
||||||
size_t writesize, nextwrite;
|
|
||||||
while(written < datasize)
|
|
||||||
{
|
|
||||||
if(datasize - written > 4*1024) nextwrite=4*1024;
|
|
||||||
else nextwrite = datasize-written;
|
|
||||||
writesize = fwrite (buffer+written, 1, nextwrite, file);
|
|
||||||
if(writesize != nextwrite) break; // write failure
|
|
||||||
written += writesize;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(written != datasize) written = 0;
|
|
||||||
fclose (file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while(written < datasize)
|
||||||
|
{
|
||||||
|
if(datasize - written > 4096) nextwrite=4096;
|
||||||
|
else nextwrite = datasize-written;
|
||||||
|
writesize = fwrite (buffer+written, 1, nextwrite, file);
|
||||||
|
if(writesize != nextwrite) break; // write failure
|
||||||
|
written += writesize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(written != datasize) written = 0;
|
||||||
|
|
||||||
if(!written)
|
if(!written)
|
||||||
{
|
{
|
||||||
unmountRequired[device] = true;
|
unmountRequired[device] = true;
|
||||||
if(!silent)
|
retry = ErrorPromptRetry("Error saving file!");
|
||||||
retry = ErrorPromptRetry("Error saving file!");
|
|
||||||
else
|
|
||||||
retry = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -987,6 +987,7 @@ static int MenuGameSelection()
|
|||||||
ExitRequested = 1;
|
ExitRequested = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HaltParseThread(); // halt parsing
|
||||||
HaltGui();
|
HaltGui();
|
||||||
mainWindow->Remove(&titleTxt);
|
mainWindow->Remove(&titleTxt);
|
||||||
mainWindow->Remove(&buttonWindow);
|
mainWindow->Remove(&buttonWindow);
|
||||||
|
@ -21,6 +21,7 @@ ConnectShare (bool silent)
|
|||||||
#include <network.h>
|
#include <network.h>
|
||||||
#include <smb.h>
|
#include <smb.h>
|
||||||
#include <mxml.h>
|
#include <mxml.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
#include "miniunz.h"
|
#include "miniunz.h"
|
||||||
@ -183,9 +184,14 @@ void InitializeNetwork(bool silent)
|
|||||||
{
|
{
|
||||||
// stop if we're already initialized, or if auto-init has failed before
|
// stop if we're already initialized, or if auto-init has failed before
|
||||||
// in which case, manual initialization is required
|
// in which case, manual initialization is required
|
||||||
if(networkInit || !autoNetworkInit)
|
if(networkInit || (silent && !autoNetworkInit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int retry = 1;
|
||||||
|
char ip[16];
|
||||||
|
char msg[150];
|
||||||
|
s32 initResult;
|
||||||
|
|
||||||
if(!silent)
|
if(!silent)
|
||||||
ShowAction ("Initializing network...");
|
ShowAction ("Initializing network...");
|
||||||
|
|
||||||
@ -196,25 +202,25 @@ void InitializeNetwork(bool silent)
|
|||||||
{
|
{
|
||||||
inNetworkInit = true;
|
inNetworkInit = true;
|
||||||
|
|
||||||
char ip[16];
|
while(retry)
|
||||||
s32 initResult = if_config(ip, NULL, NULL, true);
|
|
||||||
|
|
||||||
if(initResult == 0)
|
|
||||||
{
|
{
|
||||||
networkInit = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// do not automatically attempt a reconnection
|
|
||||||
autoNetworkInit = false;
|
|
||||||
|
|
||||||
if(!silent)
|
if(!silent)
|
||||||
{
|
ShowAction ("Initializing network...");
|
||||||
char msg[150];
|
|
||||||
sprintf(msg, "Unable to initialize network (Error #: %i)", initResult);
|
initResult = if_config(ip, NULL, NULL, true);
|
||||||
ErrorPrompt(msg);
|
|
||||||
}
|
if(initResult == 0)
|
||||||
|
networkInit = true;
|
||||||
|
|
||||||
|
if(networkInit || silent)
|
||||||
|
break;
|
||||||
|
|
||||||
|
sprintf(msg, "Unable to initialize network (Error #: %i)", initResult);
|
||||||
|
retry = ErrorPromptRetry(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do not automatically attempt a reconnection
|
||||||
|
autoNetworkInit = false;
|
||||||
inNetworkInit = false;
|
inNetworkInit = false;
|
||||||
}
|
}
|
||||||
if(!silent)
|
if(!silent)
|
||||||
@ -226,7 +232,6 @@ void CloseShare()
|
|||||||
if(networkShareInit)
|
if(networkShareInit)
|
||||||
smbClose("smb");
|
smbClose("smb");
|
||||||
networkShareInit = false;
|
networkShareInit = false;
|
||||||
networkInit = false; // trigger a network reinit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -241,6 +246,7 @@ ConnectShare (bool silent)
|
|||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int retry = 1;
|
||||||
int chkS = (strlen(GCSettings.smbshare) > 0) ? 0:1;
|
int chkS = (strlen(GCSettings.smbshare) > 0) ? 0:1;
|
||||||
int chkI = (strlen(GCSettings.smbip) > 0) ? 0:1;
|
int chkI = (strlen(GCSettings.smbip) > 0) ? 0:1;
|
||||||
|
|
||||||
@ -270,27 +276,26 @@ ConnectShare (bool silent)
|
|||||||
if(!networkInit)
|
if(!networkInit)
|
||||||
InitializeNetwork(silent);
|
InitializeNetwork(silent);
|
||||||
|
|
||||||
if(networkInit)
|
if(!networkInit)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
while(retry)
|
||||||
{
|
{
|
||||||
if(!networkShareInit)
|
if(!silent)
|
||||||
{
|
ShowAction ("Connecting to network share...");
|
||||||
if(!silent)
|
|
||||||
ShowAction ("Connecting to network share...");
|
|
||||||
|
|
||||||
if(smbInit(GCSettings.smbuser, GCSettings.smbpwd,
|
if(smbInit(GCSettings.smbuser, GCSettings.smbpwd, GCSettings.smbshare, GCSettings.smbip))
|
||||||
GCSettings.smbshare, GCSettings.smbip))
|
networkShareInit = true;
|
||||||
{
|
|
||||||
networkShareInit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!silent)
|
if(networkShareInit || silent)
|
||||||
CancelAction();
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if(!networkShareInit && !silent)
|
retry = ErrorPromptRetry("Failed to connect to network share.");
|
||||||
ErrorPrompt("Failed to connect to network share.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!silent)
|
||||||
|
CancelAction();
|
||||||
|
|
||||||
return networkShareInit;
|
return networkShareInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +547,7 @@ decodePalsData ()
|
|||||||
* Save Preferences
|
* Save Preferences
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static char prefpath[MAXPATHLEN] = { 0 };
|
static char prefpath[MAXPATHLEN] = { 0 };
|
||||||
|
static char palpath[MAXPATHLEN] = { 0 };
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SavePrefs (bool silent)
|
SavePrefs (bool silent)
|
||||||
@ -568,7 +569,7 @@ SavePrefs (bool silent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
device = autoLoadMethod();
|
device = autoSaveMethod(silent);
|
||||||
|
|
||||||
if(device == 0)
|
if(device == 0)
|
||||||
return false;
|
return false;
|
||||||
@ -576,7 +577,7 @@ SavePrefs (bool silent)
|
|||||||
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
||||||
sprintf(filepath, "%s%s", pathPrefix[device], PREF_FILE_NAME);
|
sprintf(filepath, "%s%s", pathPrefix[device], PREF_FILE_NAME);
|
||||||
else
|
else
|
||||||
sprintf(filepath, "%ssnes9x/%s", pathPrefix[device], PREF_FILE_NAME);
|
sprintf(filepath, "%s%s/%s", pathPrefix[device], APPFOLDER, PREF_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(device == 0)
|
if(device == 0)
|
||||||
@ -690,9 +691,9 @@ bool SavePalettes(bool silent)
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
int device = 0;
|
int device = 0;
|
||||||
|
|
||||||
if(prefpath[0] != 0)
|
if(palpath[0] != 0)
|
||||||
{
|
{
|
||||||
strcpy(filepath, prefpath);
|
strcpy(filepath, palpath);
|
||||||
FindDevice(filepath, &device);
|
FindDevice(filepath, &device);
|
||||||
}
|
}
|
||||||
else if(appPath[0] != 0)
|
else if(appPath[0] != 0)
|
||||||
@ -702,7 +703,7 @@ bool SavePalettes(bool silent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
device = autoLoadMethod();
|
device = autoSaveMethod(silent);
|
||||||
|
|
||||||
if(device == 0)
|
if(device == 0)
|
||||||
return false;
|
return false;
|
||||||
@ -710,7 +711,7 @@ bool SavePalettes(bool silent)
|
|||||||
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
||||||
sprintf(filepath, "%s%s", pathPrefix[device], PAL_FILE_NAME);
|
sprintf(filepath, "%s%s", pathPrefix[device], PAL_FILE_NAME);
|
||||||
else
|
else
|
||||||
sprintf(filepath, "%ssnes9x/%s", pathPrefix[device], PAL_FILE_NAME);
|
sprintf(filepath, "%s%s/%s", pathPrefix[device], APPFOLDER, PAL_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(device == 0)
|
if(device == 0)
|
||||||
@ -787,6 +788,7 @@ bool LoadPalettes()
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
char filepath[4][MAXPATHLEN];
|
char filepath[4][MAXPATHLEN];
|
||||||
int numDevices;
|
int numDevices;
|
||||||
|
int i;
|
||||||
|
|
||||||
AllocSaveBuffer ();
|
AllocSaveBuffer ();
|
||||||
|
|
||||||
@ -803,7 +805,7 @@ bool LoadPalettes()
|
|||||||
sprintf(filepath[3], "mcb:/%s", PAL_FILE_NAME);
|
sprintf(filepath[3], "mcb:/%s", PAL_FILE_NAME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(int i=0; i<numDevices; i++)
|
for(i=0; i<numDevices; i++)
|
||||||
{
|
{
|
||||||
offset = LoadFile(filepath[i], SILENT);
|
offset = LoadFile(filepath[i], SILENT);
|
||||||
|
|
||||||
@ -814,6 +816,9 @@ bool LoadPalettes()
|
|||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
retval = decodePalsData ();
|
retval = decodePalsData ();
|
||||||
|
|
||||||
|
if(retval)
|
||||||
|
strcpy(palpath, filepath[i]);
|
||||||
|
|
||||||
FreeSaveBuffer ();
|
FreeSaveBuffer ();
|
||||||
|
|
||||||
// add hard-coded palettes
|
// add hard-coded palettes
|
||||||
|
@ -61,9 +61,6 @@ extern FILE *out;
|
|||||||
|
|
||||||
static void ExitCleanup()
|
static void ExitCleanup()
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
|
||||||
ShutoffRumble();
|
|
||||||
#endif
|
|
||||||
ShutdownAudio();
|
ShutdownAudio();
|
||||||
StopGX();
|
StopGX();
|
||||||
if (out) fclose(out);
|
if (out) fclose(out);
|
||||||
@ -84,6 +81,10 @@ static void ExitCleanup()
|
|||||||
|
|
||||||
void ExitApp()
|
void ExitApp()
|
||||||
{
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
|
ShutoffRumble();
|
||||||
|
#endif
|
||||||
|
|
||||||
SavePrefs(SILENT);
|
SavePrefs(SILENT);
|
||||||
|
|
||||||
if (ROMLoaded && !ConfigRequested && GCSettings.AutoSave == 1)
|
if (ROMLoaded && !ConfigRequested && GCSettings.AutoSave == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user