diff --git a/arm9/source/lua/gm9internalfs.c b/arm9/source/lua/gm9internalfs.c index 56035c4..a9ce38c 100644 --- a/arm9/source/lua/gm9internalfs.c +++ b/arm9/source/lua/gm9internalfs.c @@ -618,13 +618,18 @@ static int internalfs_allow(lua_State* L) { }; static int internalfs_verify(lua_State* L) { - CheckLuaArgCount(L, 1, "_fs.verify"); + bool extra = CheckLuaArgCountPlusExtra(L, 1, "_fs.verify"); const char* path = luaL_checkstring(L, 1); bool res; + u32 flags = 0; + if (extra) { + flags = GetFlagsFromTable(L, 2, flags, SIG_CHECK); + } + u64 filetype = IdentifyFileType(path); if (filetype & IMG_NAND) res = (ValidateNandDump(path) == 0); - else res = (VerifyGameFile(path, false) == 0); + else res = (VerifyGameFile(path, flags & SIG_CHECK) == 0); lua_pushboolean(L, res); return 1; diff --git a/arm9/source/lua/gm9lua.h b/arm9/source/lua/gm9lua.h index 371d089..41db975 100644 --- a/arm9/source/lua/gm9lua.h +++ b/arm9/source/lua/gm9lua.h @@ -13,10 +13,11 @@ #define INCLUDE_DIRS (1UL<<15) #define EXPLORER (1UL<<16) #define ENCRYPTED (1UL<<17) +#define SIG_CHECK (1UL<<18) -#define FLAGS_STR "no_cancel", "silent", "calc_sha", "sha1", "skip", "overwrite", "append", "all", "recursive", "to_emunand", "legit", "first", "include_dirs", "explorer", "encrypted" -#define FLAGS_CONSTS NO_CANCEL, SILENT, CALC_SHA, USE_SHA1, SKIP_ALL, OVERWRITE_ALL, APPEND_ALL, ASK_ALL, RECURSIVE, TO_EMUNAND, LEGIT, FIND_FIRST, INCLUDE_DIRS, EXPLORER, ENCRYPTED -#define FLAGS_COUNT 15 +#define FLAGS_STR "no_cancel", "silent", "calc_sha", "sha1", "skip", "overwrite", "append", "all", "recursive", "to_emunand", "legit", "first", "include_dirs", "explorer", "encrypted", "sig_check" +#define FLAGS_CONSTS NO_CANCEL, SILENT, CALC_SHA, USE_SHA1, SKIP_ALL, OVERWRITE_ALL, APPEND_ALL, ASK_ALL, RECURSIVE, TO_EMUNAND, LEGIT, FIND_FIRST, INCLUDE_DIRS, EXPLORER, ENCRYPTED, SIG_CHECK +#define FLAGS_COUNT 16 #define LUASCRIPT_EXT "lua" #define LUASCRIPT_MAX_SIZE STD_BUFFER_SIZE