patch autogen, remove prints

This commit is contained in:
Cooliokid956 2026-01-02 17:29:32 -06:00
parent 41d7b52f8c
commit 1bb5e2fe8d
10 changed files with 59 additions and 27 deletions

View file

@ -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 = {

View file

@ -3,7 +3,7 @@ id ICON res/icon.ico
#include <winver.h>
#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

View file

@ -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);

View file

@ -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;
}

View file

@ -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");

View file

@ -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 };

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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
);
}