Fix minor issues in ISOFileSystem

This commit is contained in:
Henrik Rydgard 2016-03-06 14:16:40 +01:00
parent be0fdbaca2
commit 082d839965
4 changed files with 23 additions and 16 deletions

View file

@ -76,7 +76,11 @@ private:
struct PSPFileInfo {
PSPFileInfo()
: size(0), access(0), exists(false), type(FILETYPE_NORMAL), isOnSectorSystem(false), startSector(0), numSectors(0) {}
: size(0), access(0), exists(false), type(FILETYPE_NORMAL), isOnSectorSystem(false), startSector(0), numSectors(0), sectorSize(0) {
memset(&ctime, 0, sizeof(ctime));
memset(&atime, 0, sizeof(atime));
memset(&mtime, 0, sizeof(mtime));
}
void DoState(PointerWrap &p);

View file

@ -208,7 +208,7 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) {
root->valid = true; // Prevents re-reading
return;
}
lastReadBlock_ = secnum;
lastReadBlock_ = secnum; // Hm, this could affect timing... but lazy loading is probably more realistic.
for (int offset = 0; offset < 2048; ) {
DirectoryEntry &dir = *(DirectoryEntry *)&theSector[offset];
@ -248,6 +248,7 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) {
entry->parent = root;
entry->startsector = dir.firstDataSector();
entry->dirsize = dir.dataLength();
entry->valid = isFile; // Can pre-mark as valid if file, as we don't recurse into those.
// Let's not excessively spam the log - I commented this line out.
//DEBUG_LOG(FILESYS, "%s: %s %08x %08x %i", e->isDirectory?"D":"F", e->name.c_str(), dir.firstDataSectorLE, e->startingPosition, e->startingPosition);
@ -467,8 +468,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size)
return ReadFile(handle, pointer, size, ignored);
}
size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec)
{
size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
EntryMap::iterator iter = entries.find(handle);
if (iter != entries.end()) {
OpenFileEntry &e = iter->second;
@ -629,7 +629,7 @@ PSPFileInfo ISOFileSystem::GetFileInfo(std::string filename) {
std::vector<PSPFileInfo> ISOFileSystem::GetDirListing(std::string path) {
std::vector<PSPFileInfo> myVector;
TreeEntry *entry = GetFromPath(path);
if (! entry)
if (!entry)
return myVector;
const std::string dot(".");
@ -649,6 +649,11 @@ std::vector<PSPFileInfo> ISOFileSystem::GetDirListing(std::string path) {
x.type = e->isDirectory ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;
x.isOnSectorSystem = true;
x.startSector = e->startingPosition/2048;
x.sectorSize = sectorSize;
x.numSectors = (e->size + sectorSize - 1) / sectorSize;
memset(&x.atime, 0, sizeof(x.atime));
memset(&x.mtime, 0, sizeof(x.mtime));
memset(&x.ctime, 0, sizeof(x.ctime));
myVector.push_back(x);
}
return myVector;
@ -670,8 +675,7 @@ std::string ISOFileSystem::EntryFullPath(TreeEntry *e) {
path.resize(fullLen);
cur = e;
while (cur != NULL && cur != treeroot)
{
while (cur != NULL && cur != treeroot) {
path.replace(fullLen - cur->name.size(), cur->name.size(), cur->name);
path.replace(fullLen - cur->name.size() - 1, 1, "/");
fullLen -= 1 + cur->name.size();

View file

@ -60,14 +60,14 @@ extern "C" {
// For headless screenshots.
#include "Core/HLE/sceDisplay.h"
const int ERROR_ERRNO_FILE_NOT_FOUND = 0x80010002;
const int ERROR_ERRNO_IO_ERROR = 0x80010005;
const int ERROR_ERRNO_FILE_ALREADY_EXISTS = 0x80010011;
const int ERROR_MEMSTICK_DEVCTL_BAD_PARAMS = 0x80220081;
const int ERROR_MEMSTICK_DEVCTL_TOO_MANY_CALLBACKS = 0x80220082;
const int ERROR_KERNEL_BAD_FILE_DESCRIPTOR = 0x80020323;
static const int ERROR_ERRNO_FILE_NOT_FOUND = 0x80010002;
static const int ERROR_ERRNO_IO_ERROR = 0x80010005;
static const int ERROR_ERRNO_FILE_ALREADY_EXISTS = 0x80010011;
static const int ERROR_MEMSTICK_DEVCTL_BAD_PARAMS = 0x80220081;
static const int ERROR_MEMSTICK_DEVCTL_TOO_MANY_CALLBACKS = 0x80220082;
static const int ERROR_KERNEL_BAD_FILE_DESCRIPTOR = 0x80020323;
const int ERROR_PGD_INVALID_HEADER = 0x80510204;
static const int ERROR_PGD_INVALID_HEADER = 0x80510204;
/*

View file

@ -227,8 +227,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string)
}
pspFileSystem.CloseFile(fd);
}
if (!hasEncrypted)
{
if (!hasEncrypted) {
// try unencrypted BOOT.BIN
bootpath = "disc0:/PSP_GAME/SYSDIR/BOOT.BIN";
}