Add command line flag to start in surf mode #397

This commit is contained in:
BADIM-PC\Vadim 2017-11-20 12:00:59 +03:00
parent 20d0950dca
commit 39703b5d5e
2 changed files with 14 additions and 1 deletions

View File

@ -2550,11 +2550,12 @@ static void tick(Console* console)
printLine(console); printLine(console);
commandDone(console); commandDone(console);
console->active = true; console->active = true;
return; return;
} }
} }
else else
{ {
if(console->cursor.delay) if(console->cursor.delay)
console->cursor.delay--; console->cursor.delay--;
@ -2564,6 +2565,12 @@ static void tick(Console* console)
} }
console->tickCounter++; console->tickCounter++;
if(console->startSurf)
{
console->startSurf = false;
gotoSurf();
}
} }
static void cmdLoadCart(Console* console, const char* name) static void cmdLoadCart(Console* console, const char* name)
@ -2757,6 +2764,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
.colorBuffer = console->colorBuffer, .colorBuffer = console->colorBuffer,
.fs = fs, .fs = fs,
.showGameMenu = false, .showGameMenu = false,
.startSurf = false,
}; };
memset(console->buffer, 0, CONSOLE_BUFFER_SIZE); memset(console->buffer, 0, CONSOLE_BUFFER_SIZE);
@ -2802,8 +2810,12 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
} }
for (s32 i = 1; i < argc; i++) for (s32 i = 1; i < argc; i++)
{
if(strcmp(argv[i], "-nosound") == 0) if(strcmp(argv[i], "-nosound") == 0)
config->data.noSound = true; config->data.noSound = true;
else if(strcmp(argv[i], "-surf") == 0)
console->startSurf = true;
}
} }
#if defined(__EMSCRIPTEN__) #if defined(__EMSCRIPTEN__)

View File

@ -88,6 +88,7 @@ struct Console
u32 tickCounter; u32 tickCounter;
bool active; bool active;
bool showGameMenu; bool showGameMenu;
bool startSurf;
void(*load)(Console*, const char* name); void(*load)(Console*, const char* name);
bool(*loadProject)(Console*, const char* data, s32 size, tic_cartridge* dst); bool(*loadProject)(Console*, const char* data, s32 size, tic_cartridge* dst);