mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 20:58:14 +00:00
new patch for ISOFilsSystem
This commit is contained in:
parent
0019666939
commit
2de2c53918
@ -287,7 +287,7 @@ bool DirectoryFileSystem::RemoveFile(const std::string &filename) {
|
||||
return retValue;
|
||||
}
|
||||
|
||||
u32 DirectoryFileSystem::OpenFile(std::string filename, FileAccess access) {
|
||||
u32 DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
|
||||
#if HOST_IS_CASE_SENSITIVE
|
||||
if (access & (FILEACCESS_APPEND|FILEACCESS_CREATE|FILEACCESS_WRITE))
|
||||
{
|
||||
@ -667,7 +667,7 @@ bool VFSFileSystem::RemoveFile(const std::string &filename) {
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access) {
|
||||
u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
|
||||
if (access != FILEACCESS_READ) {
|
||||
ERROR_LOG(HLE, "VFSFileSystem only supports plain reading");
|
||||
return 0;
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
std::vector<PSPFileInfo> GetDirListing(std::string path);
|
||||
u32 OpenFile(std::string filename, FileAccess access);
|
||||
u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL);
|
||||
void CloseFile(u32 handle);
|
||||
size_t ReadFile(u32 handle, u8 *pointer, s64 size);
|
||||
size_t WriteFile(u32 handle, const u8 *pointer, s64 size);
|
||||
@ -104,7 +104,7 @@ public:
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
std::vector<PSPFileInfo> GetDirListing(std::string path);
|
||||
u32 OpenFile(std::string filename, FileAccess access);
|
||||
u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL);
|
||||
void CloseFile(u32 handle);
|
||||
size_t ReadFile(u32 handle, u8 *pointer, s64 size);
|
||||
size_t WriteFile(u32 handle, const u8 *pointer, s64 size);
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
|
||||
virtual void DoState(PointerWrap &p) = 0;
|
||||
virtual std::vector<PSPFileInfo> GetDirListing(std::string path) = 0;
|
||||
virtual u32 OpenFile(std::string filename, FileAccess access) = 0;
|
||||
virtual u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL) = 0;
|
||||
virtual void CloseFile(u32 handle) = 0;
|
||||
virtual size_t ReadFile(u32 handle, u8 *pointer, s64 size) = 0;
|
||||
virtual size_t WriteFile(u32 handle, const u8 *pointer, s64 size) = 0;
|
||||
@ -127,7 +127,7 @@ class EmptyFileSystem : public IFileSystem
|
||||
public:
|
||||
virtual void DoState(PointerWrap &p) {}
|
||||
std::vector<PSPFileInfo> GetDirListing(std::string path) {std::vector<PSPFileInfo> vec; return vec;}
|
||||
u32 OpenFile(std::string filename, FileAccess access) {return 0;}
|
||||
u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL) {return 0;}
|
||||
void CloseFile(u32 handle) {}
|
||||
size_t ReadFile(u32 handle, u8 *pointer, s64 size) {return 0;}
|
||||
size_t WriteFile(u32 handle, const u8 *pointer, s64 size) {return 0;}
|
||||
|
@ -161,7 +161,6 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, BlockDevice *_blockDevic
|
||||
entireISO.isDirectory = false;
|
||||
entireISO.startingPosition = 0;
|
||||
entireISO.size = _blockDevice->GetNumBlocks() * _blockDevice->GetBlockSize();
|
||||
entireISO.isBlockSectorMode = true;
|
||||
entireISO.flags = 0;
|
||||
entireISO.parent = NULL;
|
||||
|
||||
@ -178,7 +177,6 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, BlockDevice *_blockDevic
|
||||
treeroot->isDirectory = true;
|
||||
treeroot->startingPosition = 0;
|
||||
treeroot->size = 0;
|
||||
treeroot->isBlockSectorMode = false;
|
||||
treeroot->flags = 0;
|
||||
treeroot->parent = NULL;
|
||||
|
||||
@ -243,7 +241,6 @@ void ISOFileSystem::ReadDirectory(u32 startsector, u32 dirsize, TreeEntry *root,
|
||||
e->startingPosition = dir.firstDataSectorLE * 2048;
|
||||
e->isDirectory = !isFile;
|
||||
e->flags = dir.flags;
|
||||
e->isBlockSectorMode = false;
|
||||
e->parent = root;
|
||||
|
||||
// Let's not excessively spam the log - I commented this line out.
|
||||
@ -338,7 +335,7 @@ ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(std::string path, bool catc
|
||||
}
|
||||
}
|
||||
|
||||
u32 ISOFileSystem::OpenFile(std::string filename, FileAccess access)
|
||||
u32 ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename)
|
||||
{
|
||||
// LBN unittest
|
||||
/*
|
||||
@ -351,6 +348,9 @@ u32 ISOFileSystem::OpenFile(std::string filename, FileAccess access)
|
||||
|
||||
|
||||
OpenFileEntry entry;
|
||||
entry.isRawSector = false;
|
||||
entry.isBlockSectorMode = false;
|
||||
|
||||
if (filename.compare(0,8,"/sce_lbn") == 0)
|
||||
{
|
||||
u32 sectorStart = 0xFFFFFFFF, readSize = 0xFFFFFFFF;
|
||||
@ -370,15 +370,13 @@ u32 ISOFileSystem::OpenFile(std::string filename, FileAccess access)
|
||||
entry.openSize = readSize;
|
||||
// when open as "umd1:/sce_lbn0x0_size0x6B49D200", that mean open umd1 as a block device.
|
||||
// the param in sceIoLseek and sceIoRead is lba mode. we must mark it.
|
||||
// if(sectorStart==0 && readSize>=blockDevice->GetNumBlocks()*2048)
|
||||
// entry.file = &entireISO;
|
||||
if(strncmp(devicename, "umd1:", 5)==0)
|
||||
entry.isBlockSectorMode = true;
|
||||
|
||||
entries[newHandle] = entry;
|
||||
return newHandle;
|
||||
}
|
||||
|
||||
entry.isRawSector = false;
|
||||
|
||||
if (access & FILEACCESS_WRITE)
|
||||
{
|
||||
ERROR_LOG(FILESYS, "Can't open file %s with write access on an ISO partition", filename.c_str());
|
||||
@ -387,8 +385,10 @@ u32 ISOFileSystem::OpenFile(std::string filename, FileAccess access)
|
||||
|
||||
// May return entireISO for "umd0:"
|
||||
entry.file = GetFromPath(filename);
|
||||
if (!entry.file)
|
||||
if (!entry.file){
|
||||
entry.isBlockSectorMode = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
entry.seekPos = 0;
|
||||
|
||||
@ -426,7 +426,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size)
|
||||
{
|
||||
OpenFileEntry &e = iter->second;
|
||||
|
||||
if (e.file != 0 && e.file->isBlockSectorMode)
|
||||
if (e.isBlockSectorMode)
|
||||
{
|
||||
// Whole sectors! Shortcut to this simple code.
|
||||
for (int i = 0; i < size; i++)
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
~ISOFileSystem();
|
||||
void DoState(PointerWrap &p);
|
||||
std::vector<PSPFileInfo> GetDirListing(std::string path);
|
||||
u32 OpenFile(std::string filename, FileAccess access);
|
||||
u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL);
|
||||
void CloseFile(u32 handle);
|
||||
size_t ReadFile(u32 handle, u8 *pointer, s64 size);
|
||||
size_t SeekFile(u32 handle, s32 position, FileMove type);
|
||||
@ -62,7 +62,6 @@ private:
|
||||
u32 startingPosition;
|
||||
s64 size;
|
||||
bool isDirectory;
|
||||
bool isBlockSectorMode; // "umd:" mode: all sizes and offsets are in 2048 byte chunks
|
||||
|
||||
TreeEntry *parent;
|
||||
std::vector<TreeEntry*> children;
|
||||
@ -73,6 +72,7 @@ private:
|
||||
TreeEntry *file;
|
||||
unsigned int seekPos; // TODO: Make 64-bit?
|
||||
bool isRawSector; // "/sce_lbn" mode
|
||||
bool isBlockSectorMode; // "umd:" mode: all sizes and offsets are in 2048 byte chunks
|
||||
u32 sectorStart;
|
||||
u32 openSize;
|
||||
};
|
||||
|
@ -252,13 +252,13 @@ void MetaFileSystem::Shutdown()
|
||||
startingDirectory = "";
|
||||
}
|
||||
|
||||
u32 MetaFileSystem::OpenFile(std::string filename, FileAccess access)
|
||||
u32 MetaFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename)
|
||||
{
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
if (MapFilePath(filename, of, &system))
|
||||
MountPoint *mount;
|
||||
if (MapFilePath(filename, of, &mount))
|
||||
{
|
||||
return system->OpenFile(of, access);
|
||||
return mount->system->OpenFile(of, access, mount->prefix.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
bool GetHostPath(const std::string &inpath, std::string &outpath);
|
||||
|
||||
std::vector<PSPFileInfo> GetDirListing(std::string path);
|
||||
u32 OpenFile(std::string filename, FileAccess access);
|
||||
u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL);
|
||||
void CloseFile(u32 handle);
|
||||
size_t ReadFile(u32 handle, u8 *pointer, s64 size);
|
||||
size_t WriteFile(u32 handle, const u8 *pointer, s64 size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user