print param.sfo info at startup

This commit is contained in:
georgemoralis 2024-05-02 10:57:45 +03:00
parent 6f1e488b37
commit b0b73f1283
1 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include <Zydis/Zydis.h> #include <Zydis/Zydis.h>
#include <fmt/core.h> #include <fmt/core.h>
#include <core/file_format/psf.h>
#include "common/config.h" #include "common/config.h"
#include "common/discord.h" #include "common/discord.h"
#include "common/logging/backend.h" #include "common/logging/backend.h"
@ -48,6 +49,23 @@ int main(int argc, char* argv[]) {
std::filesystem::path p = std::string(path); std::filesystem::path p = std::string(path);
mnt->Mount(p.parent_path(), "/app0"); mnt->Mount(p.parent_path(), "/app0");
// Loading param.sfo file if exists
std::filesystem::path sce_sys_folder = p.parent_path() / "sce_sys";
if (std::filesystem::is_directory(sce_sys_folder)) {
for (const auto& entry : std::filesystem::directory_iterator(sce_sys_folder)) {
if (entry.path().filename() == "param.sfo") {
auto* param_sfo = Common::Singleton<PSF>::Instance();
param_sfo->open(sce_sys_folder.string() + "/param.sfo");
std::string id(param_sfo->GetString("CONTENT_ID"), 7, 9);
std::string title(param_sfo->GetString("TITLE"));
LOG_INFO(Loader, "Game id: {} Title: {}", id, title);
u32 fw_version = param_sfo->GetInteger("SYSTEM_VER");
std::string app_version = param_sfo->GetString("APP_VER");
LOG_INFO(Loader, "Fw: {:#x} App Version: {}", fw_version, app_version);
}
}
}
auto linker = Common::Singleton<Core::Linker>::Instance(); auto linker = Common::Singleton<Core::Linker>::Instance();
Libraries::InitHLELibs(&linker->getHLESymbols()); Libraries::InitHLELibs(&linker->getHLESymbols());
linker->LoadModule(path); linker->LoadModule(path);