arm9/lua/gm9internalfs: support sig_check in fs.verify

This commit is contained in:
ihaveahax 2025-10-20 10:21:38 -05:00 committed by d0k3
parent 34ca0fc3a7
commit d40f1dd022
2 changed files with 11 additions and 5 deletions

View File

@ -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;

View File

@ -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