Skip to content

Commit f136ea4

Browse files
committed
cmd cart open fix
1 parent 8f4dae8 commit f136ea4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/console.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,13 @@ static void onCartLoaded(Console* console, const char* name)
507507

508508
}
509509

510-
#if defined(TIC80_PRO)
511-
512510
static bool hasExt(const char* name, const char* ext)
513511
{
514512
return strcmp(name + strlen(name) - strlen(ext), ext) == 0;
515513
}
516514

515+
#if defined(TIC80_PRO)
516+
517517
static bool hasProjectExt(const char* name)
518518
{
519519
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)
26272627
if(hasProjectExt(name))
26282628
{
26292629
loadProject(console, name, data, size, &embed.file);
2630+
strcpy(console->romName, fsFilename(name));
2631+
embed.yes = true;
26302632
embed.fast = true;
26312633
}
26322634
else
26332635
#endif
2634-
loadCart(console->tic, &embed.file, data, size, true);
26352636

2636-
strcpy(console->romName, fsFilename(name));
2637-
2638-
embed.yes = true;
2637+
if(hasExt(name, CART_EXT))
2638+
{
2639+
loadCart(console->tic, &embed.file, data, size, true);
2640+
strcpy(console->romName, fsFilename(name));
2641+
embed.yes = true;
2642+
}
26392643

26402644
SDL_free(data);
26412645
}

0 commit comments

Comments
 (0)