mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 11:35:45 +00:00
partial sceKernelStat,stat functions
This commit is contained in:
parent
9a16abecb3
commit
d72159a64d
2 changed files with 51 additions and 0 deletions
|
@ -132,6 +132,32 @@ int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) {
|
|||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceKernelStat(const char* path, OrbisKernelStat* sb) {
|
||||
LOG_INFO(Kernel_Fs, "(PARTIAL) path = {}", path);
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string path_name = mnt->GetHostFile(path);
|
||||
memset(sb, 0, sizeof(OrbisKernelStat));
|
||||
if (std::filesystem::is_directory(path_name)) {
|
||||
sb->st_mode = 0000777u | 0040000u;
|
||||
sb->st_size = 0;
|
||||
sb->st_blksize = 512;
|
||||
sb->st_blocks = 0;
|
||||
// TODO incomplete
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_stat(const char* path, OrbisKernelStat* sb) {
|
||||
int result = sceKernelStat(path, sb);
|
||||
if (result < 0) {
|
||||
UNREACHABLE(); // TODO
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen);
|
||||
LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open);
|
||||
|
@ -142,6 +168,8 @@ void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("oib76F-12fk", "libkernel", 1, "libkernel", 1, 1, sceKernelLseek);
|
||||
LIB_FUNCTION("Cg4srZ6TKbU", "libkernel", 1, "libkernel", 1, 1, sceKernelRead);
|
||||
LIB_FUNCTION("1-LFLmRFxxM", "libkernel", 1, "libkernel", 1, 1, sceKernelMkdir);
|
||||
LIB_FUNCTION("eV9wAD2riIA", "libkernel", 1, "libkernel", 1, 1, sceKernelStat);
|
||||
LIB_FUNCTION("E6ao34wPw+U", "libScePosix", 1, "libkernel", 1, 1, posix_stat);
|
||||
|
||||
// openOrbis (to check if it is valid out of OpenOrbis
|
||||
LIB_FUNCTION("6c3rCVE-fTU", "libkernel", 1, "libkernel", 1, 1,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
#include "thread_management.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
|
@ -16,6 +17,28 @@ struct SceKernelIovec {
|
|||
std::size_t iov_len;
|
||||
};
|
||||
|
||||
struct OrbisKernelStat {
|
||||
u32 st_dev;
|
||||
u32 st_ino;
|
||||
u16 st_mode;
|
||||
u16 st_nlink;
|
||||
u32 st_uid;
|
||||
u32 st_gid;
|
||||
u32 st_rdev;
|
||||
SceKernelTimespec st_atim;
|
||||
SceKernelTimespec st_mtim;
|
||||
SceKernelTimespec st_ctim;
|
||||
s64 st_size;
|
||||
s64 st_blocks;
|
||||
u32 st_blksize;
|
||||
u32 st_flags;
|
||||
u32 st_gen;
|
||||
int32_t st_lspare;
|
||||
SceKernelTimespec st_birthtim;
|
||||
unsigned int : (8 / 2) * (16 - static_cast<int>(sizeof(SceKernelTimespec)));
|
||||
unsigned int : (8 / 2) * (16 - static_cast<int>(sizeof(SceKernelTimespec)));
|
||||
};
|
||||
|
||||
int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, /* SceKernelMode*/ u16 mode);
|
||||
|
||||
int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16 mode);
|
||||
|
|
Loading…
Add table
Reference in a new issue