mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-01 01:11:46 +00:00
Merge pull request #17520 from Nemoumbra/websocket-client
Added WebsocketClientInfo
This commit is contained in:
commit
69b5b36416
@ -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<std::mutex> guard(lifecycleLock);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user