initial handles design

This commit is contained in:
georgemoralis 2023-11-04 22:39:16 +02:00
parent c41b773677
commit 997dbddfce
4 changed files with 22 additions and 4 deletions

View File

@ -33,4 +33,8 @@ std::string MntPoints::getHostDirectory(const std::string& guest_directory) {
}
return "";
}
int HandleTable::createHandle() { return 0; }
void HandleTable::deleteHandle(int d) {}
File* HandleTable::getFile(int d) { return nullptr; }
File* HandleTable::getFile(const std::string& real_name) { return nullptr; }
} // namespace Core::FileSys

View File

@ -24,4 +24,18 @@ class MntPoints {
std::mutex m_mutex;
};
struct File {};
class HandleTable {
HandleTable() {}
virtual ~HandleTable() {}
int createHandle();
void deleteHandle(int d);
File* getFile(int d);
File* getFile(const std::string& real_name);
private:
std::vector<File*> m_files;
std::mutex m_mutex;
};
} // namespace Core::FileSys

View File

@ -12,7 +12,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
return 0;
}
int PS4_SYSV_ABI open(const char* path, int flags, /* SceKernelMode*/ u16 mode) {
int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16 mode) {
LOG_INFO_IF(log_file_fs, "posix open redirect to sceKernelOpen\n");
int result = sceKernelOpen(path, flags, mode);
if (result < 0) {
@ -23,7 +23,7 @@ int PS4_SYSV_ABI open(const char* path, int flags, /* SceKernelMode*/ u16 mode)
void fileSystemSymbolsRegister(SymbolsResolver* sym) {
LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen);
LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, open);
LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open);
}
} // namespace Core::Libraries::LibKernel

View File

@ -6,7 +6,7 @@ namespace Core::Libraries::LibKernel {
int PS4_SYSV_ABI sceKernelOpen(const char *path, int flags, /* SceKernelMode*/ u16 mode);
// posix file system
int PS4_SYSV_ABI open(const char *path, int flags, /* SceKernelMode*/ u16 mode);
int PS4_SYSV_ABI posix_open(const char *path, int flags, /* SceKernelMode*/ u16 mode);
void fileSystemSymbolsRegister(SymbolsResolver *sym);