mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-26 04:36:56 +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 ready;
|
||||||
bool avatar_ready;
|
bool avatar_ready;
|
||||||
bool connecting;
|
bool connecting;
|
||||||
|
bool inited;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct discord_state discord_state_t;
|
typedef struct discord_state discord_state_t;
|
||||||
|
@ -152,18 +152,12 @@ struct ad_packet
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Forward declarations */
|
|
||||||
#ifdef HAVE_DISCORD
|
|
||||||
extern bool discord_is_inited;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* TODO/FIXME - globals */
|
/* TODO/FIXME - globals */
|
||||||
struct netplay_room *netplay_room_list = NULL;
|
struct netplay_room *netplay_room_list = NULL;
|
||||||
int netplay_room_count = 0;
|
int netplay_room_count = 0;
|
||||||
static netplay_t *handshake_password_netplay = NULL;
|
static netplay_t *handshake_password_netplay = NULL;
|
||||||
static unsigned long simple_rand_next = 1;
|
static unsigned long simple_rand_next = 1;
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_NETPLAYDISCOVERY
|
#ifdef HAVE_NETPLAYDISCOVERY
|
||||||
/* LAN discovery sockets */
|
/* LAN discovery sockets */
|
||||||
static int lan_ad_server_fd = -1;
|
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);
|
dmsg = msg_hash_to_str(MSG_NETPLAY_CLIENT_HANGUP);
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
if (discord_is_inited)
|
if (discord_state_get_ptr()->inited)
|
||||||
{
|
{
|
||||||
discord_userdata_t userdata;
|
discord_userdata_t userdata;
|
||||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||||
@ -6957,7 +6951,7 @@ static void netplay_announce_cb(retro_task_t *task,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
if (discord_is_inited)
|
if (discord_state_get_ptr()->inited)
|
||||||
{
|
{
|
||||||
discord_userdata_t userdata;
|
discord_userdata_t userdata;
|
||||||
userdata.status = DISCORD_PRESENCE_NETPLAY_HOSTING;
|
userdata.status = DISCORD_PRESENCE_NETPLAY_HOSTING;
|
||||||
@ -7103,7 +7097,7 @@ static void netplay_disconnect(netplay_t *netplay)
|
|||||||
deinit_netplay();
|
deinit_netplay();
|
||||||
|
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
if (discord_is_inited)
|
if (discord_state_get_ptr()->inited)
|
||||||
{
|
{
|
||||||
discord_userdata_t userdata;
|
discord_userdata_t userdata;
|
||||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
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:
|
case RARCH_NETPLAY_CTL_DISABLE:
|
||||||
net_st->netplay_enabled = false;
|
net_st->netplay_enabled = false;
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
if (discord_is_inited)
|
if (discord_state_get_ptr()->inited)
|
||||||
{
|
{
|
||||||
discord_userdata_t userdata;
|
discord_userdata_t userdata;
|
||||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||||
|
23
retroarch.c
23
retroarch.c
@ -264,9 +264,6 @@ static const void *MAGIC_POINTER = (void*)(uintp
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TODO/FIXME - turn these into static global variable */
|
/* 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_config_binds[MAX_USERS];
|
||||||
retro_keybind_set input_autoconf_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;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
if (discord_is_inited)
|
if (discord_state_get_ptr()->inited)
|
||||||
{
|
{
|
||||||
discord_userdata_t userdata;
|
discord_userdata_t userdata;
|
||||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||||
@ -15200,16 +15197,20 @@ bool retroarch_main_init(int argc, char *argv[])
|
|||||||
runloop_st->is_inited = true;
|
runloop_st->is_inited = true;
|
||||||
|
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
if (command_event(CMD_EVENT_DISCORD_INIT, NULL))
|
{
|
||||||
discord_is_inited = true;
|
discord_state_t *discord_st = discord_state_get_ptr();
|
||||||
|
|
||||||
if (discord_is_inited)
|
if (command_event(CMD_EVENT_DISCORD_INIT, NULL))
|
||||||
|
discord_st->inited = true;
|
||||||
|
|
||||||
|
if (discord_st->inited)
|
||||||
{
|
{
|
||||||
discord_userdata_t userdata;
|
discord_userdata_t userdata;
|
||||||
userdata.status = DISCORD_PRESENCE_MENU;
|
userdata.status = DISCORD_PRESENCE_MENU;
|
||||||
|
|
||||||
command_event(CMD_EVENT_DISCORD_UPDATE, &userdata);
|
command_event(CMD_EVENT_DISCORD_UPDATE, &userdata);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_AUDIOMIXER)
|
#if defined(HAVE_AUDIOMIXER)
|
||||||
@ -15790,7 +15791,7 @@ bool retroarch_main_quit(void)
|
|||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
discord_state_t *discord_st = &discord_state_st;
|
discord_state_t *discord_st = &discord_state_st;
|
||||||
if (discord_is_inited)
|
if (discord_st->inited)
|
||||||
{
|
{
|
||||||
discord_userdata_t userdata;
|
discord_userdata_t userdata;
|
||||||
userdata.status = DISCORD_PRESENCE_SHUTDOWN;
|
userdata.status = DISCORD_PRESENCE_SHUTDOWN;
|
||||||
@ -15805,7 +15806,7 @@ bool retroarch_main_quit(void)
|
|||||||
Discord_Shutdown();
|
Discord_Shutdown();
|
||||||
discord_st->ready = false;
|
discord_st->ready = false;
|
||||||
}
|
}
|
||||||
discord_is_inited = false;
|
discord_st->inited = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Restore original refresh rate, if it has been changed
|
/* Restore original refresh rate, if it has been changed
|
||||||
@ -17151,7 +17152,7 @@ int runloop_iterate(void)
|
|||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
discord_state_t *discord_st = &discord_state_st;
|
discord_state_t *discord_st = &discord_state_st;
|
||||||
|
|
||||||
if (discord_is_inited)
|
if (discord_st->inited)
|
||||||
{
|
{
|
||||||
Discord_RunCallbacks();
|
Discord_RunCallbacks();
|
||||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||||
@ -17399,7 +17400,7 @@ int runloop_iterate(void)
|
|||||||
cheat_manager_apply_retro_cheats();
|
cheat_manager_apply_retro_cheats();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
if (discord_is_inited && discord_st->ready)
|
if (discord_st->inited && discord_st->ready)
|
||||||
discord_update(DISCORD_PRESENCE_GAME);
|
discord_update(DISCORD_PRESENCE_GAME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -104,9 +104,6 @@
|
|||||||
|
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
#include "../network/discord.h"
|
#include "../network/discord.h"
|
||||||
|
|
||||||
/* TODO/FIXME - get rid of this public global */
|
|
||||||
extern bool discord_is_inited;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_ARGS 32
|
#define MAX_ARGS 32
|
||||||
@ -2337,7 +2334,7 @@ static bool task_load_content_internal(
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
if (discord_is_inited)
|
if (discord_state_get_ptr()->inited)
|
||||||
{
|
{
|
||||||
discord_userdata_t userdata;
|
discord_userdata_t userdata;
|
||||||
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
userdata.status = DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user