diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index c08a107d5c..58ad589274 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -3980,9 +3980,11 @@ void netplay_hangup(netplay_t *netplay, { dmsg = msg_hash_to_str(MSG_NETPLAY_CLIENT_HANGUP); #ifdef HAVE_PRESENCE - presence_userdata_t userdata; - userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + { + presence_userdata_t userdata; + userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + } #endif netplay->is_connected = false; } @@ -7875,9 +7877,11 @@ static void netplay_announce_cb(retro_task_t *task, } #ifdef HAVE_PRESENCE - presence_userdata_t userdata; - userdata.status = PRESENCE_NETPLAY_HOSTING; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + { + presence_userdata_t userdata; + userdata.status = PRESENCE_NETPLAY_HOSTING; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + } #endif } @@ -8167,9 +8171,11 @@ static void netplay_disconnect(netplay_t *netplay) deinit_netplay(); #ifdef HAVE_PRESENCE - presence_userdata_t userdata; - userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + { + presence_userdata_t userdata; + userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + } #endif } @@ -8456,9 +8462,11 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data) case RARCH_NETPLAY_CTL_DISABLE: net_st->netplay_enabled = false; #ifdef HAVE_PRESENCE - presence_userdata_t userdata; - userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + { + presence_userdata_t userdata; + userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + } #endif goto done; diff --git a/retroarch.c b/retroarch.c index 0199999e5c..0550a6cb54 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1952,11 +1952,13 @@ bool command_event(enum event_command cmd, void *data) return false; } #ifdef HAVE_PRESENCE - presence_userdata_t userdata; - userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); - userdata.status = PRESENCE_MENU; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + { + presence_userdata_t userdata; + userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + userdata.status = PRESENCE_MENU; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + } #endif #ifdef HAVE_DYNAMIC path_clear(RARCH_PATH_CORE); @@ -5500,10 +5502,11 @@ bool retroarch_main_init(int argc, char *argv[]) #endif #ifdef HAVE_PRESENCE - presence_userdata_t userdata; - userdata.status = PRESENCE_MENU; - - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + { + presence_userdata_t userdata; + userdata.status = PRESENCE_MENU; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + } #endif #if defined(HAVE_AUDIOMIXER) @@ -6013,22 +6016,26 @@ bool retroarch_main_quit(void) settings_t *settings = config_get_ptr(); #ifdef HAVE_PRESENCE - presence_userdata_t userdata; - userdata.status = PRESENCE_SHUTDOWN; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + { + presence_userdata_t userdata; + userdata.status = PRESENCE_SHUTDOWN; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + } #endif #ifdef HAVE_DISCORD - discord_state_t *discord_st = discord_state_get_ptr(); - if (discord_st->ready) { - Discord_ClearPresence(); + discord_state_t *discord_st = discord_state_get_ptr(); + if (discord_st->ready) + { + Discord_ClearPresence(); #ifdef DISCORD_DISABLE_IO_THREAD - Discord_UpdateConnection(); + Discord_UpdateConnection(); #endif - Discord_Shutdown(); - discord_st->ready = false; + Discord_Shutdown(); + discord_st->ready = false; + } + discord_st->inited = false; } - discord_st->inited = false; #endif /* Restore original refresh rate, if it has been changed diff --git a/tasks/task_content.c b/tasks/task_content.c index f164a09376..af2a4c15d2 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -2593,11 +2593,13 @@ static bool task_load_content_internal( goto end; #ifdef HAVE_PRESENCE - presence_userdata_t userdata; - userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); - userdata.status = PRESENCE_MENU; - command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + { + presence_userdata_t userdata; + userdata.status = PRESENCE_NETPLAY_NETPLAY_STOPPED; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + userdata.status = PRESENCE_MENU; + command_event(CMD_EVENT_PRESENCE_UPDATE, &userdata); + } #endif /* Loads content into currently selected core. */