From e36d4f5db069ba613f1a910614e95ed8f7a4350c Mon Sep 17 00:00:00 2001 From: dborth Date: Sat, 3 Oct 2009 18:44:09 +0000 Subject: [PATCH] small bugfixes --- source/ngc/filebrowser.h | 5 ++--- source/ngc/fileop.cpp | 3 ++- source/ngc/gcunzip.cpp | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/source/ngc/filebrowser.h b/source/ngc/filebrowser.h index 874eabf..4aae496 100644 --- a/source/ngc/filebrowser.h +++ b/source/ngc/filebrowser.h @@ -30,10 +30,9 @@ typedef struct typedef struct { - u64 offset; // DVD offset - unsigned int length; // file length + size_t length; // file length time_t mtime; // file modified time - char isdir; // 0 - file, 1 - directory + int isdir; // 0 - file, 1 - directory char filename[MAXJOLIET + 1]; // full filename char displayname[MAXJOLIET + 1]; // name for browser display int icon; // icon to display diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index 254587d..1bc1101 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -599,6 +599,7 @@ ParseDirectory(bool waitParse) browserList[0].length = 0; browserList[0].mtime = 0; browserList[0].isdir = 1; // flag this as a dir + browserList[0].icon = ICON_FOLDER; } parseHalt = false; @@ -664,7 +665,7 @@ LoadSzFile(char * filepath, unsigned char * rbuffer) file = fopen (filepath, "rb"); if (file > 0) { - size = SzExtractFile(browserList[browser.selIndex].offset, rbuffer); + size = SzExtractFile(atoi(browserList[browser.selIndex].filename), rbuffer); fclose (file); } else diff --git a/source/ngc/gcunzip.cpp b/source/ngc/gcunzip.cpp index e719e72..8c7acc7 100644 --- a/source/ngc/gcunzip.cpp +++ b/source/ngc/gcunzip.cpp @@ -372,7 +372,6 @@ int SzParse(char * filepath) // save the length/offset of this file unsigned int filelen = browserList[browser.selIndex].length; - u64 fileoff = browserList[browser.selIndex].offset; // setup archive stream SzArchiveStream.offset = 0; @@ -423,7 +422,6 @@ int SzParse(char * filepath) // add '..' folder in case the user wants exit the 7z sprintf(browserList[0].displayname, "Up One Level"); browserList[0].isdir = 1; - browserList[0].offset = fileoff; browserList[0].length = filelen; // get contents and parse them into file list structure @@ -453,10 +451,9 @@ int SzParse(char * filepath) memset(&(browserList[SzJ]), 0, sizeof(BROWSERENTRY)); // clear the new entry // parse information about this file to the file list structure - strncpy(browserList[SzJ].filename, SzF->Name, MAXJOLIET); - StripExt(browserList[SzJ].displayname, browserList[SzJ].filename); + sprintf(browserList[SzJ].filename, "%d", SzI); // the extraction function identifies the file with this number + StripExt(browserList[SzJ].displayname, SzF->Name); browserList[SzJ].length = SzF->Size; // filesize - browserList[SzJ].offset = SzI; // the extraction function identifies the file with this number browserList[SzJ].isdir = 0; // only files will be displayed (-> no flags) SzJ++; }