2018-05-28 23:43:30 -05:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2019-06-16 13:32:27 -05:00
|
|
|
* Copyright (C) 2018-2019 - Andrés Suárez
|
2018-05-28 23:43:30 -05:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __RARCH_DISCORD_H
|
|
|
|
#define __RARCH_DISCORD_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <boolean.h>
|
|
|
|
|
2021-11-04 22:50:38 +01:00
|
|
|
#include <discord_rpc.h>
|
|
|
|
#include "../deps/discord-rpc/include/discord_rpc.h"
|
|
|
|
|
2018-05-28 23:43:30 -05:00
|
|
|
enum discord_presence
|
|
|
|
{
|
2018-09-09 16:41:50 -05:00
|
|
|
DISCORD_PRESENCE_NONE = 0,
|
|
|
|
DISCORD_PRESENCE_MENU,
|
2018-05-28 23:43:30 -05:00
|
|
|
DISCORD_PRESENCE_GAME,
|
2018-08-18 02:12:51 -05:00
|
|
|
DISCORD_PRESENCE_GAME_PAUSED,
|
2018-05-28 23:43:30 -05:00
|
|
|
DISCORD_PRESENCE_NETPLAY_HOSTING,
|
2019-02-06 19:01:11 -05:00
|
|
|
DISCORD_PRESENCE_NETPLAY_CLIENT,
|
|
|
|
DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED,
|
2020-01-05 17:53:59 -06:00
|
|
|
DISCORD_PRESENCE_RETROACHIEVEMENTS,
|
2019-02-06 19:01:11 -05:00
|
|
|
DISCORD_PRESENCE_SHUTDOWN
|
2018-05-28 23:43:30 -05:00
|
|
|
};
|
|
|
|
|
2018-05-29 12:41:13 +02:00
|
|
|
typedef struct discord_userdata
|
|
|
|
{
|
|
|
|
enum discord_presence status;
|
|
|
|
} discord_userdata_t;
|
|
|
|
|
2021-11-04 22:50:38 +01:00
|
|
|
/* The Discord API specifies these variables:
|
|
|
|
- userId --------- char[24] - the userId of the player asking to join
|
|
|
|
- username ------- char[344] - the username of the player asking to join
|
|
|
|
- discriminator -- char[8] - the discriminator of the player asking to join
|
|
|
|
- spectateSecret - char[128] - secret used for spectatin matches
|
|
|
|
- joinSecret - char[128] - secret used to join matches
|
|
|
|
- partyId - char[128] - the party you would be joining
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct discord_state
|
|
|
|
{
|
|
|
|
int64_t start_time;
|
|
|
|
int64_t pause_time;
|
|
|
|
int64_t elapsed_time;
|
|
|
|
|
|
|
|
DiscordRichPresence presence; /* int64_t alignment */
|
|
|
|
|
|
|
|
unsigned status;
|
|
|
|
|
|
|
|
char self_party_id[128];
|
|
|
|
char peer_party_id[128];
|
|
|
|
char user_name[344];
|
|
|
|
char user_avatar[344];
|
|
|
|
|
|
|
|
bool ready;
|
|
|
|
bool avatar_ready;
|
|
|
|
bool connecting;
|
2021-11-05 13:45:00 +01:00
|
|
|
bool inited;
|
2021-11-04 22:50:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct discord_state discord_state_t;
|
|
|
|
|
2020-06-26 15:39:03 +01:00
|
|
|
void discord_update(enum discord_presence presence);
|
2018-05-28 23:43:30 -05:00
|
|
|
|
2019-01-19 23:15:48 +01:00
|
|
|
bool discord_is_ready(void);
|
2018-12-24 14:28:36 -05:00
|
|
|
|
2018-12-24 15:06:21 -05:00
|
|
|
void discord_avatar_set_ready(bool ready);
|
|
|
|
|
2019-01-19 23:15:48 +01:00
|
|
|
bool discord_avatar_is_ready(void);
|
2018-12-24 15:06:21 -05:00
|
|
|
|
2018-12-24 14:28:36 -05:00
|
|
|
char* discord_get_own_avatar(void);
|
|
|
|
|
2021-11-05 04:42:03 +01:00
|
|
|
char *discord_get_own_username(void);
|
|
|
|
|
2021-11-04 22:50:38 +01:00
|
|
|
discord_state_t *discord_state_get_ptr(void);
|
|
|
|
|
|
|
|
void discord_init(const char *discord_app_id, char *args);
|
|
|
|
|
2018-05-28 23:43:30 -05:00
|
|
|
#endif /* __RARCH_DISCORD_H */
|