From ac6f2b2ad0dadae96dc26a14afc11612855e497d Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Sun, 26 Mar 2023 15:15:28 +1000 Subject: [PATCH] Beta 32.0.1 (#325) * patch for beta 32 * require the development flag for Lua profiler * autogen --- Makefile | 9 --------- autogen/lua_definitions/constants.lua | 6 ++++++ developer/profile.sh | 4 ++-- docs/lua/constants.md | 2 ++ src/game/hud.c | 2 +- src/game/level_update.c | 28 +++++++++----------------- src/pc/configfile.c | 14 +++++++++---- src/pc/configfile.h | 5 ++++- src/pc/crash_handler.c | 2 +- src/pc/debuglog.h | 18 ++++------------- src/pc/djui/djui_panel_main.c | 2 +- src/pc/djui/djui_panel_misc.c | 19 +++++++++++++++--- src/pc/lua/smlua.c | 2 +- src/pc/lua/smlua_constants_autogen.c | 29 ++------------------------- src/pc/lua/smlua_hooks.c | 7 ++++--- src/pc/mods/mod.c | 5 +++++ src/pc/network/version.c | 8 +++++++- src/pc/network/version.h | 3 +++ src/pc/pc_main.c | 2 +- 19 files changed, 79 insertions(+), 88 deletions(-) diff --git a/Makefile b/Makefile index 405f8aa1..ec11ddeb 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,6 @@ DEBUG ?= 0 # Enable development/testing flags DEVELOPMENT ?= 0 -# Enable lua profiler -LUA_PROFILER ?= 0 - # Build for the N64 (turn this off for ports) TARGET_N64 = 0 @@ -1063,12 +1060,6 @@ ifeq ($(TARGET_RPI),1) CFLAGS += -DTARGET_RPI endif -# Check for lua profiler option -ifeq ($(LUA_PROFILER),1) - CC_CHECK_CFLAGS += -DLUA_PROFILER - CFLAGS += -DLUA_PROFILER -endif - # Check for texture fix option ifeq ($(TEXTURE_FIX),1) CC_CHECK_CFLAGS += -DTEXTURE_FIX diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index a72bd074..c5fb6903 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -11506,12 +11506,18 @@ SPTASK_STATE_FINISHED = 3 --- @type SpTaskState SPTASK_STATE_FINISHED_DP = 4 +--- @type integer +MAX_LOCAL_VERSION_LENGTH = 12 + --- @type integer MAX_VERSION_LENGTH = 10 --- @type integer MINOR_VERSION_NUMBER = 0 +--- @type integer +PATCH_VERSION_NUMBER = 1 + --- @type integer VERSION_NUMBER = 32 diff --git a/developer/profile.sh b/developer/profile.sh index f92ca542..35d6eb71 100755 --- a/developer/profile.sh +++ b/developer/profile.sh @@ -2,9 +2,9 @@ set -e if [ $# -eq 0 ]; then - make DEBUG=1 DEVELOPMENT=1 STRICT=1 PROFILE=1 LUA_PROFILER=1 -j + make DEBUG=1 DEVELOPMENT=1 STRICT=1 PROFILE=1 -j else - make DEBUG=1 DEVELOPMENT=1 PROFILE=1 LUA_PROFILER=1 -j + make DEBUG=1 DEVELOPMENT=1 PROFILE=1 -j fi # find file diff --git a/docs/lua/constants.md b/docs/lua/constants.md index ace2677d..0437d720 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -4086,8 +4086,10 @@
## [version.h](#version.h) +- MAX_LOCAL_VERSION_LENGTH - MAX_VERSION_LENGTH - MINOR_VERSION_NUMBER +- PATCH_VERSION_NUMBER - VERSION_NUMBER - VERSION_TEXT diff --git a/src/game/hud.c b/src/game/hud.c index 3d66dcab..4b7d3e9f 100644 --- a/src/game/hud.c +++ b/src/game/hud.c @@ -674,7 +674,7 @@ void render_hud(void) { print_text(10, 60, "SURFACE NODE POOL FULL"); } -#if defined(LUA_PROFILER) +#if defined(DEVELOPMENT) extern bool configLuaProfiler; if (configLuaProfiler) { extern void lua_profiler_update_counters(); diff --git a/src/game/level_update.c b/src/game/level_update.c index b6b6b721..7137436c 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -1117,41 +1117,32 @@ void basic_update(UNUSED s16 *arg) { } bool find_demo_number(void) { - bool changeLevel = false; switch (gCurrLevelNum) { case LEVEL_BOWSER_1: - changeLevel = true; demoNumber = 0; - break; + return true; case LEVEL_WF: - changeLevel = true; demoNumber = 1; - break; + return true; case LEVEL_CCM: - changeLevel = true; demoNumber = 2; - break; + return true; case LEVEL_BBH: - changeLevel = true; demoNumber = 3; - break; + return true; case LEVEL_JRB: - changeLevel = true; demoNumber = 4; - break; + return true; case LEVEL_HMC: - changeLevel = true; demoNumber = 5; - break; + return true; case LEVEL_PSS: - changeLevel = true; demoNumber = 6; - break; + return true; default: - changeLevel = false; demoNumber = -1; } - return changeLevel; + return false; } static void start_demo(void) { @@ -1204,8 +1195,7 @@ s32 play_mode_normal(void) { } } else { if (gDjuiInMainMenu && gCurrDemoInput == NULL && configMenuDemos && !inPlayerMenu) { - find_demo_number(); - if ((++gDemoCountdown) == PRESS_START_DEMO_TIMER && (demoNumber <= 6 || demoNumber > -1)) { + if ((++gDemoCountdown) == PRESS_START_DEMO_TIMER && (find_demo_number() && (demoNumber <= 6 || demoNumber > -1))) { start_demo(); } } diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 6546d41c..a30202b5 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -143,14 +143,17 @@ bool configUncappedFramerate = true; unsigned int configFrameLimit = 60; unsigned int configDrawDistance = 5; bool configDisablePopups = 0; -#ifdef LUA_PROFILER -bool configLuaProfiler = 1; +#if defined(DEVELOPMENT) +bool configLuaProfiler = 0; #endif bool configDisableDownloadedModels = 0; unsigned int configInterpolationMode = 1; unsigned int configGamepadNumber = 0; bool configBackgroundGamepad = 1; bool configSingleplayerPause = 0; +bool configDebugPrint = 0; +bool configDebugInfo = 0; +bool configDebugError = 0; static const struct ConfigOption options[] = { {.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen}, @@ -248,13 +251,16 @@ static const struct ConfigOption options[] = { {.name = "coop_singleplayer_pause", .type = CONFIG_TYPE_BOOL , .boolValue = &configSingleplayerPause}, {.name = "share_lives", .type = CONFIG_TYPE_BOOL , .boolValue = &configShareLives}, {.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups}, -#ifdef LUA_PROFILER +#if defined(DEVELOPMENT) {.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler}, #endif {.name = "disable_downloaded_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableDownloadedModels}, {.name = "interpolation_mode", .type = CONFIG_TYPE_UINT , .uintValue = &configInterpolationMode}, {.name = "gamepad_number", .type = CONFIG_TYPE_UINT , .uintValue = &configGamepadNumber}, - {.name = "background_gamepad", .type = CONFIG_TYPE_UINT , .boolValue = &configBackgroundGamepad} + {.name = "background_gamepad", .type = CONFIG_TYPE_UINT , .boolValue = &configBackgroundGamepad}, + {.name = "debug_print", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugPrint}, + {.name = "debug_info", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugInfo}, + {.name = "debug_error", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugError}, }; // FunctionConfigOption functions diff --git a/src/pc/configfile.h b/src/pc/configfile.h index d7c4419e..7ac5bfd9 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -100,12 +100,15 @@ extern bool configUncappedFramerate; extern unsigned int configFrameLimit; extern unsigned int configDrawDistance; extern bool configDisablePopups; -#ifdef LUA_PROFILER +#if defined(DEVELOPMENT) extern bool configLuaProfiler; #endif extern bool configDisableDownloadedModels; extern unsigned int configInterpolationMode; extern bool configSingleplayerPause; +extern bool configDebugPrint; +extern bool configDebugInfo; +extern bool configDebugError; void configfile_load(const char *filename); void configfile_save(const char *filename); diff --git a/src/pc/crash_handler.c b/src/pc/crash_handler.c index 00bb69c2..34782d11 100644 --- a/src/pc/crash_handler.c +++ b/src/pc/crash_handler.c @@ -490,7 +490,7 @@ static CRASH_HANDLER_TYPE crash_handler(EXCEPTION_POINTERS *ExceptionInfo) { } } - crash_handler_add_info_str(&pText, 335, 208, "Version", get_version()); + crash_handler_add_info_str(&pText, 335, 208, "Version", get_version_local()); // sounds #ifdef HAVE_SDL2 diff --git a/src/pc/debuglog.h b/src/pc/debuglog.h index ab669ee5..13d30904 100644 --- a/src/pc/debuglog.h +++ b/src/pc/debuglog.h @@ -42,18 +42,8 @@ static void _debuglog_print_log(char* logType, char* filename) { _debuglog_print_short_filename(filename); } -#if defined(DEBUG) && defined(DISABLE_MODULE_LOG) - #define LOG_DEBUG(...) - #define LOG_INFO(...) - #define LOG_ERROR(...) ( _debuglog_print_log("ERROR", __FILE__), printf(__VA_ARGS__), printf("\n") ) -#elif defined(DEBUG) && !defined(DISABLE_MODULE_LOG) - #define LOG_DEBUG(...) ( _debuglog_print_log("DEBUG", __FILE__), printf(__VA_ARGS__), printf("\n") ) - #define LOG_INFO(...) ( _debuglog_print_log("INFO", __FILE__), printf(__VA_ARGS__), printf("\n") ) - #define LOG_ERROR(...) ( _debuglog_print_log("ERROR", __FILE__), printf(__VA_ARGS__), printf("\n") ) -#else - #define LOG_DEBUG(...) - #define LOG_INFO(...) - #define LOG_ERROR(...) -#endif +#define LOG_DEBUG(...) if (configDebugPrint) { ( _debuglog_print_log("DEBUG", __FILE__), printf(__VA_ARGS__), printf("\n") ); } +#define LOG_INFO(...) if (configDebugInfo) { ( _debuglog_print_log("INFO", __FILE__), printf(__VA_ARGS__), printf("\n") ); } +#define LOG_ERROR(...) if (configDebugError) { ( _debuglog_print_log("ERROR", __FILE__), printf(__VA_ARGS__), printf("\n") ); } -#endif \ No newline at end of file +#endif diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c index c3dbbda9..4edb8a87 100644 --- a/src/pc/djui/djui_panel_main.c +++ b/src/pc/djui/djui_panel_main.c @@ -47,7 +47,7 @@ void djui_panel_main_create(struct DjuiBase* caller) { djui_interactable_hook_click(&button4->base, djui_panel_main_quit); } - char* version = get_version(); + char* version = get_version_local(); struct DjuiText* footer = djui_text_create(&panel->base, version); djui_base_set_size_type(&footer->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(&footer->base, 1.0f, 1.0f); diff --git a/src/pc/djui/djui_panel_misc.c b/src/pc/djui/djui_panel_misc.c index 2dd568ae..c69a20df 100644 --- a/src/pc/djui/djui_panel_misc.c +++ b/src/pc/djui/djui_panel_misc.c @@ -5,7 +5,7 @@ #ifdef DEVELOPMENT void djui_panel_options_debug_create(struct DjuiBase* caller) { - f32 bodyHeight = 32 * 3 + 64 * 1 + 16 * 1; + f32 bodyHeight = 32 * 7 + 64 * 1 + 16 * 1; struct DjuiBase* defaultBase = NULL; struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\D\\#1be700\\E\\#00b3ff\\B\\#ffef00\\U\\#ff0800\\G"); @@ -17,12 +17,25 @@ void djui_panel_options_debug_create(struct DjuiBase* caller) { djui_base_set_size(&checkbox1->base, 1.0f, 32); defaultBase = &checkbox1->base; -#ifdef LUA_PROFILER struct DjuiCheckbox* checkbox2 = djui_checkbox_create(&body->base, "Lua Profiler", &configLuaProfiler); djui_base_set_size_type(&checkbox2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(&checkbox2->base, 1.0f, 32); defaultBase = &checkbox2->base; -#endif + + struct DjuiCheckbox* checkbox3 = djui_checkbox_create(&body->base, "Debug Print", &configDebugPrint); + djui_base_set_size_type(&checkbox3->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&checkbox3->base, 1.0f, 32); + defaultBase = &checkbox3->base; + + struct DjuiCheckbox* checkbox4 = djui_checkbox_create(&body->base, "Debug Info", &configDebugInfo); + djui_base_set_size_type(&checkbox4->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&checkbox4->base, 1.0f, 32); + defaultBase = &checkbox4->base; + + struct DjuiCheckbox* checkbox5 = djui_checkbox_create(&body->base, "Debug Errors", &configDebugError); + djui_base_set_size_type(&checkbox5->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&checkbox5->base, 1.0f, 32); + defaultBase = &checkbox5->base; struct DjuiButton* button1 = djui_button_create(&body->base, "Back"); djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); diff --git a/src/pc/lua/smlua.c b/src/pc/lua/smlua.c index 57c9cf4e..6063d5af 100644 --- a/src/pc/lua/smlua.c +++ b/src/pc/lua/smlua.c @@ -132,7 +132,7 @@ void smlua_init(void) { // load libraries luaopen_base(L); //luaopen_coroutine(L); -#if defined(LUA_PROFILER) +#if defined(DEVELOPMENT) luaL_requiref(L, "debug", luaopen_debug, 1); luaL_requiref(L, "io", luaopen_io, 1); luaL_requiref(L, "os", luaopen_os, 1); diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 445b2b93..bdca15f8 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -10,7 +10,6 @@ char gSmluaConstants[] = "" " return a['_pointer'] == b['_pointer'] and a['_lot'] == b['_lot'] and a['_pointer'] ~= nil and a['_lot'] ~= nil\n" " end\n" "}\n" -"\n" "_CPointer = {\n" " __index = function (t,k)\n" " return nil\n" @@ -24,7 +23,6 @@ char gSmluaConstants[] = "" " return a['_pointer'] == b['_pointer'] and a['_pointer'] ~= nil and a['_lvt'] ~= nil\n" " end\n" "}\n" -"\n" "_SyncTable = {\n" " __index = function (t,k)\n" " local _table = rawget(t, '_table')\n" @@ -36,7 +34,6 @@ char gSmluaConstants[] = "" " _set_sync_table_field(t, k, v)\n" " end\n" "}\n" -"\n" "_ReadOnlyTable = {\n" " __index = function (t,k)\n" " local _table = rawget(t, '_table')\n" @@ -45,7 +42,6 @@ char gSmluaConstants[] = "" " __newindex = function (t,k,v)\n" " end\n" "}\n" -"\n" "--- @param dest Vec3f\n" "--- @param src Vec3f\n" "--- @return Vec3f\n" @@ -55,7 +51,6 @@ char gSmluaConstants[] = "" " dest.z = src.z\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3f\n" "--- @param x number\n" "--- @param y number\n" @@ -67,7 +62,6 @@ char gSmluaConstants[] = "" " dest.z = z\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3f\n" "--- @param a Vec3f\n" "--- @return Vec3f\n" @@ -77,7 +71,6 @@ char gSmluaConstants[] = "" " dest.z = dest.z + a.z\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3f\n" "--- @param a Vec3f\n" "--- @param b Vec3f\n" @@ -88,7 +81,6 @@ char gSmluaConstants[] = "" " dest.z = a.z + b.z\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3f\n" "--- @param a number\n" "--- @return Vec3f\n" @@ -98,7 +90,6 @@ char gSmluaConstants[] = "" " dest.z = dest.z * a\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3f\n" "--- @return Vec3f\n" "function vec3f_normalize(dest)\n" @@ -106,28 +97,23 @@ char gSmluaConstants[] = "" " if divisor == 0 then\n" " return dest\n" " end\n" -"\n" " local invsqrt = 1.0 / divisor\n" " dest.x = dest.x * invsqrt\n" " dest.y = dest.y * invsqrt\n" " dest.z = dest.z * invsqrt\n" -"\n" " return dest\n" "end\n" -"\n" "--- @param a Vec3f\n" "--- @return number\n" "function vec3f_length(a)\n" " return math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z)\n" "end\n" -"\n" "--- @param a Vec3f\n" "--- @param b Vec3f\n" "--- @return number\n" "function vec3f_dot(a, b)\n" " return a.x * b.x + a.y * b.y + a.z * b.z\n" "end\n" -"\n" "--- @param vec Vec3f\n" "--- @param onto Vec3f\n" "--- @return Vec3f\n" @@ -139,7 +125,6 @@ char gSmluaConstants[] = "" " vec3f_mul(out, numerator / denominator)\n" " return out\n" "end\n" -"\n" "--- @param v1 Vec3f\n" "--- @param v2 Vec3f\n" "--- @return number\n" @@ -149,7 +134,6 @@ char gSmluaConstants[] = "" " dz = v1.z - v2.z\n" " return math.sqrt(dx * dx + dy * dy + dz * dz)\n" "end\n" -"\n" "--- @param dest Vec3s\n" "--- @param src Vec3s\n" "--- @return Vec3s\n" @@ -159,7 +143,6 @@ char gSmluaConstants[] = "" " dest.z = src.z\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3s\n" "--- @param x number\n" "--- @param y number\n" @@ -171,7 +154,6 @@ char gSmluaConstants[] = "" " dest.z = z\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3s\n" "--- @param a Vec3s\n" "--- @return Vec3s\n" @@ -181,7 +163,6 @@ char gSmluaConstants[] = "" " dest.z = dest.z + a.z\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3s\n" "--- @param a Vec3s\n" "--- @param b Vec3s\n" @@ -192,7 +173,6 @@ char gSmluaConstants[] = "" " dest.z = a.z + b.z\n" " return dest\n" "end\n" -"\n" "--- @param dest Vec3s\n" "--- @param a number\n" "--- @return Vec3s\n" @@ -202,7 +182,6 @@ char gSmluaConstants[] = "" " dest.z = dest.z * a\n" " return dest\n" "end\n" -"\n" "--- @param v1 Vec3s\n" "--- @param v2 Vec3s\n" "--- @return number\n" @@ -212,7 +191,6 @@ char gSmluaConstants[] = "" " dz = v1.z - v2.z\n" " return math.sqrt(dx * dx + dy * dy + dz * dz)\n" "end\n" -"\n" "--- @param current number\n" "--- @param target number\n" "--- @param inc number\n" @@ -232,7 +210,6 @@ char gSmluaConstants[] = "" " end\n" " return current;\n" "end\n" -"\n" "--- @param current number\n" "--- @param target number\n" "--- @param inc number\n" @@ -250,7 +227,6 @@ char gSmluaConstants[] = "" " current = target\n" " end\n" " end\n" -"\n" " -- keep within 32 bits\n" " if current > 2147483647 then\n" " current = -2147483648 + (current - 2147483647)\n" @@ -259,7 +235,6 @@ char gSmluaConstants[] = "" " end\n" " return current;\n" "end\n" -"\n" "--- @param bank number\n" "--- @param soundID number\n" "--- @param priority number\n" @@ -269,11 +244,9 @@ char gSmluaConstants[] = "" " if flags == nil then flags = 0 end\n" " return (bank << 28) | (soundID << 16) | (priority << 8) | flags | SOUND_STATUS_WAITING\n" "end\n" -"\n" "-------------\n" "-- courses --\n" "-------------\n" -"\n" "--- @type integer\n" "COURSE_NONE = 0\n" "--- @type integer\n" @@ -4041,5 +4014,7 @@ char gSmluaConstants[] = "" "VERSION_TEXT = 'beta'\n" "VERSION_NUMBER = 32\n" "MINOR_VERSION_NUMBER = 0\n" +"PATCH_VERSION_NUMBER = 1\n" "MAX_VERSION_LENGTH = 10\n" +"MAX_LOCAL_VERSION_LENGTH = 12\n" ; \ No newline at end of file diff --git a/src/pc/lua/smlua_hooks.c b/src/pc/lua/smlua_hooks.c index a880cf62..b8f76640 100644 --- a/src/pc/lua/smlua_hooks.c +++ b/src/pc/lua/smlua_hooks.c @@ -5,7 +5,7 @@ #include "pc/djui/djui_chat_message.h" #include "pc/crash_handler.h" -#if defined(LUA_PROFILER) +#if defined(DEVELOPMENT) #include "../mods/mods.h" #include "game/print.h" #include "gfx_dimensions.h" @@ -70,6 +70,7 @@ void lua_profiler_update_counters() { print_text(GFX_DIMENSIONS_FROM_LEFT_EDGE(4), y, text); } } + #endif #define MAX_HOOKED_REFERENCES 64 @@ -89,14 +90,14 @@ int smlua_call_hook(lua_State* L, int nargs, int nresults, int errfunc, struct M struct Mod* prev = gLuaActiveMod; gLuaActiveMod = activeMod; gLuaLastHookMod = activeMod; -#if defined(LUA_PROFILER) +#if defined(DEVELOPMENT) extern bool configLuaProfiler; if (configLuaProfiler) { lua_profiler_start_counter(activeMod); } #endif int rc = smlua_pcall(L, nargs, nresults, errfunc); -#if defined(LUA_PROFILER) +#if defined(DEVELOPMENT) if (configLuaProfiler) { lua_profiler_stop_counter(activeMod); } diff --git a/src/pc/mods/mod.c b/src/pc/mods/mod.c index 54d401d6..6de74c9d 100644 --- a/src/pc/mods/mod.c +++ b/src/pc/mods/mod.c @@ -436,10 +436,15 @@ bool mod_load(struct Mods* mods, char* basePath, char* modName) { valid = true; } else if (is_directory(fullPath)) { char tmpPath[SYS_MAX_PATH] = { 0 }; + char path1[SYS_MAX_PATH] = { 0 }; + char path2[SYS_MAX_PATH] = { 0 }; if (!concat_path(tmpPath, fullPath, "main.lua")) { LOG_ERROR("Failed to concat path '%s' + '%s'", fullPath, "main.lua"); return true; } + if ((concat_path(path1, fullPath, "c-update.lua") && path_exists(path1)) || (concat_path(path2, fullPath, "m-update.lua") && path_exists(path2))) { + return true; + } valid = path_exists(tmpPath); } diff --git a/src/pc/network/version.c b/src/pc/network/version.c index dc51bcfb..a266097d 100644 --- a/src/pc/network/version.c +++ b/src/pc/network/version.c @@ -3,8 +3,14 @@ #include "types.h" static char sVersionString[MAX_VERSION_LENGTH] = { 0 }; +static char sLocalVersionString[MAX_VERSION_LENGTH] = { 0 }; char* get_version(void) { snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER); return sVersionString; -} \ No newline at end of file +} + +char* get_version_local(void) { + snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "%s %d.%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER); + return sLocalVersionString; +} diff --git a/src/pc/network/version.h b/src/pc/network/version.h index d4f00bae..f4547fb0 100644 --- a/src/pc/network/version.h +++ b/src/pc/network/version.h @@ -4,8 +4,11 @@ #define VERSION_TEXT "beta" #define VERSION_NUMBER 32 #define MINOR_VERSION_NUMBER 0 +#define PATCH_VERSION_NUMBER 1 #define MAX_VERSION_LENGTH 10 +#define MAX_LOCAL_VERSION_LENGTH 12 char* get_version(void); +char* get_version_local(void); #endif diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index e63ffbea..a087e0f6 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -329,7 +329,7 @@ void main_func(void) { #error No rendering API! #endif - char* version = get_version(); + char* version = get_version_local(); char window_title[96] = { 0 }; #ifdef GIT_HASH snprintf(window_title, 96, "sm64ex-coop: %s [%s]", version, GIT_HASH);