From 26cfad4405f645f496202927f5d6e245fe436ae4 Mon Sep 17 00:00:00 2001 From: dborth Date: Mon, 23 Mar 2009 05:53:21 +0000 Subject: [PATCH] file code corrections --- source/ngc/dvd.cpp | 9 +++------ source/ngc/dvd.h | 2 +- source/ngc/filebrowser.cpp | 7 ++++--- source/ngc/fileop.cpp | 17 ++++++++--------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/source/ngc/dvd.cpp b/source/ngc/dvd.cpp index 9f0be17..d29f69c 100644 --- a/source/ngc/dvd.cpp +++ b/source/ngc/dvd.cpp @@ -503,7 +503,7 @@ getentry (int entrycount, unsigned char dvdbuffer[]) * The return value is number of files collected, or -1 on failure. ***************************************************************************/ int -ParseDVDdirectory (bool change) +ParseDVDdirectory () { int pdlength; u64 pdoffset; @@ -514,9 +514,6 @@ ParseDVDdirectory (bool change) // reset browser ResetBrowser(); - - if(change && !ChangeInterface(METHOD_DVD, NOTSILENT)) - return 0; pdoffset = rdoffset = dvddir; pdlength = dvddirlength; @@ -605,7 +602,7 @@ static bool SwitchDVDFolderR(char * dir, int maxDepth) if(browserList[dirindex].isdir) // only parse directories { UpdateDirName(METHOD_DVD); - ParseDVDdirectory(false); + ParseDVDdirectory(); } else { @@ -640,7 +637,7 @@ bool SwitchDVDFolder(char origdir[]) dvddir = dvdrootdir; dvddirlength = dvdrootlength; browser.dir[0] = 0; - ParseDVDdirectory(true); + ParseDVDdirectory(); return SwitchDVDFolderR(dirptr, 0); } diff --git a/source/ngc/dvd.h b/source/ngc/dvd.h index 692c1ce..d21dc36 100644 --- a/source/ngc/dvd.h +++ b/source/ngc/dvd.h @@ -14,7 +14,7 @@ #define _NGCDVD_ bool MountDVD(bool silent); -int ParseDVDdirectory(bool change); +int ParseDVDdirectory(); void SetDVDdirectory(u64 dir, int length); bool SwitchDVDFolder(char dir[]); diff --git a/source/ngc/filebrowser.cpp b/source/ngc/filebrowser.cpp index 2e320e8..f350e36 100644 --- a/source/ngc/filebrowser.cpp +++ b/source/ngc/filebrowser.cpp @@ -501,7 +501,7 @@ int BrowserChangeFolder(int method) switch (method) { case METHOD_DVD: - ParseDVDdirectory(true); + ParseDVDdirectory(); break; default: @@ -535,8 +535,9 @@ OpenGameList () { case METHOD_DVD: browser.dir[0] = 0; - if(ParseDVDdirectory(true)) // Parse root directory - SwitchDVDFolder(GCSettings.LoadFolder); // switch to ROM folder + if(MountDVD(NOTSILENT)) + if(ParseDVDdirectory()) // Parse root directory + SwitchDVDFolder(GCSettings.LoadFolder); // switch to ROM folder break; default: sprintf(browser.dir, "/%s", GCSettings.LoadFolder); diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index a80dfdd..9881779 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -280,6 +280,7 @@ ParseDirectory(int method) struct tm * timeinfo; char msg[128]; int retry = 1; + bool mounted = false; // reset browser ResetBrowser(); @@ -289,16 +290,14 @@ ParseDirectory(int method) // open the directory 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 - dir = diropen(fulldir); - if(dir == NULL) - { - unmountRequired[method] = true; - sprintf(msg, "Error opening %s", fulldir); - retry = ErrorPromptRetry(msg); - } + unmountRequired[method] = true; + sprintf(msg, "Error opening %s", fulldir); + retry = ErrorPromptRetry(msg); } }