Repository navigation
GameTrans 1.4.0
GameTrans 1.4.0
热键兼容性修复 · F9 输入框稳定性修复 · 新增「模拟输入」
修复 / Fixes
中文
- 部分游戏里单键 F8 / F9 没反应(必须 Ctrl+F8 之类组合键才行):热键被其他程序独占时
RegisterHotKey注册会直接失败;部分游戏使用 DirectInput / 独占全屏,按键不经过消息泵,注册成功却收不到WM_HOTKEY。1.4.0 起键盘热键在原生注册之外同时启用 15 msGetAsyncKeyState轮询兜底,两条通道按毫秒时间窗去重、同一次按键只触发一次;注册失败不再等于不可用,托盘会提示「已自动启用轮询兼容模式」。依然不安装任何全局钩子。 - 快速连按 F8 / F9 会叠出多个窗口:F9 以前每次触发都新建输入窗;选区窗口是模态对话框,其消息循环里热键仍会派发回来,连按还会叠出多个选区窗口。现在输入窗为单实例(已打开时再按 F9 只重新聚焦),选区期间忽略热键,F8/F9 另有 180 ms 去重。
- 英雄联盟等游戏里 F9 输入框:翻译结束后 3 秒不消失、Enter / Esc 无效、关闭按钮点不中要连点几次:
- 前台焦点:游戏持前台锁时
Show()+Activate()会被系统拒绝,窗口可见但键盘焦点仍在游戏,Enter / Esc 全部送进游戏。改用AttachThreadInput + SetForegroundWindow强制接管前台,失败时短时重试,用户切回游戏立即停止。 - 自动关闭:旧版只在剪贴板复制成功时才启动 3 秒倒计时;游戏客户端 / 加速器占用剪贴板时复制失败,窗口就永远不关。现在翻译成功后一定自动关闭(复制成功 3 秒、复制失败 5 秒并提示 Enter 重试),任意按键取消倒计时。
- 键盘路由:Esc / Enter 从输入框按键处理提升到窗口级,点过按钮后依然有效。
- 点击偏移:状态文字不再参与命中测试并与按钮分列(长文案会盖住按钮吞掉点击);窗口改用物理像素定位并处理 DPI 变化,消除逐显示器 DPI 下的「看得到、点不到」。
- 前台焦点:游戏持前台锁时
English
- Single-key F8 / F9 ignored in some games (only Ctrl+F8 worked):
RegisterHotKeyfails outright when another program owns the hotkey, and some games (DirectInput / exclusive fullscreen) keep keys away from the message pump soWM_HOTKEYnever arrives. Keyboard hotkeys now also run a 15 msGetAsyncKeyStatepolling fallback; the two channels de-duplicate the same physical press, so nothing fires twice. A failed registration no longer means "unusable" — a toast reports the polling fallback. No global hooks are installed. - Rapid F8 / F9 presses no longer stack windows: the F9 box is now single-instance (pressing F9 again refocuses it), region selection ignores hotkeys while open, and F8/F9 have a 180 ms de-dup guard.
- F9 box in games such as League of Legends: never closed after translating, Enter / Esc did nothing, close button hard to hit:
- Foreground focus is now taken with
AttachThreadInput + SetForegroundWindow(short retry, stops as soon as you switch back), so keys actually reach the box. - The box now always auto-closes after a successful translation: 3 s when the copy succeeded, 5 s when the clipboard was busy (Enter retries). Any key cancels.
- Enter / Esc are handled at window level, so they work after clicking a button too.
- Status text no longer covers the buttons, and the window is positioned in physical pixels, removing per-monitor DPI click offsets.
- Foreground focus is now taken with
新增 / What's new
中文
- 设置页「翻译行为」新增 模拟输入 开关(配置字段
behavior.simulateInput,默认关闭)。开启后 F9 翻译完成不写剪贴板,而是把译文用SendInput(Unicode 字符)直接键入当前游戏窗口;会先把前台还给游戏并确认游戏窗口重新获得焦点再开始键入,键入期间临时挂起热键。请先打开游戏聊天输入框,程序不会自动按 Enter 发送。
English
- New Simulated input switch under Settings → Translation (
behavior.simulateInput, off by default). With it enabled the F9 result is typed straight into the current game window viaSendInput(Unicode) instead of the clipboard. The app returns the foreground to the game, verifies the game window is focused again before typing, and suspends hotkeys while typing. Open the in-game chat box first — the app does not press Enter for you.
下载 / Download
GameTrans.exe— Windows x64, self-contained single file, no .NET runtime required, no administrator rights required.
升级说明 / Upgrade notes
- 配置与 1.3.x 兼容,新增
behavior.simulateInput(缺省false,保持原来的剪贴板方案)。/ Configuration is compatible with 1.3.x; the newbehavior.simulateInputdefaults tofalse, keeping the clipboard workflow. - 模拟输入需要目标游戏窗口能接收字符消息;若游戏以管理员权限运行,非管理员进程的模拟输入会被 UIPI 拦截,程序会自动退回复制到剪贴板并提示。/ Simulated input needs the game window to accept character messages. If the game runs elevated, UIPI blocks simulated input from a non-elevated process and the app falls back to the clipboard automatically.
- 若单键热键仍与游戏内绑定冲突(游戏和翻译同时响应),建议改用
Ctrl/Alt组合键。/ If a single-key hotkey still collides with the game's own binding, use aCtrl/Altcombination.
项目主页 / Project: https://github.com/ab-Royo/GameTrans
QQ 群 / QQ group: 419733401
Bilibili: https://m.bilibili.com/space/51952428