Beta 32.0.1 (#325)

* patch for beta 32

* require the development flag for Lua profiler

* autogen
This commit is contained in:
Isaac0-dev 2023-03-26 15:15:28 +10:00 committed by GitHub
parent 7e1dafaa73
commit 6cb1b2faec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 79 additions and 88 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -4086,8 +4086,10 @@
<br />
## [version.h](#version.h)
- MAX_LOCAL_VERSION_LENGTH
- MAX_VERSION_LENGTH
- MINOR_VERSION_NUMBER
- PATCH_VERSION_NUMBER
- VERSION_NUMBER
- VERSION_TEXT

View file

@ -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();

View file

@ -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();
}
}

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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"
;

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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;
}
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;
}

View file

@ -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

View file

@ -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);