- [PSP] Fix for issue 768 : PSP cannot read zipped images from zipped files. This was a lowercase/uppercase issue

- [PSP] added last log message in exception log
This commit is contained in:
wagic.the.homebrew
2011-12-04 07:14:16 +00:00
parent 524c7486f5
commit 70b1879093
3 changed files with 19 additions and 3 deletions
+3 -1
View File
@@ -169,7 +169,9 @@ void ExceptionHandler(PspDebugRegBlock * regs)
FILE *log = fopen("exception.log", "w"); FILE *log = fopen("exception.log", "w");
if (log != NULL) if (log != NULL)
{ {
char testo[512]; char testo[1024];
pspDebugScreenPrintf("Last Log Message: \n%s\n\n", JLogger::lastLog.c_str());
fwrite(testo, 1, strlen(testo), log);
sprintf(testo, "Exception details:\n\n"); sprintf(testo, "Exception details:\n\n");
fwrite(testo, 1, strlen(testo), log); fwrite(testo, 1, strlen(testo), log);
sprintf(testo, "Exception - %s\n", codeTxt[(regs->cause >> 2) & 31]); sprintf(testo, "Exception - %s\n", codeTxt[(regs->cause >> 2) & 31]);
+5 -1
View File
@@ -197,6 +197,7 @@ inline search_iterator & search_iterator::begin(const char * FileSpec) {
DirectoryName.assign(FileSpec + 0, FileSpec + i++); DirectoryName.assign(FileSpec + 0, FileSpec + i++);
m_Extension = FileSpec + i + 1; m_Extension = FileSpec + i + 1;
std::transform(m_Extension.begin(), m_Extension.end(), m_Extension.begin(), ::tolower);
m_Valid = ((m_Directory = opendir(DirectoryName.c_str())) != NULL); m_Valid = ((m_Directory = opendir(DirectoryName.c_str())) != NULL);
if (! m_Valid) if (! m_Valid)
@@ -225,8 +226,11 @@ inline search_iterator & search_iterator::next() {
Found = false; Found = false;
else if (FileName.size() <= m_Extension.size()) else if (FileName.size() <= m_Extension.size())
Found = false; Found = false;
else if (std::equal(m_Extension.rbegin(), m_Extension.rend(), FileName.rbegin())) else {
std::transform(FileName.begin(), FileName.end(), FileName.begin(), ::tolower);
if (std::equal(m_Extension.rbegin(), m_Extension.rend(), FileName.rbegin()))
Found = true; Found = true;
}
} }
else else
break; break;
+10
View File
@@ -12,6 +12,9 @@
#include "stdafx.h" #include "stdafx.h"
#include "zfsystem.h" #include "zfsystem.h"
// Debug
#include "../../include/JLogger.h"
#include "fileio.h" // I/O facilities #include "fileio.h" // I/O facilities
@@ -58,6 +61,9 @@ filesystem::filesystem(const char * BasePath, const char * FileExt, bool Default
} }
// Search all *.zip files (or whatever the ZipExt specify as the file extension) // Search all *.zip files (or whatever the ZipExt specify as the file extension)
// Search is case insensitive (see fileio.h for details)
// The case insensitive state is mostly because some of the filesystems we support such as FAT32 are case insensitive
// Being case sensitive would lead to weird bugs on these systems.
vector<string> ZipFiles; vector<string> ZipFiles;
for (search_iterator ZSrch = (m_BasePath + "*." + m_FileExt).c_str(); ZSrch != ZSrch.end(); ++ZSrch) for (search_iterator ZSrch = (m_BasePath + "*." + m_FileExt).c_str(); ZSrch != ZSrch.end(); ++ZSrch)
@@ -285,12 +291,16 @@ void filesystem::InsertZip(const char * Filename, const size_t PackID)
// Open zip // Open zip
ifstream File(ZipPath.c_str(), ios::binary); ifstream File(ZipPath.c_str(), ios::binary);
LOG(("opening zip:" + ZipPath).c_str());
if (! File) if (! File)
return; return;
// Find the start of the central directory // Find the start of the central directory
if (! File.seekg(CentralDir(File))) return; if (! File.seekg(CentralDir(File))) return;
LOG("open zip ok");
// Check every headers within the zip file // Check every headers within the zip file
file_header FileHdr; file_header FileHdr;