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