added posix close
This commit is contained in:
parent
fc14a8a707
commit
365222ee9a
|
@ -67,9 +67,9 @@ int PS4_SYSV_ABI sceKernelClose(int handle) {
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelGetdents(int fd, char* buf, int nbytes) {
|
int PS4_SYSV_ABI sceKernelGetdents(int fd, char* buf, int nbytes) {
|
||||||
PRINT_FUNCTION_NAME();
|
PRINT_FUNCTION_NAME();
|
||||||
//TODO error codes
|
// TODO error codes
|
||||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||||
auto* file = h->getFile(fd);
|
auto* file = h->getFile(fd);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ int PS4_SYSV_ABI sceKernelGetdents(int fd, char* buf, int nbytes) {
|
||||||
auto str_size = str.size() - 1;
|
auto str_size = str.size() - 1;
|
||||||
|
|
||||||
SceKernelDirent* sce_ent = (SceKernelDirent*)buf;
|
SceKernelDirent* sce_ent = (SceKernelDirent*)buf;
|
||||||
sce_ent->d_fileno = fd; //TODO this should be unique but atm it changes maybe switch to a hash or something?
|
sce_ent->d_fileno = fd; // TODO this should be unique but atm it changes maybe switch to a hash or something?
|
||||||
sce_ent->d_reclen = sizeof(SceKernelDirent);
|
sce_ent->d_reclen = sizeof(SceKernelDirent);
|
||||||
sce_ent->d_type = (entry.isFile ? 8 : 4);
|
sce_ent->d_type = (entry.isFile ? 8 : 4);
|
||||||
sce_ent->d_namlen = str_size;
|
sce_ent->d_namlen = str_size;
|
||||||
|
@ -100,11 +100,21 @@ int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI posix_close(int handle) {
|
||||||
|
LOG_INFO_IF(log_file_fs, "posix close redirect to sceKernelClose\n");
|
||||||
|
int result = sceKernelClose(handle);
|
||||||
|
if (result < 0) {
|
||||||
|
BREAKPOINT(); // posix calls different only for their return values
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void fileSystemSymbolsRegister(Loader::SymbolsResolver* sym) {
|
void fileSystemSymbolsRegister(Loader::SymbolsResolver* sym) {
|
||||||
LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen);
|
LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen);
|
||||||
LIB_FUNCTION("UK2Tl2DWUns", "libkernel", 1, "libkernel", 1, 1, sceKernelClose);
|
LIB_FUNCTION("UK2Tl2DWUns", "libkernel", 1, "libkernel", 1, 1, sceKernelClose);
|
||||||
LIB_FUNCTION("j2AIqSqJP0w", "libkernel", 1, "libkernel", 1, 1, sceKernelGetdents);
|
LIB_FUNCTION("j2AIqSqJP0w", "libkernel", 1, "libkernel", 1, 1, sceKernelGetdents);
|
||||||
LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open);
|
LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open);
|
||||||
|
LIB_FUNCTION("bY-PO6JhzhQ", "libScePosix", 1, "libkernel", 1, 1, posix_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Core::Libraries::LibKernel
|
} // namespace Core::Libraries::LibKernel
|
||||||
|
|
|
@ -36,6 +36,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char *path, int flags, /* SceKernelMode*/ u
|
||||||
int PS4_SYSV_ABI sceKernelClose(int handle);
|
int PS4_SYSV_ABI sceKernelClose(int handle);
|
||||||
int PS4_SYSV_ABI sceKernelGetdents(int fd, char *buf, int nbytes);
|
int PS4_SYSV_ABI sceKernelGetdents(int fd, char *buf, int nbytes);
|
||||||
int PS4_SYSV_ABI posix_open(const char *path, int flags, /* SceKernelMode*/ u16 mode);
|
int PS4_SYSV_ABI posix_open(const char *path, int flags, /* SceKernelMode*/ u16 mode);
|
||||||
|
int PS4_SYSV_ABI posix_close(int handle);
|
||||||
|
|
||||||
void fileSystemSymbolsRegister(Loader::SymbolsResolver *sym);
|
void fileSystemSymbolsRegister(Loader::SymbolsResolver *sym);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue