initial fs work (logging mostly)

This commit is contained in:
georgemoralis 2023-10-19 12:13:09 +03:00
parent 189d177692
commit 84393e6acc
6 changed files with 53 additions and 0 deletions

View File

@ -45,6 +45,12 @@ set(SYSTEMSERVICE_SOURCES src/Emulator/HLE/Libraries/LibSystemService/system_ser
src/Emulator/HLE/Libraries/LibSystemService/system_service.h src/Emulator/HLE/Libraries/LibSystemService/system_service.h
) )
set(FILESYSTEM_SOURCES src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.cpp
src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h
src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.cpp
src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h
)
set(UTIL_SOURCES src/Emulator/Util/singleton.h set(UTIL_SOURCES src/Emulator/Util/singleton.h
) )
@ -53,6 +59,7 @@ add_executable(shadps4
${USERSERVICE_SOURCES} ${USERSERVICE_SOURCES}
${PAD_SOURCES} ${PAD_SOURCES}
${SYSTEMSERVICE_SOURCES} ${SYSTEMSERVICE_SOURCES}
${FILESYSTEM_SOURCES}
${UTIL_SOURCES} ${UTIL_SOURCES}
src/main.cpp src/main.cpp
src/types.h src/types.h

View File

@ -10,6 +10,8 @@
#include "Kernel/event_queues.h" #include "Kernel/event_queues.h"
#include "Kernel/memory_management.h" #include "Kernel/memory_management.h"
#include "Libs.h" #include "Libs.h"
#include "Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h"
#include "Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h"
namespace HLE::Libs::LibKernel { namespace HLE::Libs::LibKernel {
@ -44,6 +46,9 @@ void LibKernel_Register(SymbolsResolver* sym) {
LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail); LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail);
// time // time
LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc); LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc);
// fs
LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, Emulator::HLE::Libraries::LibKernel::FileSystem::sceKernelOpen);
LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX::open);
} }
}; // namespace HLE::Libs::LibKernel }; // namespace HLE::Libs::LibKernel

View File

@ -0,0 +1,13 @@
#include "file_system.h"
#include <debug.h>
#include <Util/log.h>
namespace Emulator::HLE::Libraries::LibKernel::FileSystem {
constexpr bool log_file_fs = true; // disable it to disable logging
int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
LOG_INFO_IF(log_file_fs, "sceKernelOpen path = {} flags = {} mode = {}\n", path, log_hex_full(flags), log_hex_full(mode));
return 0;
}
} // namespace Emulator::HLE::Libraries::LibKernel::FileSystem

View File

@ -0,0 +1,7 @@
#pragma once
#include <types.h>
namespace Emulator::HLE::Libraries::LibKernel::FileSystem {
int PS4_SYSV_ABI sceKernelOpen(const char *path, int flags, /* SceKernelMode*/ u16 mode);
}

View File

@ -0,0 +1,15 @@
#include "posix_file_system.h"
#include <debug.h>
#include "file_system.h"
namespace Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX {
int PS4_SYSV_ABI open(const char* path, int flags, /* SceKernelMode*/ u16 mode) {
int result = sceKernelOpen(path, flags, mode);
if (result < 0) {
BREAKPOINT(); // posix calls different only for their return values
}
return result;
}
} // namespace Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX

View File

@ -0,0 +1,6 @@
#pragma once
#include "types.h"
namespace Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX {
int PS4_SYSV_ABI open(const char *path, int flags, /* SceKernelMode*/ u16 mode);
}