add 硬件控制模块 (hardware_control.py) 并修复游戏状态扫描区域宽度

- 新增 wyhkm.dll 硬件盒子 COM 接口封装,支持键盘鼠标控制
- 修复 game_state_config.json 中 scan_region_width 过小导致截图越界的问题
- 添加鼠标路径录制器、硬件测试脚本等工具
- 更新多项配置默认值

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
王鹏
2026-04-15 12:15:00 +08:00
parent b4de5278ed
commit 33dc741fd9
203 changed files with 12197 additions and 247 deletions

View File

@@ -1,7 +1,7 @@
import math
import time
import random
import pydirectinput
from hardware_control import hw_ctrl
class StuckHandler:
# 针对 0.xxxx 坐标系优化
@@ -61,27 +61,27 @@ class StuckHandler:
# 1. 全停
for k in ("w", "a", "d", "s"):
pydirectinput.keyUp(k)
hw_ctrl.keyUp(k)
# 2. 倒车并转向(组合动作更有效)
pydirectinput.keyDown("s")
hw_ctrl.keyDown("s")
turn_key = random.choice(["a", "d"])
pydirectinput.keyDown(turn_key)
hw_ctrl.keyDown(turn_key)
# 倒车时间稍长一点,离开障碍物
time.sleep(0.5)
# 3. 尝试跳跃脱离地形卡位
pydirectinput.press("space")
hw_ctrl.press("space")
time.sleep(0.5)
pydirectinput.keyUp(turn_key)
pydirectinput.keyUp("s")
hw_ctrl.keyUp(turn_key)
hw_ctrl.keyUp("s")
# 4. 往前稍微走一步,重新锁定坐标
pydirectinput.keyDown("w")
hw_ctrl.keyDown("w")
time.sleep(0.5)
pydirectinput.keyUp("w")
hw_ctrl.keyUp("w")
self.reset()
print(">>> 脱困尝试结束")