From e272b152eda8e4e4b90b880592d0a98cbd59db2a Mon Sep 17 00:00:00 2001 From: whereismyfoodat Date: Wed, 27 Mar 2024 08:41:14 +0200 Subject: [PATCH] small fixes , cleanups --- src/common/config.cpp | 8 ++++---- src/core/hle/libraries/libkernel/libkernel.cpp | 2 -- src/core/linker.cpp | 10 +--------- src/core/linker.h | 1 - src/main.cpp | 8 ++++---- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index 72a46ddf..6040df53 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -89,11 +89,11 @@ void load(const std::filesystem::path& path) { } } if (data.contains("LLE")) { - auto generalResult = toml::expect(data.at("LLE")); - if (generalResult.is_ok()) { - auto general = generalResult.unwrap(); + auto lleResult = toml::expect(data.at("LLE")); + if (lleResult.is_ok()) { + auto lle = lleResult.unwrap(); - isLibc = toml::find_or(general, "libc", true); + isLibc = toml::find_or(lle, "libc", true); } } } diff --git a/src/core/hle/libraries/libkernel/libkernel.cpp b/src/core/hle/libraries/libkernel/libkernel.cpp index bf40182c..e666d6a3 100644 --- a/src/core/hle/libraries/libkernel/libkernel.cpp +++ b/src/core/hle/libraries/libkernel/libkernel.cpp @@ -27,9 +27,7 @@ namespace Core::Libraries::LibKernel { static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; // dummy return static void* PS4_SYSV_ABI sceKernelGetProcParam() { - auto* linker = Common::Singleton::Instance(); - return reinterpret_cast(linker->GetProcParam()); } diff --git a/src/core/linker.cpp b/src/core/linker.cpp index 153abed1..ba38d412 100644 --- a/src/core/linker.cpp +++ b/src/core/linker.cpp @@ -84,14 +84,6 @@ Module* Linker::LoadModule(const std::filesystem::path& elf_name) { return m.get(); } -Module* Linker::FindModule(u32 id) { - // TODO atm we only have 1 module so we don't need to iterate on vector - if (m_modules.empty()) [[unlikely]] { - return nullptr; - } - return m_modules[0].get(); -} - void Linker::LoadModuleToMemory(Module* m) { // get elf header, program header const auto elf_header = m->elf.GetElfHeader(); @@ -628,7 +620,7 @@ static PS4_SYSV_ABI int run_module(uint64_t addr, size_t args, const void* argp, } int Linker::StartModule(Module* m, size_t args, const void* argp, module_func_t func) { - LOG_INFO(Core_Linker, "Module started : {}\n", m->file_name); + LOG_INFO(Core_Linker, "Module started : {}", m->file_name); return run_module(m->dynamic_info.init_virtual_addr + m->base_virtual_addr, args, argp, func); } diff --git a/src/core/linker.h b/src/core/linker.h index 62630395..ae730878 100644 --- a/src/core/linker.h +++ b/src/core/linker.h @@ -126,7 +126,6 @@ public: virtual ~Linker(); Module* LoadModule(const std::filesystem::path& elf_name); - Module* FindModule(u32 id = 0); void LoadModuleToMemory(Module* m); void LoadDynamicInfo(Module* m); void LoadSymbols(Module* m); diff --git a/src/main.cpp b/src/main.cpp index 8d45f7a6..c63bb528 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include "common/config.h" @@ -53,13 +54,12 @@ int main(int argc, char* argv[]) { // check if there is a libc.prx in sce_module folder bool found = false; if (Config::isLleLibc()) { - std::filesystem::path sce_module_folder = - std::string(p.parent_path().string() + "\\sce_module"); - if (std::filesystem::exists(sce_module_folder)) { + std::filesystem::path sce_module_folder = p.parent_path() / "sce_module"; + if (std::filesystem::is_directory(sce_module_folder)) { for (const auto& entry : std::filesystem::directory_iterator(sce_module_folder)) { if (entry.path().filename() == "libc.prx") { found = true; - printf("%s\n", entry.path().string().c_str()); + LOG_INFO(Loader, "Loading {}", entry.path().string().c_str()); linker->LoadModule(entry.path().string().c_str()); } }