2018-05-26 22:24:13 -06:00
|
|
|
// Copyright 2018 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-07-03 15:50:08 -06:00
|
|
|
#include <functional>
|
|
|
|
|
2018-05-26 22:24:13 -06:00
|
|
|
namespace Discord
|
|
|
|
{
|
2018-07-03 15:50:08 -06:00
|
|
|
using JoinFunction = std::function<void()>;
|
2018-07-20 16:27:43 -06:00
|
|
|
using JoinRequestFunction =
|
|
|
|
std::function<void(const char* id, const std::string& discord_tag, const char* avatar)>;
|
2018-07-03 15:50:08 -06:00
|
|
|
|
2018-07-20 16:27:43 -06:00
|
|
|
class Handler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Handler();
|
|
|
|
virtual void DiscordJoin() = 0;
|
|
|
|
virtual void DiscordJoinRequest(const char* id, const std::string& discord_tag,
|
|
|
|
const char* avatar) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class SecretType
|
2018-07-03 15:50:08 -06:00
|
|
|
{
|
|
|
|
Empty,
|
|
|
|
IPAddress,
|
|
|
|
RoomID,
|
|
|
|
};
|
|
|
|
|
2018-05-26 22:24:13 -06:00
|
|
|
void Init();
|
2018-07-20 16:27:43 -06:00
|
|
|
void InitNetPlayFunctionality(Handler& handler);
|
2018-07-03 15:50:08 -06:00
|
|
|
void CallPendingCallbacks();
|
|
|
|
void UpdateDiscordPresence(int party_size = 0, SecretType type = SecretType::Empty,
|
2018-07-20 16:27:43 -06:00
|
|
|
const std::string& secret = {}, const std::string& current_game = {});
|
|
|
|
std::string CreateSecretFromIPAddress(const std::string& ip_address, int port);
|
2018-05-26 22:24:13 -06:00
|
|
|
void Shutdown();
|
2018-06-05 22:16:42 -06:00
|
|
|
void SetDiscordPresenceEnabled(bool enabled);
|
2018-05-26 22:24:13 -06:00
|
|
|
} // namespace Discord
|