mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-22 01:52:43 +00:00
Merge ad26fc4abb into 24c5a226ed
This commit is contained in:
commit
c2b1e9967b
19 changed files with 96 additions and 32 deletions
|
|
@ -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" ],
|
||||
}
|
||||
|
||||
include_constants = {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -325,7 +325,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"
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,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"
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,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"
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,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"
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,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"
|
||||
|
||||
|
|
|
|||
|
|
@ -323,7 +323,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"
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,6 @@ MENU_OPTIONS = "メニューの設定"
|
|||
INFORMATION = "情報"
|
||||
DEBUG = "デバッグ"
|
||||
LANGUAGE = "言語"
|
||||
COOP_COMPATIBILITY = "sm64ex-coopとの互換性を有効にする"
|
||||
R_BUTTON = "Rボタン - 設定"
|
||||
L_BUTTON = "Lボタン - 有効化されたMODを再読み込み"
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,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"
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,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"
|
||||
|
||||
|
|
|
|||
|
|
@ -324,7 +324,6 @@ MENU_OPTIONS = "Параметры меню"
|
|||
INFORMATION = "Информация"
|
||||
DEBUG = "Отладка"
|
||||
LANGUAGE = "Язык"
|
||||
COOP_COMPATIBILITY = "Включить совместимость sm64ex-coop"
|
||||
R_BUTTON = "Кнопка R - Опции"
|
||||
L_BUTTON = "Кнопка L - Перезагрузить активные моды"
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,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"
|
||||
|
||||
|
|
|
|||
28
res/icon.rc
28
res/icon.rc
|
|
@ -1 +1,27 @@
|
|||
id ICON res/icon.ico
|
||||
id ICON res/icon.ico
|
||||
|
||||
#include <winver.h>
|
||||
#include "../src/pc/network/version.h"
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,(VERSION_NUMBER-VERSION_OFFSET),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
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -5,21 +5,27 @@
|
|||
static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
|
||||
|
||||
const char* get_version(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;
|
||||
}
|
||||
|
||||
#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
|
||||
|
|
@ -6,7 +6,9 @@
|
|||
// 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
|
||||
|
||||
#if defined(VERSION_JP)
|
||||
#define VERSION_REGION "JP"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,20 @@ downloading and parsing a source file.
|
|||
*/
|
||||
|
||||
static char sVersionUpdateTextBuffer[256] = { 0 };
|
||||
static char sRemoteVersion[8] = { 0 };
|
||||
static char sRemoteVersionStr[8] = { 0 };
|
||||
|
||||
struct Version {
|
||||
int maj, min, 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 };
|
||||
static struct Version sRemoteVersion = { 0 };
|
||||
|
||||
bool gUpdateMessage = false;
|
||||
|
||||
|
|
@ -51,6 +64,27 @@ size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata) {
|
|||
}
|
||||
#endif
|
||||
|
||||
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 version_to_string(struct Version ver, char* str, size_t size) {
|
||||
int len;
|
||||
snprintf(str, size, "v%i", ver.maj);
|
||||
if (ver.min || ver.fix) {
|
||||
len = strlen(str);
|
||||
snprintf(str + len, size - len, ".%i", ver.min);
|
||||
if (ver.fix) {
|
||||
len = strlen(str);
|
||||
snprintf(str + len, size - len, ".%i", ver.fix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parse_version(const char *data) {
|
||||
const char *version = strstr(data, VERSION_IDENTIFIER);
|
||||
if (version == NULL) { return; }
|
||||
|
|
@ -58,14 +92,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';
|
||||
|
||||
string_to_version(sRemoteVersionStr, &sRemoteVersion);
|
||||
string_to_version(get_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 +182,13 @@ 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)) {
|
||||
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()
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue