From 32525770c2bbe0ecd1ff17722b43c9d25773b6d3 Mon Sep 17 00:00:00 2001 From: dborth Date: Thu, 9 Jul 2009 21:51:19 +0000 Subject: [PATCH] fix 7z lockup, better 7z error message --- source/ngc/filebrowser.cpp | 6 +++++- source/ngc/gcunzip.cpp | 8 +++++--- source/sz/7zDecode.c | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/ngc/filebrowser.cpp b/source/ngc/filebrowser.cpp index f09fdeb..159e2fa 100644 --- a/source/ngc/filebrowser.cpp +++ b/source/ngc/filebrowser.cpp @@ -494,8 +494,12 @@ int BrowserLoadFile(int method) SNESROMSize = LoadSzFile(szpath, (unsigned char *)Memory.ROM); break; } + if(SNESROMSize <= 0) + { + browser.selIndex = 0; + BrowserChangeFolder(method); + } } - inSz = false; if (SNESROMSize <= 0) { diff --git a/source/ngc/gcunzip.cpp b/source/ngc/gcunzip.cpp index 942695d..a68fbe7 100644 --- a/source/ngc/gcunzip.cpp +++ b/source/ngc/gcunzip.cpp @@ -267,7 +267,7 @@ typedef struct _SzFileInStream } SzFileInStream; // 7zip error list -static char szerrormsg[][50] = { +static char szerrormsg[][100] = { "File is corrupt.", // 7z: Data error "Archive contains too many files.", // 7z: Out of memory "File is corrupt (CRC mismatch).", // 7z: CRC Error @@ -275,7 +275,7 @@ static char szerrormsg[][50] = { "File is corrupt.", // 7z: Fail "Failed to read file data.", // 7z: Data read failure "File is corrupt.", // 7z: Archive error - "File uses too high of compression settings.", // 7z: Dictionary too large + "File uses too high of compression settings (dictionary size is too large).", // 7z: Dictionary too large }; static SZ_RESULT SzRes; @@ -453,7 +453,7 @@ int SzParse(char * filepath, int method) ResetBrowser(); // add '..' folder in case the user wants exit the 7z - strncpy(browserList[0].displayname, "..", 2); + sprintf(browserList[0].displayname, "Up One Level"); browserList[0].isdir = 1; browserList[0].offset = fileoff; browserList[0].length = filelen; @@ -501,6 +501,8 @@ int SzParse(char * filepath, int method) } } + CancelAction(); + // close file switch (method) { diff --git a/source/sz/7zDecode.c b/source/sz/7zDecode.c index 12198ee..a120724 100644 --- a/source/sz/7zDecode.c +++ b/source/sz/7zDecode.c @@ -236,7 +236,7 @@ SZ_RESULT SzDecode2(const CFileSize *packSizes, const CFolder *folder, if (state.Dictionary == 0) { allocMain->Free(state.Probs); - return SZE_OUTOFMEMORY; + return SZE_OUTOFMEMORYDIC; } } LzmaDecoderInit(&state);