cmd cart open fix
@@ -507,13 +507,13 @@ static void onCartLoaded(Console* console, const char* name)
}
-#if defined(TIC80_PRO)
-
static bool hasExt(const char* name, const char* ext)
{
return strcmp(name + strlen(name) - strlen(ext), ext) == 0;
}
+#if defined(TIC80_PRO)
+
static bool hasProjectExt(const char* name)
{
return hasExt(name, PROJECT_LUA_EXT) || hasExt(name, PROJECT_MOON_EXT) || hasExt(name, PROJECT_JS_EXT);
@@ -2627,15 +2627,19 @@ static void cmdLoadCart(Console* console, const char* name)
if(hasProjectExt(name))
{
loadProject(console, name, data, size, &embed.file);
+ strcpy(console->romName, fsFilename(name));
+ embed.yes = true;
embed.fast = true;
}
else
#endif
- loadCart(console->tic, &embed.file, data, size, true);
+ if(hasExt(name, CART_EXT))
+ {
+ loadCart(console->tic, &embed.file, data, size, true);
strcpy(console->romName, fsFilename(name));
-
embed.yes = true;
+ }
SDL_free(data);
}
