fix mod compatibility due to version constants

This commit is contained in:
Isaac0-dev 2024-03-19 20:47:18 +10:00
parent 5f81a88edd
commit 90331f8fe5
6 changed files with 19 additions and 19 deletions

View file

@ -169,7 +169,7 @@ def process_define(filename, line):
if p.startswith('0x'): if p.startswith('0x'):
continue continue
p = re.sub(r'0x[a-fA-F0-9]+', '', p) 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: if 'gCurrentObject' not in line and verbose:
print('UNRECOGNIZED DEFINE: ' + line) print('UNRECOGNIZED DEFINE: ' + line)
return None return None
@ -259,7 +259,7 @@ def build_to_c(built_files):
txt = 'char gSmluaConstants[] = ""\n' txt = 'char gSmluaConstants[] = ""\n'
for line in lines: for line in lines:
txt += '"%s\\n"\n' % line 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 return txt
############################################################################ ############################################################################

View file

@ -12612,8 +12612,11 @@ MINOR_VERSION_NUMBER = 0
--- @type integer --- @type integer
PATCH_VERSION_NUMBER = 0 PATCH_VERSION_NUMBER = 0
--- @type string
SM64COOPDX_VERSION = "v1.0"
--- @type integer --- @type integer
VERSION_NUMBER = 1 VERSION_NUMBER = 37
--- @type string --- @type string
VERSION_REGION = "JP" VERSION_REGION = "JP"
@ -12628,4 +12631,4 @@ VERSION_REGION = "SH"
VERSION_REGION = "US" VERSION_REGION = "US"
--- @type string --- @type string
VERSION_TEXT = "v" VERSION_TEXT = "beta"

View file

@ -4481,6 +4481,7 @@
- MAX_VERSION_LENGTH - MAX_VERSION_LENGTH
- MINOR_VERSION_NUMBER - MINOR_VERSION_NUMBER
- PATCH_VERSION_NUMBER - PATCH_VERSION_NUMBER
- SM64COOPDX_VERSION
- VERSION_NUMBER - VERSION_NUMBER
- VERSION_REGION - VERSION_REGION
- VERSION_REGION - VERSION_REGION

View file

@ -4400,8 +4400,9 @@ char gSmluaConstants[] = ""
"COOP_OBJ_FLAG_LUA = (1 << 1)\n" "COOP_OBJ_FLAG_LUA = (1 << 1)\n"
"COOP_OBJ_FLAG_NON_SYNC = (1 << 2)\n" "COOP_OBJ_FLAG_NON_SYNC = (1 << 2)\n"
"COOP_OBJ_FLAG_INITIALIZED = (1 << 3)\n" "COOP_OBJ_FLAG_INITIALIZED = (1 << 3)\n"
"VERSION_TEXT = 'v'\n" "SM64COOPDX_VERSION = 'v1.0'\n"
"VERSION_NUMBER = 1\n" "VERSION_TEXT = 'beta'\n"
"VERSION_NUMBER = 37\n"
"MINOR_VERSION_NUMBER = 0\n" "MINOR_VERSION_NUMBER = 0\n"
"PATCH_VERSION_NUMBER = 0\n" "PATCH_VERSION_NUMBER = 0\n"
"VERSION_REGION = 'JP'\n" "VERSION_REGION = 'JP'\n"
@ -4409,4 +4410,4 @@ char gSmluaConstants[] = ""
"VERSION_REGION = 'SH'\n" "VERSION_REGION = 'SH'\n"
"VERSION_REGION = 'US'\n" "VERSION_REGION = 'US'\n"
"MAX_VERSION_LENGTH = 32\n" "MAX_VERSION_LENGTH = 32\n"
"SM64COOPDX_VERSION = VERSION_TEXT .. VERSION_NUMBER .. '.' .. MINOR_VERSION_NUMBER .. (PATCH_VERSION_NUMBER > 0 and '.' .. PATCH_VERSION_NUMBER or '')"; ;

View file

@ -6,17 +6,9 @@ static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
const char* get_version(void) { const char* get_version(void) {
#if defined(VERSION_US) #if defined(VERSION_US)
if (PATCH_VERSION_NUMBER > 0) { snprintf(sVersionString, MAX_VERSION_LENGTH, "%s", SM64COOPDX_VERSION);
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);
}
#else #else
if (PATCH_VERSION_NUMBER > 0) { snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %s", SM64COOPDX_VERSION, VERSION_REGION);
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 #endif
return sVersionString; return sVersionString;
} }

View file

@ -1,8 +1,11 @@
#ifndef VERSION_H #ifndef VERSION_H
#define VERSION_H #define VERSION_H
#define VERSION_TEXT "v" #define SM64COOPDX_VERSION "v1.0"
#define VERSION_NUMBER 1
// sm64ex-coop version, for mod compatibility
#define VERSION_TEXT "beta"
#define VERSION_NUMBER 37
#define MINOR_VERSION_NUMBER 0 #define MINOR_VERSION_NUMBER 0
#define PATCH_VERSION_NUMBER 0 #define PATCH_VERSION_NUMBER 0