Merge pull request #763 from mtm/feature-fennel-text-carts
adds support for Fennel text carts
This commit is contained in:
commit
03fd522271
|
@ -480,7 +480,7 @@ static void* getDemoCart(Console* console, ScriptLang script, s32* size)
|
|||
case MoonScript: strcpy(path, DefaultMoonTicPath); break;
|
||||
# endif
|
||||
|
||||
# if defined(TIC_BUILD_WITH_MOON)
|
||||
# if defined(TIC_BUILD_WITH_FENNEL)
|
||||
case Fennel: strcpy(path, DefaultFennelTicPath); break;
|
||||
# endif
|
||||
|
||||
|
@ -690,12 +690,25 @@ static bool hasExt(const char* name, const char* ext)
|
|||
|
||||
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_FENNEL_EXT);
|
||||
}
|
||||
|
||||
static const char* projectComment(const char* name)
|
||||
{
|
||||
return hasExt(name, PROJECT_JS_EXT) || hasExt(name, PROJECT_WREN_EXT) ? "//" : "--";
|
||||
char* comment;
|
||||
|
||||
if(hasExt(name, PROJECT_JS_EXT) || hasExt(name, PROJECT_WREN_EXT))
|
||||
comment = "//";
|
||||
else if(hasExt(name, PROJECT_FENNEL_EXT))
|
||||
comment = ";;";
|
||||
else
|
||||
comment = "--";
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
static void buf2str(const void* data, s32 size, char* ptr, bool flip)
|
||||
|
@ -1069,6 +1082,9 @@ static void onConsoleLoadCommandConfirmed(Console* console, const char* param)
|
|||
if(!fsExistsFile(console->fs, name))
|
||||
name = getName(param, PROJECT_WREN_EXT);
|
||||
|
||||
if(!fsExistsFile(console->fs, name))
|
||||
name = getName(param, PROJECT_FENNEL_EXT);
|
||||
|
||||
void* data = fsLoadFile(console->fs, name, &size);
|
||||
|
||||
if(data)
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#define PROJECT_JS_EXT ".js"
|
||||
#define PROJECT_WREN_EXT ".wren"
|
||||
#define PROJECT_SQUIRREL_EXT ".nut"
|
||||
#define PROJECT_FENNEL_EXT ".fnl"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
@ -396,6 +396,7 @@ static bool addMenuItem(const char* name, const char* info, s32 id, void* ptr, b
|
|||
|| hasExt(name, PROJECT_MOON_EXT)
|
||||
|| hasExt(name, PROJECT_JS_EXT)
|
||||
|| hasExt(name, PROJECT_WREN_EXT)
|
||||
|| hasExt(name, PROJECT_FENNEL_EXT)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
@ -533,7 +534,7 @@ static void loadCover(Surf* surf)
|
|||
|
||||
if(cart)
|
||||
{
|
||||
if(hasExt(item->name, PROJECT_LUA_EXT))
|
||||
if(hasExt(item->name, PROJECT_LUA_EXT) || hasExt(item->name, PROJECT_FENNEL_EXT))
|
||||
surf->console->loadProject(surf->console, item->name, data, size, cart);
|
||||
else
|
||||
tic->api.load(cart, data, size, true);
|
||||
|
|
Loading…
Reference in New Issue