Io: Open sce_lbn references and whole ISO faster.
This commit is contained in:
parent
91427c1f4e
commit
49abe9ed6c
16 changed files with 76 additions and 62 deletions
|
@ -108,8 +108,8 @@ int BlobFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 out
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BlobFileSystem::DevType(u32 handle) {
|
PSPDevType BlobFileSystem::DevType(u32 handle) {
|
||||||
return PSP_DEV_TYPE_FILE;
|
return PSPDevType::FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlobFileSystem::MkDir(const std::string &dirname) {
|
bool BlobFileSystem::MkDir(const std::string &dirname) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
PSPFileInfo GetFileInfo(std::string filename) override;
|
PSPFileInfo GetFileInfo(std::string filename) override;
|
||||||
bool OwnsHandle(u32 handle) override;
|
bool OwnsHandle(u32 handle) override;
|
||||||
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
||||||
int DevType(u32 handle) override;
|
PSPDevType DevType(u32 handle) override;
|
||||||
FileSystemFlags Flags() override { return FileSystemFlags::FLASH; }
|
FileSystemFlags Flags() override { return FileSystemFlags::FLASH; }
|
||||||
|
|
||||||
bool MkDir(const std::string &dirname) override;
|
bool MkDir(const std::string &dirname) override;
|
||||||
|
|
|
@ -663,8 +663,8 @@ int DirectoryFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u3
|
||||||
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DirectoryFileSystem::DevType(u32 handle) {
|
PSPDevType DirectoryFileSystem::DevType(u32 handle) {
|
||||||
return PSP_DEV_TYPE_FILE;
|
return PSPDevType::FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DirectoryFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) {
|
size_t DirectoryFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) {
|
||||||
|
@ -1121,8 +1121,8 @@ int VFSFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outd
|
||||||
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int VFSFileSystem::DevType(u32 handle) {
|
PSPDevType VFSFileSystem::DevType(u32 handle) {
|
||||||
return PSP_DEV_TYPE_FILE;
|
return PSPDevType::FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) {
|
size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) {
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
// TODO: Remove the Windows-specific code, FILE is fine there too.
|
// TODO: Remove the Windows-specific code, FILE is fine there too.
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include "Core/FileSystems/FileSystem.h"
|
||||||
#include "../Core/FileSystems/FileSystem.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
typedef void * HANDLE;
|
typedef void * HANDLE;
|
||||||
|
@ -102,7 +101,7 @@ public:
|
||||||
PSPFileInfo GetFileInfo(std::string filename) override;
|
PSPFileInfo GetFileInfo(std::string filename) override;
|
||||||
bool OwnsHandle(u32 handle) override;
|
bool OwnsHandle(u32 handle) override;
|
||||||
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
||||||
int DevType(u32 handle) override;
|
PSPDevType DevType(u32 handle) override;
|
||||||
|
|
||||||
bool MkDir(const std::string &dirname) override;
|
bool MkDir(const std::string &dirname) override;
|
||||||
bool RmDir(const std::string &dirname) override;
|
bool RmDir(const std::string &dirname) override;
|
||||||
|
@ -147,7 +146,7 @@ public:
|
||||||
PSPFileInfo GetFileInfo(std::string filename) override;
|
PSPFileInfo GetFileInfo(std::string filename) override;
|
||||||
bool OwnsHandle(u32 handle) override;
|
bool OwnsHandle(u32 handle) override;
|
||||||
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
||||||
int DevType(u32 handle) override;
|
PSPDevType DevType(u32 handle) override;
|
||||||
|
|
||||||
bool MkDir(const std::string &dirname) override;
|
bool MkDir(const std::string &dirname) override;
|
||||||
bool RmDir(const std::string &dirname) override;
|
bool RmDir(const std::string &dirname) override;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include "base/basictypes.h"
|
||||||
|
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
|
|
||||||
|
@ -44,11 +45,15 @@ enum FileType {
|
||||||
FILETYPE_DIRECTORY = 2
|
FILETYPE_DIRECTORY = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DevType {
|
enum class PSPDevType {
|
||||||
PSP_DEV_TYPE_BLOCK = 0x04,
|
INVALID = 0,
|
||||||
PSP_DEV_TYPE_FILE = 0x10,
|
BLOCK = 0x04,
|
||||||
PSP_DEV_TYPE_ALIAS = 0x20,
|
FILE = 0x10,
|
||||||
|
ALIAS = 0x20,
|
||||||
|
EMU_MASK = 0xFF,
|
||||||
|
EMU_LBN = 0x10000,
|
||||||
};
|
};
|
||||||
|
ENUM_CLASS_BITOPS(PSPDevType);
|
||||||
|
|
||||||
enum class FileSystemFlags {
|
enum class FileSystemFlags {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
|
@ -57,13 +62,7 @@ enum class FileSystemFlags {
|
||||||
CARD = 4,
|
CARD = 4,
|
||||||
FLASH = 8,
|
FLASH = 8,
|
||||||
};
|
};
|
||||||
|
ENUM_CLASS_BITOPS(FileSystemFlags);
|
||||||
inline FileSystemFlags operator |(const FileSystemFlags &lhs, const FileSystemFlags &rhs) {
|
|
||||||
return FileSystemFlags((int)lhs | (int)rhs);
|
|
||||||
}
|
|
||||||
inline bool operator &(const FileSystemFlags &lhs, const FileSystemFlags &rhs) {
|
|
||||||
return ((int)lhs & (int)rhs) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
class IHandleAllocator {
|
class IHandleAllocator {
|
||||||
public:
|
public:
|
||||||
|
@ -136,7 +135,7 @@ public:
|
||||||
virtual bool RemoveFile(const std::string &filename) = 0;
|
virtual bool RemoveFile(const std::string &filename) = 0;
|
||||||
virtual bool GetHostPath(const std::string &inpath, std::string &outpath) = 0;
|
virtual bool GetHostPath(const std::string &inpath, std::string &outpath) = 0;
|
||||||
virtual int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) = 0;
|
virtual int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) = 0;
|
||||||
virtual int DevType(u32 handle) = 0;
|
virtual PSPDevType DevType(u32 handle) = 0;
|
||||||
virtual FileSystemFlags Flags() = 0;
|
virtual FileSystemFlags Flags() = 0;
|
||||||
virtual u64 FreeSpace(const std::string &path) = 0;
|
virtual u64 FreeSpace(const std::string &path) = 0;
|
||||||
};
|
};
|
||||||
|
@ -162,7 +161,7 @@ public:
|
||||||
virtual bool RemoveFile(const std::string &filename) override {return false;}
|
virtual bool RemoveFile(const std::string &filename) override {return false;}
|
||||||
virtual bool GetHostPath(const std::string &inpath, std::string &outpath) override {return false;}
|
virtual bool GetHostPath(const std::string &inpath, std::string &outpath) override {return false;}
|
||||||
virtual int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override {return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED; }
|
virtual int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override {return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED; }
|
||||||
virtual int DevType(u32 handle) override { return 0; }
|
virtual PSPDevType DevType(u32 handle) override { return PSPDevType::INVALID; }
|
||||||
virtual FileSystemFlags Flags() override { return FileSystemFlags::NONE; }
|
virtual FileSystemFlags Flags() override { return FileSystemFlags::NONE; }
|
||||||
virtual u64 FreeSpace(const std::string &path) override { return 0; }
|
virtual u64 FreeSpace(const std::string &path) override { return 0; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -461,10 +461,12 @@ int ISOFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outd
|
||||||
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ISOFileSystem::DevType(u32 handle)
|
PSPDevType ISOFileSystem::DevType(u32 handle) {
|
||||||
{
|
|
||||||
EntryMap::iterator iter = entries.find(handle);
|
EntryMap::iterator iter = entries.find(handle);
|
||||||
return iter->second.isBlockSectorMode ? PSP_DEV_TYPE_BLOCK : PSP_DEV_TYPE_FILE;
|
PSPDevType type = iter->second.isBlockSectorMode ? PSPDevType::BLOCK : PSPDevType::FILE;
|
||||||
|
if (iter->second.isRawSector)
|
||||||
|
type |= PSPDevType::EMU_LBN;
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemFlags ISOFileSystem::Flags() {
|
FileSystemFlags ISOFileSystem::Flags() {
|
||||||
|
@ -613,6 +615,7 @@ PSPFileInfo ISOFileSystem::GetFileInfo(std::string filename) {
|
||||||
PSPFileInfo fileInfo;
|
PSPFileInfo fileInfo;
|
||||||
fileInfo.name = filename;
|
fileInfo.name = filename;
|
||||||
fileInfo.exists = true;
|
fileInfo.exists = true;
|
||||||
|
fileInfo.type = FILETYPE_NORMAL;
|
||||||
fileInfo.size = readSize;
|
fileInfo.size = readSize;
|
||||||
fileInfo.startSector = sectorStart;
|
fileInfo.startSector = sectorStart;
|
||||||
fileInfo.isOnSectorSystem = true;
|
fileInfo.isOnSectorSystem = true;
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
PSPFileInfo GetFileInfo(std::string filename) override;
|
PSPFileInfo GetFileInfo(std::string filename) override;
|
||||||
bool OwnsHandle(u32 handle) override;
|
bool OwnsHandle(u32 handle) override;
|
||||||
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
||||||
int DevType(u32 handle) override;
|
PSPDevType DevType(u32 handle) override;
|
||||||
FileSystemFlags Flags() override;
|
FileSystemFlags Flags() override;
|
||||||
u64 FreeSpace(const std::string &path) override { return 0; }
|
u64 FreeSpace(const std::string &path) override { return 0; }
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override {
|
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override {
|
||||||
return isoFileSystem_->Ioctl(handle, cmd, indataPtr, inlen, outdataPtr, outlen, usec);
|
return isoFileSystem_->Ioctl(handle, cmd, indataPtr, inlen, outdataPtr, outlen, usec);
|
||||||
}
|
}
|
||||||
int DevType(u32 handle) override {
|
PSPDevType DevType(u32 handle) override {
|
||||||
return isoFileSystem_->DevType(handle);
|
return isoFileSystem_->DevType(handle);
|
||||||
}
|
}
|
||||||
FileSystemFlags Flags() override { return isoFileSystem_->Flags(); }
|
FileSystemFlags Flags() override { return isoFileSystem_->Flags(); }
|
||||||
|
|
|
@ -538,13 +538,13 @@ int MetaFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 out
|
||||||
return SCE_KERNEL_ERROR_ERROR;
|
return SCE_KERNEL_ERROR_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MetaFileSystem::DevType(u32 handle)
|
PSPDevType MetaFileSystem::DevType(u32 handle)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> guard(lock);
|
std::lock_guard<std::recursive_mutex> guard(lock);
|
||||||
IFileSystem *sys = GetHandleOwner(handle);
|
IFileSystem *sys = GetHandleOwner(handle);
|
||||||
if (sys)
|
if (sys)
|
||||||
return sys->DevType(handle);
|
return sys->DevType(handle);
|
||||||
return SCE_KERNEL_ERROR_ERROR;
|
return PSPDevType::INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaFileSystem::CloseFile(u32 handle)
|
void MetaFileSystem::CloseFile(u32 handle)
|
||||||
|
|
|
@ -118,7 +118,7 @@ public:
|
||||||
int RenameFile(const std::string &from, const std::string &to) override;
|
int RenameFile(const std::string &from, const std::string &to) override;
|
||||||
bool RemoveFile(const std::string &filename) override;
|
bool RemoveFile(const std::string &filename) override;
|
||||||
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
||||||
int DevType(u32 handle) override;
|
PSPDevType DevType(u32 handle) override;
|
||||||
FileSystemFlags Flags() override { return FileSystemFlags::NONE; }
|
FileSystemFlags Flags() override { return FileSystemFlags::NONE; }
|
||||||
u64 FreeSpace(const std::string &path) override;
|
u64 FreeSpace(const std::string &path) override;
|
||||||
|
|
||||||
|
|
|
@ -552,9 +552,9 @@ int VirtualDiscFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen,
|
||||||
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int VirtualDiscFileSystem::DevType(u32 handle) {
|
PSPDevType VirtualDiscFileSystem::DevType(u32 handle) {
|
||||||
EntryMap::iterator iter = entries.find(handle);
|
EntryMap::iterator iter = entries.find(handle);
|
||||||
return iter->second.type == VFILETYPE_ISO ? PSP_DEV_TYPE_BLOCK : PSP_DEV_TYPE_FILE;
|
return iter->second.type == VFILETYPE_ISO ? PSPDevType::BLOCK : PSPDevType::FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
|
PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
|
||||||
|
@ -569,6 +569,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
|
||||||
PSPFileInfo fileInfo;
|
PSPFileInfo fileInfo;
|
||||||
fileInfo.name = filename;
|
fileInfo.name = filename;
|
||||||
fileInfo.exists = true;
|
fileInfo.exists = true;
|
||||||
|
fileInfo.type = FILETYPE_NORMAL;
|
||||||
fileInfo.size = readSize;
|
fileInfo.size = readSize;
|
||||||
fileInfo.startSector = sectorStart;
|
fileInfo.startSector = sectorStart;
|
||||||
fileInfo.isOnSectorSystem = true;
|
fileInfo.isOnSectorSystem = true;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
PSPFileInfo GetFileInfo(std::string filename) override;
|
PSPFileInfo GetFileInfo(std::string filename) override;
|
||||||
bool OwnsHandle(u32 handle) override;
|
bool OwnsHandle(u32 handle) override;
|
||||||
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
|
||||||
int DevType(u32 handle) override;
|
PSPDevType DevType(u32 handle) override;
|
||||||
bool GetHostPath(const std::string &inpath, std::string &outpath) override;
|
bool GetHostPath(const std::string &inpath, std::string &outpath) override;
|
||||||
std::vector<PSPFileInfo> GetDirListing(std::string path) override;
|
std::vector<PSPFileInfo> GetDirListing(std::string path) override;
|
||||||
FileSystemFlags Flags() override { return FileSystemFlags::UMD; }
|
FileSystemFlags Flags() override { return FileSystemFlags::UMD; }
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ static u32 sceIoWriteAsync(int id, u32 data_addr, int size) {
|
||||||
static u32 sceIoGetDevType(int id) {
|
static u32 sceIoGetDevType(int id) {
|
||||||
if (id == PSP_STDOUT || id == PSP_STDERR || id == PSP_STDIN) {
|
if (id == PSP_STDOUT || id == PSP_STDERR || id == PSP_STDIN) {
|
||||||
DEBUG_LOG(SCEIO, "sceIoGetDevType(%d)", id);
|
DEBUG_LOG(SCEIO, "sceIoGetDevType(%d)", id);
|
||||||
return PSP_DEV_TYPE_FILE;
|
return (u32)PSPDevType::FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 error;
|
u32 error;
|
||||||
|
@ -1254,7 +1254,7 @@ static u32 sceIoGetDevType(int id) {
|
||||||
if (f) {
|
if (f) {
|
||||||
// TODO: When would this return PSP_DEV_TYPE_ALIAS?
|
// TODO: When would this return PSP_DEV_TYPE_ALIAS?
|
||||||
WARN_LOG(SCEIO, "sceIoGetDevType(%d - %s)", id, f->fullpath.c_str());
|
WARN_LOG(SCEIO, "sceIoGetDevType(%d - %s)", id, f->fullpath.c_str());
|
||||||
result = pspFileSystem.DevType(f->handle);
|
result = (u32)pspFileSystem.DevType(f->handle) & (u32)PSPDevType::EMU_MASK;
|
||||||
} else {
|
} else {
|
||||||
ERROR_LOG(SCEIO, "sceIoGetDevType: unknown id %d", id);
|
ERROR_LOG(SCEIO, "sceIoGetDevType: unknown id %d", id);
|
||||||
result = SCE_KERNEL_ERROR_BADF;
|
result = SCE_KERNEL_ERROR_BADF;
|
||||||
|
@ -1496,6 +1496,11 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) {
|
||||||
return hleLogError(SCEIO, hleDelayResult(id, "file opened", 1000), "out of fds");
|
return hleLogError(SCEIO, hleDelayResult(id, "file opened", 1000), "out of fds");
|
||||||
} else {
|
} else {
|
||||||
asyncParams[id].priority = asyncDefaultPriority;
|
asyncParams[id].priority = asyncDefaultPriority;
|
||||||
|
IFileSystem *sys = pspFileSystem.GetSystemFromFilename(filename);
|
||||||
|
if (sys && (sys->DevType(f->handle) & (PSPDevType::BLOCK | PSPDevType::EMU_LBN))) {
|
||||||
|
// These are fast to open, no delay or even rescheduling happens.
|
||||||
|
return hleLogSuccessI(SCEIO, id);
|
||||||
|
}
|
||||||
// UMD: Speed varies from 1-6ms.
|
// UMD: Speed varies from 1-6ms.
|
||||||
// Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo.
|
// Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo.
|
||||||
int delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 4000 : 10000;
|
int delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 4000 : 10000;
|
||||||
|
@ -2712,11 +2717,20 @@ static int IoAsyncFinish(int id) {
|
||||||
case IoAsyncOp::OPEN:
|
case IoAsyncOp::OPEN:
|
||||||
{
|
{
|
||||||
// See notes on timing in sceIoOpen.
|
// See notes on timing in sceIoOpen.
|
||||||
FileSystemFlags flags = pspFileSystem.FlagsFromFilename(Memory::GetCharPointer(params.open.filenameAddr));
|
const std::string filename = Memory::GetCharPointer(params.open.filenameAddr);
|
||||||
if (f->asyncResult == (int)SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND)
|
IFileSystem *sys = pspFileSystem.GetSystemFromFilename(filename);
|
||||||
us = flags & FileSystemFlags::UMD ? 6000 : 10000;
|
if (sys) {
|
||||||
else
|
if (f->asyncResult == (int)SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND) {
|
||||||
us = flags & FileSystemFlags::UMD ? 4000 : 10000;
|
us = sys->Flags() & FileSystemFlags::UMD ? 6000 : 10000;
|
||||||
|
} else if (sys->DevType(f->handle) & (PSPDevType::BLOCK | PSPDevType::EMU_LBN)) {
|
||||||
|
// These are fast to open, no delay or even rescheduling happens.
|
||||||
|
us = 80;
|
||||||
|
} else {
|
||||||
|
us = sys->Flags() & FileSystemFlags::UMD ? 4000 : 10000;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
us = 80;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "base/basictypes.h"
|
||||||
#include "GPU/Common/ShaderCommon.h"
|
#include "GPU/Common/ShaderCommon.h"
|
||||||
|
|
||||||
struct CardboardSettings {
|
struct CardboardSettings {
|
||||||
|
@ -59,17 +60,7 @@ enum class OutputFlags {
|
||||||
BACKBUFFER_FLIPPED = 0x0004,
|
BACKBUFFER_FLIPPED = 0x0004,
|
||||||
POSITION_FLIPPED = 0x0008,
|
POSITION_FLIPPED = 0x0008,
|
||||||
};
|
};
|
||||||
|
ENUM_CLASS_BITOPS(OutputFlags);
|
||||||
inline OutputFlags operator | (const OutputFlags &lhs, const OutputFlags &rhs) {
|
|
||||||
return OutputFlags((int)lhs | (int)rhs);
|
|
||||||
}
|
|
||||||
inline OutputFlags operator |= (OutputFlags &lhs, const OutputFlags &rhs) {
|
|
||||||
lhs = lhs | rhs;
|
|
||||||
return lhs;
|
|
||||||
}
|
|
||||||
inline bool operator & (const OutputFlags &lhs, const OutputFlags &rhs) {
|
|
||||||
return ((int)lhs & (int)rhs) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
class PresentationCommon {
|
class PresentationCommon {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -36,14 +36,7 @@ enum class BrowseFlags {
|
||||||
HOMEBREW_STORE = 8,
|
HOMEBREW_STORE = 8,
|
||||||
STANDARD = 1 | 2 | 4,
|
STANDARD = 1 | 2 | 4,
|
||||||
};
|
};
|
||||||
|
ENUM_CLASS_BITOPS(BrowseFlags);
|
||||||
static inline BrowseFlags operator |(const BrowseFlags &lhs, const BrowseFlags &rhs) {
|
|
||||||
return BrowseFlags((int)lhs | (int)rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool operator &(const BrowseFlags &lhs, const BrowseFlags &rhs) {
|
|
||||||
return ((int)lhs & (int)rhs) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
class GameBrowser : public UI::LinearLayout {
|
class GameBrowser : public UI::LinearLayout {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -928,7 +928,7 @@ namespace MainWindow {
|
||||||
u32 handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ, "");
|
u32 handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ, "");
|
||||||
// Note: len may be in blocks.
|
// Note: len may be in blocks.
|
||||||
size_t len = pspFileSystem.SeekFile(handle, 0, FILEMOVE_END);
|
size_t len = pspFileSystem.SeekFile(handle, 0, FILEMOVE_END);
|
||||||
bool isBlockMode = pspFileSystem.DevType(handle) == PSP_DEV_TYPE_BLOCK;
|
bool isBlockMode = pspFileSystem.DevType(handle) & PSPDevType::BLOCK;
|
||||||
|
|
||||||
FILE *fp = File::OpenCFile(fn, "wb");
|
FILE *fp = File::OpenCFile(fn, "wb");
|
||||||
pspFileSystem.SeekFile(handle, 0, FILEMOVE_BEGIN);
|
pspFileSystem.SeekFile(handle, 0, FILEMOVE_BEGIN);
|
||||||
|
|
|
@ -14,6 +14,20 @@
|
||||||
void operator =(const t &other) = delete;
|
void operator =(const t &other) = delete;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENUM_CLASS_BITOPS
|
||||||
|
#define ENUM_CLASS_BITOPS(T) \
|
||||||
|
static inline T operator |(const T &lhs, const T &rhs) { \
|
||||||
|
return T((int)lhs | (int)rhs); \
|
||||||
|
} \
|
||||||
|
static inline T &operator |= (T &lhs, const T &rhs) { \
|
||||||
|
lhs = lhs | rhs; \
|
||||||
|
return lhs; \
|
||||||
|
} \
|
||||||
|
static inline bool operator &(const T &lhs, const T &rhs) { \
|
||||||
|
return ((int)lhs & (int)rhs) != 0; \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
typedef intptr_t ssize_t;
|
typedef intptr_t ssize_t;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue