mirror of
https://github.com/SirHumza/orbisRPC.git
synced 2026-10-06 13:00:35 +02:00
- tmdb_crypto: self-contained SHA1/HMAC, URL builder, response parse, all verified against hashlib and Sony's live service in unit tests - tmdb: plain-HTTP fetch with deadline plus 8-entry cache - detect: TMDB in both resolve paths; artwork URL plumbed through detect_last_art into presence assets (official Sony CDN, no uploads) - remove appdb byte-scan: boundary ambiguity returned wrong names, worse than raw IDs; also removes the multi-MB game-process read - discord/daemon: full-URL artwork wins, pack URL next, asset key last
32 lines
1.7 KiB
C
32 lines
1.7 KiB
C
/* discord.h - gateway session + presence (user session token). */
|
|
#ifndef DISCORD_H
|
|
#define DISCORD_H
|
|
#include "ws.h"
|
|
typedef struct {
|
|
ws_t ws;
|
|
char token[512];
|
|
int64_t last_heartbeat; /* when we last sent op 1 */
|
|
int64_t last_ack; /* when the gateway last acked (op 11) */
|
|
int64_t hb_interval_ms;
|
|
int seq; /* last dispatch sequence (heartbeat payload) */
|
|
int connected;
|
|
int sent_hb; /* at least one heartbeat sent */
|
|
} discord_t;
|
|
/* Returns 0 on READY, -1 net/proto error, -2 auth-fatal (close 4004: don't
|
|
* retry — the token is wrong and Discord bans IPs that hammer it). */
|
|
int discord_connect(discord_t *d, const char *token);
|
|
int discord_set_presence(discord_t *d, const char *state, const char *name,
|
|
const char *application_id, int64_t started_epoch); /* op 3 */
|
|
/* Same + titleId asset key: when application_id is set, sends
|
|
* assets { large_image: "<lower titleId>", large_text: "<name>" } so the
|
|
* game icon shows once uploaded under that name in the Discord app.
|
|
* When art_base_url is set instead, large_image becomes
|
|
* "<base><lower titleId>.png" (external URL assets, no uploads needed). */
|
|
int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
|
const char *title_id, const char *application_id,
|
|
const char *art_base_url, const char *art_url,
|
|
int64_t started_epoch); /* op 3 */
|
|
int discord_clear_presence(discord_t *d); /* clear activity, stay online */
|
|
int discord_tick(discord_t *d); /* 0 ok; -1 drop/reconnect; -2 auth-fatal; -3 invalid session (retry promptly) */
|
|
#endif
|