mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 12:25:56 +00:00
Add Discord Rich Presence, off by default.
A host thread speaks Discord's documented IPC protocol to a running client through platform.h's new plat_ipc_* (a named pipe on Windows, a Unix socket in $DISCORD_IPC_PATH, $XDG_RUNTIME_DIR, $TMPDIR or /tmp on Linux) and shows the game update and the elapsed play time as the status of a configurable application. It never holds a virtual core, picks up settings changes within half a second of the menu writing them, re-sends the activity once a minute as its keep-alive, answers the client's Ping frames and reconnects 15 s after a break; Discord clears the status when the process ends. The Menu tab of the settings menu switches discord_rpc, and discord_app_id and discord_image in totk.ini name the application and its art asset (a player can register their own). The default app id is the one this was developed against; the maintainer may want to register a project-owned one and swap it. --probe-discord runs the exchange without the game: it caught the opcode numbering (Handshake is 0, not 1) against a live client. Tested on 1.4.3, Linux: probe passed end to end against Vesktop's arRPC bridge, an invalid app id falls back to the default, selftest clean.
This commit is contained in:
1 parent
ab1dee5bdb
commit
664ee03759
12 files changed
+416
-2
No files matched your search
@@ -849,6 +849,7 @@ static void tab_menu(float scale) {
|
||||
static const UiTextId langs[] = {UI_MENU_MENU_LANG_AUTO, UI_MENU_LANGNAME_EN, UI_MENU_LANGNAME_RU,
|
||||
UI_MENU_LANGNAME_PT_BR, UI_MENU_LANGNAME_ZH_HANS};
|
||||
opt_choice("TOTK_MENU_LANG", UI_MENU_MENU_LANG, langs, sizeof langs / sizeof *langs, UI_MENU_MENU_LANG_DESC);
|
||||
opt_toggle("TOTK_DISCORD_RPC", UI_MENU_DISCORD_RPC, UI_MENU_DISCORD_RPC_DESC);
|
||||
opt_end();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user