From f136ea4c7351a5f117a9ad1c4de1fabb6d67e987 Mon Sep 17 00:00:00 2001 From: Nesbox Date: Fri, 24 Nov 2017 12:09:25 +0300 Subject: [PATCH] cmd cart open fix --- src/console.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/console.c b/src/console.c index cac2eeb..3c67422 100644 --- a/src/console.c +++ b/src/console.c @@ -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); - strcpy(console->romName, fsFilename(name)); - - embed.yes = 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); }