复核驱动输入与窗口补丁,修复接管互斥和异常清理

Browse Source
This commit is contained in:
yws
2026-10-22 06:52:39 +00:00
parent e2de126687
commit 46b5af01cd
10 changed files with 667 additions and 176 deletions
+26 -29
View File
@@ -11,8 +11,8 @@ import sys
from . import preflight from . import preflight
from .aalc_engine import bootstrap from .aalc_engine import bootstrap
from .aalc_patches import (WindowGuard, install_driver_click, install_exact_team_match, from .aalc_patches import (WindowGuard, driver_click_tasks, install_exact_team_match,
install_robust_set_foreground) install_robust_set_foreground)
# 任务 -> {参数名: AALC 配置项}; 参数只在本次运行内生效 # 任务 -> {参数名: AALC 配置项}; 参数只在本次运行内生效
TASKS = { TASKS = {
@@ -88,34 +88,31 @@ def run(task, params):
guard.start() guard.start()
restore_path = os.environ.get(RESTORE_ENV) restore_path = os.environ.get(RESTORE_ENV)
originals = apply_overrides(cfg, task, params, restore_path) originals = apply_overrides(cfg, task, params, restore_path)
try: with driver_click_tasks(scheme, auto, screen, cfg, log=log):
if task == 'all': try:
scheme.script_task() if task == 'all':
scheme.script_task()
return 0
# 与 script_task() 相同的前置步骤
scheme.init_game()
path_manager.initialize_paths()
auto.clear_img_cache()
retry_monitor.start()
get_reward = None
if auto.click_element('battle/turn_assets.png', take_screenshot=True):
print('[lc_mcp] 检测到正在战斗, 先打完', flush=True)
get_reward = battle.fight()
{
'daily': scheme.Daily_task_wrapper(get_reward=get_reward),
'reward': scheme.to_get_reward,
'enkephalin': scheme.Buy_enkephalin,
'mirror': scheme.Mirror_task,
}[task]()
return 0 return 0
# 与 script_task() 相同的前置步骤 finally:
scheme.init_game() guard.stop()
# ⚠ 必须放在 init_game() 之后: 它会把 auto.input_handler 重建一次, retry_monitor.stop()
# 放在前面装好的代理会被覆盖掉(2026-10-22 实测: 日志有 patch 记录但代理从未被调用)。 restore(cfg, originals, restore_path)
if os.environ.get('LCP_DRIVER_INPUT', '').strip() == '1':
install_driver_click(auto, screen, log=log)
path_manager.initialize_paths()
auto.clear_img_cache()
retry_monitor.start()
get_reward = None
if auto.click_element('battle/turn_assets.png', take_screenshot=True):
print('[lc_mcp] 检测到正在战斗, 先打完', flush=True)
get_reward = battle.fight()
{
'daily': scheme.Daily_task_wrapper(get_reward=get_reward),
'reward': scheme.to_get_reward,
'enkephalin': scheme.Buy_enkephalin,
'mirror': scheme.Mirror_task,
}[task]()
return 0
finally:
guard.stop()
retry_monitor.stop()
restore(cfg, originals, restore_path)
def main(argv): def main(argv):