minor bugfixes

This commit is contained in:
dborth 2008-11-26 07:40:43 +00:00
parent 26ed480183
commit d844b56dcb
9 changed files with 28 additions and 20 deletions

View File

@ -279,7 +279,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
fclose((FILE *)t); fclose((FILE *)t);
else /* Probably gzip */ else /* Probably gzip */
{ {
int fd; int fd = 0;
/*** REMOVED GCV1.0 /*** REMOVED GCV1.0
fd = dup(fileno( (FILE *)t)); fd = dup(fileno( (FILE *)t));

View File

@ -163,7 +163,7 @@ local int unzlocal_getShort (fin,pX)
uLong *pX; uLong *pX;
{ {
uLong x ; uLong x ;
int i; int i = 0;
int err; int err;
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
@ -185,7 +185,7 @@ local int unzlocal_getLong (fin,pX)
uLong *pX; uLong *pX;
{ {
uLong x ; uLong x ;
int i; int i = 0;
int err; int err;
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);

View File

@ -332,6 +332,7 @@ static int
getentry (int entrycount, unsigned char dvdbuffer[]) getentry (int entrycount, unsigned char dvdbuffer[])
{ {
char fname[512]; /* Huge, but experience has determined this */ char fname[512]; /* Huge, but experience has determined this */
char tmpname[512];
char *ptr; char *ptr;
char *filename; char *filename;
char *filenamelength; char *filenamelength;
@ -411,8 +412,9 @@ getentry (int entrycount, unsigned char dvdbuffer[])
*rr = 0; *rr = 0;
strcpy (filelist[entrycount].filename, fname); strcpy (filelist[entrycount].filename, fname);
fname[MAXDISPLAY - 1] = 0; StripExt(tmpname, fname); // hide file extension
strcpy (filelist[entrycount].displayname, fname); tmpname[MAXDISPLAY - 1] = 0;
strcpy (filelist[entrycount].displayname, tmpname);
memcpy (&offset32, &dvdbuffer[diroffset + EXTENT], 4); memcpy (&offset32, &dvdbuffer[diroffset + EXTENT], 4);

View File

@ -155,8 +155,6 @@ void CreateAppPath(char origpath[])
if(pos >= 0 && pos < 1024) if(pos >= 0 && pos < 1024)
sprintf(appPath, &(path[pos])); sprintf(appPath, &(path[pos]));
else
sprintf(appPath, "/");
#endif #endif
} }
@ -230,7 +228,9 @@ int main(int argc, char *argv[])
DefaultSettings(); DefaultSettings();
// store path app was loaded from // store path app was loaded from
CreateAppPath(argv[0]); sprintf(appPath, "fceugx");
if(argc > 0 && argv[0] != NULL)
CreateAppPath(argv[0]);
// Load preferences // Load preferences
if(!LoadPrefs()) if(!LoadPrefs())

View File

@ -118,6 +118,7 @@ ParseFATdirectory(int method)
int nbfiles = 0; int nbfiles = 0;
DIR_ITER *fatdir; DIR_ITER *fatdir;
char filename[MAXPATHLEN]; char filename[MAXPATHLEN];
char tmpname[MAXPATHLEN];
struct stat filestat; struct stat filestat;
char msg[128]; char msg[128];
@ -154,7 +155,8 @@ ParseFATdirectory(int method)
{ {
memset(&filelist[nbfiles], 0, sizeof(FILEENTRIES)); memset(&filelist[nbfiles], 0, sizeof(FILEENTRIES));
strncpy(filelist[nbfiles].filename, filename, MAXPATHLEN); strncpy(filelist[nbfiles].filename, filename, MAXPATHLEN);
strncpy(filelist[nbfiles].displayname, filename, MAXDISPLAY+1); // crop name for display StripExt(tmpname, filename); // hide file extension
strncpy(filelist[nbfiles].displayname, tmpname, MAXDISPLAY+1); // crop name for display
filelist[nbfiles].length = filestat.st_size; filelist[nbfiles].length = filestat.st_size;
filelist[nbfiles].flags = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir filelist[nbfiles].flags = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
nbfiles++; nbfiles++;

View File

@ -498,7 +498,7 @@ int FileSelector (int method)
break; break;
case METHOD_SMB: case METHOD_SMB:
maxfiles = ParseSMBdirectory(); maxfiles = ParseSMBdirectory(NOTSILENT);
break; break;
} }
@ -759,7 +759,7 @@ OpenSMB (int method)
// change current dir to root dir // change current dir to root dir
sprintf(currentdir, "/%s", GCSettings.LoadFolder); sprintf(currentdir, "/%s", GCSettings.LoadFolder);
maxfiles = ParseSMBdirectory (); maxfiles = ParseSMBdirectory (SILENT);
if (maxfiles > 0) if (maxfiles > 0)
{ {
return FileSelector (method); return FileSelector (method);

View File

@ -603,8 +603,7 @@ ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
} }
else else
{ {
// hide file extension on listing (.7z, .fig, .smc) sprintf(text, filelist[i].displayname);
StripExt(text, filelist[i].displayname);
} }
if (j == (selection - offset)) if (j == (selection - offset))
{ {

View File

@ -146,13 +146,14 @@ char * SMBPath(char * path)
* Load the directory and put in the filelist array * Load the directory and put in the filelist array
*****************************************************************************/ *****************************************************************************/
int int
ParseSMBdirectory () ParseSMBdirectory (bool silent)
{ {
if(!ConnectShare (NOTSILENT)) if(!ConnectShare (NOTSILENT))
return 0; return 0;
int filecount = 0; int filecount = 0;
char searchpath[1024]; char searchpath[1024];
char tmpname[MAXJOLIET];
SMBDIRENTRY smbdir; SMBDIRENTRY smbdir;
// initialize selection // initialize selection
@ -169,13 +170,17 @@ ParseSMBdirectory ()
if (SMB_FindFirst if (SMB_FindFirst
(SMBPath(searchpath), SMB_SRCH_READONLY | SMB_SRCH_DIRECTORY, &smbdir, smbconn) != SMB_SUCCESS) (SMBPath(searchpath), SMB_SRCH_READONLY | SMB_SRCH_DIRECTORY, &smbdir, smbconn) != SMB_SUCCESS)
{ {
char msg[200]; if(!silent)
sprintf(msg, "Could not open %s", currentdir); {
WaitPrompt (msg); char msg[200];
sprintf(msg, "Could not open %s", currentdir);
WaitPrompt (msg);
}
// if we can't open the dir, open root dir // if we can't open the dir, open root dir
sprintf(searchpath, "/"); sprintf(searchpath, "/");
sprintf(searchpath,"*"); sprintf(searchpath,"*");
sprintf(currentdir,"/");
if (SMB_FindFirst if (SMB_FindFirst
(SMBPath(searchpath), SMB_SRCH_READONLY | SMB_SRCH_DIRECTORY, &smbdir, smbconn) != SMB_SUCCESS) (SMBPath(searchpath), SMB_SRCH_READONLY | SMB_SRCH_DIRECTORY, &smbdir, smbconn) != SMB_SUCCESS)
@ -197,8 +202,8 @@ ParseSMBdirectory ()
else else
filelist[filecount].flags = 0; filelist[filecount].flags = 0;
// Update display name StripExt(tmpname, smbdir.name); // hide file extension
memcpy (&filelist[filecount].displayname, smbdir.name, MAXDISPLAY); memcpy (&filelist[filecount].displayname, tmpname, MAXDISPLAY);
filelist[filecount].displayname[MAXDISPLAY] = 0; filelist[filecount].displayname[MAXDISPLAY] = 0;
strcpy (filelist[filecount].filename, smbdir.name); strcpy (filelist[filecount].filename, smbdir.name);

View File

@ -18,7 +18,7 @@ bool InitializeNetwork(bool silent);
bool ConnectShare (bool silent); bool ConnectShare (bool silent);
char * SMBPath(char * path); char * SMBPath(char * path);
int UpdateSMBdirname(); int UpdateSMBdirname();
int ParseSMBdirectory (); int ParseSMBdirectory (bool silent);
SMBFILE OpenSMBFile(char * filepath); SMBFILE OpenSMBFile(char * filepath);
int LoadSMBSzFile(char * filepath, unsigned char * rbuffer); int LoadSMBSzFile(char * filepath, unsigned char * rbuffer);
int LoadSMBFile (char * sbuffer, char *filepath, int length, bool silent); int LoadSMBFile (char * sbuffer, char *filepath, int length, bool silent);