Repository navigation
feat(mfw): PC 游戏支持通过链接启动,由脚本控制时由 MAS 兜底关闭 - #1982
Merged
qiyinxi merged 3 commits intoNov 13, 2026
Merged
Conversation
- Game.LaunchMode 新增 URL:MAS 打开 Game.URL(如 steam://rungameid/<appid>)拉起游戏, Game.LaunchPath 只用来识别;按 exe + 启动时刻找进程,时限 max(WaitTime, 60), 关闭时兜底结束启动后出现的同 exe 进程;不使用 Game.Arguments - 新增 Game.CloseMode(Script / OnFailure / Always,默认 OnFailure)与可选 Game.LauncherPath: AttachOnly 下最终收尾按控制器窗口、游戏 exe、启动器 exe 收集候选,只关本次运行开始后 出现的进程,重试之间不关 - 编辑页 Win32 区块拆到 MaaFWDesktopGameFields,启动方式三项,补齐三种语言词条 - 重新生成受影响的 OpenAPI 模型,更新 app/task/MaaFW/AGENTS.md
Contributor
总体结论:修改后合并宝宝,把脚本模式的关闭动作留到最终收尾,没有在重试之间乱关游戏,这点处理对啦。不过“运行前已经开着的进程不碰”还差一道边界,先补好再合喵。 [逻辑 · P2] 关闭筛选会误收运行前两秒内启动的进程按源码静态推演:用户先打开游戏,1 秒后启动账号任务。选择“由脚本自身控制游戏”,再遇到默认 OnFailure 的失败收尾,或选择 Always,最终收尾会从窗口 PID、游戏 exe、启动器 exe 中找匹配进程。这里用 AttachOnly 没有启动前的“已运行则接管”保护,也没保存并排除已有进程;结束前复核创建时间只能防 PID 被复用,拦不住这个场景。原先 AttachOnly 不执行这段关闭,所以这是新增的误关风险。查找刚启动进程时允许时间容差,不等于结束进程时也能把权限往前放宽两秒呀。 请在这条关闭路径严格排除运行前创建的进程;若确实需要保留时间容差,就在运行开始时记录已有进程身份,并在关闭时排除。把“提前 1 秒打开的进程保留、本次启动的进程可按配置关闭”做成随 PR 提交的回归测试,别只留在本机。 —— 替已打开的游戏守住关闭边界的 dot酱 🐾 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
steam://rungameid/...这类链接,再按「游戏 exe + 启动时间」找到游戏进程。等待上限是max(等待时间, 60)秒。游戏已经在运行就直接接管,不再打开链接。ControlConfigSection.vue拆到MaaFWDesktopGameFields.vue,三种语言都已补齐。OpenAPI 已重新生成。测试与验证
.venv\Scripts\python.exe -m pytest tests结果是 2099 passed, 1 skipped。corepack yarn typecheck和corepack yarn lint退出码都是 0。tests/task/test_maafw_game_close_link.py共 13 条,覆盖链接启动、接管已运行的游戏、超时后晚到、各关闭方式乘以成功/失败、重试之间不关、关不掉写日志。改坏验证:去掉收尾时的兜底扫描后,test_url_mode_game_arriving_after_timeout_is_closed_at_teardown变红。1a0efc900,基于ad3de270e。Windows 11,Python 3.12.13(uv 锁定环境)。open_protocol原有的行为。Games.exe)不会被关。steam://rungameid/431960(Wallpaper Engine):拉起后 2 秒按 exe 认出进程。控制器窗口没就绪导致失败,收尾时关掉了它和子进程,没有残留。