support for unlocking trophies (#854)

* add pugixml

* trophy_viewer: support for trophy unlocking

* nptrophy: UnlockTrophy(), DestroyContext()

* initial imgui popup

* queue to handle multiple trophies at once

* extract trophy info on game start + various fixes

* platinum trophy support + extract trophy data on startup

* format

* nptrophy: GetTrophyUnlockState

* implement vinicius' reviews
This commit is contained in:
CrazyBloo 2024-09-10 23:50:55 -04:00 committed by GitHub
parent c5b8e492f6
commit 74c2888aaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 607 additions and 53 deletions

View file

@ -19,12 +19,14 @@
#include "core/file_format/playgo_chunk.h"
#include "core/file_format/psf.h"
#include "core/file_format/splash.h"
#include "core/file_format/trp.h"
#include "core/file_sys/fs.h"
#include "core/libraries/disc_map/disc_map.h"
#include "core/libraries/kernel/thread_management.h"
#include "core/libraries/libc_internal/libc_internal.h"
#include "core/libraries/libs.h"
#include "core/libraries/ngs2/ngs2.h"
#include "core/libraries/np_trophy/np_trophy.h"
#include "core/libraries/rtc/rtc.h"
#include "core/linker.h"
#include "core/memory.h"
@ -98,6 +100,15 @@ void Emulator::Run(const std::filesystem::path& file) {
auto* param_sfo = Common::Singleton<PSF>::Instance();
param_sfo->open(sce_sys_folder.string() + "/param.sfo", {});
id = std::string(param_sfo->GetString("CONTENT_ID"), 7, 9);
Libraries::NpTrophy::game_serial = id;
const auto trophyDir =
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / id / "TrophyFiles";
if (!std::filesystem::exists(trophyDir)) {
TRP trp;
if (!trp.Extract(file.parent_path())) {
LOG_ERROR(Loader, "Couldn't extract trophies");
}
}
#ifdef ENABLE_QT_GUI
MemoryPatcher::g_game_serial = id;
#endif