diff --git a/CMakeLists.txt b/CMakeLists.txt index 12e4f2b..ec3092a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,7 @@ target_include_directories(wren PRIVATE 3rd-party/wren-0.1.0/src/vm) # SQUIRREL ################################ -set(SQUIRREL_DIR 3rd-party/squirrel3.1) +set(SQUIRREL_DIR 3rd-party/squirrel) set(SQUIRREL_SRC ${SQUIRREL_DIR}/squirrel/sqapi.cpp ${SQUIRREL_DIR}/squirrel/sqbaselib.cpp @@ -163,9 +163,9 @@ set(SQUIRREL_SRC add_library(squirrel STATIC ${SQUIRREL_SRC}) set_target_properties(squirrel PROPERTIES LINKER_LANGUAGE CXX) -target_include_directories(squirrel PRIVATE 3rd-party/squirrel3.1/include) -target_include_directories(squirrel PRIVATE 3rd-party/squirrel3.1/squirrel) -target_include_directories(squirrel PRIVATE 3rd-party/squirrel3.1/sqstdlib) +target_include_directories(squirrel PRIVATE 3rd-party/squirrel/include) +target_include_directories(squirrel PRIVATE 3rd-party/squirrel/squirrel) +target_include_directories(squirrel PRIVATE 3rd-party/squirrel/sqstdlib) ################################ # GIFLIB @@ -210,7 +210,7 @@ target_include_directories(tic80core PRIVATE 3rd-party/duktape-2.2.0/src) target_include_directories(tic80core PRIVATE 3rd-party/lua-5.3.1/src) target_include_directories(tic80core PRIVATE 3rd-party/giflib-5.1.4/lib) target_include_directories(tic80core PRIVATE 3rd-party/wren-0.1.0/src/include) -target_include_directories(tic80core PRIVATE 3rd-party/squirrel3.1/include) +target_include_directories(tic80core PRIVATE 3rd-party/squirrel/include) target_include_directories(tic80core PRIVATE 3rd-party/moonscript) target_include_directories(tic80core PRIVATE 3rd-party/fennel) diff --git a/src/console.c b/src/console.c index f79548b..c3d71df 100644 --- a/src/console.c +++ b/src/console.c @@ -73,6 +73,10 @@ typedef enum WrenScript, #endif +#if defined(TIC_BUILD_WITH_SQUIRREL) + SquirrelScript, +#endif + } ScriptLang; #if defined(__TIC_WINDOWS__) || defined(__TIC_LINUX__) || defined(__TIC_MACOSX__) @@ -118,7 +122,10 @@ static const char DefaultJSTicPath[] = TIC_LOCAL "default_js.tic"; #if defined(TIC_BUILD_WITH_WREN) static const char DefaultWrenTicPath[] = TIC_LOCAL "default_wren.tic"; #endif - + +#if defined(TIC_BUILD_WITH_SQUIRREL) +static const char DefaultSquirrelTicPath[] = TIC_LOCAL "default_squirrel.tic"; +#endif static const char* getName(const char* name, const char* ext) { @@ -485,6 +492,10 @@ static void* getDemoCart(Console* console, ScriptLang script, s32* size) #if defined(TIC_BUILD_WITH_WREN) case WrenScript: strcpy(path, DefaultWrenTicPath); break; +#endif + +#if defined(TIC_BUILD_WITH_SQUIRREL) + case SquirrelScript: strcpy(path, DefaultSquirrelTicPath); break; #endif } @@ -570,6 +581,20 @@ static void* getDemoCart(Console* console, ScriptLang script, s32* size) } break; #endif + +#if defined(TIC_BUILD_WITH_SQUIRREL) + case SquirrelScript: + { + static const u8 SquirrelDemoRom[] = + { + #include "../bin/assets/squirreldemo.tic.dat" + }; + + demo = SquirrelDemoRom; + romSize = sizeof SquirrelDemoRom; + } + break; +#endif } u8* data = NULL; @@ -622,6 +647,11 @@ static void onConsoleLoadDemoCommandConfirmed(Console* console, const char* para data = getDemoCart(console, WrenScript, &size); #endif +#if defined(TIC_BUILD_WITH_SQUIRREL) + if(strcmp(param, DefaultSquirrelTicPath) == 0) + data = getDemoCart(console, SquirrelScript, &size); +#endif + const char* name = getCartName(param); setCartName(console, name); @@ -1228,6 +1258,14 @@ static void onConsoleNewCommandConfirmed(Console* console, const char* param) } #endif +#if defined(TIC_BUILD_WITH_SQUIRREL) + if(strcmp(param, "squirrel") == 0) + { + loadDemo(console, SquirrelScript); + done = true; + } +#endif + if(!done) { printError(console, "\nunknown parameter: "); @@ -1525,6 +1563,13 @@ static void onConsoleConfigCommand(Console* console, const char* param) onConsoleLoadDemoCommand(console, DefaultWrenTicPath); } #endif + +#if defined(TIC_BUILD_WITH_SQUIRREL) + else if(strcmp(param, "default squirrel") == 0) + { + onConsoleLoadDemoCommand(console, DefaultSquirrelTicPath); + } +#endif else { @@ -2738,6 +2783,8 @@ static void tick(Console* console) loadDemo(console, JavaScript); #elif defined(TIC_BUILD_WITH_WREN) loadDemo(console, WrenScript); +#elif defined(TIC_BUILD_WITH_SQUIRREL) + loadDemo(console, SquirrelScript); #endif printBack(console, "\n hello! type ");