2018-05-26 22:24:13 -06:00
|
|
|
// Copyright 2018 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-05-26 22:24:13 -06:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-07-03 15:50:08 -06:00
|
|
|
#include <functional>
|
2018-08-06 15:56:40 -06:00
|
|
|
#include <string>
|
2018-07-03 15:50:08 -06:00
|
|
|
|
2018-05-26 22:24:13 -06:00
|
|
|
namespace Discord
|
|
|
|
{
|
2022-08-02 22:46:11 -06:00
|
|
|
// The number is the client ID for Dolphin, it's used for images and the application name
|
|
|
|
const std::string DEFAULT_CLIENT_ID = "455712169795780630";
|
|
|
|
|
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();
|
2022-08-02 22:46:11 -06:00
|
|
|
void UpdateClientID(const std::string& new_client = {});
|
|
|
|
bool UpdateDiscordPresenceRaw(const std::string& details = {}, const std::string& state = {},
|
|
|
|
const std::string& large_image_key = {},
|
|
|
|
const std::string& large_image_text = {},
|
|
|
|
const std::string& small_image_key = {},
|
|
|
|
const std::string& small_image_text = {},
|
|
|
|
const int64_t start_timestamp = 0, const int64_t end_timestamp = 0,
|
|
|
|
const int party_size = 0, const int party_max = 0);
|
2018-07-03 15:50:08 -06:00
|
|
|
void UpdateDiscordPresence(int party_size = 0, SecretType type = SecretType::Empty,
|
2024-02-24 13:57:06 -07:00
|
|
|
const std::string& secret = {}, const std::string& current_game = {},
|
|
|
|
const bool reset_timer = false);
|
2018-07-20 16:27:43 -06:00
|
|
|
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
|