added live cart reloading #374

This commit is contained in:
BADIM-PC\Vadim 2017-11-21 20:04:04 +03:00
parent 46ea791356
commit 55a6728db2
1 changed files with 4 additions and 1 deletions

View File

@ -53,6 +53,7 @@ static struct
char prefix[32]; char prefix[32];
bool yes; bool yes;
bool fast; bool fast;
bool cmd;
bool menu; bool menu;
tic_cartridge file; tic_cartridge file;
} embed = } embed =
@ -60,6 +61,7 @@ static struct
.prefix = "C8B39163816B47209E721136D37B8031", .prefix = "C8B39163816B47209E721136D37B8031",
.yes = false, .yes = false,
.fast = false, .fast = false,
.cmd = false,
}; };
static const char DefaultLuaTicPath[] = TIC_LOCAL "default.tic"; static const char DefaultLuaTicPath[] = TIC_LOCAL "default.tic";
@ -2541,7 +2543,7 @@ static void tick(Console* console)
{ {
if(console->tickCounter >= (u32)(embed.fast ? 1 : TIC_FRAMERATE)) if(console->tickCounter >= (u32)(embed.fast ? 1 : TIC_FRAMERATE))
{ {
if(!embed.fast) if(!embed.fast && !embed.cmd)
console->showGameMenu = true; console->showGameMenu = true;
memcpy(&console->tic->cart, &embed.file, sizeof(tic_cartridge)); memcpy(&console->tic->cart, &embed.file, sizeof(tic_cartridge));
@ -2599,6 +2601,7 @@ static void cmdLoadCart(Console* console, const char* name)
strcpy(console->romName, fsFilename(name)); strcpy(console->romName, fsFilename(name));
embed.yes = true; embed.yes = true;
embed.cmd = true;
SDL_free(data); SDL_free(data);
} }