From 78c05e122fcc1c909bcaa560ba3110c47f607f02 Mon Sep 17 00:00:00 2001 From: DarkGod <darkgod@net-core.org> Date: Sun, 28 Dec 2014 15:49:31 +0100 Subject: [PATCH] auto compute md5 --- game/engines/default/engine/Module.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/game/engines/default/engine/Module.lua b/game/engines/default/engine/Module.lua index 5e5f3f4a5c..543924729d 100644 --- a/game/engines/default/engine/Module.lua +++ b/game/engines/default/engine/Module.lua @@ -459,6 +459,13 @@ function _M:addonMD5(add, base) table.print(md5s) local fmd5 = md5.sumhexa(table.concat(md5s)) print("[MODULE LOADER] addon ", add.short_name, " MD5", fmd5, "computed in ", core.game.getTime() - t, vbase) + + if __module_extra_info.compute_md5_only then + local f = io.open(__module_extra_info.compute_md5_only, "a") + f:write(("%s : addon[%s] md5\n"):format(fmd5, add.version_name)) + f:close() + end + return fmd5 end @@ -579,7 +586,7 @@ You may try to force loading if you are sure the savefile does not use that addo -- Compute addon md5 local hash_valid, hash_err - if config.settings.cheat then + if config.settings.cheat and not __module_extra_info.compute_md5_only then hash_valid, hash_err = false, "cheat mode skipping addon validation" else local fmd5 = self:addonMD5(add) @@ -878,7 +885,7 @@ function _M:instanciate(mod, name, new_game, no_reboot, extra_module_info) local hash_valid, hash_err local t = core.game.getTime() local module_md5 = "--" - if config.settings.cheat then + if config.settings.cheat and not __module_extra_info.compute_md5_only then hash_valid, hash_err = false, "cheat mode skipping validation" else if mod.short_name ~= "boot" then @@ -888,6 +895,12 @@ function _M:instanciate(mod, name, new_game, no_reboot, extra_module_info) table.sort(md5s) module_md5 = md5.sumhexa(table.concat(md5s)) print("[MODULE LOADER] module MD5", module_md5, "computed in ", core.game.getTime() - t) + + if __module_extra_info.compute_md5_only then + local f = io.open(__module_extra_info.compute_md5_only, "w") + f:write(("%s : module[%s] md5\n"):format(module_md5, mod.version_string)) + f:close() + end end end @@ -898,6 +911,9 @@ function _M:instanciate(mod, name, new_game, no_reboot, extra_module_info) hash_valid, hash_err = profile:checkBatchHash(hashlist) print("[MODULE] All hashes validation: ", hash_valid, hash_err) + -- Finish now + if __module_extra_info.compute_md5_only then os.crash() end + -- Now that addons are loaded we can load UI definitions for _, file in ipairs(fs.list("/data/gfx/ui/definitions")) do if file:find("%.lua$") then UIBase:loadUIDefinitions("/data/gfx/ui/definitions/"..file) end -- GitLab