diff --git a/Core/Debugger/WebSocket.cpp b/Core/Debugger/WebSocket.cpp index 23333d5a19..560dc719f2 100644 --- a/Core/Debugger/WebSocket.cpp +++ b/Core/Debugger/WebSocket.cpp @@ -138,6 +138,8 @@ void HandleDebuggerRequest(const http::Request &request) { UpdateConnected(1); SetupDebuggerLock(); + WebSocketClientInfo client_info; + GameBroadcaster game; LogBroadcaster logger; InputBroadcaster input; @@ -166,7 +168,7 @@ void HandleDebuggerRequest(const http::Request &request) { return; } - DebuggerRequest req(event, ws, root); + DebuggerRequest req(event, ws, root, &client_info); auto eventFunc = eventHandlers.find(event); if (eventFunc != eventHandlers.end()) { std::lock_guard guard(lifecycleLock); diff --git a/Core/Debugger/WebSocket/GameSubscriber.cpp b/Core/Debugger/WebSocket/GameSubscriber.cpp index 6d4d356cfe..2a680ec0d6 100644 --- a/Core/Debugger/WebSocket/GameSubscriber.cpp +++ b/Core/Debugger/WebSocket/GameSubscriber.cpp @@ -96,6 +96,18 @@ void WebSocketGameStatus(DebuggerRequest &req) { // - version: string, typically starts with "v" and may have git build info. void WebSocketVersion(DebuggerRequest &req) { JsonWriter &json = req.Respond(); + + std::string version; + if (!req.ParamString("version", &version)) { + return; + } + std::string name; + if (!req.ParamString("name", &name)) { + return; + } + req.client->name = name; + req.client->version = version; + json.writeString("name", "PPSSPP"); json.writeString("version", PPSSPP_GIT_VERSION); } diff --git a/Core/Debugger/WebSocket/WebSocketUtils.h b/Core/Debugger/WebSocket/WebSocketUtils.h index 38edc24a68..6c104eef3c 100644 --- a/Core/Debugger/WebSocket/WebSocketUtils.h +++ b/Core/Debugger/WebSocket/WebSocketUtils.h @@ -33,6 +33,14 @@ using namespace json; +struct WebSocketClientInfo { + WebSocketClientInfo() : name(), version() { + + } + std::string name; + std::string version; +}; + struct DebuggerErrorEvent { DebuggerErrorEvent(const std::string m, LogTypes::LOG_LEVELS l, const JsonGet data = JsonValue(JSON_NULL)) : message(m), level(l) { @@ -70,13 +78,14 @@ enum class DebuggerParamType { }; struct DebuggerRequest { - DebuggerRequest(const char *n, net::WebSocketServer *w, const JsonGet &d) - : name(n), ws(w), data(d) { + DebuggerRequest(const char *n, net::WebSocketServer *w, const JsonGet &d, WebSocketClientInfo *client_info) + : name(n), ws(w), data(d), client(client_info) { } const char *name; net::WebSocketServer *ws; const JsonGet data; + WebSocketClientInfo *client; void Fail(const std::string &message) { ws->Send(DebuggerErrorEvent(message, LogTypes::LERROR, data));