diff --git a/src/pc/configfile.c b/src/pc/configfile.c index d95a0e56a..f8d4b7d14 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -156,6 +156,8 @@ bool configDebugPrint = 0; bool configDebugInfo = 0; bool configDebugError = 0; char configLanguage[MAX_CONFIG_STRING] = ""; +char configCoopNetIp[MAX_CONFIG_STRING] = DEFAULT_COOPNET_IP; +unsigned int configCoopNetPort = DEFAULT_COOPNET_PORT; static const struct ConfigOption options[] = { {.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen}, @@ -264,6 +266,8 @@ static const struct ConfigOption options[] = { {.name = "debug_info", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugInfo}, {.name = "debug_error", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugError}, {.name = "language", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLanguage, .maxStringLength = MAX_CONFIG_STRING}, + {.name = "coopnet_ip", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configCoopNetIp, .maxStringLength = MAX_CONFIG_STRING}, + {.name = "coopnet_port", .type = CONFIG_TYPE_UINT , .uintValue = &configCoopNetPort}, }; // FunctionConfigOption functions diff --git a/src/pc/configfile.h b/src/pc/configfile.h index e074c0394..747812a20 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -15,6 +15,8 @@ #define MAX_DESCRIPTION_STRING 20 #define DEFAULT_PORT 7777 +#define DEFAULT_COOPNET_IP "localhost" +#define DEFAULT_COOPNET_PORT 34197 typedef struct { unsigned int x, y, w, h; @@ -111,6 +113,8 @@ extern bool configDebugPrint; extern bool configDebugInfo; extern bool configDebugError; extern char configLanguage[]; +extern char configCoopNetIp[]; +extern unsigned int configCoopNetPort; void configfile_load(void); void configfile_save(const char *filename); diff --git a/src/pc/network/coopnet/coopnet.c b/src/pc/network/coopnet/coopnet.c index b6a3f4276..8960ac96f 100644 --- a/src/pc/network/coopnet/coopnet.c +++ b/src/pc/network/coopnet/coopnet.c @@ -9,8 +9,6 @@ #ifdef COOPNET -#define CN_HOST "localhost" -#define CN_PORT 34197 #define CN_GAME_STR "sm64ex-coop" uint64_t gCoopNetDesiredLobby = 0; @@ -138,7 +136,7 @@ static CoopNetRc coopnet_initialize(void) { gCoopNetCallbacks.OnLobbyLeft = coopnet_on_lobby_left; gCoopNetCallbacks.OnPeerDisconnected = coopnet_on_peer_disconnected; - CoopNetRc rc = coopnet_begin(CN_HOST, CN_PORT); + CoopNetRc rc = coopnet_begin(configCoopNetIp, configCoopNetPort); if (rc == COOPNET_FAILED) { djui_popup_create(DLANG(NOTIF, COOPNET_CONNECTION_FAILED), 2); } @@ -160,4 +158,4 @@ struct NetworkSystem gNetworkSystemCoopNet = { .name = "CoopNet", }; -#endif \ No newline at end of file +#endif