From 15f17680838492e4b1b4149bc079b76e35f04b33 Mon Sep 17 00:00:00 2001 From: Hidenori TAKESHITA Date: Mon, 5 Nov 2018 00:31:10 +0900 Subject: [PATCH] Can set parameters and specific cartridge through arguments option. --- src/system.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/system.c b/src/system.c index 7b5e096..40e2d07 100644 --- a/src/system.c +++ b/src/system.c @@ -1528,15 +1528,21 @@ static void onEmscriptenWgetError(const char* error) {} static void emsStart(s32 argc, char **argv, const char* folder) { - if(argc == 2) + if (argc >= 2) { - startVars.argc = argc; - startVars.argv = argv; - startVars.folder = folder; + int pos = strlen(argv[1]) - strlen(".tic"); + if (pos >= 0 && strcmp(&argv[1][pos], ".tic") == 0) + { + 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