mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
minor bugfixes
This commit is contained in:
parent
524eaf4da1
commit
699d27a4ee
@ -336,6 +336,7 @@ static int
|
||||
getentry (int entrycount, unsigned char dvdbuffer[])
|
||||
{
|
||||
char fname[512]; /* Huge, but experience has determined this */
|
||||
char tmpname[512];
|
||||
char *ptr;
|
||||
char *filename;
|
||||
char *filenamelength;
|
||||
@ -415,8 +416,9 @@ getentry (int entrycount, unsigned char dvdbuffer[])
|
||||
*rr = 0;
|
||||
|
||||
strcpy (filelist[entrycount].filename, fname);
|
||||
fname[MAXDISPLAY - 1] = 0;
|
||||
strcpy (filelist[entrycount].displayname, fname);
|
||||
StripExt(tmpname, fname); // hide file extension
|
||||
tmpname[MAXDISPLAY - 1] = 0;
|
||||
strcpy (filelist[entrycount].displayname, tmpname);
|
||||
|
||||
memcpy (&offset32, &dvdbuffer[diroffset + EXTENT], 4);
|
||||
|
||||
|
@ -123,6 +123,7 @@ ParseFATdirectory(int method)
|
||||
int nbfiles = 0;
|
||||
DIR_ITER *fatdir;
|
||||
char filename[MAXPATHLEN];
|
||||
char tmpname[MAXPATHLEN];
|
||||
struct stat filestat;
|
||||
char msg[128];
|
||||
|
||||
@ -159,7 +160,8 @@ ParseFATdirectory(int method)
|
||||
{
|
||||
memset(&filelist[nbfiles], 0, sizeof(FILEENTRIES));
|
||||
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].flags = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
||||
nbfiles++;
|
||||
|
@ -523,7 +523,7 @@ int FileSelector (int method)
|
||||
break;
|
||||
|
||||
case METHOD_SMB:
|
||||
maxfiles = ParseSMBdirectory();
|
||||
maxfiles = ParseSMBdirectory(NOTSILENT);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -773,10 +773,10 @@ OpenSMB (int method)
|
||||
// Connect to network share
|
||||
if(ConnectShare (NOTSILENT))
|
||||
{
|
||||
// change current dir to root dir
|
||||
// change current dir to load dir
|
||||
sprintf(currentdir, "/%s", GCSettings.LoadFolder);
|
||||
|
||||
maxfiles = ParseSMBdirectory ();
|
||||
maxfiles = ParseSMBdirectory (SILENT);
|
||||
if (maxfiles > 0)
|
||||
{
|
||||
return FileSelector (method);
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#define SAVEBUFFERSIZE (512 * 1024)
|
||||
#define MAXJOLIET 255
|
||||
#define MAXDISPLAY 54
|
||||
#define MAXDISPLAY 50
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -671,8 +671,7 @@ ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
|
||||
}
|
||||
else
|
||||
{
|
||||
// hide file extension on listing (.7z, .fig, .smc)
|
||||
StripExt(text, filelist[i].displayname);
|
||||
sprintf(text, filelist[i].displayname);
|
||||
}
|
||||
if (j == (selection - offset))
|
||||
{
|
||||
|
@ -146,13 +146,14 @@ char * SMBPath(char * path)
|
||||
* Load the directory and put in the filelist array
|
||||
*****************************************************************************/
|
||||
int
|
||||
ParseSMBdirectory ()
|
||||
ParseSMBdirectory (bool silent)
|
||||
{
|
||||
if(!ConnectShare (NOTSILENT))
|
||||
return 0;
|
||||
|
||||
int filecount = 0;
|
||||
char searchpath[1024];
|
||||
char tmpname[MAXJOLIET];
|
||||
SMBDIRENTRY smbdir;
|
||||
|
||||
// initialize selection
|
||||
@ -169,13 +170,17 @@ ParseSMBdirectory ()
|
||||
if (SMB_FindFirst
|
||||
(SMBPath(searchpath), SMB_SRCH_READONLY | SMB_SRCH_DIRECTORY, &smbdir, smbconn) != SMB_SUCCESS)
|
||||
{
|
||||
char msg[200];
|
||||
sprintf(msg, "Could not open %s", currentdir);
|
||||
WaitPrompt (msg);
|
||||
if(!silent)
|
||||
{
|
||||
char msg[200];
|
||||
sprintf(msg, "Could not open %s", currentdir);
|
||||
WaitPrompt (msg);
|
||||
}
|
||||
|
||||
// if we can't open the dir, open root dir
|
||||
sprintf(searchpath, "/");
|
||||
sprintf(searchpath,"*");
|
||||
sprintf(currentdir,"/");
|
||||
|
||||
if (SMB_FindFirst
|
||||
(SMBPath(searchpath), SMB_SRCH_READONLY | SMB_SRCH_DIRECTORY, &smbdir, smbconn) != SMB_SUCCESS)
|
||||
@ -197,8 +202,8 @@ ParseSMBdirectory ()
|
||||
else
|
||||
filelist[filecount].flags = 0;
|
||||
|
||||
// Update display name
|
||||
memcpy (&filelist[filecount].displayname, smbdir.name, MAXDISPLAY);
|
||||
StripExt(tmpname, smbdir.name); // hide file extension
|
||||
memcpy (&filelist[filecount].displayname, tmpname, MAXDISPLAY);
|
||||
filelist[filecount].displayname[MAXDISPLAY] = 0;
|
||||
|
||||
strcpy (filelist[filecount].filename, smbdir.name);
|
||||
|
@ -20,7 +20,7 @@ bool InitializeNetwork(bool silent);
|
||||
bool ConnectShare (bool silent);
|
||||
char * SMBPath(char * path);
|
||||
int UpdateSMBdirname();
|
||||
int ParseSMBdirectory ();
|
||||
int ParseSMBdirectory (bool silent);
|
||||
SMBFILE OpenSMBFile(char * filepath);
|
||||
int LoadSMBSzFile(char * filepath, unsigned char * rbuffer);
|
||||
int LoadSMBFile (char * sbuffer, char *filepath, int length, bool silent);
|
||||
|
@ -295,8 +295,6 @@ void CreateAppPath(char origpath[])
|
||||
|
||||
if(pos >= 0 && pos < 1024)
|
||||
sprintf(appPath, &(path[pos]));
|
||||
else
|
||||
sprintf(appPath, "/");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -389,7 +387,9 @@ main(int argc, char *argv[])
|
||||
DefaultSettings ();
|
||||
|
||||
// store path app was loaded from
|
||||
CreateAppPath(argv[0]);
|
||||
sprintf(appPath, "snes9x");
|
||||
if(argc > 0 && argv[0] != NULL)
|
||||
CreateAppPath(argv[0]);
|
||||
|
||||
S9xUnmapAllControls ();
|
||||
SetDefaultButtonMap ();
|
||||
|
Loading…
Reference in New Issue
Block a user