2020-12-05 13:08:24 +01:00
|
|
|
#ifdef WITH_DISCORD_RPC
|
2018-06-16 22:56:21 +02:00
|
|
|
#include "_discord_utils.h"
|
|
|
|
|
#include "discord_rpc.h"
|
|
|
|
|
|
2020-12-22 09:42:57 +01:00
|
|
|
#include <string>
|
|
|
|
|
#include <ctime>
|
|
|
|
|
|
2018-06-16 22:56:21 +02:00
|
|
|
namespace discord
|
|
|
|
|
{
|
|
|
|
|
void initialize(const std::string& application_id)
|
|
|
|
|
{
|
|
|
|
|
DiscordEventHandlers handlers = {};
|
2021-04-07 23:05:18 +02:00
|
|
|
Discord_Initialize(application_id.c_str(), &handlers, 1, nullptr);
|
2018-06-16 22:56:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void shutdown()
|
|
|
|
|
{
|
|
|
|
|
Discord_Shutdown();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void update_presence(const std::string& state, const std::string& details, bool reset_timer)
|
|
|
|
|
{
|
|
|
|
|
DiscordRichPresence discordPresence = {};
|
|
|
|
|
discordPresence.details = details.c_str();
|
|
|
|
|
discordPresence.state = state.c_str();
|
|
|
|
|
discordPresence.largeImageKey = "rpcs3_logo";
|
|
|
|
|
discordPresence.largeImageText = "RPCS3 is the world's first PlayStation 3 emulator.";
|
|
|
|
|
|
|
|
|
|
if (reset_timer)
|
|
|
|
|
{
|
2021-04-07 23:05:18 +02:00
|
|
|
discordPresence.startTimestamp = std::time(nullptr);
|
2018-06-16 22:56:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Discord_UpdatePresence(&discordPresence);
|
|
|
|
|
}
|
2025-04-05 21:50:45 +02:00
|
|
|
} // namespace discord
|
2018-06-21 00:46:41 +02:00
|
|
|
#endif
|