Exemplo n.º 1
0
	DiscordRPC::DiscordRPC()
	{
		joinString = "";
		detailString = "";
		Utils::Cryptography::RandomPassword(32, matchSecret);

		HMODULE hModule = GetModuleHandleW(NULL);
		WCHAR appPath[MAX_PATH];
		GetModuleFileNameW(hModule, appPath, MAX_PATH);
		Discord_Register("ElDewrito", Utils::String::ThinString(appPath).c_str());

		DiscordEventHandlers handlers;
		memset(&handlers, 0, sizeof(handlers));
		handlers.ready = handleDiscordReady;
		handlers.disconnected = handleDiscordDisconnected;
		handlers.errored = handleDiscordError;
		handlers.joinGame = handleDiscordJoin;
		handlers.spectateGame = handleDiscordSpectate;
		handlers.joinRequest = handleDiscordJoinRequest;
		Discord_Initialize(APPLICATION_ID, &handlers, 1, NULL);

		Patches::Core::OnShutdown(OnShutdown);
	}
Exemplo n.º 2
0
void discord_init(void)
{
   settings_t *settings = config_get_ptr();
   DiscordEventHandlers handlers;

   RARCH_LOG("[Discord] initializing ..\n");
   start_time            = time(0);

   memset(&handlers, 0, sizeof(handlers));
   handlers.ready        = handle_discord_ready;
   handlers.disconnected = handle_discord_disconnected;
   handlers.errored      = handle_discord_error;
   handlers.joinGame     = handle_discord_join;
   handlers.spectateGame = handle_discord_spectate;
   handlers.joinRequest  = handle_discord_join_request;

   /* To-Do: Add the arguments RetroArch was started with to the register URI*/
   const char command[256] = "retroarch";

   Discord_Initialize(settings->arrays.discord_app_id, &handlers, 0, NULL);
   Discord_Register(settings->arrays.discord_app_id, NULL);

   discord_ready         = true;
}
extern "C" DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId)
{
    char command[256];
    sprintf(command, "xdg-open steam://rungameid/%s", steamId);
    Discord_Register(applicationId, command);
}