- [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

View File

@@ -169,7 +169,9 @@ void ExceptionHandler(PspDebugRegBlock * regs)
FILE *log = fopen("exception.log", "w");
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");
fwrite(testo, 1, strlen(testo), log);
sprintf(testo, "Exception - %s\n", codeTxt[(regs->cause >> 2) & 31]);

View File

@@ -197,6 +197,7 @@ inline search_iterator & search_iterator::begin(const char * FileSpec) {
DirectoryName.assign(FileSpec + 0, FileSpec + i++);
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);
if (! m_Valid)
@@ -225,8 +226,11 @@ inline search_iterator & search_iterator::next() {
Found = false;
else if (FileName.size() <= m_Extension.size())
Found = false;
else if (std::equal(m_Extension.rbegin(), m_Extension.rend(), FileName.rbegin()))
Found = true;
else {
std::transform(FileName.begin(), FileName.end(), FileName.begin(), ::tolower);
if (std::equal(m_Extension.rbegin(), m_Extension.rend(), FileName.rbegin()))
Found = true;
}
}
else
break;

View File

@@ -12,6 +12,9 @@
#include "stdafx.h"
#include "zfsystem.h"
// Debug
#include "../../include/JLogger.h"
#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 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;
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
ifstream File(ZipPath.c_str(), ios::binary);
LOG(("opening zip:" + ZipPath).c_str());
if (! File)
return;
// Find the start of the central directory
if (! File.seekg(CentralDir(File))) return;
LOG("open zip ok");
// Check every headers within the zip file
file_header FileHdr;