mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-12-25 02:31:50 +01:00
small improvements
This commit is contained in:
parent
61f9a207c2
commit
8fba5d861e
@ -278,10 +278,10 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum)
|
||||
{
|
||||
if(GCSettings.SaveMethod == DEVICE_AUTO)
|
||||
GCSettings.SaveMethod = autoSaveMethod(SILENT);
|
||||
|
||||
|
||||
if(GCSettings.SaveMethod == DEVICE_AUTO)
|
||||
return false;
|
||||
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case FILE_SRAM:
|
||||
|
@ -101,6 +101,8 @@ ParseMCDirectory (int slot)
|
||||
int CardError;
|
||||
int entryNum = 0;
|
||||
|
||||
HaltDeviceThread();
|
||||
|
||||
// Try to mount the card
|
||||
CardError = MountMC(slot, NOTSILENT);
|
||||
|
||||
@ -109,20 +111,11 @@ ParseMCDirectory (int slot)
|
||||
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
||||
while (CardError != CARD_ERROR_NOFILE)
|
||||
{
|
||||
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
||||
|
||||
if(!newBrowserList) // failed to allocate required memory
|
||||
if(!AddBrowserEntry())
|
||||
{
|
||||
ResetBrowser();
|
||||
ErrorPrompt("Out of memory: too many files!");
|
||||
entryNum = -1;
|
||||
entryNum = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
browserList = newBrowserList;
|
||||
}
|
||||
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||
|
||||
strncpy(browserList[entryNum].filename, (char *)CardDir.filename, MAXJOLIET);
|
||||
StripExt(browserList[entryNum].displayname, browserList[entryNum].filename); // hide file extension
|
||||
@ -135,6 +128,8 @@ ParseMCDirectory (int slot)
|
||||
CARD_Unmount(slot);
|
||||
}
|
||||
|
||||
ResumeDeviceThread();
|
||||
|
||||
// Sort the file list
|
||||
qsort(browserList, entryNum, sizeof(BROWSERENTRY), FileSortCallback);
|
||||
|
||||
|
@ -241,24 +241,18 @@ ConnectShare (bool silent)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
int chkU = (strlen(GCSettings.smbuser) > 0) ? 0:1;
|
||||
int chkP = (strlen(GCSettings.smbpwd) > 0) ? 0:1;
|
||||
int chkS = (strlen(GCSettings.smbshare) > 0) ? 0:1;
|
||||
int chkI = (strlen(GCSettings.smbip) > 0) ? 0:1;
|
||||
|
||||
// check that all parameters have been set
|
||||
if(chkU + chkP + chkS + chkI > 0)
|
||||
if(chkS + chkI > 0)
|
||||
{
|
||||
if(!silent)
|
||||
{
|
||||
char msg[50];
|
||||
char msg2[100];
|
||||
if(chkU + chkP + chkS + chkI > 1) // more than one thing is wrong
|
||||
if(chkS + chkI > 1) // more than one thing is wrong
|
||||
sprintf(msg, "Check settings.xml.");
|
||||
else if(chkU)
|
||||
sprintf(msg, "Username is blank.");
|
||||
else if(chkP)
|
||||
sprintf(msg, "Password is blank.");
|
||||
else if(chkS)
|
||||
sprintf(msg, "Share name is blank.");
|
||||
else if(chkI)
|
||||
|
Loading…
Reference in New Issue
Block a user