mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
Restore old versioning system
This commit is contained in:
parent
c21d30b176
commit
d2842becdb
14 changed files with 56 additions and 118 deletions
|
@ -169,7 +169,7 @@ def process_define(filename, line):
|
|||
if p.startswith('0x'):
|
||||
continue
|
||||
p = re.sub(r'0x[a-fA-F0-9]+', '', p)
|
||||
if re.search('[a-z]', p) != None and "VERSION_TEXT" not in line and "SM64COOPDX_VERSION" not in line:
|
||||
if re.search('[a-z]', p) != None and "VERSION_TEXT" not in line:
|
||||
if 'gCurrentObject' not in line and verbose:
|
||||
print('UNRECOGNIZED DEFINE: ' + line)
|
||||
return None
|
||||
|
@ -259,7 +259,7 @@ def build_to_c(built_files):
|
|||
txt = 'char gSmluaConstants[] = ""\n'
|
||||
for line in lines:
|
||||
txt += '"%s\\n"\n' % line
|
||||
txt += '"if get_coop_compatibility_enabled() then SM64COOPDX_VERSION = nil end";'
|
||||
txt += '"SM64COOPDX_VERSION = VERSION_TEXT .. VERSION_NUMBER .. \'.\' .. MINOR_VERSION_NUMBER .. (PATCH_VERSION_NUMBER > 0 and \'.\' .. PATCH_VERSION_NUMBER or \'\')";'
|
||||
return txt
|
||||
|
||||
############################################################################
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
math.randomseed(get_time())
|
||||
|
||||
|
||||
--------------
|
||||
-- CObjects --
|
||||
--------------
|
||||
|
@ -92,6 +93,7 @@ _ReadOnlyTable = {
|
|||
end
|
||||
}
|
||||
|
||||
|
||||
--------------------
|
||||
-- math functions --
|
||||
--------------------
|
||||
|
@ -310,6 +312,7 @@ function approach_s32(current, target, inc, dec)
|
|||
return current
|
||||
end
|
||||
|
||||
|
||||
-----------
|
||||
-- sound --
|
||||
-----------
|
||||
|
@ -392,6 +395,7 @@ COURSE_COUNT = 25
|
|||
--- @type integer
|
||||
COURSE_MIN = 1
|
||||
|
||||
|
||||
-----------------
|
||||
-- legacy font --
|
||||
-----------------
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
math.randomseed(get_time())
|
||||
|
||||
|
||||
--------------
|
||||
-- CObjects --
|
||||
--------------
|
||||
|
@ -94,6 +95,7 @@ _ReadOnlyTable = {
|
|||
end
|
||||
}
|
||||
|
||||
|
||||
--------------------
|
||||
-- math functions --
|
||||
--------------------
|
||||
|
@ -312,6 +314,7 @@ function approach_s32(current, target, inc, dec)
|
|||
return current
|
||||
end
|
||||
|
||||
|
||||
-----------
|
||||
-- sound --
|
||||
-----------
|
||||
|
@ -394,6 +397,7 @@ COURSE_COUNT = 25
|
|||
--- @type integer
|
||||
COURSE_MIN = 1
|
||||
|
||||
|
||||
-----------------
|
||||
-- legacy font --
|
||||
-----------------
|
||||
|
@ -12592,23 +12596,17 @@ SPTASK_STATE_FINISHED = 3
|
|||
--- @type SpTaskState
|
||||
SPTASK_STATE_FINISHED_DP = 4
|
||||
|
||||
--- @type integer
|
||||
MAX_LOCAL_VERSION_LENGTH = 36
|
||||
|
||||
--- @type integer
|
||||
MAX_VERSION_LENGTH = 32
|
||||
|
||||
--- @type integer
|
||||
MINOR_VERSION_NUMBER = 1
|
||||
MINOR_VERSION_NUMBER = 3
|
||||
|
||||
--- @type integer
|
||||
PATCH_VERSION_NUMBER = 0
|
||||
|
||||
--- @type string
|
||||
SM64COOPDX_VERSION = "0.2"
|
||||
|
||||
--- @type integer
|
||||
VERSION_NUMBER = 36
|
||||
VERSION_NUMBER = 0
|
||||
|
||||
--- @type string
|
||||
VERSION_REGION = "JP"
|
||||
|
@ -12623,4 +12621,4 @@ VERSION_REGION = "SH"
|
|||
VERSION_REGION = "US"
|
||||
|
||||
--- @type string
|
||||
VERSION_TEXT = "beta"
|
||||
VERSION_TEXT = "v"
|
||||
|
|
|
@ -4478,11 +4478,9 @@
|
|||
<br />
|
||||
|
||||
## [version.h](#version.h)
|
||||
- MAX_LOCAL_VERSION_LENGTH
|
||||
- MAX_VERSION_LENGTH
|
||||
- MINOR_VERSION_NUMBER
|
||||
- PATCH_VERSION_NUMBER
|
||||
- SM64COOPDX_VERSION
|
||||
- VERSION_NUMBER
|
||||
- VERSION_REGION
|
||||
- VERSION_REGION
|
||||
|
|
|
@ -166,7 +166,7 @@ bool configDjuiThemeCenter = true;
|
|||
unsigned int configDjuiScale = 0;
|
||||
bool configCoopCompatibility = false;
|
||||
bool configGlobalPlayerModels = true;
|
||||
char configLastVersion[MAX_CONFIG_STRING] = SM64COOPDX_VERSION;
|
||||
char configLastVersion[MAX_CONFIG_STRING] = "";
|
||||
|
||||
static const struct ConfigOption options[] = {
|
||||
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
|
||||
|
@ -609,8 +609,11 @@ NEXT_OPTION:
|
|||
if (configFrameLimit > 3000) { configFrameLimit = 3000; }
|
||||
|
||||
if (configPlayerModel >= CT_MAX) { configPlayerModel = 0; }
|
||||
|
||||
if (configDjuiTheme >= DJUI_THEME_MAX) { configDjuiTheme = 0; }
|
||||
|
||||
if (!strcmp(configLastVersion, "")) { strncpy(configLastVersion, get_version(), MAX_CONFIG_STRING); }
|
||||
|
||||
#ifndef COOPNET
|
||||
configNetworkSystem = NS_SOCKET;
|
||||
#endif
|
||||
|
|
|
@ -290,8 +290,8 @@ static void crash_handler_add_info_str(CrashHandlerText** pTextP, f32 x, f32 y,
|
|||
|
||||
static void crash_handler_add_version_str(CrashHandlerText** pTextP, f32 x, f32 y) {
|
||||
CrashHandlerText* pText = *pTextP;
|
||||
crash_handler_set_text(x, y, 0xFF, 0xFF, 0x00, "%s", "sm64coopdx v");
|
||||
crash_handler_set_text(-1, y, 0x00, 0xFF, 0xFF, "%s", SM64COOPDX_VERSION);
|
||||
crash_handler_set_text(x, y, 0xFF, 0xFF, 0x00, "%s", "sm64coopdx ");
|
||||
crash_handler_set_text(-1, y, 0x00, 0xFF, 0xFF, "%s", get_version());
|
||||
*pTextP = pText;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,8 +94,8 @@ void djui_init_late(void) {
|
|||
gPanelLanguageOnStartup = true;
|
||||
djui_panel_language_create(NULL);
|
||||
}
|
||||
if (strcmp(configLastVersion, SM64COOPDX_VERSION)) {
|
||||
strncpy(configLastVersion, SM64COOPDX_VERSION, MAX_CONFIG_STRING);
|
||||
if (strcmp(configLastVersion, get_version())) {
|
||||
strncpy(configLastVersion, get_version(), MAX_CONFIG_STRING);
|
||||
djui_panel_changelog_create(NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ 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 {
|
||||
struct DjuiText* version = djui_text_create(&panel->base, get_version_dx());
|
||||
struct DjuiText* version = djui_text_create(&panel->base, get_version());
|
||||
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);
|
||||
|
|
|
@ -4396,15 +4396,13 @@ char gSmluaConstants[] = ""
|
|||
"COOP_OBJ_FLAG_LUA = (1 << 1)\n"
|
||||
"COOP_OBJ_FLAG_NON_SYNC = (1 << 2)\n"
|
||||
"COOP_OBJ_FLAG_INITIALIZED = (1 << 3)\n"
|
||||
"SM64COOPDX_VERSION = '0.2'\n"
|
||||
"VERSION_TEXT = 'beta'\n"
|
||||
"VERSION_NUMBER = 36\n"
|
||||
"MINOR_VERSION_NUMBER = 1\n"
|
||||
"VERSION_TEXT = 'v'\n"
|
||||
"VERSION_NUMBER = 0\n"
|
||||
"MINOR_VERSION_NUMBER = 3\n"
|
||||
"PATCH_VERSION_NUMBER = 0\n"
|
||||
"VERSION_REGION = 'JP'\n"
|
||||
"VERSION_REGION = 'EU'\n"
|
||||
"VERSION_REGION = 'SH'\n"
|
||||
"VERSION_REGION = 'US'\n"
|
||||
"MAX_VERSION_LENGTH = 32\n"
|
||||
"MAX_LOCAL_VERSION_LENGTH = 36\n"
|
||||
"if get_coop_compatibility_enabled() then SM64COOPDX_VERSION = nil end";
|
||||
"SM64COOPDX_VERSION = VERSION_TEXT .. VERSION_NUMBER .. '.' .. MINOR_VERSION_NUMBER .. (PATCH_VERSION_NUMBER > 0 and '.' .. PATCH_VERSION_NUMBER or '')";
|
|
@ -30,7 +30,7 @@ bool ns_coopnet_query(QueryCallbackPtr callback, QueryFinishCallbackPtr finishCa
|
|||
gCoopNetCallbacks.OnLobbyListGot = callback;
|
||||
gCoopNetCallbacks.OnLobbyListFinish = finishCallback;
|
||||
if (coopnet_initialize() != COOPNET_OK) { return false; }
|
||||
if (coopnet_lobby_list_get(get_game_name(), password) != COOPNET_OK) { return false; }
|
||||
if (coopnet_lobby_list_get(GAME_NAME, password) != COOPNET_OK) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -208,12 +208,12 @@ void ns_coopnet_update(void) {
|
|||
if (sReconnecting) {
|
||||
LOG_INFO("Update lobby");
|
||||
coopnet_populate_description();
|
||||
coopnet_lobby_update(sLocalLobbyId, get_game_name(), get_version(), 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(get_game_name(), get_version(), 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");
|
||||
|
|
|
@ -2,87 +2,21 @@
|
|||
#include "version.h"
|
||||
#include "types.h"
|
||||
|
||||
#undef VERSION_TEXT
|
||||
#define VERSION_TEXT "v"
|
||||
|
||||
static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
|
||||
static char sLocalVersionString[MAX_LOCAL_VERSION_LENGTH] = { 0 };
|
||||
static char sDxVersionString[MAX_VERSION_LENGTH] = { 0 };
|
||||
|
||||
const char* get_version(void) {
|
||||
if (configCoopCompatibility) {
|
||||
#if defined(VERSION_US)
|
||||
if (MINOR_VERSION_NUMBER > 0) {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER);
|
||||
} else {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d", VERSION_TEXT, VERSION_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (MINOR_VERSION_NUMBER > 0) {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d.%d %s", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, VERSION_REGION);
|
||||
} else {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d %s", VERSION_TEXT, VERSION_NUMBER, VERSION_REGION);
|
||||
}
|
||||
#endif
|
||||
if (PATCH_VERSION_NUMBER > 0) {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d.%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER);
|
||||
} else {
|
||||
#if defined(VERSION_US)
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "v%s", SM64COOPDX_VERSION);
|
||||
#else
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "v%s %s", SM64COOPDX_VERSION, VERSION_REGION);
|
||||
#endif
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (PATCH_VERSION_NUMBER > 0) {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d.%d.%d %s", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER, VERSION_REGION);
|
||||
} else {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d.%d %s", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, VERSION_REGION);
|
||||
}
|
||||
#endif
|
||||
return sVersionString;
|
||||
}
|
||||
|
||||
const char* get_version_local(void) {
|
||||
if (PATCH_VERSION_NUMBER <= 0) {
|
||||
return get_version();
|
||||
}
|
||||
|
||||
if (configCoopCompatibility) {
|
||||
#if defined(VERSION_US)
|
||||
snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "%s%d.%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER);
|
||||
#else
|
||||
snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "%s%d.%d.%d %s", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER, VERSION_REGION);
|
||||
#endif
|
||||
} else {
|
||||
#if defined(VERSION_US)
|
||||
snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "v%s", SM64COOPDX_VERSION);
|
||||
#else
|
||||
snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "v%s %s", VERSION_TEXT, SM64COOPDX_VERSION, VERSION_REGION);
|
||||
#endif
|
||||
}
|
||||
|
||||
return sLocalVersionString;
|
||||
}
|
||||
|
||||
// I want to redo this whole file when I remove sm64ex-coop compatibility
|
||||
const char* get_version_dx(void) {
|
||||
#if defined(VERSION_US)
|
||||
snprintf(sDxVersionString, MAX_VERSION_LENGTH, "v%s", SM64COOPDX_VERSION);
|
||||
#else
|
||||
snprintf(sDxVersionString, MAX_VERSION_LENGTH, "v%s %s", SM64COOPDX_VERSION, VERSION_REGION);
|
||||
#endif
|
||||
|
||||
return sDxVersionString;
|
||||
}
|
||||
|
||||
const char* get_game_name(void) {
|
||||
if (configCoopCompatibility) {
|
||||
#ifdef DEVELOPMENT
|
||||
return "sm64ex-coop-dev";
|
||||
#elif !defined(VERSION_US)
|
||||
return "sm64ex-coop-intl";
|
||||
#else
|
||||
return "sm64ex-coop";
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEVELOPMENT
|
||||
return "sm64coopdx-dev";
|
||||
#elif !defined(VERSION_US)
|
||||
return "sm64coopdx-intl";
|
||||
#else
|
||||
return "sm64coopdx";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#define SM64COOPDX_VERSION "0.2"
|
||||
|
||||
#define VERSION_TEXT "beta"
|
||||
#define VERSION_NUMBER 36
|
||||
#define MINOR_VERSION_NUMBER 1
|
||||
#define VERSION_TEXT "v"
|
||||
#define VERSION_NUMBER 0
|
||||
#define MINOR_VERSION_NUMBER 3
|
||||
#define PATCH_VERSION_NUMBER 0
|
||||
|
||||
#if defined(VERSION_JP)
|
||||
|
@ -18,11 +16,16 @@
|
|||
#define VERSION_REGION "US"
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPMENT
|
||||
#define GAME_NAME "sm64coopdx-dev"
|
||||
#elif !defined(VERSION_US)
|
||||
#define GAME_NAME "sm64coopdx-intl"
|
||||
#else
|
||||
#define GAME_NAME "sm64coopdx"
|
||||
#endif
|
||||
|
||||
#define MAX_VERSION_LENGTH 32
|
||||
#define MAX_LOCAL_VERSION_LENGTH 36
|
||||
|
||||
const char* get_version(void);
|
||||
const char* get_version_local(void);
|
||||
const char* get_version_dx(void);
|
||||
const char* get_game_name(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -58,9 +58,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#ifdef GIT_HASH
|
||||
#define TITLE ({ char title[96] = ""; snprintf(title, 96, "sm64coopdx [%s]", GIT_HASH); title; })
|
||||
#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s, [%s]", GAME_NAME, get_version(), GIT_HASH); title; })
|
||||
#else
|
||||
#define TITLE ({ char title[96] = ""; snprintf(title, 96, "sm64coopdx v%s", SM64COOPDX_VERSION); title; })
|
||||
#define TITLE ({ char title[96] = ""; snprintf(title, 96, "%s %s", GAME_NAME, get_version()); title; })
|
||||
#endif
|
||||
|
||||
#define AT_STARTUP __attribute__((constructor))
|
||||
|
|
|
@ -118,15 +118,15 @@ void check_for_updates(void) {
|
|||
if (gIsThreaded) { REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Checking For Updates")); }
|
||||
|
||||
get_version_remote();
|
||||
if (sRemoteVersion[0] != '\0' && strcmp(sRemoteVersion, SM64COOPDX_VERSION)) {
|
||||
if (sRemoteVersion[0] != '\0' && strcmp(sRemoteVersion, get_version())) {
|
||||
snprintf(
|
||||
sVersionUpdateTextBuffer, 256,
|
||||
"\\#ffffa0\\%s\n\\#dcdcdc\\%s: v%s\n%s: v%s",
|
||||
"\\#ffffa0\\%s\n\\#dcdcdc\\%s: v%s\n%s: %s",
|
||||
DLANG(NOTIF, UPDATE_AVAILABLE),
|
||||
DLANG(NOTIF, LATEST_VERSION),
|
||||
sRemoteVersion,
|
||||
DLANG(NOTIF, YOUR_VERSION),
|
||||
SM64COOPDX_VERSION
|
||||
get_version()
|
||||
);
|
||||
gUpdateMessage = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue