mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Make coopnet IP and Port configurable (Isaac)
This commit is contained in:
parent
3f38c740d8
commit
29a8c391bb
3 changed files with 10 additions and 4 deletions
|
|
@ -156,6 +156,8 @@ bool configDebugPrint = 0;
|
||||||
bool configDebugInfo = 0;
|
bool configDebugInfo = 0;
|
||||||
bool configDebugError = 0;
|
bool configDebugError = 0;
|
||||||
char configLanguage[MAX_CONFIG_STRING] = "";
|
char configLanguage[MAX_CONFIG_STRING] = "";
|
||||||
|
char configCoopNetIp[MAX_CONFIG_STRING] = DEFAULT_COOPNET_IP;
|
||||||
|
unsigned int configCoopNetPort = DEFAULT_COOPNET_PORT;
|
||||||
|
|
||||||
static const struct ConfigOption options[] = {
|
static const struct ConfigOption options[] = {
|
||||||
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
|
{.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_info", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugInfo},
|
||||||
{.name = "debug_error", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugError},
|
{.name = "debug_error", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugError},
|
||||||
{.name = "language", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLanguage, .maxStringLength = MAX_CONFIG_STRING},
|
{.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
|
// FunctionConfigOption functions
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
#define MAX_DESCRIPTION_STRING 20
|
#define MAX_DESCRIPTION_STRING 20
|
||||||
|
|
||||||
#define DEFAULT_PORT 7777
|
#define DEFAULT_PORT 7777
|
||||||
|
#define DEFAULT_COOPNET_IP "localhost"
|
||||||
|
#define DEFAULT_COOPNET_PORT 34197
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned int x, y, w, h;
|
unsigned int x, y, w, h;
|
||||||
|
|
@ -111,6 +113,8 @@ extern bool configDebugPrint;
|
||||||
extern bool configDebugInfo;
|
extern bool configDebugInfo;
|
||||||
extern bool configDebugError;
|
extern bool configDebugError;
|
||||||
extern char configLanguage[];
|
extern char configLanguage[];
|
||||||
|
extern char configCoopNetIp[];
|
||||||
|
extern unsigned int configCoopNetPort;
|
||||||
|
|
||||||
void configfile_load(void);
|
void configfile_load(void);
|
||||||
void configfile_save(const char *filename);
|
void configfile_save(const char *filename);
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
#ifdef COOPNET
|
#ifdef COOPNET
|
||||||
|
|
||||||
#define CN_HOST "localhost"
|
|
||||||
#define CN_PORT 34197
|
|
||||||
#define CN_GAME_STR "sm64ex-coop"
|
#define CN_GAME_STR "sm64ex-coop"
|
||||||
|
|
||||||
uint64_t gCoopNetDesiredLobby = 0;
|
uint64_t gCoopNetDesiredLobby = 0;
|
||||||
|
|
@ -138,7 +136,7 @@ static CoopNetRc coopnet_initialize(void) {
|
||||||
gCoopNetCallbacks.OnLobbyLeft = coopnet_on_lobby_left;
|
gCoopNetCallbacks.OnLobbyLeft = coopnet_on_lobby_left;
|
||||||
gCoopNetCallbacks.OnPeerDisconnected = coopnet_on_peer_disconnected;
|
gCoopNetCallbacks.OnPeerDisconnected = coopnet_on_peer_disconnected;
|
||||||
|
|
||||||
CoopNetRc rc = coopnet_begin(CN_HOST, CN_PORT);
|
CoopNetRc rc = coopnet_begin(configCoopNetIp, configCoopNetPort);
|
||||||
if (rc == COOPNET_FAILED) {
|
if (rc == COOPNET_FAILED) {
|
||||||
djui_popup_create(DLANG(NOTIF, COOPNET_CONNECTION_FAILED), 2);
|
djui_popup_create(DLANG(NOTIF, COOPNET_CONNECTION_FAILED), 2);
|
||||||
}
|
}
|
||||||
|
|
@ -160,4 +158,4 @@ struct NetworkSystem gNetworkSystemCoopNet = {
|
||||||
.name = "CoopNet",
|
.name = "CoopNet",
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue