Merge pull request #771 from taketin/fix_init_option_on_wasm

Can set parameters and specific cartridge through arguments option.
This commit is contained in:
Vadim Grigoruk 2018-11-13 20:49:54 +02:00 committed by GitHub
commit 2108d1f666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -1528,15 +1528,21 @@ static void onEmscriptenWgetError(const char* error) {}
static void emsStart(s32 argc, char **argv, const char* folder) static void emsStart(s32 argc, char **argv, const char* folder)
{ {
if(argc == 2) if (argc >= 2)
{ {
startVars.argc = argc; int pos = strlen(argv[1]) - strlen(".tic");
startVars.argv = argv; if (pos >= 0 && strcmp(&argv[1][pos], ".tic") == 0)
startVars.folder = folder; {
startVars.argc = argc;
startVars.argv = argv;
startVars.folder = folder;
emscripten_async_wget(argv[1], DEFAULT_CART, onEmscriptenWget, onEmscriptenWgetError); emscripten_async_wget(argv[1], DEFAULT_CART, onEmscriptenWget, onEmscriptenWgetError);
return;
}
} }
else start(argc, argv, folder);
start(argc, argv, folder);
} }
#endif #endif