mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-04 03:33:44 +01:00
Correctly unload GE framedumps. Additionally, look up the title when possible and show in titlebar.
This commit is contained in:
1 parent
3ab625a0fa
commit
2cc631338b
6 files changed
+37
-4
No files matched your search
@@ -88,7 +88,7 @@ constexpr bool SIMULATE_SLOW_IO = false;
|
||||
#else
|
||||
constexpr bool SIMULATE_SLOW_IO = false;
|
||||
#endif
|
||||
constexpr bool LOG_IO = false;
|
||||
constexpr bool LOG_IO = true;
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
BlobFileSystem::BlobFileSystem(IHandleAllocator *hAlloc, FileLoader *fileLoader, std::string alias)
|
||||
: alloc_(hAlloc), fileLoader_(fileLoader), alias_(alias) {
|
||||
NOTICE_LOG(Log::FileSystem, "%s", fileLoader->GetPath().c_str());
|
||||
}
|
||||
|
||||
BlobFileSystem::~BlobFileSystem() {
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "Core/SaveState.h"
|
||||
#include "Common/ExceptionHandlerSetup.h"
|
||||
#include "GPU/GPUCommon.h"
|
||||
#include "GPU/Debugger/Playback.h"
|
||||
#include "GPU/Debugger/RecordFormat.h"
|
||||
#include "Core/RetroAchievements.h"
|
||||
|
||||
@@ -326,6 +327,8 @@ void CPU_Shutdown() {
|
||||
PSP_LoadingLock lock;
|
||||
PSPLoaders_Shutdown();
|
||||
|
||||
GPURecord::Replay_Unload();
|
||||
|
||||
if (g_Config.bAutoSaveSymbolMap) {
|
||||
SaveSymbolMapIfSupported();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ struct GameDBInfo {
|
||||
class GameDB {
|
||||
public:
|
||||
// Warning: Linear search. Don't call it every frame if possible.
|
||||
// If this returns true, there is at least 1 entry in infos, so it's safe to go
|
||||
// look up element 0 for a quick guess.
|
||||
bool GetGameInfos(std::string_view id, std::vector<GameDBInfo> *infos);
|
||||
|
||||
private:
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Util/GameDB.h"
|
||||
#include "GPU/GPUCommon.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "GPU/ge_constants.h"
|
||||
@@ -73,6 +74,8 @@ static uint32_t lastExecVersion;
|
||||
static std::vector<Command> lastExecCommands;
|
||||
static std::vector<u8> lastExecPushbuf;
|
||||
|
||||
// This thread is restarted every frame (dump execution) for simplicity. TODO: Make persistent?
|
||||
// Alternatively, get rid of it, but the code is written in a way that makes it difficult (you'll see if you try).
|
||||
static std::thread replayThread;
|
||||
|
||||
static std::mutex opStartLock;
|
||||
@@ -80,6 +83,7 @@ static std::condition_variable opStartWait;
|
||||
|
||||
static std::mutex opFinishLock;
|
||||
static std::condition_variable opFinishWait;
|
||||
|
||||
static Operation g_opToExec;
|
||||
static u32 g_retVal;
|
||||
static bool g_opDone = true;
|
||||
@@ -825,6 +829,9 @@ static bool ReadCompressed(u32 fp, void *dest, size_t sz, uint32_t version) {
|
||||
|
||||
static u32 LoadReplay(const std::string &filename) {
|
||||
PROFILE_THIS_SCOPE("ReplayLoad");
|
||||
|
||||
NOTICE_LOG(Log::GeDebugger, "LoadReplay %s", filename.c_str());
|
||||
|
||||
u32 fp = pspFileSystem.OpenFile(filename, FILEACCESS_READ);
|
||||
Header header;
|
||||
pspFileSystem.ReadFile(fp, (u8 *)&header, sizeof(header));
|
||||
@@ -843,9 +850,17 @@ static u32 LoadReplay(const std::string &filename) {
|
||||
size_t gameIDLength = strnlen(header.gameID, sizeof(header.gameID));
|
||||
if (gameIDLength != 0) {
|
||||
g_paramSFO.SetValue("DISC_ID", std::string(header.gameID, gameIDLength), (int)sizeof(header.gameID));
|
||||
System_SetWindowTitle(g_paramSFO.GetValueString("DISC_ID"));
|
||||
std::vector<GameDBInfo> info;
|
||||
std::string gameTitle = "(unknown title)";
|
||||
#if !defined(__LIBRETRO__)
|
||||
if (g_gameDB.GetGameInfos(header.gameID, &info)) {
|
||||
gameTitle = info[0].title;
|
||||
g_paramSFO.SetValue("TITLE", gameTitle, (int)gameTitle.size());
|
||||
}
|
||||
#endif
|
||||
System_SetWindowTitle(g_paramSFO.GetValueString("DISC_ID") + " : " + gameTitle + " (GE frame dump)");
|
||||
} else {
|
||||
System_SetWindowTitle("(old dump: missing DISC_ID)");
|
||||
System_SetWindowTitle("(GE frame dump: old format, missing DISC_ID)");
|
||||
}
|
||||
|
||||
u32 sz = 0;
|
||||
@@ -872,6 +887,18 @@ static u32 LoadReplay(const std::string &filename) {
|
||||
return version;
|
||||
}
|
||||
|
||||
void Replay_Unload() {
|
||||
_dbg_assert_(!replayThread.joinable());
|
||||
|
||||
lastExecFilename.clear();
|
||||
lastExecVersion = 0;
|
||||
lastExecCommands.clear();
|
||||
lastExecPushbuf.clear();
|
||||
|
||||
g_opDone = true;
|
||||
g_retVal = 0;
|
||||
}
|
||||
|
||||
void WriteRunDumpCode(u32 codeStart) {
|
||||
// NOTE: Not static, since parts are run-time computed (MIPS_MAKE_SYSCALL etc)
|
||||
const u32 runDumpCode[] = {
|
||||
|
||||
@@ -30,6 +30,6 @@ enum class ReplayResult {
|
||||
|
||||
void WriteRunDumpCode(u32 addr);
|
||||
ReplayResult RunMountedReplay(const std::string &filename);
|
||||
void ReplayShutdown();
|
||||
void Replay_Unload();
|
||||
|
||||
} // namespace GPURecord
|
||||
Reference in new issue
Block a user