Skip to content

Commit

Permalink
Debugger: Add version event for future proofing.
Browse files Browse the repository at this point in the history
Game isn't precisely right, but it's close enough.
  • Loading branch information
unknownbrackets committed Apr 24, 2018
1 parent 1ded50d commit 84ba2f4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Core/Debugger/WebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
// - "message": A string describing what happened.
// - "level": Integer severity level. (1 = NOTICE, 2 = ERROR, 3 = WARN, 4 = INFO, 5 = DEBUG, 6 = VERBOSE)
// - "ticket": Optional, present if in response to an event with a "ticket" field, simply repeats that value.
//
// At start, please send a "version" event. See WebSocket/GameSubscriber.cpp for more details.
//
// For other events, look inside Core/Debugger/WebSocket/ for details on each event.

#include "Core/Debugger/WebSocket/GameBroadcaster.h"
#include "Core/Debugger/WebSocket/LogBroadcaster.h"
Expand Down
16 changes: 16 additions & 0 deletions Core/Debugger/WebSocket/GameSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

void *WebSocketGameInit(DebuggerEventHandlerMap &map) {
map["game.status"] = &WebSocketGameStatus;
map["version"] = &WebSocketVersion;

return nullptr;
}
Expand Down Expand Up @@ -49,3 +50,18 @@ void WebSocketGameStatus(DebuggerRequest &req) {
}
json.writeBool("paused", GetUIState() == UISTATE_PAUSEMENU);
}

// Notify debugger version info (version)
//
// Parameters:
// - name: string indicating name of app or tool.
// - version: string version.
//
// Response (same event name):
// - name: string, "PPSSPP" unless some special build.
// - version: string, typically starts with "v" and may have git build info.
void WebSocketVersion(DebuggerRequest &req) {
JsonWriter &json = req.Respond();
json.writeString("name", "PPSSPP");
json.writeString("version", PPSSPP_GIT_VERSION);
}
1 change: 1 addition & 0 deletions Core/Debugger/WebSocket/GameSubscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
void *WebSocketGameInit(DebuggerEventHandlerMap &map);

void WebSocketGameStatus(DebuggerRequest &req);
void WebSocketVersion(DebuggerRequest &req);

0 comments on commit 84ba2f4

Please sign in to comment.