From 733b20a6db8b53cb52ee61ac8b5695c0aadf2954 Mon Sep 17 00:00:00 2001 From: ZuoSiZhu <2839299264@qq.com> Date: Sun, 8 Jun 2025 02:48:37 +0800 Subject: [PATCH] fix: unexpected restarts caused by do_inject --- config/template.json | 2 +- module/config/argument/args.json | 2 +- module/config/argument/argument.yaml | 2 +- module/config/config_generated.py | 2 +- module/config/i18n/en-US.json | 6 +++--- module/config/i18n/ja-JP.json | 6 +++--- module/config/i18n/zh-CN.json | 6 +++--- module/config/i18n/zh-TW.json | 6 +++--- module/luahook/crack.py | 8 ++------ 9 files changed, 18 insertions(+), 22 deletions(-) diff --git a/config/template.json b/config/template.json index 293e27dec..dbd9058bd 100644 --- a/config/template.json +++ b/config/template.json @@ -235,7 +235,7 @@ "Hook": { "HookGeneral": { "Enable": false, - "RestartEverytime": true, + "PushEveryTime": true, "Architecture": "auto", "InjectMethod": "local_patch", "RequestTimeLimit": 10, diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 3b6b30407..b9d0e77b5 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -931,7 +931,7 @@ "type": "checkbox", "value": false }, - "RestartEverytime": { + "PushEveryTime": { "type": "checkbox", "value": true }, diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index c0066f100..6951fa7e1 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -152,7 +152,7 @@ OldRetire: HookGeneral: Enable: false - RestartEverytime: true + PushEveryTime: true Architecture: value: auto option: [ auto, x86, x86_64, arm64-v8a, armeabi-v7a ] diff --git a/module/config/config_generated.py b/module/config/config_generated.py index faaea9e41..25c0d40dc 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -80,7 +80,7 @@ class GeneratedConfig: # Group `HookGeneral` HookGeneral_Enable = False - HookGeneral_RestartEverytime = True + HookGeneral_PushEveryTime = True HookGeneral_Architecture = 'auto' # auto, x86, x86_64, arm64-v8a, armeabi-v7a HookGeneral_InjectMethod = 'local_patch' # local_patch, global_patch, outer_inject HookGeneral_RequestTimeLimit = 10 diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 0a3da28cb..2e165da55 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -773,9 +773,9 @@ "name": "HookGeneral.Enable.name", "help": "HookGeneral.Enable.help" }, - "RestartEverytime": { - "name": "HookGeneral.RestartEverytime.name", - "help": "HookGeneral.RestartEverytime.help" + "PushEveryTime": { + "name": "HookGeneral.PushEveryTime.name", + "help": "HookGeneral.PushEveryTime.help" }, "Architecture": { "name": "HookGeneral.Architecture.name", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 2eeec24fd..43cd943f9 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -773,9 +773,9 @@ "name": "HookGeneral.Enable.name", "help": "HookGeneral.Enable.help" }, - "RestartEverytime": { - "name": "HookGeneral.RestartEverytime.name", - "help": "HookGeneral.RestartEverytime.help" + "PushEveryTime": { + "name": "HookGeneral.PushEveryTime.name", + "help": "HookGeneral.PushEveryTime.help" }, "Architecture": { "name": "HookGeneral.Architecture.name", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 45e28c1de..8a854d9fa 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -773,9 +773,9 @@ "name": "总开关", "help": "" }, - "RestartEverytime": { - "name": "每次启动Alas时重启", - "help": "推荐打开" + "PushEveryTime": { + "name": "每次重新推送资源", + "help": "视情况开关,一般更新时推送" }, "Architecture": { "name": "架构", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 48a7db5cd..283610b0e 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -773,9 +773,9 @@ "name": "HookGeneral.Enable.name", "help": "HookGeneral.Enable.help" }, - "RestartEverytime": { - "name": "HookGeneral.RestartEverytime.name", - "help": "HookGeneral.RestartEverytime.help" + "PushEveryTime": { + "name": "HookGeneral.PushEveryTime.name", + "help": "HookGeneral.PushEveryTime.help" }, "Architecture": { "name": "HookGeneral.Architecture.name", diff --git a/module/luahook/crack.py b/module/luahook/crack.py index d991b2eb7..6c1ccefe8 100644 --- a/module/luahook/crack.py +++ b/module/luahook/crack.py @@ -464,16 +464,12 @@ class CrackResource: if not self.__check_game_lib_dir(): raise CrackerError(f"GameLibDir '{self.game_lib_dir}' is invalid") - if deep_get(self.config.data, "Hook.HookGeneral.RestartEverytime", True): - self.device.app_stop() - self.config.task_call("Restart") - self.__adb_root() self.__ensure_crack_resource() if not self.first_init: self.__check_update() - if self.has_new_version or not self.__is_remote_file_exist(): + if self.has_new_version or not self.__is_remote_file_exist() or deep_get(self.config.data, "Hook.HookGeneral.PushEverytime", True): self.__push_resource() self.device.app_stop() self.config.task_call("Restart") - self.__do_inject() + self.__do_inject()