mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-12-22 18:35:34 +00:00
Let's just register in init
This commit is contained in:
parent
1f6fd05884
commit
f617f3b78d
|
@ -97,16 +97,13 @@ static void gameLoop()
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
/* This would typically be in an installer and/or wrapped to only run once */
|
||||
Discord_Register(APPLICATION_ID);
|
||||
|
||||
DiscordEventHandlers handlers;
|
||||
memset(&handlers, 0, sizeof(handlers));
|
||||
handlers.ready = handleDiscordReady;
|
||||
handlers.disconnected = handleDiscordDisconnected;
|
||||
handlers.errored = handleDiscordError;
|
||||
handlers.presenceRequested = handleDiscordPresenceRequested;
|
||||
Discord_Initialize(APPLICATION_ID, &handlers);
|
||||
Discord_Initialize(APPLICATION_ID, &handlers, 1);
|
||||
|
||||
gameLoop();
|
||||
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Registration */
|
||||
|
||||
void Discord_Register(const char* applicationId);
|
||||
|
||||
/* RPC */
|
||||
|
||||
typedef struct DiscordRichPresence {
|
||||
const char* state;
|
||||
const char* details;
|
||||
|
@ -38,7 +32,7 @@ typedef struct DiscordEventHandlers {
|
|||
void (*spectateGame)(const char* spectateSecret);
|
||||
} DiscordEventHandlers;
|
||||
|
||||
void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers);
|
||||
void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers, int autoRegister);
|
||||
void Discord_Shutdown();
|
||||
|
||||
/* checks for incoming messages, dispatches callbacks */
|
||||
|
|
4
src/discord-register.h
Normal file
4
src/discord-register.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
void Discord_Register(const char* applicationId);
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#include "discord-rpc.h"
|
||||
|
||||
#include "backoff.h"
|
||||
#include "discord-register.h"
|
||||
#include "rpc_connection.h"
|
||||
#include "serialization.h"
|
||||
|
||||
|
@ -179,8 +180,12 @@ bool RegisterForEvent(const char* evtName)
|
|||
return false;
|
||||
}
|
||||
|
||||
extern "C" void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers)
|
||||
extern "C" void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers, int autoRegister)
|
||||
{
|
||||
if (autoRegister) {
|
||||
Discord_Register(applicationId);
|
||||
}
|
||||
|
||||
Pid = GetProcessId();
|
||||
|
||||
if (handlers) {
|
||||
|
|
Loading…
Reference in a new issue