From cdbc376d1f2acb34e6e035329b259baede313491 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Tue, 10 Dec 2024 05:12:23 -0600 Subject: [PATCH] Fix socket-only compile error (#552) Also remove the connection system selectionbox (no need for that, only causes crashes) --- Makefile | 6 +++--- src/pc/djui/djui_panel_host.c | 20 +++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 50dd38931..996c12893 100644 --- a/Makefile +++ b/Makefile @@ -949,9 +949,9 @@ COOPNET_LIBS := ifeq ($(COOPNET),1) ifeq ($(WINDOWS_BUILD),1) 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 - 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 else ifeq ($(OSX_BUILD),1) ifeq ($(shell uname -m),arm64) @@ -976,7 +976,7 @@ endif # Network/Discord (ugh, needs cleanup) ifeq ($(WINDOWS_BUILD),1) - LDFLAGS += -L"ws2_32" -lwsock32 + LDFLAGS += -lws2_32 -lwsock32 ifeq ($(DISCORD_SDK),1) LDFLAGS += -Wl,-Bdynamic -L./lib/discordsdk/ -ldiscord_game_sdk -Wl,-Bstatic endif diff --git a/src/pc/djui/djui_panel_host.c b/src/pc/djui/djui_panel_host.c index 7c01b8b95..56afb6161 100644 --- a/src/pc/djui/djui_panel_host.c +++ b/src/pc/djui/djui_panel_host.c @@ -14,25 +14,18 @@ #include "pc/update_checker.h" static struct DjuiRect* sRectPort = NULL; -static struct DjuiRect* sRectPassword = NULL; static struct DjuiInputbox* sInputboxPort = NULL; +#ifdef COOPNET +static struct DjuiRect* sRectPassword = NULL; static struct DjuiInputbox* sInputboxPassword = NULL; 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(&sRectPassword->base, (configNetworkSystem == NS_COOPNET)); djui_base_set_enabled(&sInputboxPort->base, (configNetworkSystem == NS_SOCKET)); djui_base_set_enabled(&sInputboxPassword->base, (configNetworkSystem == NS_COOPNET)); } +#endif static bool djui_panel_host_port_valid(void) { 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) { snprintf(configPassword, 64, "%s", sInputboxPassword->buffer); if (strlen(sInputboxPassword->buffer) >= 64) { djui_inputbox_set_text(sInputboxPassword, configPassword); } } +#endif extern void djui_panel_do_host(bool reconnecting, bool playSound); static void djui_panel_host_do_host(struct DjuiBase* caller) { @@ -98,11 +93,13 @@ void djui_panel_host_create(struct DjuiBase* caller) { false); struct DjuiBase* body = djui_three_panel_get_body(panel); { + #ifdef 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); if (gNetworkType == NT_SERVER) { djui_base_set_enabled(&selectionbox1->base, false); } + #endif 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)); } } - +#ifdef COOPNET sRectPassword = djui_rect_container_create(&rect1->base, 32); djui_base_set_location(&sRectPassword->base, 0, 0); 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)); } } +#endif } struct DjuiRect* rect2 = djui_rect_container_create(body, 32);