added live cart reloading #374

This commit is contained in:
BADIM-PC\Vadim
2017-11-21 19:47:36 +03:00
parent f4808d40d4
commit 31929e5550
3 changed files with 49 additions and 1 deletions

View File

@@ -731,6 +731,25 @@ static bool loadProject(Console* console, const char* data, s32 size, tic_cartri
return done;
}
static void updateProject(Console* console)
{
tic_mem* tic = console->tic;
if(strlen(console->romName))
{
s32 size = 0;
void* data = fsLoadFile(console->fs, console->romName, &size);
if(data)
{
loadProject(console, data, size, &tic->cart);
SDL_free(data);
studioRomLoaded();
}
}
}
static bool hasExt(const char* name, const char* ext)
{
return strcmp(name + strlen(name) - strlen(ext), ext) == 0;
@@ -2721,10 +2740,11 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
#if defined(TIC80_PRO)
.loadProject = loadProject,
.updateProject = updateProject,
#else
.loadProject = NULL,
.updateProject = NULL,
#endif
.error = error,
.trace = trace,
.tick = tick,