Added default Squirrel cart, .nut file extension
This commit is contained in:
		
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							@@ -181,6 +181,7 @@ DEMO_ASSETS= \
 | 
				
			|||||||
	bin/assets/moondemo.tic.dat \
 | 
						bin/assets/moondemo.tic.dat \
 | 
				
			||||||
	bin/assets/fenneldemo.tic.dat \
 | 
						bin/assets/fenneldemo.tic.dat \
 | 
				
			||||||
	bin/assets/wrendemo.tic.dat \
 | 
						bin/assets/wrendemo.tic.dat \
 | 
				
			||||||
 | 
						bin/assets/squirreldemo.tic.dat \
 | 
				
			||||||
	bin/assets/benchmark.tic.dat \
 | 
						bin/assets/benchmark.tic.dat \
 | 
				
			||||||
	bin/assets/config.tic.dat
 | 
						bin/assets/config.tic.dat
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -461,6 +462,9 @@ bin/assets/moondemo.tic.dat: demos/moondemo.tic
 | 
				
			|||||||
bin/assets/fenneldemo.tic.dat: demos/fenneldemo.tic
 | 
					bin/assets/fenneldemo.tic.dat: demos/fenneldemo.tic
 | 
				
			||||||
	$(BIN2TXT) $< $@ -z
 | 
						$(BIN2TXT) $< $@ -z
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bin/assets/squirreldemo.tic.dat: demos/squirreldemo.tic
 | 
				
			||||||
 | 
						$(BIN2TXT) $< $@ -z
 | 
				
			||||||
 | 
						
 | 
				
			||||||
bin/assets/benchmark.tic.dat: demos/benchmark.tic
 | 
					bin/assets/benchmark.tic.dat: demos/benchmark.tic
 | 
				
			||||||
	$(BIN2TXT) $< $@ -z
 | 
						$(BIN2TXT) $< $@ -z
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								bin/assets/squirreldemo.tic.dat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								bin/assets/squirreldemo.tic.dat
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					0x78, 0xda, 0x63, 0x5c, 0xc0, 0xc4, 0x40, 0x08, 0xfc, 0xfb, 0x0f, 0x04, 0x4a, 0x4a, 0x4a, 0xfd, 0x1d, 0x1d, 0x1d, 0xfd, 0x20, 0x1a, 0xc8, 0xed, 0xff, 0xff, 0x01, 0x8e, 0xff, 0xff, 0x7f, 0xff, 0x4e, 0x49, 0xe9, 0xff, 0xbb, 0x8e, 0x8e, 0x0f, 0xef, 0x94, 0x9a, 0x3e, 0xbc, 0xfb, 0xdf, 0xff, 0xe1, 0xff, 0x87, 0xfe, 0x0f, 0x1f, 0x60, 0x18, 0xbb, 0xfe, 0xff, 0x78, 0xf5, 0xff, 0x47, 0xd2, 0xcf, 0x30, 0x0a, 0x06, 0x14, 0x80, 0xe3, 0x0a, 0x14, 0x77, 0x60, 0xf8, 0x03, 0xcc, 0xd6, 0x07, 0xc6, 0xe3, 0x7f, 0x86, 0x0f, 0xff, 0x81, 0x71, 0xfb, 0xef, 0x7f, 0x3f, 0xc3, 0x7f, 0x60, 0xdc, 0xbd, 0xef, 0x07, 0xc6, 0x5f, 0x07, 0x14, 0x83, 0xe2, 0x93, 0xe1, 0xc3, 0xfb, 0x77, 0xff, 0xff, 0xbf, 0x7b, 0x47, 0xa9, 0x7e, 0x56, 0x1d, 0x46, 0x06, 0x7d, 0x7d, 0x85, 0x92, 0xcc, 0x92, 0x9c, 0x54, 0x2b, 0x05, 0x85, 0xf4, 0xc4, 0xdc, 0x54, 0x08, 0x87, 0x0b, 0x28, 0x9a, 0x58, 0x5a, 0x92, 0x91, 0x5f, 0x64, 0x05, 0x11, 0x4d, 0x49, 0x2d, 0x4b, 0xcd, 0xc9, 0x2f, 0x48, 0x2d, 0x02, 0xc9, 0xa4, 0xa4, 0x16, 0x27, 0x03, 0x95, 0x2b, 0x14, 0x03, 0xe5, 0x4b, 0xc0, 0xbc, 0xa2, 0xcc, 0x82, 0x92, 0xcc, 0x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a, 0xc0, 0x28, 0xa4, 0x6c, 0xc6, 0xae, 0x3b, 0xff, 0xde, 0x9f, 0x5d, 0xdd, 0x99, 0xee, 0xaa, 0xcc, 0x08, 0xe3, 0xc3, 0x68, 0x1e, 0xa0, 0x1e, 0x11, 0x1e, 0x19, 0x17, 0x15, 0x13, 0x03, 0x93, 0x5c, 0x3f, 0x2f, 0xbf, 0x56, 0x1f, 0x03, 0x93, 0x54, 0x95, 0x0b, 0x6e, 0x1e, 0xa5, 0x85, 0x89, 0x91, 0xb5, 0xe7, 0x2e, 0xd5, 0xea, 0xb4, 0x4e, 0x5d, 0x98, 0xbb, 0x4a, 0xe7, 0xd2, 0xaa, 0x99, 0xb9, 0x87, 0x4e, 0xdd, 0xba, 0x12, 0x77, 0xef, 0xdd, 0x35, 0x00, 0x34, 0x53, 0x38, 0x01, 
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								demos/squirreldemo.tic
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								demos/squirreldemo.tic
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -70,6 +70,10 @@ typedef enum
 | 
				
			|||||||
	WrenScript,	
 | 
						WrenScript,	
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(TIC_BUILD_WITH_SQUIRREL)
 | 
				
			||||||
 | 
						Squirrel,	
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} ScriptLang;
 | 
					} ScriptLang;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__TIC_WINDOWS__) || defined(__TIC_LINUX__) || defined(__TIC_MACOSX__)
 | 
					#if defined(__TIC_WINDOWS__) || defined(__TIC_LINUX__) || defined(__TIC_MACOSX__)
 | 
				
			||||||
@@ -115,6 +119,10 @@ static const char DefaultJSTicPath[] = TIC_LOCAL "default_js.tic";
 | 
				
			|||||||
static const char DefaultWrenTicPath[] = TIC_LOCAL "default_wren.tic";
 | 
					static const char DefaultWrenTicPath[] = TIC_LOCAL "default_wren.tic";
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(TIC_BUILD_WITH_SQUIRREL)
 | 
				
			||||||
 | 
					static const char DefaultSquirrelTicPath[] = TIC_LOCAL "default_squirrel.tic";
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline s32 BufferSize(const tic_mem* tic)
 | 
					static inline s32 BufferSize(const tic_mem* tic)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return BufferWidth(tic) * BufferHeight(tic) * CONSOLE_BUFFER_SCREENS;
 | 
						return BufferWidth(tic) * BufferHeight(tic) * CONSOLE_BUFFER_SCREENS;
 | 
				
			||||||
@@ -490,6 +498,9 @@ static void* getDemoCart(Console* console, ScriptLang script, s32* size)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#if defined(TIC_BUILD_WITH_WREN)
 | 
					#if defined(TIC_BUILD_WITH_WREN)
 | 
				
			||||||
		case WrenScript: strcpy(path, DefaultWrenTicPath); break;
 | 
							case WrenScript: strcpy(path, DefaultWrenTicPath); break;
 | 
				
			||||||
 | 
					#endif			
 | 
				
			||||||
 | 
					#if defined(TIC_BUILD_WITH_SQUIRREL)
 | 
				
			||||||
 | 
							case Squirrel: strcpy(path, DefaultSquirrelTicPath); break;
 | 
				
			||||||
#endif			
 | 
					#endif			
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -545,8 +556,22 @@ static void* getDemoCart(Console* console, ScriptLang script, s32* size)
 | 
				
			|||||||
		break;
 | 
							break;
 | 
				
			||||||
#	endif
 | 
					#	endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* defined(TIC_BUILD_WITH_LUA) */
 | 
					#endif /* defined(TIC_BUILD_WITH_LUA) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(TIC_BUILD_WITH_SQUIRREL)
 | 
				
			||||||
 | 
						case Squirrel:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								static const u8 SquirrelDemoRom[] =
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									#include "../bin/assets/squirreldemo.tic.dat"
 | 
				
			||||||
 | 
								};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								demo = SquirrelDemoRom;
 | 
				
			||||||
 | 
								romSize = sizeof SquirrelDemoRom;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(TIC_BUILD_WITH_JS)
 | 
					#if defined(TIC_BUILD_WITH_JS)
 | 
				
			||||||
	case JavaScript:
 | 
						case JavaScript:
 | 
				
			||||||
@@ -627,6 +652,10 @@ static void onConsoleLoadDemoCommandConfirmed(Console* console, const char* para
 | 
				
			|||||||
		data = getDemoCart(console, WrenScript, &size);
 | 
							data = getDemoCart(console, WrenScript, &size);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(TIC_BUILD_WITH_SQUIRREL)
 | 
				
			||||||
 | 
						if(strcmp(param, DefaultSquirrelTicPath) == 0)
 | 
				
			||||||
 | 
							data = getDemoCart(console, Squirrel, &size);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	const char* name = getCartName(param);
 | 
						const char* name = getCartName(param);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setCartName(console, name);
 | 
						setCartName(console, name);
 | 
				
			||||||
@@ -665,12 +694,12 @@ static bool hasExt(const char* name, const char* ext)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static bool hasProjectExt(const char* name)
 | 
					static bool hasProjectExt(const char* name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return hasExt(name, PROJECT_LUA_EXT) || hasExt(name, PROJECT_MOON_EXT) || hasExt(name, PROJECT_JS_EXT) || hasExt(name, PROJECT_WREN_EXT);
 | 
						return hasExt(name, PROJECT_LUA_EXT) || hasExt(name, PROJECT_MOON_EXT) || hasExt(name, PROJECT_JS_EXT) || hasExt(name, PROJECT_WREN_EXT) || hasExt(name, PROJECT_SQUIRREL_EXT);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char* projectComment(const char* name)
 | 
					static const char* projectComment(const char* name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return hasExt(name, PROJECT_JS_EXT) || hasExt(name, PROJECT_WREN_EXT) ? "//" : "--";
 | 
						return (hasExt(name, PROJECT_SQUIRREL_EXT) || hasExt(name, PROJECT_JS_EXT) || hasExt(name, PROJECT_WREN_EXT)) ? "//" : "--";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void buf2str(const void* data, s32 size, char* ptr, bool flip)
 | 
					static void buf2str(const void* data, s32 size, char* ptr, bool flip)
 | 
				
			||||||
@@ -1058,6 +1087,9 @@ static void onConsoleLoadCommandConfirmed(Console* console, const char* param)
 | 
				
			|||||||
			if(!fsExistsFile(console->fs, name))
 | 
								if(!fsExistsFile(console->fs, name))
 | 
				
			||||||
				name = getName(param, PROJECT_WREN_EXT);
 | 
									name = getName(param, PROJECT_WREN_EXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if(!fsExistsFile(console->fs, name))
 | 
				
			||||||
 | 
									name = getName(param, PROJECT_SQUIRREL_EXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        void* data = fsLoadFile(console->fs, name, &size);
 | 
					                        void* data = fsLoadFile(console->fs, name, &size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if(data)
 | 
								if(data)
 | 
				
			||||||
@@ -1223,6 +1255,14 @@ static void onConsoleNewCommandConfirmed(Console* console, const char* param)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
#endif			
 | 
					#endif			
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(TIC_BUILD_WITH_SQUIRREL)
 | 
				
			||||||
 | 
							if(strcmp(param, "squirrel") == 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								loadDemo(console, Squirrel);
 | 
				
			||||||
 | 
								done = true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif			
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if(!done)
 | 
					                if(!done)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			printError(console, "\nunknown parameter: ");
 | 
								printError(console, "\nunknown parameter: ");
 | 
				
			||||||
@@ -1506,6 +1546,7 @@ static void onConsoleConfigCommand(Console* console, const char* param)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
#	endif
 | 
					#	endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* defined(TIC_BUILD_WITH_LUA) */
 | 
					#endif /* defined(TIC_BUILD_WITH_LUA) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(TIC_BUILD_WITH_JS)
 | 
					#if defined(TIC_BUILD_WITH_JS)
 | 
				
			||||||
@@ -1522,6 +1563,13 @@ static void onConsoleConfigCommand(Console* console, const char* param)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(TIC_BUILD_WITH_SQUIRREL)
 | 
				
			||||||
 | 
						else if(strcmp(param, "default squirrel") == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							onConsoleLoadDemoCommand(console, DefaultSquirrelTicPath);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		printError(console, "\nunknown parameter: ");
 | 
							printError(console, "\nunknown parameter: ");
 | 
				
			||||||
@@ -2851,6 +2899,8 @@ static void tick(Console* console)
 | 
				
			|||||||
			loadDemo(console, JavaScript);
 | 
								loadDemo(console, JavaScript);
 | 
				
			||||||
#elif defined(TIC_BUILD_WITH_WREN)
 | 
					#elif defined(TIC_BUILD_WITH_WREN)
 | 
				
			||||||
			loadDemo(console, WrenScript);
 | 
								loadDemo(console, WrenScript);
 | 
				
			||||||
 | 
					#elif defined(TIC_BUILD_WITH_SQUIRREL)
 | 
				
			||||||
 | 
								loadDemo(console, Squirrel);
 | 
				
			||||||
#endif			
 | 
					#endif			
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			printBack(console, "\n hello! type ");
 | 
								printBack(console, "\n hello! type ");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,6 +56,7 @@
 | 
				
			|||||||
#define PROJECT_MOON_EXT ".moon"
 | 
					#define PROJECT_MOON_EXT ".moon"
 | 
				
			||||||
#define PROJECT_JS_EXT ".js"
 | 
					#define PROJECT_JS_EXT ".js"
 | 
				
			||||||
#define PROJECT_WREN_EXT ".wren"
 | 
					#define PROJECT_WREN_EXT ".wren"
 | 
				
			||||||
 | 
					#define PROJECT_SQUIRREL_EXT ".nut"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef enum
 | 
					typedef enum
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user