mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 02:33:43 +01:00
Replay and GPUDisasm subscribers: read core state on the CPU thread
replay.* mutates and reads replay/RTC state that the CPU thread consumes as it runs, and gpu.displaylist.disasm reads through the gpu pointer and emulated memory. Both did it straight from the WebSocket thread. Route through Core_RunOnCPUThread(), and fold the "is a game running" checks into the same trip rather than testing before it, where the answer could already be stale. Part of removing the WebSocket debugger's lifecycleLock. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
This commit is contained in:
1 parent
a59b5c6dd5
commit
3a669891dc
2 files changed
+66
-26
No files matched your search
@@ -20,6 +20,7 @@
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Debugger/WebSocket/GPUDisasmSubscriber.h"
|
||||
#include "Core/Debugger/WebSocket/WebSocketUtils.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "GPU/GPU.h"
|
||||
#include "GPU/GPUCommon.h"
|
||||
@@ -58,13 +59,6 @@ DebuggerSubscriber *WebSocketGPUDisasmInit(DebuggerEventHandlerMap &map) {
|
||||
// "AAAAAAAA desc" - meant for skimming a display list by eye instead of parsing full JSON,
|
||||
// same idea as memory.disasm's own compact mode.
|
||||
void WebSocketGPUDisplayListDisasm(DebuggerRequest &req) {
|
||||
if (!gpu) {
|
||||
return req.Fail("No GPU active (game not booted?)");
|
||||
}
|
||||
if (!Memory::IsActive()) {
|
||||
return req.Fail("Memory not active");
|
||||
}
|
||||
|
||||
// Mirrors memory.disasm's own limit - keeps a client typo (e.g. count=0xFFFFFFFF) from
|
||||
// blocking the debugger connection for an unreasonable amount of time.
|
||||
static const uint32_t MAX_RANGE = 10000;
|
||||
@@ -89,7 +83,17 @@ void WebSocketGPUDisplayListDisasm(DebuggerRequest &req) {
|
||||
if (!req.ParamBool("compact", &compact, DebuggerParamType::OPTIONAL))
|
||||
return;
|
||||
|
||||
std::vector<GPUDebugOp> ops = gpu->DisassembleOpRange(start, end);
|
||||
// gpu and the memory it disassembles from are CPU-thread-owned, so do the read over there
|
||||
// rather than from this WebSocket handler thread - see Core_RunOnCPUThread() in Core.h.
|
||||
bool active = false;
|
||||
std::vector<GPUDebugOp> ops;
|
||||
Core_RunOnCPUThread([&] {
|
||||
active = gpu && Memory::IsActive();
|
||||
if (active)
|
||||
ops = gpu->DisassembleOpRange(start, end);
|
||||
});
|
||||
if (!active)
|
||||
return req.Fail("No GPU active (game not booted?)");
|
||||
|
||||
JsonWriter &json = req.Respond();
|
||||
json.pushArray("lines");
|
||||
|
||||
Reference in new issue
Block a user