From a4a8e8f569c4ddc4849ba4c03da6bbfcea95871a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 23 Jan 2016 13:06:58 -0800 Subject: [PATCH] UI: Show savestate titles in manager. Note: this will also show broken savestates with (broken). --- UI/GameInfoCache.cpp | 11 ++++++++++- UI/GameInfoCache.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 36b428cd4a..0e98c0cf5c 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -35,6 +35,7 @@ #include "Core/FileSystems/DirectoryFileSystem.h" #include "Core/FileSystems/VirtualDiscFileSystem.h" #include "Core/ELF/PBPReader.h" +#include "Core/SaveState.h" #include "Core/System.h" #include "Core/Util/GameManager.h" #include "Core/Config.h" @@ -287,6 +288,11 @@ std::string GameInfo::GetTitle() { return title; } +void GameInfo::SetTitle(const std::string &newTitle) { + lock_guard guard(lock); + title = newTitle; +} + static bool ReadFileToString(IFileSystem *fs, const char *filename, std::string *contents, recursive_mutex *mtx) { PSPFileInfo info = fs->GetFileInfo(filename); if (!info.exists) { @@ -443,9 +449,12 @@ handleELF: case FILETYPE_PPSSPP_SAVESTATE: { + info_->SetTitle(SaveState::GetTitle(gamePath_)); + + lock_guard guard(info_->lock); + // Let's use the screenshot as an icon, too. std::string screenshotPath = ReplaceAll(gamePath_, ".ppst", ".jpg"); - lock_guard guard(info_->lock); if (File::Exists(screenshotPath)) { if (readFileToString(false, screenshotPath.c_str(), info_->iconTextureData)) { info_->iconDataLoaded = true; diff --git a/UI/GameInfoCache.h b/UI/GameInfoCache.h index 74d2823a1a..9fa3c36a39 100644 --- a/UI/GameInfoCache.h +++ b/UI/GameInfoCache.h @@ -117,6 +117,7 @@ public: std::vector GetSaveDataDirectories(); std::string GetTitle(); + void SetTitle(const std::string &newTitle); // Hold this when reading or writing from the GameInfo. // Don't need to hold it when just passing around the pointer,