1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 13:49:26 +08:00

add: select arch manually

This commit is contained in:
LA_DI_DA
2025-03-21 19:42:04 +08:00
parent cb2ecfa5af
commit 3d87557568
9 changed files with 58 additions and 5 deletions

View File

@@ -97,6 +97,7 @@
"HookGeneral": {
"Enable": false,
"RestartEverytime": true,
"Architecture": "auto",
"InjectMethod": "local_patch",
"RequestTimeLimit": 10,
"UpdateServer": null,

View File

@@ -486,6 +486,16 @@
"type": "checkbox",
"value": true
},
"Architecture": {
"type": "select",
"value": "auto",
"option": [
"auto",
"x86",
"arm64-v8a",
"armeabi-v7a"
]
},
"InjectMethod": {
"type": "select",
"value": "local_patch",

View File

@@ -152,6 +152,9 @@ OldRetire:
HookGeneral:
Enable: false
RestartEverytime: true
Architecture:
value: auto
option: [ auto, x86, arm64-v8a, armeabi-v7a ]
InjectMethod:
value: local_patch
option: [local_patch, global_patch, outer_inject]

View File

@@ -80,6 +80,7 @@ class GeneratedConfig:
# Group `HookGeneral`
HookGeneral_Enable = False
HookGeneral_RestartEverytime = True
HookGeneral_Architecture = 'auto' # auto, x86, arm64-v8a, armeabi-v7a
HookGeneral_InjectMethod = 'local_patch' # local_patch, global_patch, outer_inject
HookGeneral_RequestTimeLimit = 10
HookGeneral_UpdateServer = None

View File

@@ -735,6 +735,14 @@
"name": "HookGeneral.RestartEverytime.name",
"help": "HookGeneral.RestartEverytime.help"
},
"Architecture": {
"name": "HookGeneral.Architecture.name",
"help": "HookGeneral.Architecture.help",
"auto": "auto",
"x86": "x86",
"arm64-v8a": "arm64-v8a",
"armeabi-v7a": "armeabi-v7a"
},
"InjectMethod": {
"name": "HookGeneral.InjectMethod.name",
"help": "HookGeneral.InjectMethod.help",

View File

@@ -735,6 +735,14 @@
"name": "HookGeneral.RestartEverytime.name",
"help": "HookGeneral.RestartEverytime.help"
},
"Architecture": {
"name": "HookGeneral.Architecture.name",
"help": "HookGeneral.Architecture.help",
"auto": "auto",
"x86": "x86",
"arm64-v8a": "arm64-v8a",
"armeabi-v7a": "armeabi-v7a"
},
"InjectMethod": {
"name": "HookGeneral.InjectMethod.name",
"help": "HookGeneral.InjectMethod.help",

View File

@@ -735,6 +735,14 @@
"name": "每次启动Alas时重启",
"help": "推荐打开"
},
"Architecture": {
"name": "架构",
"help": "选择使用的架构,如果自动检测失败,请手动选择\n注意如果你修改了架构需要手动删除/data/tmp的所有文件\n游戏库目录中看到的架构和选项的对应关系一般如下\nx86 -> x86\nx86_64 -> x86\narm -> armeabi-v7a\narm64 -> arm64-v8a",
"auto": "自动检测",
"x86": "x86",
"arm64-v8a": "arm64-v8a",
"armeabi-v7a": "armeabi-v7a"
},
"InjectMethod": {
"name": "注入方式",
"help": "",

View File

@@ -735,6 +735,14 @@
"name": "HookGeneral.RestartEverytime.name",
"help": "HookGeneral.RestartEverytime.help"
},
"Architecture": {
"name": "HookGeneral.Architecture.name",
"help": "HookGeneral.Architecture.help",
"auto": "auto",
"x86": "x86",
"arm64-v8a": "arm64-v8a",
"armeabi-v7a": "armeabi-v7a"
},
"InjectMethod": {
"name": "HookGeneral.InjectMethod.name",
"help": "HookGeneral.InjectMethod.help",

View File

@@ -249,12 +249,18 @@ class CrackResource:
def __init__(self, config: AzurLaneConfig, device: Device):
self.config = config
self.device = device
arch_conf = deep_get(config.data, "Hook.HookGeneral.Architecture")
if arch_conf == "auto":
arch_ret = device.adb_shell("uname -m").lower()
self.arch = self.ARCH_MAP.get(arch_ret, "")
if not self.arch:
raise CrackerError(f"Unsupported arch: {arch_ret}")
logger.info(f"Arch: {arch_ret} -> {self.arch}")
else:
logger.info(f"Use arch: {self.arch}")
self.arch = arch_conf
self.resource_root = f"./bin/hook"
self.resource_dir = f"{self.resource_root}/{self.arch}"