From 16bca6fe8b20347ab8a9599a926f6e0184c22dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 31 May 2023 07:51:14 +0200 Subject: [PATCH 1/2] Make GAmeSubscriber backward compatible again. Now it won't break any potential old client that doesn't pass the fields. Should have insisted on this. --- Core/Debugger/WebSocket/GameSubscriber.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Core/Debugger/WebSocket/GameSubscriber.cpp b/Core/Debugger/WebSocket/GameSubscriber.cpp index 2a680ec0d6..50dbead55a 100644 --- a/Core/Debugger/WebSocket/GameSubscriber.cpp +++ b/Core/Debugger/WebSocket/GameSubscriber.cpp @@ -98,15 +98,13 @@ void WebSocketVersion(DebuggerRequest &req) { JsonWriter &json = req.Respond(); std::string version; - if (!req.ParamString("version", &version)) { - return; + if (req.ParamString("version", &version)) { + req.client->version = version; } std::string name; - if (!req.ParamString("name", &name)) { - return; + if (req.ParamString("name", &name)) { + req.client->name = name; } - req.client->name = name; - req.client->version = version; json.writeString("name", "PPSSPP"); json.writeString("version", PPSSPP_GIT_VERSION); From 69f67fa73fd0a76aa8526c7aa02b2ce087327119 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 31 May 2023 00:01:47 -0700 Subject: [PATCH 2/2] Debugger: Make version API params optional. They still have types, so some will fail such as an array. --- Core/Debugger/WebSocket/GameSubscriber.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Core/Debugger/WebSocket/GameSubscriber.cpp b/Core/Debugger/WebSocket/GameSubscriber.cpp index 50dbead55a..dae7f871a7 100644 --- a/Core/Debugger/WebSocket/GameSubscriber.cpp +++ b/Core/Debugger/WebSocket/GameSubscriber.cpp @@ -97,14 +97,15 @@ void WebSocketGameStatus(DebuggerRequest &req) { void WebSocketVersion(DebuggerRequest &req) { JsonWriter &json = req.Respond(); - std::string version; - if (req.ParamString("version", &version)) { - req.client->version = version; - } - std::string name; - if (req.ParamString("name", &name)) { - req.client->name = name; - } + std::string version = req.client->version; + if (!req.ParamString("version", &version, DebuggerParamType::OPTIONAL_LOOSE)) + return; + std::string name = req.client->name; + if (!req.ParamString("name", &name, DebuggerParamType::OPTIONAL_LOOSE)) + return; + + req.client->version = version; + req.client->name = name; json.writeString("name", "PPSSPP"); json.writeString("version", PPSSPP_GIT_VERSION);