Fix Discord connections on unstable
This commit is contained in:
parent
7757a69145
commit
9699d79dd7
|
@ -16,3 +16,8 @@ fi
|
||||||
$FILE --discord 2 --configfile sm64config_server.txt &
|
$FILE --discord 2 --configfile sm64config_server.txt &
|
||||||
$FILE --discord 1 --configfile sm64config_client.txt &
|
$FILE --discord 1 --configfile sm64config_client.txt &
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
|
||||||
|
#debug discord client
|
||||||
|
$FILE --discord 2 --configfile sm64config_server.txt &
|
||||||
|
winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'r --discord 1 --configfile sm64config_client.txt'
|
||||||
|
|
|
@ -310,7 +310,7 @@ static void djui_inputbox_on_text_input(struct DjuiBase *base, char* text) {
|
||||||
// make sure we're not just printing garbage characters
|
// make sure we're not just printing garbage characters
|
||||||
bool containsValidAscii = false;
|
bool containsValidAscii = false;
|
||||||
char* tinput = text;
|
char* tinput = text;
|
||||||
while (*tinput != NULL) {
|
while (*tinput != '\0') {
|
||||||
if (*tinput >= '!' && *tinput <= '~') {
|
if (*tinput >= '!' && *tinput <= '~') {
|
||||||
containsValidAscii = true;
|
containsValidAscii = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -33,6 +33,11 @@ static void on_activity_join_callback(UNUSED void* data, enum EDiscordResult res
|
||||||
discord_network_init(lobby->id);
|
discord_network_init(lobby->id);
|
||||||
discord_activity_update(false);
|
discord_activity_update(false);
|
||||||
|
|
||||||
|
if (gNetworkType == NT_CLIENT) {
|
||||||
|
ns_discord_save_id(gNetworkPlayerServer->localIndex, lobby->owner_id);
|
||||||
|
network_send_join_request();
|
||||||
|
}
|
||||||
|
|
||||||
gNetworkUserIds[0] = lobby->owner_id;
|
gNetworkUserIds[0] = lobby->owner_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,12 +131,6 @@ static bool ns_discord_initialize(enum NetworkType networkType) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
set_instance_env_variable();
|
set_instance_env_variable();
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNSTABLE_BRANCH
|
|
||||||
if (networkType != NT_NONE) {
|
|
||||||
// refuse to host on discord for unstable branch
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!gDiscordInitialized) {
|
if (!gDiscordInitialized) {
|
||||||
// set up discord params
|
// set up discord params
|
||||||
|
|
|
@ -86,7 +86,6 @@ bool network_init(enum NetworkType inNetworkType) {
|
||||||
djui_chat_box_create();
|
djui_chat_box_create();
|
||||||
} else if (gNetworkType == NT_CLIENT) {
|
} else if (gNetworkType == NT_CLIENT) {
|
||||||
network_player_connected(NPT_SERVER, 0);
|
network_player_connected(NPT_SERVER, 0);
|
||||||
network_send_join_request();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("initialized");
|
LOG_INFO("initialized");
|
||||||
|
|
|
@ -80,6 +80,7 @@ void packet_receive(struct Packet* p) {
|
||||||
LOG_INFO("closing connection for packetType: %d", packetType);
|
LOG_INFO("closing connection for packetType: %d", packetType);
|
||||||
network_send_kick(EKT_CLOSE_CONNECTION);
|
network_send_kick(EKT_CLOSE_CONNECTION);
|
||||||
}
|
}
|
||||||
|
LOG_INFO("refusing packet from unknown player, packetType: %d", packetType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +113,8 @@ void packet_receive(struct Packet* p) {
|
||||||
// process the packet
|
// process the packet
|
||||||
packet_process(p);
|
packet_process(p);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
LOG_INFO("packet initial read failed, packetType: %d", packetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// broadcast packet
|
// broadcast packet
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "pc/djui/djui.h"
|
#include "pc/djui/djui.h"
|
||||||
#include "pc/cheats.h"
|
#include "pc/cheats.h"
|
||||||
#include "pc/utils/string_builder.h"
|
#include "pc/utils/string_builder.h"
|
||||||
#define DISABLE_MODULE_LOG 1
|
//#define DISABLE_MODULE_LOG 1
|
||||||
#include "pc/debuglog.h"
|
#include "pc/debuglog.h"
|
||||||
|
|
||||||
extern u8* gOverrideEeprom;
|
extern u8* gOverrideEeprom;
|
||||||
|
@ -26,7 +26,7 @@ void network_send_join_request(void) {
|
||||||
|
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_JOIN_REQUEST, true, false);
|
packet_init(&p, PACKET_JOIN_REQUEST, true, false);
|
||||||
network_send_to(gNetworkPlayerServer->localIndex, &p);
|
network_send_to((gNetworkPlayerServer != NULL) ? gNetworkPlayerServer->localIndex : 0, &p);
|
||||||
LOG_INFO("sending join request");
|
LOG_INFO("sending join request");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,10 @@ static bool ns_socket_initialize(enum NetworkType networkType) {
|
||||||
|
|
||||||
LOG_INFO("initialized");
|
LOG_INFO("initialized");
|
||||||
|
|
||||||
|
if (networkType == NT_CLIENT) {
|
||||||
|
network_send_join_request();
|
||||||
|
}
|
||||||
|
|
||||||
// success
|
// success
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue