adds support for Fennel text carts
This commit is contained in:
parent
adacd39d79
commit
0a1bf64d0d
|
@ -480,7 +480,7 @@ static void* getDemoCart(Console* console, ScriptLang script, s32* size)
|
||||||
case MoonScript: strcpy(path, DefaultMoonTicPath); break;
|
case MoonScript: strcpy(path, DefaultMoonTicPath); break;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(TIC_BUILD_WITH_MOON)
|
# if defined(TIC_BUILD_WITH_FENNEL)
|
||||||
case Fennel: strcpy(path, DefaultFennelTicPath); break;
|
case Fennel: strcpy(path, DefaultFennelTicPath); break;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@ -690,12 +690,25 @@ 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_FENNEL_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) ? "//" : "--";
|
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)
|
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))
|
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_FENNEL_EXT);
|
||||||
|
|
||||||
void* data = fsLoadFile(console->fs, name, &size);
|
void* data = fsLoadFile(console->fs, name, &size);
|
||||||
|
|
||||||
if(data)
|
if(data)
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
#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"
|
#define PROJECT_SQUIRREL_EXT ".nut"
|
||||||
|
#define PROJECT_FENNEL_EXT ".fnl"
|
||||||
|
|
||||||
typedef enum
|
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_MOON_EXT)
|
||||||
|| hasExt(name, PROJECT_JS_EXT)
|
|| hasExt(name, PROJECT_JS_EXT)
|
||||||
|| hasExt(name, PROJECT_WREN_EXT)
|
|| hasExt(name, PROJECT_WREN_EXT)
|
||||||
|
|| hasExt(name, PROJECT_FENNEL_EXT)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -533,7 +534,7 @@ static void loadCover(Surf* surf)
|
||||||
|
|
||||||
if(cart)
|
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);
|
surf->console->loadProject(surf->console, item->name, data, size, cart);
|
||||||
else
|
else
|
||||||
tic->api.load(cart, data, size, true);
|
tic->api.load(cart, data, size, true);
|
||||||
|
|
Loading…
Reference in New Issue