From 90331f8fe52ce901ca727370f4d39a244d1bd776 Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Tue, 19 Mar 2024 20:47:18 +1000 Subject: [PATCH] fix mod compatibility due to version constants --- autogen/convert_constants.py | 4 ++-- autogen/lua_definitions/constants.lua | 7 +++++-- docs/lua/constants.md | 1 + src/pc/lua/smlua_constants_autogen.c | 7 ++++--- src/pc/network/version.c | 12 ++---------- src/pc/network/version.h | 7 +++++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index b394e727..9a85e45a 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -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: + if re.search('[a-z]', p) != None and "VERSION_TEXT" not in line and "SM64COOPDX_VERSION" 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 += '"SM64COOPDX_VERSION = VERSION_TEXT .. VERSION_NUMBER .. \'.\' .. MINOR_VERSION_NUMBER .. (PATCH_VERSION_NUMBER > 0 and \'.\' .. PATCH_VERSION_NUMBER or \'\')";' + txt += ';' return txt ############################################################################ diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index c69e5b24..c37bfbbb 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -12612,8 +12612,11 @@ MINOR_VERSION_NUMBER = 0 --- @type integer PATCH_VERSION_NUMBER = 0 +--- @type string +SM64COOPDX_VERSION = "v1.0" + --- @type integer -VERSION_NUMBER = 1 +VERSION_NUMBER = 37 --- @type string VERSION_REGION = "JP" @@ -12628,4 +12631,4 @@ VERSION_REGION = "SH" VERSION_REGION = "US" --- @type string -VERSION_TEXT = "v" +VERSION_TEXT = "beta" diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 7ad5198a..4e2d818c 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -4481,6 +4481,7 @@ - MAX_VERSION_LENGTH - MINOR_VERSION_NUMBER - PATCH_VERSION_NUMBER +- SM64COOPDX_VERSION - VERSION_NUMBER - VERSION_REGION - VERSION_REGION diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 48af2137..e8284ba4 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -4400,8 +4400,9 @@ char gSmluaConstants[] = "" "COOP_OBJ_FLAG_LUA = (1 << 1)\n" "COOP_OBJ_FLAG_NON_SYNC = (1 << 2)\n" "COOP_OBJ_FLAG_INITIALIZED = (1 << 3)\n" -"VERSION_TEXT = 'v'\n" -"VERSION_NUMBER = 1\n" +"SM64COOPDX_VERSION = 'v1.0'\n" +"VERSION_TEXT = 'beta'\n" +"VERSION_NUMBER = 37\n" "MINOR_VERSION_NUMBER = 0\n" "PATCH_VERSION_NUMBER = 0\n" "VERSION_REGION = 'JP'\n" @@ -4409,4 +4410,4 @@ char gSmluaConstants[] = "" "VERSION_REGION = 'SH'\n" "VERSION_REGION = 'US'\n" "MAX_VERSION_LENGTH = 32\n" -"SM64COOPDX_VERSION = VERSION_TEXT .. VERSION_NUMBER .. '.' .. MINOR_VERSION_NUMBER .. (PATCH_VERSION_NUMBER > 0 and '.' .. PATCH_VERSION_NUMBER or '')"; \ No newline at end of file +; \ No newline at end of file diff --git a/src/pc/network/version.c b/src/pc/network/version.c index dc3423d2..b655ee0f 100644 --- a/src/pc/network/version.c +++ b/src/pc/network/version.c @@ -6,17 +6,9 @@ static char sVersionString[MAX_VERSION_LENGTH] = { 0 }; const char* get_version(void) { #if defined(VERSION_US) - 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 { - snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER); - } + snprintf(sVersionString, MAX_VERSION_LENGTH, "%s", SM64COOPDX_VERSION); #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); - } + snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %s", SM64COOPDX_VERSION, VERSION_REGION); #endif return sVersionString; } diff --git a/src/pc/network/version.h b/src/pc/network/version.h index f13bcc79..af312b86 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -1,8 +1,11 @@ #ifndef VERSION_H #define VERSION_H -#define VERSION_TEXT "v" -#define VERSION_NUMBER 1 +#define SM64COOPDX_VERSION "v1.0" + +// sm64ex-coop version, for mod compatibility +#define VERSION_TEXT "beta" +#define VERSION_NUMBER 37 #define MINOR_VERSION_NUMBER 0 #define PATCH_VERSION_NUMBER 0