Fix socket-only compile error (#552)

Also remove the connection system selectionbox (no need for that, only causes crashes)
This commit is contained in:
Cooliokid956 2024-12-10 05:12:23 -06:00 committed by GitHub
parent 9285e404db
commit cdbc376d1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 14 deletions

View file

@ -949,9 +949,9 @@ COOPNET_LIBS :=
ifeq ($(COOPNET),1) ifeq ($(COOPNET),1)
ifeq ($(WINDOWS_BUILD),1) ifeq ($(WINDOWS_BUILD),1)
ifeq ($(TARGET_BITS), 32) ifeq ($(TARGET_BITS), 32)
LDFLAGS += -Llib/coopnet/win32 -l:libcoopnet.a -l:libjuice.a -lbcrypt -lws2_32 -liphlpapi LDFLAGS += -Llib/coopnet/win32 -l:libcoopnet.a -l:libjuice.a -lbcrypt -liphlpapi
else else
LDFLAGS += -Llib/coopnet/win64 -l:libcoopnet.a -l:libjuice.a -lbcrypt -lws2_32 -liphlpapi LDFLAGS += -Llib/coopnet/win64 -l:libcoopnet.a -l:libjuice.a -lbcrypt -liphlpapi
endif endif
else ifeq ($(OSX_BUILD),1) else ifeq ($(OSX_BUILD),1)
ifeq ($(shell uname -m),arm64) ifeq ($(shell uname -m),arm64)
@ -976,7 +976,7 @@ endif
# Network/Discord (ugh, needs cleanup) # Network/Discord (ugh, needs cleanup)
ifeq ($(WINDOWS_BUILD),1) ifeq ($(WINDOWS_BUILD),1)
LDFLAGS += -L"ws2_32" -lwsock32 LDFLAGS += -lws2_32 -lwsock32
ifeq ($(DISCORD_SDK),1) ifeq ($(DISCORD_SDK),1)
LDFLAGS += -Wl,-Bdynamic -L./lib/discordsdk/ -ldiscord_game_sdk -Wl,-Bstatic LDFLAGS += -Wl,-Bdynamic -L./lib/discordsdk/ -ldiscord_game_sdk -Wl,-Bstatic
endif endif

View file

@ -14,25 +14,18 @@
#include "pc/update_checker.h" #include "pc/update_checker.h"
static struct DjuiRect* sRectPort = NULL; static struct DjuiRect* sRectPort = NULL;
static struct DjuiRect* sRectPassword = NULL;
static struct DjuiInputbox* sInputboxPort = NULL; static struct DjuiInputbox* sInputboxPort = NULL;
#ifdef COOPNET
static struct DjuiRect* sRectPassword = NULL;
static struct DjuiInputbox* sInputboxPassword = NULL; static struct DjuiInputbox* sInputboxPassword = NULL;
static void djui_panel_host_network_system_change(UNUSED struct DjuiBase* base) { static void djui_panel_host_network_system_change(UNUSED struct DjuiBase* base) {
#ifndef COOPNET
{
struct DjuiSelectionbox* selectionbox = (struct DjuiSelectionbox*) base;
if (*selectionbox->value == NS_COOPNET) {
selectionbox->value = NS_SOCKET;
}
}
#endif
djui_base_set_visible(&sRectPort->base, (configNetworkSystem == NS_SOCKET)); djui_base_set_visible(&sRectPort->base, (configNetworkSystem == NS_SOCKET));
djui_base_set_visible(&sRectPassword->base, (configNetworkSystem == NS_COOPNET)); djui_base_set_visible(&sRectPassword->base, (configNetworkSystem == NS_COOPNET));
djui_base_set_enabled(&sInputboxPort->base, (configNetworkSystem == NS_SOCKET)); djui_base_set_enabled(&sInputboxPort->base, (configNetworkSystem == NS_SOCKET));
djui_base_set_enabled(&sInputboxPassword->base, (configNetworkSystem == NS_COOPNET)); djui_base_set_enabled(&sInputboxPassword->base, (configNetworkSystem == NS_COOPNET));
} }
#endif
static bool djui_panel_host_port_valid(void) { static bool djui_panel_host_port_valid(void) {
char* buffer = sInputboxPort->buffer; char* buffer = sInputboxPort->buffer;
@ -59,12 +52,14 @@ static void djui_panel_host_port_text_change(struct DjuiBase* caller) {
} }
} }
#ifdef COOPNET
static void djui_panel_host_password_text_change(UNUSED struct DjuiBase* caller) { static void djui_panel_host_password_text_change(UNUSED struct DjuiBase* caller) {
snprintf(configPassword, 64, "%s", sInputboxPassword->buffer); snprintf(configPassword, 64, "%s", sInputboxPassword->buffer);
if (strlen(sInputboxPassword->buffer) >= 64) { if (strlen(sInputboxPassword->buffer) >= 64) {
djui_inputbox_set_text(sInputboxPassword, configPassword); djui_inputbox_set_text(sInputboxPassword, configPassword);
} }
} }
#endif
extern void djui_panel_do_host(bool reconnecting, bool playSound); extern void djui_panel_do_host(bool reconnecting, bool playSound);
static void djui_panel_host_do_host(struct DjuiBase* caller) { static void djui_panel_host_do_host(struct DjuiBase* caller) {
@ -98,11 +93,13 @@ void djui_panel_host_create(struct DjuiBase* caller) {
false); false);
struct DjuiBase* body = djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
#ifdef COOPNET
char* nChoices[] = { DLANG(HOST, DIRECT_CONNECTION), DLANG(HOST, COOPNET) }; char* nChoices[] = { DLANG(HOST, DIRECT_CONNECTION), DLANG(HOST, COOPNET) };
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(HOST, NETWORK_SYSTEM), nChoices, 2, &configNetworkSystem, djui_panel_host_network_system_change); struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(HOST, NETWORK_SYSTEM), nChoices, 2, &configNetworkSystem, djui_panel_host_network_system_change);
if (gNetworkType == NT_SERVER) { if (gNetworkType == NT_SERVER) {
djui_base_set_enabled(&selectionbox1->base, false); djui_base_set_enabled(&selectionbox1->base, false);
} }
#endif
struct DjuiRect* rect1 = djui_rect_container_create(body, 32); struct DjuiRect* rect1 = djui_rect_container_create(body, 32);
{ {
@ -134,7 +131,7 @@ void djui_panel_host_create(struct DjuiBase* caller) {
djui_base_set_enabled(&sInputboxPort->base, (configNetworkSystem == NS_SOCKET)); djui_base_set_enabled(&sInputboxPort->base, (configNetworkSystem == NS_SOCKET));
} }
} }
#ifdef COOPNET
sRectPassword = djui_rect_container_create(&rect1->base, 32); sRectPassword = djui_rect_container_create(&rect1->base, 32);
djui_base_set_location(&sRectPassword->base, 0, 0); djui_base_set_location(&sRectPassword->base, 0, 0);
djui_base_set_visible(&sRectPassword->base, (configNetworkSystem == NS_COOPNET)); djui_base_set_visible(&sRectPassword->base, (configNetworkSystem == NS_COOPNET));
@ -163,6 +160,7 @@ void djui_panel_host_create(struct DjuiBase* caller) {
djui_base_set_enabled(&sInputboxPassword->base, (configNetworkSystem == NS_COOPNET)); djui_base_set_enabled(&sInputboxPassword->base, (configNetworkSystem == NS_COOPNET));
} }
} }
#endif
} }
struct DjuiRect* rect2 = djui_rect_container_create(body, 32); struct DjuiRect* rect2 = djui_rect_container_create(body, 32);