some more fopen debugging

This commit is contained in:
georgemoralis 2023-11-13 14:11:53 +02:00
parent 57985304c6
commit 7feffecb0f
2 changed files with 10 additions and 2 deletions

View file

@ -40,7 +40,7 @@ int PS4_SYSV_ABI vsnprintf(char* s, size_t n, const char* format, VaList* arg) {
int PS4_SYSV_ABI puts(const char* s) { return std::puts(s); }
FILE* PS4_SYSV_ABI fopen(const char* filename, const char* mode) {
LOG_ERROR_IF(log_file_libc, "fopen filename={} , mode ={}\n", filename, mode);
LOG_INFO_IF(log_file_libc, "fopen filename={} , mode ={}\n", filename, mode);
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
@ -49,10 +49,13 @@ FILE* PS4_SYSV_ABI fopen(const char* filename, const char* mode) {
file->m_guest_name = filename;
file->m_host_name = mnt->getHostFile(file->m_guest_name);
FILE* f = std::fopen(file->m_host_name.c_str(), mode);
if (!f) {
LOG_ERROR_IF(log_file_libc, "fopen can't open file={}\n", filename);
}
return f;
}
int PS4_SYSV_ABI fclose(FILE* stream) {
LOG_ERROR_IF(log_file_libc, "fclose\n");
LOG_INFO_IF(log_file_libc, "fclose\n");
if (stream != nullptr) {
std::fclose(stream);
}

View file

@ -17,6 +17,7 @@
#include "emuTimer.h"
#include "emulator.h"
#include <core/hle/libraries/libkernel/thread_management.h>
#include "core/file_sys/fs.h"
int main(int argc, char* argv[]) {
if (argc == 1) {
@ -35,6 +36,10 @@ int main(int argc, char* argv[]) {
// Argument 1 is the path of self file to boot
const char* const path = argv[1];
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
std::filesystem::path p = std::string(path);
mnt->mount(p.parent_path().string(), "/app0");
auto linker = Common::Singleton<Core::Linker>::Instance();
Core::Libraries::InitHLELibs(&linker->getHLESymbols());
linker->LoadModule(path);