file code corrections

This commit is contained in:
dborth 2009-03-23 05:53:21 +00:00
parent faea01e64f
commit 26cfad4405
4 changed files with 16 additions and 19 deletions

View File

@ -503,7 +503,7 @@ getentry (int entrycount, unsigned char dvdbuffer[])
* The return value is number of files collected, or -1 on failure. * The return value is number of files collected, or -1 on failure.
***************************************************************************/ ***************************************************************************/
int int
ParseDVDdirectory (bool change) ParseDVDdirectory ()
{ {
int pdlength; int pdlength;
u64 pdoffset; u64 pdoffset;
@ -515,9 +515,6 @@ ParseDVDdirectory (bool change)
// reset browser // reset browser
ResetBrowser(); ResetBrowser();
if(change && !ChangeInterface(METHOD_DVD, NOTSILENT))
return 0;
pdoffset = rdoffset = dvddir; pdoffset = rdoffset = dvddir;
pdlength = dvddirlength; pdlength = dvddirlength;
filecount = 0; filecount = 0;
@ -605,7 +602,7 @@ static bool SwitchDVDFolderR(char * dir, int maxDepth)
if(browserList[dirindex].isdir) // only parse directories if(browserList[dirindex].isdir) // only parse directories
{ {
UpdateDirName(METHOD_DVD); UpdateDirName(METHOD_DVD);
ParseDVDdirectory(false); ParseDVDdirectory();
} }
else else
{ {
@ -640,7 +637,7 @@ bool SwitchDVDFolder(char origdir[])
dvddir = dvdrootdir; dvddir = dvdrootdir;
dvddirlength = dvdrootlength; dvddirlength = dvdrootlength;
browser.dir[0] = 0; browser.dir[0] = 0;
ParseDVDdirectory(true); ParseDVDdirectory();
return SwitchDVDFolderR(dirptr, 0); return SwitchDVDFolderR(dirptr, 0);
} }

View File

@ -14,7 +14,7 @@
#define _NGCDVD_ #define _NGCDVD_
bool MountDVD(bool silent); bool MountDVD(bool silent);
int ParseDVDdirectory(bool change); int ParseDVDdirectory();
void SetDVDdirectory(u64 dir, int length); void SetDVDdirectory(u64 dir, int length);
bool SwitchDVDFolder(char dir[]); bool SwitchDVDFolder(char dir[]);

View File

@ -501,7 +501,7 @@ int BrowserChangeFolder(int method)
switch (method) switch (method)
{ {
case METHOD_DVD: case METHOD_DVD:
ParseDVDdirectory(true); ParseDVDdirectory();
break; break;
default: default:
@ -535,8 +535,9 @@ OpenGameList ()
{ {
case METHOD_DVD: case METHOD_DVD:
browser.dir[0] = 0; browser.dir[0] = 0;
if(ParseDVDdirectory(true)) // Parse root directory if(MountDVD(NOTSILENT))
SwitchDVDFolder(GCSettings.LoadFolder); // switch to ROM folder if(ParseDVDdirectory()) // Parse root directory
SwitchDVDFolder(GCSettings.LoadFolder); // switch to ROM folder
break; break;
default: default:
sprintf(browser.dir, "/%s", GCSettings.LoadFolder); sprintf(browser.dir, "/%s", GCSettings.LoadFolder);

View File

@ -280,6 +280,7 @@ ParseDirectory(int method)
struct tm * timeinfo; struct tm * timeinfo;
char msg[128]; char msg[128];
int retry = 1; int retry = 1;
bool mounted = false;
// reset browser // reset browser
ResetBrowser(); ResetBrowser();
@ -289,16 +290,14 @@ ParseDirectory(int method)
// open the directory // open the directory
while(dir == NULL && retry == 1) while(dir == NULL && retry == 1)
{ {
if(ChangeInterface(method, NOTSILENT)) mounted = ChangeInterface(method, NOTSILENT);
sprintf(fulldir, "%s%s", rootdir, browser.dir); // add device to path
if(mounted) dir = diropen(fulldir);
if(dir == NULL)
{ {
sprintf(fulldir, "%s%s", rootdir, browser.dir); // add device to path unmountRequired[method] = true;
dir = diropen(fulldir); sprintf(msg, "Error opening %s", fulldir);
if(dir == NULL) retry = ErrorPromptRetry(msg);
{
unmountRequired[method] = true;
sprintf(msg, "Error opening %s", fulldir);
retry = ErrorPromptRetry(msg);
}
} }
} }