From 6cfc6b04383ad03ae8be04ae809e01d128bc0a21 Mon Sep 17 00:00:00 2001 From: JailDoctor Date: Wed, 2 Nov 2022 13:48:53 +0100 Subject: [PATCH] - v0.9.01 - [NEW] version numbers - debug() is now an alias of printf --- lua.cpp | 16 ++++++++-------- mini.cpp | 6 +++--- mini.h | 5 ++++- opti.bat | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lua.cpp b/lua.cpp index a04cd89..01cab0e 100644 --- a/lua.cpp +++ b/lua.cpp @@ -914,15 +914,15 @@ void lua_init(char* filenames) { int size; char* buffer = file_getfilebuffer(file_start, size); if (luaL_loadbuffer(L, buffer, size, file_start)) { - debug("LOADING ERROR:"); - debug(lua_tostring(L, -1)); + debug("LOADING ERROR: "); + debug("%s\n",lua_tostring(L, -1)); lua_pop(L,1); return; } free(buffer); if (lua_pcall(L,0, LUA_MULTRET, 0)) { - debug("RUNTIME ERROR:"); - debug(lua_tostring(L, -1)); + debug("RUNTIME ERROR: "); + debug("%s\n",lua_tostring(L, -1)); lua_pop(L,1); return; } @@ -945,8 +945,8 @@ void lua_call_init() { if (!init_exists) return; lua_getglobal(L, "_init"); if (lua_pcall(L, 0, 0, 0)) { - debug("RUNTIME ERROR:"); - debug(lua_tostring(L, -1)); + debug("RUNTIME ERROR: "); + debug("%s\n",lua_tostring(L, -1)); lua_pop(L,1); is_playing = false; } @@ -956,8 +956,8 @@ void lua_call_update() { if (!update_exists) return; lua_getglobal(L, "_update"); if (lua_pcall(L, 0, 0, 0)) { - debug("RUNTIME ERROR:"); - debug(lua_tostring(L, -1)); + debug("RUNTIME ERROR: "); + debug("%s\n",lua_tostring(L, -1)); lua_pop(L,1); is_playing = false; } diff --git a/mini.cpp b/mini.cpp index 8ad9e9d..0cbba1d 100644 --- a/mini.cpp +++ b/mini.cpp @@ -211,7 +211,7 @@ int main(int argc,char*argv[]){ reinit(); initaudio(); - debug("MINI SYSTEM BOOTING..."); + debug("MINI v%s\n",MINI_VERSION); lua_init(lua_files); lua_call_init(); @@ -904,9 +904,9 @@ const char* tostr(int val) { return SDL_itoa(val, tostr_tmp, 10); } -void debug(const char *str) { +/*void debug(const char *str) { printf("%s\n",str); -} +}*/ uint8_t ascii(const char *str, uint8_t index) { return str[index]; diff --git a/mini.h b/mini.h index 1924808..284da09 100644 --- a/mini.h +++ b/mini.h @@ -2,6 +2,8 @@ #include +#define MINI_VERSION "0.9.01d" + #define KEY_UNKNOWN 0 #define KEY_A 4 #define KEY_B 5 @@ -232,7 +234,8 @@ int rnd(int x); const char* tostr(int val); -void debug(const char *str); +//void debug(const char *str); +#define debug printf uint8_t ascii(const char *str, uint8_t index); diff --git a/opti.bat b/opti.bat index bfbf6d3..2dcb35f 100644 --- a/opti.bat +++ b/opti.bat @@ -1,2 +1,2 @@ -g++ *.cpp ./lua/*.c -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lmingw32 -lSDL2main -lSDL2 -mwindows -o mini.exe +g++ *.cpp ./lua/*.c -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lmingw32 -lSDL2main -lSDL2 -o mini.exe strip -s -R .comment -R .gnu.version --strip-unneeded mini.exe