mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Add --no-discord launch param
This commit is contained in:
parent
27bc5c0e09
commit
9206aa1e98
9 changed files with 30 additions and 15 deletions
|
|
@ -27,6 +27,7 @@ static void print_help(void) {
|
|||
printf("--client IP PORT Starts the game and joins an existing server.\n");
|
||||
printf("--playername PLAYERNAME Starts the game with a specific playername.\n");
|
||||
printf("--skip-update-check Skips the update check when loading the game.\n");
|
||||
printf("--no-discord Disables discord integration.");
|
||||
}
|
||||
|
||||
static inline int arg_string(const char *name, const char *value, char *target, int maxLength) {
|
||||
|
|
@ -83,6 +84,8 @@ bool parse_cli_opts(int argc, char* argv[]) {
|
|||
arg_string("--playername", argv[++i], gCLIOpts.playerName, MAX_CONFIG_STRING);
|
||||
} else if (!strcmp(argv[i], "--skip-update-check")) {
|
||||
gCLIOpts.skipUpdateCheck = true;
|
||||
} else if (!strcmp(argv[i], "--no-discord")) {
|
||||
gCLIOpts.noDiscord = true;
|
||||
} else if (!strcmp(argv[i], "--help")) {
|
||||
print_help();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ struct CLIOptions {
|
|||
char playerName[MAX_CONFIG_STRING];
|
||||
bool hideLoadingScreen;
|
||||
bool skipUpdateCheck;
|
||||
bool noDiscord;
|
||||
};
|
||||
|
||||
extern struct CLIOptions gCLIOpts;
|
||||
|
|
|
|||
|
|
@ -172,7 +172,10 @@ u64 discord_get_user_id(void) {
|
|||
|
||||
void discord_update(void) {
|
||||
if (sDiscordFailed) { return; }
|
||||
if (!gDiscordInitialized) { discord_initialize(); }
|
||||
if (!gDiscordInitialized) {
|
||||
if (gCLIOpts.noDiscord) { return; }
|
||||
discord_initialize();
|
||||
}
|
||||
if (sDiscordFailed) { return; }
|
||||
|
||||
discord_activity_update_check();
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@
|
|||
#include "pc/network/network.h"
|
||||
#include "pc/utils/misc.h"
|
||||
#include "pc/update_checker.h"
|
||||
#ifdef DISCORD_SDK
|
||||
#include "pc/discord/discord.h"
|
||||
#endif
|
||||
|
||||
#ifdef COOPNET
|
||||
static void djui_panel_join_public_lobbies(struct DjuiBase* caller) {
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@
|
|||
#include "pc/configfile.h"
|
||||
#include "pc/debuglog.h"
|
||||
#include "macros.h"
|
||||
#ifdef DISCORD_SDK
|
||||
#include "pc/discord/discord.h"
|
||||
#endif
|
||||
|
||||
static struct DjuiInputbox* sInputboxIp = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -427,9 +427,13 @@ s32 get_dialog_response(void) {
|
|||
|
||||
const char* get_local_discord_id(void) {
|
||||
#ifdef DISCORD_SDK
|
||||
static char sDiscordId[64] = "";
|
||||
snprintf(sDiscordId, 64, "%" PRIu64 "", (uint64_t)discord_get_user_id());
|
||||
return sDiscordId;
|
||||
if (gDiscordInitialized) {
|
||||
static char sDiscordId[64] = "";
|
||||
snprintf(sDiscordId, 64, "%" PRIu64 "", (uint64_t)discord_get_user_id());
|
||||
return sDiscordId;
|
||||
} else {
|
||||
return "0";
|
||||
}
|
||||
#else
|
||||
return "0";
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -88,7 +88,9 @@ static void coopnet_on_lobby_joined(uint64_t lobbyId, uint64_t userId, uint64_t
|
|||
network_send_mod_list_request();
|
||||
}
|
||||
#ifdef DISCORD_SDK
|
||||
discord_activity_update();
|
||||
if (gDiscordInitialized) {
|
||||
discord_activity_update();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,9 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) {
|
|||
configfile_save(configfile_name());
|
||||
|
||||
#ifdef DISCORD_SDK
|
||||
discord_activity_update();
|
||||
if (gDiscordInitialized) {
|
||||
discord_activity_update();
|
||||
}
|
||||
#endif
|
||||
|
||||
LOG_INFO("initialized");
|
||||
|
|
@ -757,7 +759,9 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
|
|||
djui_lua_error_clear();
|
||||
|
||||
#ifdef DISCORD_SDK
|
||||
discord_activity_update();
|
||||
if (gDiscordInitialized) {
|
||||
discord_activity_update();
|
||||
}
|
||||
#endif
|
||||
packet_ordered_clear_all();
|
||||
|
||||
|
|
|
|||
|
|
@ -340,7 +340,9 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
|
|||
smlua_call_event_hooks_mario_param(HOOK_ON_PLAYER_CONNECTED, &gMarioStates[localIndex]);
|
||||
|
||||
#ifdef DISCORD_SDK
|
||||
discord_activity_update();
|
||||
if (gDiscordInitialized) {
|
||||
discord_activity_update();
|
||||
}
|
||||
#endif
|
||||
|
||||
return localIndex;
|
||||
|
|
@ -392,7 +394,9 @@ u8 network_player_disconnected(u8 globalIndex) {
|
|||
memset(np, 0, sizeof(struct NetworkPlayer));
|
||||
|
||||
#ifdef DISCORD_SDK
|
||||
discord_activity_update();
|
||||
if (gDiscordInitialized) {
|
||||
discord_activity_update();
|
||||
}
|
||||
#endif
|
||||
|
||||
// reset mario state
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue