mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-25 20:32:22 +00:00
(Discord) Remove stray discord_is_inited global - put it in
discord_state_t instead
This commit is contained in:
parent
15321b2588
commit
121174c9af
@ -71,6 +71,7 @@ struct discord_state
|
||||
bool ready;
|
||||
bool avatar_ready;
|
||||
bool connecting;
|
||||
bool inited;
|
||||
};
|
||||
|
||||
typedef struct discord_state discord_state_t;
|
||||
|
@ -152,18 +152,12 @@ struct ad_packet
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
#ifdef HAVE_DISCORD
|
||||
extern bool discord_is_inited;
|
||||
#endif
|
||||
|
||||
/* TODO/FIXME - globals */
|
||||
struct netplay_room *netplay_room_list = NULL;
|
||||
int netplay_room_count = 0;
|
||||
static netplay_t *handshake_password_netplay = NULL;
|
||||
static unsigned long simple_rand_next = 1;
|
||||
|
||||
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
/* LAN discovery sockets */
|
||||
static int lan_ad_server_fd = -1;
|
||||
@ -3533,7 +3527,7 @@ void netplay_hangup(netplay_t *netplay,
|
||||
{
|
||||
dmsg = msg_hash_to_str(MSG_NETPLAY_CLIENT_HANGUP);
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited)
|
||||
if (discord_state_get_ptr()->inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||
@ -6957,7 +6951,7 @@ static void netplay_announce_cb(retro_task_t *task,
|
||||
}
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited)
|
||||
if (discord_state_get_ptr()->inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_NETPLAY_HOSTING;
|
||||
@ -7103,7 +7097,7 @@ static void netplay_disconnect(netplay_t *netplay)
|
||||
deinit_netplay();
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited)
|
||||
if (discord_state_get_ptr()->inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||
@ -7336,7 +7330,7 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data)
|
||||
case RARCH_NETPLAY_CTL_DISABLE:
|
||||
net_st->netplay_enabled = false;
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited)
|
||||
if (discord_state_get_ptr()->inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||
|
31
retroarch.c
31
retroarch.c
@ -264,9 +264,6 @@ static const void *MAGIC_POINTER = (void*)(uintp
|
||||
#endif
|
||||
|
||||
/* TODO/FIXME - turn these into static global variable */
|
||||
#ifdef HAVE_DISCORD
|
||||
bool discord_is_inited = false;
|
||||
#endif
|
||||
retro_keybind_set input_config_binds[MAX_USERS];
|
||||
retro_keybind_set input_autoconf_binds[MAX_USERS];
|
||||
|
||||
@ -5491,7 +5488,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
return false;
|
||||
}
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited)
|
||||
if (discord_state_get_ptr()->inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||
@ -15200,15 +15197,19 @@ bool retroarch_main_init(int argc, char *argv[])
|
||||
runloop_st->is_inited = true;
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
if (command_event(CMD_EVENT_DISCORD_INIT, NULL))
|
||||
discord_is_inited = true;
|
||||
|
||||
if (discord_is_inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_MENU;
|
||||
discord_state_t *discord_st = discord_state_get_ptr();
|
||||
|
||||
command_event(CMD_EVENT_DISCORD_UPDATE, &userdata);
|
||||
if (command_event(CMD_EVENT_DISCORD_INIT, NULL))
|
||||
discord_st->inited = true;
|
||||
|
||||
if (discord_st->inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_MENU;
|
||||
|
||||
command_event(CMD_EVENT_DISCORD_UPDATE, &userdata);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -15790,7 +15791,7 @@ bool retroarch_main_quit(void)
|
||||
global_t *global = global_get_ptr();
|
||||
#ifdef HAVE_DISCORD
|
||||
discord_state_t *discord_st = &discord_state_st;
|
||||
if (discord_is_inited)
|
||||
if (discord_st->inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_SHUTDOWN;
|
||||
@ -15805,7 +15806,7 @@ bool retroarch_main_quit(void)
|
||||
Discord_Shutdown();
|
||||
discord_st->ready = false;
|
||||
}
|
||||
discord_is_inited = false;
|
||||
discord_st->inited = false;
|
||||
#endif
|
||||
|
||||
/* Restore original refresh rate, if it has been changed
|
||||
@ -17151,7 +17152,7 @@ int runloop_iterate(void)
|
||||
#ifdef HAVE_DISCORD
|
||||
discord_state_t *discord_st = &discord_state_st;
|
||||
|
||||
if (discord_is_inited)
|
||||
if (discord_st->inited)
|
||||
{
|
||||
Discord_RunCallbacks();
|
||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||
@ -17399,7 +17400,7 @@ int runloop_iterate(void)
|
||||
cheat_manager_apply_retro_cheats();
|
||||
#endif
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited && discord_st->ready)
|
||||
if (discord_st->inited && discord_st->ready)
|
||||
discord_update(DISCORD_PRESENCE_GAME);
|
||||
#endif
|
||||
|
||||
|
@ -104,9 +104,6 @@
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
#include "../network/discord.h"
|
||||
|
||||
/* TODO/FIXME - get rid of this public global */
|
||||
extern bool discord_is_inited;
|
||||
#endif
|
||||
|
||||
#define MAX_ARGS 32
|
||||
@ -2337,7 +2334,7 @@ static bool task_load_content_internal(
|
||||
goto end;
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited)
|
||||
if (discord_state_get_ptr()->inited)
|
||||
{
|
||||
discord_userdata_t userdata;
|
||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user