From 41d7b52f8c733df7c991fda51c3b4ac3b0139238 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Thu, 1 Jan 2026 03:04:25 -0600 Subject: [PATCH 1/7] Add version info (Windows) + Smart update checker --- res/icon.rc | 28 +++++++++++++- src/pc/djui/djui_panel_join_lobbies.c | 2 +- src/pc/djui/djui_panel_main.c | 15 +++++--- src/pc/network/coopnet/coopnet.c | 6 +-- src/pc/network/packets/packet_join.c | 6 +-- src/pc/network/packets/packet_mod_list.c | 6 +-- src/pc/network/version.c | 6 ++- src/pc/network/version.h | 7 ++++ src/pc/pc_main.h | 4 +- src/pc/update_checker.c | 48 ++++++++++++++++++++---- 10 files changed, 101 insertions(+), 27 deletions(-) diff --git a/res/icon.rc b/res/icon.rc index 7e84e50bf..a7d340011 100644 --- a/res/icon.rc +++ b/res/icon.rc @@ -1 +1,27 @@ -id ICON res/icon.ico \ No newline at end of file +id ICON res/icon.ico + +#include +#include "../src/pc/network/version.h" +VS_VERSION_INFO VERSIONINFO +FILEVERSION 1,(VERSION_NUMBER-37),MINOR_VERSION_NUMBER,0 +PRODUCTVERSION VERSION_NUMBER,MINOR_VERSION_NUMBER,0,0 +FILEOS VOS_NT +FILETYPE VFT_APP +{ + BLOCK StringFileInfo + { + BLOCK "040904B0" + { + VALUE "FileDescription", "Super Mario 64 Coop Deluxe" + VALUE "FileVersion", SM64COOPDX_VERSION + VALUE "ProductName", "Super Mario 64 Coop Deluxe" + VALUE "ProductVersion", SM64COOPDX_VERSION + VALUE "InternalName", "sm64coopdx.exe" + VALUE "OriginalFilename", "sm64coopdx.exe" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0409, 0x04B0 + } +} \ No newline at end of file diff --git a/src/pc/djui/djui_panel_join_lobbies.c b/src/pc/djui/djui_panel_join_lobbies.c index bc0d7514f..0a9278b48 100644 --- a/src/pc/djui/djui_panel_join_lobbies.c +++ b/src/pc/djui/djui_panel_join_lobbies.c @@ -87,7 +87,7 @@ void djui_panel_join_query(uint64_t aLobbyId, UNUSED uint64_t aOwnerId, uint16_t snprintf(mode, 64, "%s", aMode); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); bool disabled = strcmp(version, aVersion) != 0; if (disabled) { snprintf(mode, 64, "\\#ff0000\\[%s]", aVersion); diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index 57707045c..0a849bb51 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -61,15 +61,18 @@ void djui_panel_main_create(struct DjuiBase* caller) { djui_base_set_color(&message->base, 255, 255, 160, 255); djui_text_set_alignment(message, DJUI_HALIGN_CENTER, DJUI_VALIGN_BOTTOM); } else { - #ifdef COMPILE_TIME - struct DjuiText* version = djui_text_create(&panel->base, get_version_with_build_date()); - #else - struct DjuiText* version = djui_text_create(&panel->base, get_version()); - #endif + struct DjuiText* version = djui_text_create( + &panel->base, + #ifdef COMPILE_TIME + get_version_with_build_date() + #else + get_version() + #endif + ); djui_base_set_size_type(&version->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(&version->base, 1.0f, 1.0f); djui_base_set_color(&version->base, 50, 50, 50, 255); - djui_text_set_alignment(version, DJUI_HALIGN_RIGHT, DJUI_VALIGN_BOTTOM); + djui_text_set_alignment(version, configExCoopTheme ? DJUI_HALIGN_CENTER : DJUI_HALIGN_RIGHT, DJUI_VALIGN_BOTTOM); } } diff --git a/src/pc/network/coopnet/coopnet.c b/src/pc/network/coopnet/coopnet.c index 5b5ac4244..e343d75e4 100644 --- a/src/pc/network/coopnet/coopnet.c +++ b/src/pc/network/coopnet/coopnet.c @@ -177,7 +177,7 @@ static void coopnet_populate_description(void) { char* buffer = sCoopNetDescription; int bufferLength = MAX_COOPNET_DESCRIPTION_LENGTH; // get version - const char* version = get_version(); + const char* version = get_real_version(); int versionLength = strlen(version); snprintf(buffer, bufferLength, "%s", version); buffer += versionLength; @@ -212,12 +212,12 @@ void ns_coopnet_update(void) { if (sReconnecting) { LOG_INFO("Update lobby"); coopnet_populate_description(); - coopnet_lobby_update(sLocalLobbyId, GAME_NAME, get_version(), configPlayerName, mode, sCoopNetDescription); + coopnet_lobby_update(sLocalLobbyId, GAME_NAME, get_real_version(), configPlayerName, mode, sCoopNetDescription); } else { LOG_INFO("Create lobby"); snprintf(gCoopNetPassword, 64, "%s", configPassword); coopnet_populate_description(); - coopnet_lobby_create(GAME_NAME, get_version(), configPlayerName, mode, (uint16_t)configAmountOfPlayers, gCoopNetPassword, sCoopNetDescription); + coopnet_lobby_create(GAME_NAME, get_real_version(), configPlayerName, mode, (uint16_t)configAmountOfPlayers, gCoopNetPassword, sCoopNetDescription); } } else if (sNetworkType == NT_CLIENT) { LOG_INFO("Join lobby"); diff --git a/src/pc/network/packets/packet_join.c b/src/pc/network/packets/packet_join.c index 0f1602352..c41f23414 100644 --- a/src/pc/network/packets/packet_join.c +++ b/src/pc/network/packets/packet_join.c @@ -45,7 +45,7 @@ void network_send_join_request(void) { struct Packet p = { 0 }; packet_init(&p, PACKET_JOIN_REQUEST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); packet_write(&p, &configPlayerModel, sizeof(u8)); @@ -107,7 +107,7 @@ void network_send_join(struct Packet* joinRequestPacket) { } char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); LOG_INFO("sending version: %s", version); struct Packet p = { 0 }; @@ -143,7 +143,7 @@ void network_receive_join(struct Packet* p) { gOverrideEeprom = eeprom; char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); LOG_INFO("client has version: %s", version); char remoteVersion[MAX_VERSION_LENGTH] = { 0 }; diff --git a/src/pc/network/packets/packet_mod_list.c b/src/pc/network/packets/packet_mod_list.c index 23a4411d2..28e8ed05a 100644 --- a/src/pc/network/packets/packet_mod_list.c +++ b/src/pc/network/packets/packet_mod_list.c @@ -20,7 +20,7 @@ void network_send_mod_list_request(void) { struct Packet p = { 0 }; packet_init(&p, PACKET_MOD_LIST_REQUEST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); network_send_to(PACKET_DESTINATION_SERVER, &p); @@ -47,7 +47,7 @@ void network_send_mod_list(void) { packet_init(&p, PACKET_MOD_LIST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); LOG_INFO("sending version: %s", version); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); packet_write(&p, &gActiveMods.entryCount, sizeof(u16)); @@ -135,7 +135,7 @@ void network_receive_mod_list(struct Packet* p) { } char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); LOG_INFO("client has version: %s", version); // verify version diff --git a/src/pc/network/version.c b/src/pc/network/version.c index fd792dc0a..f8b64c575 100644 --- a/src/pc/network/version.c +++ b/src/pc/network/version.c @@ -4,7 +4,7 @@ static char sVersionString[MAX_VERSION_LENGTH] = { 0 }; -const char* get_version(void) { +const char* get_real_version(void) { #if defined(VERSION_US) snprintf(sVersionString, MAX_VERSION_LENGTH, "%s", SM64COOPDX_VERSION); #else @@ -13,6 +13,10 @@ const char* get_version(void) { return sVersionString; } +const char* get_version(void) { + return configExCoopTheme ? EX_VERSION : get_real_version(); +} + #ifdef COMPILE_TIME const char* get_version_with_build_date(void) { #if defined(VERSION_US) diff --git a/src/pc/network/version.h b/src/pc/network/version.h index 9bda5050c..decc17b13 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -8,6 +8,10 @@ #define VERSION_NUMBER 41 #define MINOR_VERSION_NUMBER 1 +#define STR(x) #x +#define _EX_VERSION(major, minor) STR(major) "." STR(minor) +#define EX_VERSION "v" _EX_VERSION(VERSION_NUMBER, MINOR_VERSION_NUMBER) + #if defined(VERSION_JP) #define VERSION_REGION "JP" #elif defined(VERSION_EU) @@ -29,8 +33,11 @@ #define WINDOW_NAME "Super Mario 64 Coop Deluxe" #endif +#define EX_WINDOW_NAME "sm64ex-coop:" + #define MAX_VERSION_LENGTH 128 +const char* get_real_version(void); const char* get_version(void); #ifdef COMPILE_TIME const char* get_version_with_build_date(void); diff --git a/src/pc/pc_main.h b/src/pc/pc_main.h index 384bcc8dc..37482c80f 100644 --- a/src/pc/pc_main.h +++ b/src/pc/pc_main.h @@ -54,9 +54,9 @@ extern "C" { #endif #ifdef GIT_HASH -#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s, [%s]", WINDOW_NAME, get_version(), GIT_HASH); title; }) +#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s, [%s]", configExCoopTheme ? EX_WINDOW_NAME : WINDOW_NAME, get_version(), GIT_HASH); title; }) #else -#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s", WINDOW_NAME, get_version()); title; }) +#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s", configExCoopTheme ? EX_WINDOW_NAME : WINDOW_NAME, get_version()); title; }) #endif #define AT_STARTUP __attribute__((constructor)) diff --git a/src/pc/update_checker.c b/src/pc/update_checker.c index 77d21abb5..13cbd6bf3 100644 --- a/src/pc/update_checker.c +++ b/src/pc/update_checker.c @@ -23,7 +23,20 @@ downloading and parsing a source file. */ static char sVersionUpdateTextBuffer[256] = { 0 }; -static char sRemoteVersion[8] = { 0 }; +static char sRemoteVersionStr[10] = { 0 }; + +struct Version { + int maj, min, fix; +}; + +bool is_version_newer(struct Version old, struct Version new) { + if (new.maj != old.maj) return new.maj > old.maj; + if (new.min != old.min) return new.min > old.min; + return new.fix > old.fix; +} + +static struct Version sClientVersion = { 0 }; +static struct Version sRemoteVersion = { 0 }; bool gUpdateMessage = false; @@ -51,6 +64,16 @@ size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata) { } #endif +void parse_to_version(const char *str, struct Version *ver) { + printf("%s\n", str); + char* end; + ver->maj = strtol(str+1, &end, 10); + if (end) ver->min = strtol(end+1, &end, 10); + if (end) ver->fix = strtol(end+1, &end, 10); + + printf("v%i.%i.%i\n", ver->maj, ver->min, ver->fix); +} + void parse_version(const char *data) { const char *version = strstr(data, VERSION_IDENTIFIER); if (version == NULL) { return; } @@ -58,14 +81,17 @@ void parse_version(const char *data) { version += len; const char *end = strchr(version, '"'); size_t versionLength = (size_t)(end - version); - if (versionLength > sizeof(sRemoteVersion) - 1) { return; } - memcpy(sRemoteVersion, version, versionLength); - sRemoteVersion[versionLength] = '\0'; + if (versionLength > sizeof(sRemoteVersionStr) - 1) { return; } + memcpy(sRemoteVersionStr, version, versionLength); + sRemoteVersionStr[versionLength] = '\0'; + + parse_to_version(sRemoteVersionStr, &sRemoteVersion); + parse_to_version(SM64COOPDX_VERSION, &sClientVersion); } // function to download a text file from the internet void get_version_remote(void) { - sRemoteVersion[0] = '\0'; + sRemoteVersionStr[0] = '\0'; #if defined(_WIN32) || defined(_WIN64) char buffer[0xFF] = { 0 }; @@ -145,13 +171,21 @@ void check_for_updates(void) { LOADING_SCREEN_MUTEX(loading_screen_set_segment_text("Checking For Updates")); get_version_remote(); - if (sRemoteVersion[0] == 'v' && strcmp(sRemoteVersion, get_version())) { + if (sRemoteVersionStr[0] == 'v' && is_version_newer(sClientVersion, sRemoteVersion)) { + if (configExCoopTheme) { + snprintf( + sRemoteVersionStr, 10, + "v%i.%i", + sRemoteVersion.min + 37, + sRemoteVersion.fix + ); + } snprintf( sVersionUpdateTextBuffer, 256, "\\#ffffa0\\%s\n\\#dcdcdc\\%s: %s\n%s: %s", DLANG(NOTIF, UPDATE_AVAILABLE), DLANG(NOTIF, LATEST_VERSION), - sRemoteVersion, + sRemoteVersionStr, DLANG(NOTIF, YOUR_VERSION), get_version() ); From 1bb5e2fe8de03182f5afe115e5221f252ec24d7b Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Fri, 2 Jan 2026 17:29:32 -0600 Subject: [PATCH 2/7] patch autogen, remove prints --- autogen/convert_constants.py | 1 + res/icon.rc | 2 +- src/pc/djui/djui_panel_join_lobbies.c | 2 +- src/pc/djui/djui_panel_main.c | 30 ++++++++++++++++++++++++ src/pc/network/coopnet/coopnet.c | 6 ++--- src/pc/network/packets/packet_join.c | 6 ++--- src/pc/network/packets/packet_mod_list.c | 6 ++--- src/pc/network/version.c | 20 +++++++++------- src/pc/network/version.h | 6 ++--- src/pc/update_checker.c | 7 ++---- 10 files changed, 59 insertions(+), 27 deletions(-) diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index 409cd8427..cadd4b0ca 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -68,6 +68,7 @@ exclude_constants = { "src/pc/lua/smlua_hooks.h": [ "MAX_HOOKED_MOD_MENU_ELEMENTS", "^HOOK_RETURN_.*", "^ACTION_HOOK_.*", "^MOD_MENU_ELEMENT_.*" ], "src/pc/djui/djui_panel_menu.h": [ "RAINBOW_TEXT_LEN" ], "src/pc/mods/mod_fs.h": [ "INT_TYPE_MAX", "FLOAT_TYPE_MAX", "FILE_SEEK_MAX" ], + "src/pc/network/version.h": [ "VERSION_OFFSET", "EX_VERSION", "EX_WINDOW_NAME" ], } include_constants = { diff --git a/res/icon.rc b/res/icon.rc index a7d340011..c4ad9f1fe 100644 --- a/res/icon.rc +++ b/res/icon.rc @@ -3,7 +3,7 @@ id ICON res/icon.ico #include #include "../src/pc/network/version.h" VS_VERSION_INFO VERSIONINFO -FILEVERSION 1,(VERSION_NUMBER-37),MINOR_VERSION_NUMBER,0 +FILEVERSION 1,(VERSION_NUMBER-VERSION_OFFSET),MINOR_VERSION_NUMBER,0 PRODUCTVERSION VERSION_NUMBER,MINOR_VERSION_NUMBER,0,0 FILEOS VOS_NT FILETYPE VFT_APP diff --git a/src/pc/djui/djui_panel_join_lobbies.c b/src/pc/djui/djui_panel_join_lobbies.c index 0a9278b48..b56676ed8 100644 --- a/src/pc/djui/djui_panel_join_lobbies.c +++ b/src/pc/djui/djui_panel_join_lobbies.c @@ -87,7 +87,7 @@ void djui_panel_join_query(uint64_t aLobbyId, UNUSED uint64_t aOwnerId, uint16_t snprintf(mode, 64, "%s", aMode); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); bool disabled = strcmp(version, aVersion) != 0; if (disabled) { snprintf(mode, 64, "\\#ff0000\\[%s]", aVersion); diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index 0a849bb51..a71fa9e71 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -8,6 +8,8 @@ #include "pc/controller/controller_sdl.h" #include "pc/pc_main.h" #include "pc/update_checker.h" +#include "sounds.h" +#include "audio/external.h" extern ALIGNED8 u8 texture_coopdx_logo[]; @@ -24,8 +26,34 @@ static void djui_panel_main_quit(struct DjuiBase* caller) { djui_panel_main_quit_yes); } +static int sEggCounter; +static void djui_panel_main_increment_egg_counter(UNUSED struct DjuiBase *base) { + play_sound(SOUND_MENU_COLLECT_RED_COIN + ((8 - sEggCounter) << 16), gGlobalSoundSource); + + if (!--sEggCounter) { + configExCoopTheme = !configExCoopTheme; + game_exit(); + } +} + +static u32 sEggHintLastFired; +static void djui_panel_main_egg_hint(UNUSED struct DjuiBase *base) { + if (sEggHintLastFired < gGlobalTimer) { + play_sound(SOUND_GENERAL_COIN, gGlobalSoundSource); + } + sEggHintLastFired = gGlobalTimer + 1; +} + +static void djui_panel_main_setup_egg_interactable(struct DjuiBase *base) { + djui_interactable_create(base, NULL); + djui_interactable_hook_click(base, djui_panel_main_increment_egg_counter); + djui_interactable_hook_hover(base, djui_panel_main_egg_hint, NULL); +} + void djui_panel_main_create(struct DjuiBase* caller) { struct DjuiThreePanel* panel = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false); + if (configExCoopTheme) { djui_panel_main_setup_egg_interactable(djui_three_panel_get_header(panel)); } + { struct DjuiBase* body = djui_three_panel_get_body(panel); { @@ -39,6 +67,7 @@ void djui_panel_main_create(struct DjuiBase* caller) { djui_base_set_alignment(&logo->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP); djui_base_set_location_type(&logo->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_location(&logo->base, 0, -30); + djui_panel_main_setup_egg_interactable(&logo->base); } struct DjuiButton* button1 = djui_button_create(body, DLANG(MAIN, HOST), DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create); @@ -79,4 +108,5 @@ void djui_panel_main_create(struct DjuiBase* caller) { djui_panel_add(caller, panel, NULL); gInteractableOverridePad = true; gDjuiPanelMainCreated = true; + sEggCounter = 8; } diff --git a/src/pc/network/coopnet/coopnet.c b/src/pc/network/coopnet/coopnet.c index e343d75e4..efbd039f2 100644 --- a/src/pc/network/coopnet/coopnet.c +++ b/src/pc/network/coopnet/coopnet.c @@ -177,7 +177,7 @@ static void coopnet_populate_description(void) { char* buffer = sCoopNetDescription; int bufferLength = MAX_COOPNET_DESCRIPTION_LENGTH; // get version - const char* version = get_real_version(); + const char* version = get_version_online(); int versionLength = strlen(version); snprintf(buffer, bufferLength, "%s", version); buffer += versionLength; @@ -212,12 +212,12 @@ void ns_coopnet_update(void) { if (sReconnecting) { LOG_INFO("Update lobby"); coopnet_populate_description(); - coopnet_lobby_update(sLocalLobbyId, GAME_NAME, get_real_version(), configPlayerName, mode, sCoopNetDescription); + coopnet_lobby_update(sLocalLobbyId, GAME_NAME, get_version_online(), configPlayerName, mode, sCoopNetDescription); } else { LOG_INFO("Create lobby"); snprintf(gCoopNetPassword, 64, "%s", configPassword); coopnet_populate_description(); - coopnet_lobby_create(GAME_NAME, get_real_version(), configPlayerName, mode, (uint16_t)configAmountOfPlayers, gCoopNetPassword, sCoopNetDescription); + coopnet_lobby_create(GAME_NAME, get_version_online(), configPlayerName, mode, (uint16_t)configAmountOfPlayers, gCoopNetPassword, sCoopNetDescription); } } else if (sNetworkType == NT_CLIENT) { LOG_INFO("Join lobby"); diff --git a/src/pc/network/packets/packet_join.c b/src/pc/network/packets/packet_join.c index c41f23414..ad8fab6b7 100644 --- a/src/pc/network/packets/packet_join.c +++ b/src/pc/network/packets/packet_join.c @@ -45,7 +45,7 @@ void network_send_join_request(void) { struct Packet p = { 0 }; packet_init(&p, PACKET_JOIN_REQUEST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); packet_write(&p, &configPlayerModel, sizeof(u8)); @@ -107,7 +107,7 @@ void network_send_join(struct Packet* joinRequestPacket) { } char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); LOG_INFO("sending version: %s", version); struct Packet p = { 0 }; @@ -143,7 +143,7 @@ void network_receive_join(struct Packet* p) { gOverrideEeprom = eeprom; char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); LOG_INFO("client has version: %s", version); char remoteVersion[MAX_VERSION_LENGTH] = { 0 }; diff --git a/src/pc/network/packets/packet_mod_list.c b/src/pc/network/packets/packet_mod_list.c index 28e8ed05a..49409f524 100644 --- a/src/pc/network/packets/packet_mod_list.c +++ b/src/pc/network/packets/packet_mod_list.c @@ -20,7 +20,7 @@ void network_send_mod_list_request(void) { struct Packet p = { 0 }; packet_init(&p, PACKET_MOD_LIST_REQUEST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); network_send_to(PACKET_DESTINATION_SERVER, &p); @@ -47,7 +47,7 @@ void network_send_mod_list(void) { packet_init(&p, PACKET_MOD_LIST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); LOG_INFO("sending version: %s", version); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); packet_write(&p, &gActiveMods.entryCount, sizeof(u16)); @@ -135,7 +135,7 @@ void network_receive_mod_list(struct Packet* p) { } char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_real_version()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); LOG_INFO("client has version: %s", version); // verify version diff --git a/src/pc/network/version.c b/src/pc/network/version.c index f8b64c575..73041f093 100644 --- a/src/pc/network/version.c +++ b/src/pc/network/version.c @@ -4,26 +4,30 @@ static char sVersionString[MAX_VERSION_LENGTH] = { 0 }; -const char* get_real_version(void) { +const char* get_version_online(void) { + snprintf( + sVersionString, MAX_VERSION_LENGTH, #if defined(VERSION_US) - snprintf(sVersionString, MAX_VERSION_LENGTH, "%s", SM64COOPDX_VERSION); + "%s", SM64COOPDX_VERSION #else - snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %s", SM64COOPDX_VERSION, VERSION_REGION); + "%s %s", SM64COOPDX_VERSION, VERSION_REGION #endif // VERSION_US + ); return sVersionString; } -const char* get_version(void) { - return configExCoopTheme ? EX_VERSION : get_real_version(); -} +const char* get_version(void) { return configExCoopTheme ? EX_VERSION : get_version_online(); } #ifdef COMPILE_TIME const char* get_version_with_build_date(void) { + snprintf( + sVersionString, MAX_VERSION_LENGTH, #if defined(VERSION_US) - snprintf(sVersionString, MAX_VERSION_LENGTH, "%s, %s", SM64COOPDX_VERSION, COMPILE_TIME); + "%s, %s", SM64COOPDX_VERSION, COMPILE_TIME #else - snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %s, %s", SM64COOPDX_VERSION, VERSION_REGION, COMPILE_TIME); + "%s %s, %s", SM64COOPDX_VERSION, VERSION_REGION, COMPILE_TIME #endif // VERSION_US + ); return sVersionString; } #endif \ No newline at end of file diff --git a/src/pc/network/version.h b/src/pc/network/version.h index decc17b13..27d57ced8 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -8,9 +8,10 @@ #define VERSION_NUMBER 41 #define MINOR_VERSION_NUMBER 1 +#define VERSION_OFFSET 37 #define STR(x) #x #define _EX_VERSION(major, minor) STR(major) "." STR(minor) -#define EX_VERSION "v" _EX_VERSION(VERSION_NUMBER, MINOR_VERSION_NUMBER) +#define EX_VERSION VERSION_TEXT _EX_VERSION(VERSION_NUMBER, MINOR_VERSION_NUMBER) #if defined(VERSION_JP) #define VERSION_REGION "JP" @@ -32,12 +33,11 @@ #define GAME_NAME "sm64coopdx" #define WINDOW_NAME "Super Mario 64 Coop Deluxe" #endif - #define EX_WINDOW_NAME "sm64ex-coop:" #define MAX_VERSION_LENGTH 128 -const char* get_real_version(void); +const char* get_version_online(void); const char* get_version(void); #ifdef COMPILE_TIME const char* get_version_with_build_date(void); diff --git a/src/pc/update_checker.c b/src/pc/update_checker.c index 13cbd6bf3..2f99f92b3 100644 --- a/src/pc/update_checker.c +++ b/src/pc/update_checker.c @@ -23,7 +23,7 @@ downloading and parsing a source file. */ static char sVersionUpdateTextBuffer[256] = { 0 }; -static char sRemoteVersionStr[10] = { 0 }; +static char sRemoteVersionStr[8] = { 0 }; struct Version { int maj, min, fix; @@ -65,13 +65,10 @@ size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata) { #endif void parse_to_version(const char *str, struct Version *ver) { - printf("%s\n", str); char* end; ver->maj = strtol(str+1, &end, 10); if (end) ver->min = strtol(end+1, &end, 10); if (end) ver->fix = strtol(end+1, &end, 10); - - printf("v%i.%i.%i\n", ver->maj, ver->min, ver->fix); } void parse_version(const char *data) { @@ -176,7 +173,7 @@ void check_for_updates(void) { snprintf( sRemoteVersionStr, 10, "v%i.%i", - sRemoteVersion.min + 37, + sRemoteVersion.min + VERSION_OFFSET, sRemoteVersion.fix ); } From d4cc6560461e21a913fd6df9f9ef88a40c095369 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Fri, 2 Jan 2026 21:37:43 -0600 Subject: [PATCH 3/7] Fix special case (min=0,fix=!0) --- autogen/convert_constants.py | 2 +- lang/Czech.ini | 1 - lang/Dutch.ini | 1 - lang/English.ini | 1 - lang/French.ini | 1 - lang/German.ini | 1 - lang/Italian.ini | 1 - lang/Japanese.ini | 1 - lang/Polish.ini | 1 - lang/Portuguese.ini | 1 - lang/Russian.ini | 1 - lang/Spanish.ini | 1 - src/pc/network/version.c | 6 ++++- src/pc/network/version.h | 3 --- src/pc/update_checker.c | 49 +++++++++++++++++++++++++----------- 15 files changed, 40 insertions(+), 31 deletions(-) diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index cadd4b0ca..a2c5668b7 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -68,7 +68,7 @@ exclude_constants = { "src/pc/lua/smlua_hooks.h": [ "MAX_HOOKED_MOD_MENU_ELEMENTS", "^HOOK_RETURN_.*", "^ACTION_HOOK_.*", "^MOD_MENU_ELEMENT_.*" ], "src/pc/djui/djui_panel_menu.h": [ "RAINBOW_TEXT_LEN" ], "src/pc/mods/mod_fs.h": [ "INT_TYPE_MAX", "FLOAT_TYPE_MAX", "FILE_SEEK_MAX" ], - "src/pc/network/version.h": [ "VERSION_OFFSET", "EX_VERSION", "EX_WINDOW_NAME" ], + "src/pc/network/version.h": [ "VERSION_OFFSET", "EX_WINDOW_NAME" ], } include_constants = { diff --git a/lang/Czech.ini b/lang/Czech.ini index ddf7ae547..d967f9678 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "Nastavení hlavního menu" INFORMATION = "Informace" DEBUG = "Debug" LANGUAGE = "Jazyk" -COOP_COMPATIBILITY = "Povolit kompatibilitu sm64ex-coop" R_BUTTON = "Tlačítko R - Možnosti" L_BUTTON = "Tlačítko L - Znovu načíst aktivní mody" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index a06530f8b..a93256985 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "Menu Instellingen" INFORMATION = "Informatie" DEBUG = "Debug" LANGUAGE = "Taal" -COOP_COMPATIBILITY = "Schakel sm64ex-coop compatibiliteit in" R_BUTTON = "R-knop - Opties" L_BUTTON = "L-knop - Actieve mods opnieuw laden" diff --git a/lang/English.ini b/lang/English.ini index 14ec1d462..e234ab76e 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "Menu Options" INFORMATION = "Info" DEBUG = "Debug" LANGUAGE = "Language" -COOP_COMPATIBILITY = "Enable sm64ex-coop Compatibility" R_BUTTON = "R Button - Options" L_BUTTON = "L Button - Reload Active Mods" diff --git a/lang/French.ini b/lang/French.ini index b0dfe3be2..cf7f9b0f4 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "Options du menu" INFORMATION = "Information" DEBUG = "Débogage" LANGUAGE = "Langue" -COOP_COMPATIBILITY = "Activer la compatibilité sm64ex-coop" R_BUTTON = "Bouton R - Options" L_BUTTON = "Bouton L - Recharger les mods actifs" diff --git a/lang/German.ini b/lang/German.ini index e44e5c718..951d0e517 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "Menüoptionen" INFORMATION = "Info" DEBUG = "Debug" LANGUAGE = "Sprache" -COOP_COMPATIBILITY = "Aktiviere sm64ex-coop Kompatibilität" R_BUTTON = "R-Taste - Optionen" L_BUTTON = "L-Taste - Aktive Mods neu laden" diff --git a/lang/Italian.ini b/lang/Italian.ini index e0827a2f6..eb48d000b 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -322,7 +322,6 @@ MENU_OPTIONS = "Opzioni Menù" INFORMATION = "Informazione" DEBUG = "Debug" LANGUAGE = "Lingua" -COOP_COMPATIBILITY = "Abilita la compatibilità con sm64ex-coop" R_BUTTON = "Pulsante R - Opzioni" L_BUTTON = "Pulsante L - Ricarica Mod Attive" diff --git a/lang/Japanese.ini b/lang/Japanese.ini index a15f74b3a..0f50fb020 100644 --- a/lang/Japanese.ini +++ b/lang/Japanese.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "メニューの設定" INFORMATION = "情報" DEBUG = "デバッグ" LANGUAGE = "言語" -COOP_COMPATIBILITY = "sm64ex-coopとの互換性を有効にする" R_BUTTON = "Rボタン - 設定" L_BUTTON = "Lボタン - 有効化されたMODを再読み込み" diff --git a/lang/Polish.ini b/lang/Polish.ini index 9781c549e..df84139d4 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "Opcje Menu" INFORMATION = "Informacja" DEBUG = "Debugowanie" LANGUAGE = "Język" -COOP_COMPATIBILITY = "Włącz kompatybilność z sm64ex-coop" R_BUTTON = "Przycisk R - Opcje" L_BUTTON = "Przycisk L - Przeładuj aktywne mody" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index e935499a6..db2615124 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "Opções de menu" INFORMATION = "Informações" DEBUG = "Debug" LANGUAGE = "Idioma" -COOP_COMPATIBILITY = "Ativar a compatibilidade com sm64ex-coop" R_BUTTON = "Botão R - Opções" L_BUTTON = "Botão L - Recarregar mods ativos" diff --git a/lang/Russian.ini b/lang/Russian.ini index 52861a4cf..851107795 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -323,7 +323,6 @@ MENU_OPTIONS = "Параметры меню" INFORMATION = "Информация" DEBUG = "Отладка" LANGUAGE = "Язык" -COOP_COMPATIBILITY = "Включить совместимость sm64ex-coop" R_BUTTON = "Кнопка R - Опции" L_BUTTON = "Кнопка L - Перезагрузить активные моды" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index f083c8ba2..ef82d277f 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -324,7 +324,6 @@ MENU_OPTIONS = "Opciones del menú" INFORMATION = "Información" DEBUG = "Depuración" LANGUAGE = "Idioma" -COOP_COMPATIBILITY = "Habilitar la compatibilidad con sm64ex-coop" R_BUTTON = "Botón R - Opciones" L_BUTTON = "Botón L - Recargar mods activos" diff --git a/src/pc/network/version.c b/src/pc/network/version.c index 73041f093..a9083483b 100644 --- a/src/pc/network/version.c +++ b/src/pc/network/version.c @@ -16,7 +16,11 @@ const char* get_version_online(void) { return sVersionString; } -const char* get_version(void) { return configExCoopTheme ? EX_VERSION : get_version_online(); } +const char* get_version(void) { + get_version_online(); + extern void exify_version_str(char* str); + if (configExCoopTheme) { exify_version_str(sVersionString); } + return sVersionString; } #ifdef COMPILE_TIME const char* get_version_with_build_date(void) { diff --git a/src/pc/network/version.h b/src/pc/network/version.h index 27d57ced8..80fd1303a 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -9,9 +9,6 @@ #define MINOR_VERSION_NUMBER 1 #define VERSION_OFFSET 37 -#define STR(x) #x -#define _EX_VERSION(major, minor) STR(major) "." STR(minor) -#define EX_VERSION VERSION_TEXT _EX_VERSION(VERSION_NUMBER, MINOR_VERSION_NUMBER) #if defined(VERSION_JP) #define VERSION_REGION "JP" diff --git a/src/pc/update_checker.c b/src/pc/update_checker.c index 2f99f92b3..4f95517eb 100644 --- a/src/pc/update_checker.c +++ b/src/pc/update_checker.c @@ -29,10 +29,10 @@ struct Version { int maj, min, fix; }; -bool is_version_newer(struct Version old, struct Version new) { - if (new.maj != old.maj) return new.maj > old.maj; - if (new.min != old.min) return new.min > old.min; - return new.fix > old.fix; +bool is_version_newer(struct Version client, struct Version remote) { + if (remote.maj != client.maj) return remote.maj > client.maj; + if (remote.min != client.min) return remote.min > client.min; + return remote.fix > client.fix; } static struct Version sClientVersion = { 0 }; @@ -64,13 +64,39 @@ size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata) { } #endif -void parse_to_version(const char *str, struct Version *ver) { +void strtov(const char *str, struct Version *ver) { char* end; ver->maj = strtol(str+1, &end, 10); if (end) ver->min = strtol(end+1, &end, 10); if (end) ver->fix = strtol(end+1, &end, 10); } +void vtostr(struct Version ver, char* str) { + int len; + snprintf(str, 8, "v%i", ver.maj); + if (ver.min || ver.fix) { + len = strlen(str); + snprintf(str + len, 8 - len, ".%i", ver.min); + if (ver.fix) { + len = strlen(str); + snprintf(str + len, 8 - len, ".%i", ver.fix); + } + } +} + +void exify_version(struct Version *ver) { + ver->maj = ver->min + VERSION_OFFSET; + ver->min = ver->fix; + ver->fix = 0; +} + +void exify_version_str(char* str) { + struct Version ver; + strtov(str, &ver); + exify_version(&ver); + vtostr(ver, str); +} + void parse_version(const char *data) { const char *version = strstr(data, VERSION_IDENTIFIER); if (version == NULL) { return; } @@ -82,8 +108,8 @@ void parse_version(const char *data) { memcpy(sRemoteVersionStr, version, versionLength); sRemoteVersionStr[versionLength] = '\0'; - parse_to_version(sRemoteVersionStr, &sRemoteVersion); - parse_to_version(SM64COOPDX_VERSION, &sClientVersion); + strtov(sRemoteVersionStr, &sRemoteVersion); + strtov(get_version_online(), &sClientVersion); } // function to download a text file from the internet @@ -169,14 +195,7 @@ void check_for_updates(void) { get_version_remote(); if (sRemoteVersionStr[0] == 'v' && is_version_newer(sClientVersion, sRemoteVersion)) { - if (configExCoopTheme) { - snprintf( - sRemoteVersionStr, 10, - "v%i.%i", - sRemoteVersion.min + VERSION_OFFSET, - sRemoteVersion.fix - ); - } + if (configExCoopTheme) { exify_version_str(sRemoteVersionStr); } snprintf( sVersionUpdateTextBuffer, 256, "\\#ffffa0\\%s\n\\#dcdcdc\\%s: %s\n%s: %s", From e019d3ec4324b206a02b3cbbcdf4651913ff086f Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Fri, 2 Jan 2026 22:10:28 -0600 Subject: [PATCH 4/7] Not that obvious!! --- src/pc/djui/djui_panel_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index a71fa9e71..b4fd25a0a 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -48,6 +48,7 @@ static void djui_panel_main_setup_egg_interactable(struct DjuiBase *base) { djui_interactable_create(base, NULL); djui_interactable_hook_click(base, djui_panel_main_increment_egg_counter); djui_interactable_hook_hover(base, djui_panel_main_egg_hint, NULL); + base->interactable->enabled = false; } void djui_panel_main_create(struct DjuiBase* caller) { From fd9168760f4b5d66fe44b97dccc595a651a6f2e5 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 3 Jan 2026 01:25:24 -0600 Subject: [PATCH 5/7] Still too obvious... last one --- src/pc/djui/djui_panel_main.c | 68 +++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index b4fd25a0a..6fb7547fa 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -6,14 +6,17 @@ #include "djui_panel_menu.h" #include "djui_panel_confirm.h" #include "pc/controller/controller_sdl.h" +#include "pc/controller/controller_mouse.h" #include "pc/pc_main.h" #include "pc/update_checker.h" #include "sounds.h" #include "audio/external.h" +#include "game/area.h" extern ALIGNED8 u8 texture_coopdx_logo[]; bool gDjuiPanelMainCreated = false; +struct DjuiThreePanel* panel = NULL; static void djui_panel_main_quit_yes(UNUSED struct DjuiBase* caller) { game_exit(); @@ -27,33 +30,54 @@ static void djui_panel_main_quit(struct DjuiBase* caller) { } static int sEggCounter; -static void djui_panel_main_increment_egg_counter(UNUSED struct DjuiBase *base) { - play_sound(SOUND_MENU_COLLECT_RED_COIN + ((8 - sEggCounter) << 16), gGlobalSoundSource); +static u32 sEggLastFired; +static f32 sEggLastY; +static bool sEggHovered = false; +static bool sEggClicked = false; - if (!--sEggCounter) { - configExCoopTheme = !configExCoopTheme; - game_exit(); - } +static void djui_panel_main_egg_end(struct DjuiBase *base, UNUSED bool *noRender) { + panel->base.x.value -= gGlobalTimer - sEggLastFired + 60; + base->color.a = MAX(255.f - ((gGlobalTimer - sEggLastFired + 60) << 3), 0); + if (gGlobalTimer == sEggLastFired) { game_exit(); } } -static u32 sEggHintLastFired; -static void djui_panel_main_egg_hint(UNUSED struct DjuiBase *base) { - if (sEggHintLastFired < gGlobalTimer) { - play_sound(SOUND_GENERAL_COIN, gGlobalSoundSource); - } - sEggHintLastFired = gGlobalTimer + 1; -} +static void djui_panel_main_egg(struct DjuiBase *base, UNUSED bool *noRender) { + if (sEggCounter && sEggLastY == base->clip.y) { + bool hovering = djui_cursor_inside_base(base); + bool clicking = (gInteractablePad.button & PAD_BUTTON_A || mouse_buttons & L_MOUSE_BUTTON); + + if (hovering) { + if (!sEggHovered && sEggLastFired + 20 < gGlobalTimer) { + play_sound(SOUND_GENERAL_COIN, gGlobalSoundSource); + } + sEggLastFired = gGlobalTimer; + + if (!sEggClicked && clicking) { + play_sound(SOUND_MENU_COLLECT_SECRET + ((5 - sEggCounter) << 16), gGlobalSoundSource); + + if (!--sEggCounter) { + configExCoopTheme = !configExCoopTheme; + play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); + fade_volume_scale(SEQ_PLAYER_LEVEL, 0, 40); + sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL & ~(1 << SOUND_BANK_MENU)); + sEggLastFired = gGlobalTimer + 60; -static void djui_panel_main_setup_egg_interactable(struct DjuiBase *base) { - djui_interactable_create(base, NULL); - djui_interactable_hook_click(base, djui_panel_main_increment_egg_counter); - djui_interactable_hook_hover(base, djui_panel_main_egg_hint, NULL); - base->interactable->enabled = false; + extern struct DjuiImage* sMouseCursor; + sMouseCursor->base.on_render_pre = djui_panel_main_egg_end; + } + } + } + + sEggHovered = hovering; + sEggClicked = clicking; + return; + } + sEggLastY = base->clip.y; } void djui_panel_main_create(struct DjuiBase* caller) { - struct DjuiThreePanel* panel = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false); - if (configExCoopTheme) { djui_panel_main_setup_egg_interactable(djui_three_panel_get_header(panel)); } + panel = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false); + if (configExCoopTheme) { djui_three_panel_get_header(panel)->on_render_pre = djui_panel_main_egg; } { struct DjuiBase* body = djui_three_panel_get_body(panel); @@ -68,7 +92,7 @@ void djui_panel_main_create(struct DjuiBase* caller) { djui_base_set_alignment(&logo->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP); djui_base_set_location_type(&logo->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_location(&logo->base, 0, -30); - djui_panel_main_setup_egg_interactable(&logo->base); + logo->base.on_render_pre = djui_panel_main_egg; } struct DjuiButton* button1 = djui_button_create(body, DLANG(MAIN, HOST), DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create); @@ -109,5 +133,5 @@ void djui_panel_main_create(struct DjuiBase* caller) { djui_panel_add(caller, panel, NULL); gInteractableOverridePad = true; gDjuiPanelMainCreated = true; - sEggCounter = 8; + sEggCounter = 5; } From d63bfd1719713c64ebe52f1c56f7195db82a7d15 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Thu, 26 Mar 2026 23:10:46 -0500 Subject: [PATCH 6/7] the djoslin0 review --- src/pc/djui/djui_panel_main.c | 24 +++++++++++++----------- src/pc/network/version.h | 2 +- src/pc/update_checker.c | 19 ++++++++++--------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index 6fb7547fa..7fd37cc56 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -16,7 +16,7 @@ extern ALIGNED8 u8 texture_coopdx_logo[]; bool gDjuiPanelMainCreated = false; -struct DjuiThreePanel* panel = NULL; +static struct DjuiThreePanel* sPanelMain = NULL; static void djui_panel_main_quit_yes(UNUSED struct DjuiBase* caller) { game_exit(); @@ -36,15 +36,18 @@ static bool sEggHovered = false; static bool sEggClicked = false; static void djui_panel_main_egg_end(struct DjuiBase *base, UNUSED bool *noRender) { - panel->base.x.value -= gGlobalTimer - sEggLastFired + 60; + sPanelMain->base.x.value -= gGlobalTimer - sEggLastFired + 60; base->color.a = MAX(255.f - ((gGlobalTimer - sEggLastFired + 60) << 3), 0); - if (gGlobalTimer == sEggLastFired) { game_exit(); } + if (gGlobalTimer == sEggLastFired) { + configExCoopTheme = !configExCoopTheme; + game_exit(); + } } static void djui_panel_main_egg(struct DjuiBase *base, UNUSED bool *noRender) { if (sEggCounter && sEggLastY == base->clip.y) { bool hovering = djui_cursor_inside_base(base); - bool clicking = (gInteractablePad.button & PAD_BUTTON_A || mouse_buttons & L_MOUSE_BUTTON); + bool clicking = ((gInteractablePad.button & PAD_BUTTON_A) || (mouse_buttons & L_MOUSE_BUTTON)); if (hovering) { if (!sEggHovered && sEggLastFired + 20 < gGlobalTimer) { @@ -56,7 +59,6 @@ static void djui_panel_main_egg(struct DjuiBase *base, UNUSED bool *noRender) { play_sound(SOUND_MENU_COLLECT_SECRET + ((5 - sEggCounter) << 16), gGlobalSoundSource); if (!--sEggCounter) { - configExCoopTheme = !configExCoopTheme; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); fade_volume_scale(SEQ_PLAYER_LEVEL, 0, 40); sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL & ~(1 << SOUND_BANK_MENU)); @@ -76,11 +78,11 @@ static void djui_panel_main_egg(struct DjuiBase *base, UNUSED bool *noRender) { } void djui_panel_main_create(struct DjuiBase* caller) { - panel = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false); - if (configExCoopTheme) { djui_three_panel_get_header(panel)->on_render_pre = djui_panel_main_egg; } + sPanelMain = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false); + if (configExCoopTheme) { djui_three_panel_get_header(sPanelMain)->on_render_pre = djui_panel_main_egg; } { - struct DjuiBase* body = djui_three_panel_get_body(panel); + struct DjuiBase* body = djui_three_panel_get_body(sPanelMain); { if (!configExCoopTheme) { struct DjuiImage* logo = djui_image_create(body, texture_coopdx_logo, 2048, 1024, G_IM_FMT_RGBA, G_IM_SIZ_32b); @@ -109,14 +111,14 @@ void djui_panel_main_create(struct DjuiBase* caller) { // these two cannot co-exist for some reason if (gUpdateMessage) { - struct DjuiText* message = djui_text_create(&panel->base, DLANG(NOTIF, UPDATE_AVAILABLE)); + struct DjuiText* message = djui_text_create(&sPanelMain->base, DLANG(NOTIF, UPDATE_AVAILABLE)); djui_base_set_size_type(&message->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(&message->base, 1.0f, 1.0f); djui_base_set_color(&message->base, 255, 255, 160, 255); djui_text_set_alignment(message, DJUI_HALIGN_CENTER, DJUI_VALIGN_BOTTOM); } else { struct DjuiText* version = djui_text_create( - &panel->base, + &sPanelMain->base, #ifdef COMPILE_TIME get_version_with_build_date() #else @@ -130,7 +132,7 @@ void djui_panel_main_create(struct DjuiBase* caller) { } } - djui_panel_add(caller, panel, NULL); + djui_panel_add(caller, sPanelMain, NULL); gInteractableOverridePad = true; gDjuiPanelMainCreated = true; sEggCounter = 5; diff --git a/src/pc/network/version.h b/src/pc/network/version.h index 80fd1303a..7dacb0e4c 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -8,7 +8,7 @@ #define VERSION_NUMBER 41 #define MINOR_VERSION_NUMBER 1 -#define VERSION_OFFSET 37 +#define VERSION_OFFSET 37 // difference from old versioning system #if defined(VERSION_JP) #define VERSION_REGION "JP" diff --git a/src/pc/update_checker.c b/src/pc/update_checker.c index 4f95517eb..64b474b14 100644 --- a/src/pc/update_checker.c +++ b/src/pc/update_checker.c @@ -64,22 +64,23 @@ size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata) { } #endif -void strtov(const char *str, struct Version *ver) { +void string_to_version(const char *str, struct Version *ver) { char* end; ver->maj = strtol(str+1, &end, 10); + ver->min = 0; ver->fix = 0; if (end) ver->min = strtol(end+1, &end, 10); if (end) ver->fix = strtol(end+1, &end, 10); } -void vtostr(struct Version ver, char* str) { +void version_to_string(struct Version ver, char* str, size_t size) { int len; - snprintf(str, 8, "v%i", ver.maj); + snprintf(str, size, "v%i", ver.maj); if (ver.min || ver.fix) { len = strlen(str); - snprintf(str + len, 8 - len, ".%i", ver.min); + snprintf(str + len, size - len, ".%i", ver.min); if (ver.fix) { len = strlen(str); - snprintf(str + len, 8 - len, ".%i", ver.fix); + snprintf(str + len, size - len, ".%i", ver.fix); } } } @@ -92,9 +93,9 @@ void exify_version(struct Version *ver) { void exify_version_str(char* str) { struct Version ver; - strtov(str, &ver); + string_to_version(str, &ver); exify_version(&ver); - vtostr(ver, str); + version_to_string(ver, str, 8); } void parse_version(const char *data) { @@ -108,8 +109,8 @@ void parse_version(const char *data) { memcpy(sRemoteVersionStr, version, versionLength); sRemoteVersionStr[versionLength] = '\0'; - strtov(sRemoteVersionStr, &sRemoteVersion); - strtov(get_version_online(), &sClientVersion); + string_to_version(sRemoteVersionStr, &sRemoteVersion); + string_to_version(get_version_online(), &sClientVersion); } // function to download a text file from the internet From ad26fc4abbf035976ae39466073eaa96b764e5d8 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Fri, 27 Mar 2026 20:10:00 -0500 Subject: [PATCH 7/7] Nuked --- autogen/convert_constants.py | 2 +- autogen/lua_definitions/constants.lua | 2 +- src/pc/djui/djui_panel_join_lobbies.c | 2 +- src/pc/djui/djui_panel_main.c | 67 ++---------------------- src/pc/lua/smlua_constants_autogen.c | 2 +- src/pc/network/coopnet/coopnet.c | 6 +-- src/pc/network/packets/packet_join.c | 6 +-- src/pc/network/packets/packet_mod_list.c | 6 +-- src/pc/network/version.c | 8 +-- src/pc/network/version.h | 4 +- src/pc/pc_main.h | 4 +- src/pc/update_checker.c | 16 +----- 12 files changed, 23 insertions(+), 102 deletions(-) diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index a2c5668b7..811f60508 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -68,7 +68,7 @@ exclude_constants = { "src/pc/lua/smlua_hooks.h": [ "MAX_HOOKED_MOD_MENU_ELEMENTS", "^HOOK_RETURN_.*", "^ACTION_HOOK_.*", "^MOD_MENU_ELEMENT_.*" ], "src/pc/djui/djui_panel_menu.h": [ "RAINBOW_TEXT_LEN" ], "src/pc/mods/mod_fs.h": [ "INT_TYPE_MAX", "FLOAT_TYPE_MAX", "FILE_SEEK_MAX" ], - "src/pc/network/version.h": [ "VERSION_OFFSET", "EX_WINDOW_NAME" ], + "src/pc/network/version.h": [ "VERSION_OFFSET" ], } include_constants = { diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 1d7dfb2dc..ef30bc29f 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -11275,7 +11275,7 @@ VERSION_TEXT = "v" VERSION_NUMBER = 41 --- @type integer -MINOR_VERSION_NUMBER = 1 +MINOR_VERSION_NUMBER = 2 --- @type string GAME_NAME = "sm64coopdx" diff --git a/src/pc/djui/djui_panel_join_lobbies.c b/src/pc/djui/djui_panel_join_lobbies.c index b56676ed8..bc0d7514f 100644 --- a/src/pc/djui/djui_panel_join_lobbies.c +++ b/src/pc/djui/djui_panel_join_lobbies.c @@ -87,7 +87,7 @@ void djui_panel_join_query(uint64_t aLobbyId, UNUSED uint64_t aOwnerId, uint16_t snprintf(mode, 64, "%s", aMode); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); bool disabled = strcmp(version, aVersion) != 0; if (disabled) { snprintf(mode, 64, "\\#ff0000\\[%s]", aVersion); diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index 7fd37cc56..0a849bb51 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -6,17 +6,12 @@ #include "djui_panel_menu.h" #include "djui_panel_confirm.h" #include "pc/controller/controller_sdl.h" -#include "pc/controller/controller_mouse.h" #include "pc/pc_main.h" #include "pc/update_checker.h" -#include "sounds.h" -#include "audio/external.h" -#include "game/area.h" extern ALIGNED8 u8 texture_coopdx_logo[]; bool gDjuiPanelMainCreated = false; -static struct DjuiThreePanel* sPanelMain = NULL; static void djui_panel_main_quit_yes(UNUSED struct DjuiBase* caller) { game_exit(); @@ -29,60 +24,10 @@ static void djui_panel_main_quit(struct DjuiBase* caller) { djui_panel_main_quit_yes); } -static int sEggCounter; -static u32 sEggLastFired; -static f32 sEggLastY; -static bool sEggHovered = false; -static bool sEggClicked = false; - -static void djui_panel_main_egg_end(struct DjuiBase *base, UNUSED bool *noRender) { - sPanelMain->base.x.value -= gGlobalTimer - sEggLastFired + 60; - base->color.a = MAX(255.f - ((gGlobalTimer - sEggLastFired + 60) << 3), 0); - if (gGlobalTimer == sEggLastFired) { - configExCoopTheme = !configExCoopTheme; - game_exit(); - } -} - -static void djui_panel_main_egg(struct DjuiBase *base, UNUSED bool *noRender) { - if (sEggCounter && sEggLastY == base->clip.y) { - bool hovering = djui_cursor_inside_base(base); - bool clicking = ((gInteractablePad.button & PAD_BUTTON_A) || (mouse_buttons & L_MOUSE_BUTTON)); - - if (hovering) { - if (!sEggHovered && sEggLastFired + 20 < gGlobalTimer) { - play_sound(SOUND_GENERAL_COIN, gGlobalSoundSource); - } - sEggLastFired = gGlobalTimer; - - if (!sEggClicked && clicking) { - play_sound(SOUND_MENU_COLLECT_SECRET + ((5 - sEggCounter) << 16), gGlobalSoundSource); - - if (!--sEggCounter) { - play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); - fade_volume_scale(SEQ_PLAYER_LEVEL, 0, 40); - sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL & ~(1 << SOUND_BANK_MENU)); - sEggLastFired = gGlobalTimer + 60; - - extern struct DjuiImage* sMouseCursor; - sMouseCursor->base.on_render_pre = djui_panel_main_egg_end; - } - } - } - - sEggHovered = hovering; - sEggClicked = clicking; - return; - } - sEggLastY = base->clip.y; -} - void djui_panel_main_create(struct DjuiBase* caller) { - sPanelMain = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false); - if (configExCoopTheme) { djui_three_panel_get_header(sPanelMain)->on_render_pre = djui_panel_main_egg; } - + struct DjuiThreePanel* panel = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false); { - struct DjuiBase* body = djui_three_panel_get_body(sPanelMain); + struct DjuiBase* body = djui_three_panel_get_body(panel); { if (!configExCoopTheme) { struct DjuiImage* logo = djui_image_create(body, texture_coopdx_logo, 2048, 1024, G_IM_FMT_RGBA, G_IM_SIZ_32b); @@ -94,7 +39,6 @@ void djui_panel_main_create(struct DjuiBase* caller) { djui_base_set_alignment(&logo->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP); djui_base_set_location_type(&logo->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_location(&logo->base, 0, -30); - logo->base.on_render_pre = djui_panel_main_egg; } struct DjuiButton* button1 = djui_button_create(body, DLANG(MAIN, HOST), DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create); @@ -111,14 +55,14 @@ void djui_panel_main_create(struct DjuiBase* caller) { // these two cannot co-exist for some reason if (gUpdateMessage) { - struct DjuiText* message = djui_text_create(&sPanelMain->base, DLANG(NOTIF, UPDATE_AVAILABLE)); + struct DjuiText* message = djui_text_create(&panel->base, DLANG(NOTIF, UPDATE_AVAILABLE)); djui_base_set_size_type(&message->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(&message->base, 1.0f, 1.0f); djui_base_set_color(&message->base, 255, 255, 160, 255); djui_text_set_alignment(message, DJUI_HALIGN_CENTER, DJUI_VALIGN_BOTTOM); } else { struct DjuiText* version = djui_text_create( - &sPanelMain->base, + &panel->base, #ifdef COMPILE_TIME get_version_with_build_date() #else @@ -132,8 +76,7 @@ void djui_panel_main_create(struct DjuiBase* caller) { } } - djui_panel_add(caller, sPanelMain, NULL); + djui_panel_add(caller, panel, NULL); gInteractableOverridePad = true; gDjuiPanelMainCreated = true; - sEggCounter = 5; } diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index de7da771c..1c36adfca 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -4690,7 +4690,7 @@ char gSmluaConstants[] = "" "SM64COOPDX_VERSION='v1.4.2'\n" "VERSION_TEXT='v'\n" "VERSION_NUMBER=41\n" -"MINOR_VERSION_NUMBER=1\n" +"MINOR_VERSION_NUMBER=2\n" "GAME_NAME='sm64coopdx'\n" "WINDOW_NAME='Super Mario 64 Coop Deluxe'\n" "MAX_VERSION_LENGTH=128\n" diff --git a/src/pc/network/coopnet/coopnet.c b/src/pc/network/coopnet/coopnet.c index efbd039f2..5b5ac4244 100644 --- a/src/pc/network/coopnet/coopnet.c +++ b/src/pc/network/coopnet/coopnet.c @@ -177,7 +177,7 @@ static void coopnet_populate_description(void) { char* buffer = sCoopNetDescription; int bufferLength = MAX_COOPNET_DESCRIPTION_LENGTH; // get version - const char* version = get_version_online(); + const char* version = get_version(); int versionLength = strlen(version); snprintf(buffer, bufferLength, "%s", version); buffer += versionLength; @@ -212,12 +212,12 @@ void ns_coopnet_update(void) { if (sReconnecting) { LOG_INFO("Update lobby"); coopnet_populate_description(); - coopnet_lobby_update(sLocalLobbyId, GAME_NAME, get_version_online(), configPlayerName, mode, sCoopNetDescription); + coopnet_lobby_update(sLocalLobbyId, GAME_NAME, get_version(), configPlayerName, mode, sCoopNetDescription); } else { LOG_INFO("Create lobby"); snprintf(gCoopNetPassword, 64, "%s", configPassword); coopnet_populate_description(); - coopnet_lobby_create(GAME_NAME, get_version_online(), configPlayerName, mode, (uint16_t)configAmountOfPlayers, gCoopNetPassword, sCoopNetDescription); + coopnet_lobby_create(GAME_NAME, get_version(), configPlayerName, mode, (uint16_t)configAmountOfPlayers, gCoopNetPassword, sCoopNetDescription); } } else if (sNetworkType == NT_CLIENT) { LOG_INFO("Join lobby"); diff --git a/src/pc/network/packets/packet_join.c b/src/pc/network/packets/packet_join.c index ad8fab6b7..0f1602352 100644 --- a/src/pc/network/packets/packet_join.c +++ b/src/pc/network/packets/packet_join.c @@ -45,7 +45,7 @@ void network_send_join_request(void) { struct Packet p = { 0 }; packet_init(&p, PACKET_JOIN_REQUEST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); packet_write(&p, &configPlayerModel, sizeof(u8)); @@ -107,7 +107,7 @@ void network_send_join(struct Packet* joinRequestPacket) { } char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); LOG_INFO("sending version: %s", version); struct Packet p = { 0 }; @@ -143,7 +143,7 @@ void network_receive_join(struct Packet* p) { gOverrideEeprom = eeprom; char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); LOG_INFO("client has version: %s", version); char remoteVersion[MAX_VERSION_LENGTH] = { 0 }; diff --git a/src/pc/network/packets/packet_mod_list.c b/src/pc/network/packets/packet_mod_list.c index 49409f524..23a4411d2 100644 --- a/src/pc/network/packets/packet_mod_list.c +++ b/src/pc/network/packets/packet_mod_list.c @@ -20,7 +20,7 @@ void network_send_mod_list_request(void) { struct Packet p = { 0 }; packet_init(&p, PACKET_MOD_LIST_REQUEST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); network_send_to(PACKET_DESTINATION_SERVER, &p); @@ -47,7 +47,7 @@ void network_send_mod_list(void) { packet_init(&p, PACKET_MOD_LIST, true, PLMT_NONE); char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); LOG_INFO("sending version: %s", version); packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH); packet_write(&p, &gActiveMods.entryCount, sizeof(u16)); @@ -135,7 +135,7 @@ void network_receive_mod_list(struct Packet* p) { } char version[MAX_VERSION_LENGTH] = { 0 }; - snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online()); + snprintf(version, MAX_VERSION_LENGTH, "%s", get_version()); LOG_INFO("client has version: %s", version); // verify version diff --git a/src/pc/network/version.c b/src/pc/network/version.c index a9083483b..97cd04580 100644 --- a/src/pc/network/version.c +++ b/src/pc/network/version.c @@ -4,7 +4,7 @@ static char sVersionString[MAX_VERSION_LENGTH] = { 0 }; -const char* get_version_online(void) { +const char* get_version(void) { snprintf( sVersionString, MAX_VERSION_LENGTH, #if defined(VERSION_US) @@ -16,12 +16,6 @@ const char* get_version_online(void) { return sVersionString; } -const char* get_version(void) { - get_version_online(); - extern void exify_version_str(char* str); - if (configExCoopTheme) { exify_version_str(sVersionString); } - return sVersionString; } - #ifdef COMPILE_TIME const char* get_version_with_build_date(void) { snprintf( diff --git a/src/pc/network/version.h b/src/pc/network/version.h index 7dacb0e4c..1ed77ffae 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -6,7 +6,7 @@ // internal version #define VERSION_TEXT "v" #define VERSION_NUMBER 41 -#define MINOR_VERSION_NUMBER 1 +#define MINOR_VERSION_NUMBER 2 #define VERSION_OFFSET 37 // difference from old versioning system @@ -30,11 +30,9 @@ #define GAME_NAME "sm64coopdx" #define WINDOW_NAME "Super Mario 64 Coop Deluxe" #endif -#define EX_WINDOW_NAME "sm64ex-coop:" #define MAX_VERSION_LENGTH 128 -const char* get_version_online(void); const char* get_version(void); #ifdef COMPILE_TIME const char* get_version_with_build_date(void); diff --git a/src/pc/pc_main.h b/src/pc/pc_main.h index 37482c80f..384bcc8dc 100644 --- a/src/pc/pc_main.h +++ b/src/pc/pc_main.h @@ -54,9 +54,9 @@ extern "C" { #endif #ifdef GIT_HASH -#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s, [%s]", configExCoopTheme ? EX_WINDOW_NAME : WINDOW_NAME, get_version(), GIT_HASH); title; }) +#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s, [%s]", WINDOW_NAME, get_version(), GIT_HASH); title; }) #else -#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s", configExCoopTheme ? EX_WINDOW_NAME : WINDOW_NAME, get_version()); title; }) +#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s", WINDOW_NAME, get_version()); title; }) #endif #define AT_STARTUP __attribute__((constructor)) diff --git a/src/pc/update_checker.c b/src/pc/update_checker.c index 64b474b14..e060f6203 100644 --- a/src/pc/update_checker.c +++ b/src/pc/update_checker.c @@ -85,19 +85,6 @@ void version_to_string(struct Version ver, char* str, size_t size) { } } -void exify_version(struct Version *ver) { - ver->maj = ver->min + VERSION_OFFSET; - ver->min = ver->fix; - ver->fix = 0; -} - -void exify_version_str(char* str) { - struct Version ver; - string_to_version(str, &ver); - exify_version(&ver); - version_to_string(ver, str, 8); -} - void parse_version(const char *data) { const char *version = strstr(data, VERSION_IDENTIFIER); if (version == NULL) { return; } @@ -110,7 +97,7 @@ void parse_version(const char *data) { sRemoteVersionStr[versionLength] = '\0'; string_to_version(sRemoteVersionStr, &sRemoteVersion); - string_to_version(get_version_online(), &sClientVersion); + string_to_version(get_version(), &sClientVersion); } // function to download a text file from the internet @@ -196,7 +183,6 @@ void check_for_updates(void) { get_version_remote(); if (sRemoteVersionStr[0] == 'v' && is_version_newer(sClientVersion, sRemoteVersion)) { - if (configExCoopTheme) { exify_version_str(sRemoteVersionStr); } snprintf( sVersionUpdateTextBuffer, 256, "\\#ffffa0\\%s\n\\#dcdcdc\\%s: %s\n%s: %s",