Discord rich presence (#4500)

* WIP RPC support

* Might have windows support now, don't peek

* Windows support

* RichPresence: __SWITCH__ => DISABLE_RPC (for MOBILE_STK support)

* RichPresence: Handle JSON strings according to spec, support for addons icon

* RichPresence: use translated difficulty name

* RichPresence: disable when client_id=-1

* RichPresence: thread connection, show server name on RPC

* RichPresence: destroy on close

* RichPresence: don't compile methods at all if DISABLE_RPC

* RichPresence: fix windows compile (untested)

* RichPresence: fix for mac

* RichPresence: Linux needs MSG_NOSIGNAL still

* RichPresence: fix memory leaks, don't spam update while not connected

* RichPresence: free thread on terminate

* RichPresence: handle initial registration

* RichPresence: fix compiler warning
This commit is contained in:
Mary
2021-03-09 21:47:33 -05:00
committed by GitHub
parent 8daf149895
commit 0dd3c62a43
11 changed files with 616 additions and 5 deletions

View File

@@ -56,6 +56,7 @@
#include "utils/string_utils.hpp"
#include "utils/time.hpp"
#include "utils/translation.hpp"
#include "io/rich_presence.hpp"
#ifndef WIN32
#include <unistd.h>
@@ -714,6 +715,8 @@ void MainLoop::run()
}
}
RichPresenceNS::RichPresence::get()->update(false);
if (auto gp = GameProtocol::lock())
{
gp->sendActions();