mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-30 02:47:13 +08:00
Fix: Unable to get activity level (MAA)
This commit is contained in:
@@ -50,11 +50,15 @@ class ArknightsAutoScript(AzurLaneAutoScript):
|
|||||||
|
|
||||||
logger.info(f'MAA安装路径:{self.config.MaaEmulator_MaaPath}')
|
logger.info(f'MAA安装路径:{self.config.MaaEmulator_MaaPath}')
|
||||||
try:
|
try:
|
||||||
incremental_path = None
|
incremental_path = [os.path.join(self.config.MaaEmulator_MaaPath, './cache')]
|
||||||
if self.config.MaaEmulator_PackageName in ["YoStarEN", "YoStarJP", "YoStarKR", "txwy"]:
|
if self.config.MaaEmulator_PackageName in ["YoStarEN", "YoStarJP", "YoStarKR", "txwy"]:
|
||||||
incremental_path = os.path.join(
|
incremental_path.append(os.path.join(
|
||||||
self.config.MaaEmulator_MaaPath,
|
self.config.MaaEmulator_MaaPath,
|
||||||
'./resource/global/' + self.config.MaaEmulator_PackageName
|
'./resource/global/' + self.config.MaaEmulator_PackageName)
|
||||||
|
)
|
||||||
|
incremental_path.append(os.path.join(
|
||||||
|
self.config.MaaEmulator_MaaPath,
|
||||||
|
'./cache/resource/global/' + self.config.MaaEmulator_PackageName)
|
||||||
)
|
)
|
||||||
AssistantHandler.load(self.config.MaaEmulator_MaaPath, incremental_path)
|
AssistantHandler.load(self.config.MaaEmulator_MaaPath, incremental_path)
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Asst:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(path: Union[pathlib.Path, str], incremental_path: Optional[Union[pathlib.Path, str]] = None,
|
def load(path: Union[pathlib.Path, str], incremental_path: Optional[Union[pathlib.Path, str, list]] = None,
|
||||||
user_dir: Optional[Union[pathlib.Path, str]] = None) -> bool:
|
user_dir: Optional[Union[pathlib.Path, str]] = None) -> bool:
|
||||||
"""
|
"""
|
||||||
加载 dll 及资源
|
加载 dll 及资源
|
||||||
@@ -46,17 +46,18 @@ class Asst:
|
|||||||
'environ_var': 'LD_LIBRARY_PATH'
|
'environ_var': 'LD_LIBRARY_PATH'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lib_import_func = None
|
|
||||||
|
|
||||||
platform_type = platform.system().lower()
|
platform_type = platform.system().lower()
|
||||||
if platform_type == 'windows':
|
if platform_type == 'windows':
|
||||||
lib_import_func = ctypes.WinDLL
|
lib_import_func = ctypes.WinDLL
|
||||||
|
# Todo: MAA v4.12.0正式版更新之后删除
|
||||||
# 手动加载onnxruntime.dll以避免部分版本的python错误地从System32加载旧版本
|
# 手动加载onnxruntime.dll以避免部分版本的python错误地从System32加载旧版本
|
||||||
try:
|
try:
|
||||||
lib_import_func(str(pathlib.Path(path) / 'onnxruntime.dll'))
|
lib_import_func(str(pathlib.Path(path) / 'onnxruntime.dll'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
pass
|
pass
|
||||||
|
# Todo
|
||||||
else:
|
else:
|
||||||
lib_import_func = ctypes.CDLL
|
lib_import_func = ctypes.CDLL
|
||||||
|
|
||||||
@@ -74,8 +75,13 @@ class Asst:
|
|||||||
|
|
||||||
ret &= Asst.__lib.AsstLoadResource(str(path).encode('utf-8'))
|
ret &= Asst.__lib.AsstLoadResource(str(path).encode('utf-8'))
|
||||||
if incremental_path:
|
if incremental_path:
|
||||||
ret &= Asst.__lib.AsstLoadResource(
|
if isinstance(incremental_path, list):
|
||||||
str(incremental_path).encode('utf-8'))
|
for i_path in incremental_path:
|
||||||
|
ret &= Asst.__lib.AsstLoadResource(
|
||||||
|
str(i_path).encode('utf-8'))
|
||||||
|
else:
|
||||||
|
ret &= Asst.__lib.AsstLoadResource(
|
||||||
|
str(incremental_path).encode('utf-8'))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user