Repository navigation
fix(app): reinitialize the engine when reopening RFVP games - #383
Merged
Merged
Conversation
Returning to the library destroys the native engine while retaining the player Node and runtime kind. Reuse a matching player only while its engine remains initialized so RFVP can set its encoding before opening the next session. Add behavioral regressions for repeated reopening, restored settings, initialization failure and retry. Validate the macOS Debug build with RFVP and AetherInternal enabled, five Godot script suites, and normal-library first launch, natural exit, second launch and Chinese story input in Astrea.
Add an opt-in library launch mode to the runtime regression probe so pre-open RFVP options execute through the production launch path without eager initialization. Record engine lifetime and actual presented-frame statistics, and cover host-requested and natural exits. Skip empty iOS seed copies because the app creates the isolated writable root at initialization. Validation passed on macOS and an iPad mini (A17 Pro, iPadOS 26.5.2): 23 automatic steps, four RFVP sessions, two host exits, one natural game exit, presented frames, engine cleanup and process shutdown. Godot probe/reopen contracts and five Python runner checks also passed.
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.
RFVP 游戏首次启动正常,但退出回到媒体库后,在同一 App 进程内再次启动会弹出
engine is not initialized。本 PR 修复退出后的引擎重建,使游戏可以直接再次启动。原因
退出流程调用
player.destroy_engine()销毁内部引擎句柄,同时保留播放器 Node 和当前引擎类型。原来的_switch_runtime_player()只检查播放器对象和引擎类型,相同类型便直接返回成功。RFVP 会在
_on_open_game()之前设置rfvp_encoding。第二次启动时,这个选项写入发生在句柄已销毁、初始化尚未执行的阶段,因此返回INVALID_STATE,后续打开游戏的初始化路径也无法执行。首次启动正常,是因为 App 启动时已经初始化了句柄。修复方案
player.is_initialized():播放器存在、引擎类型一致且句柄仍有效时才直接复用。launch_mode: "library",通过生产启动链路执行 RFVP 的前置选项;探针不会预先初始化引擎,从而能够检出原来的跳过初始化问题。iPad 真机自动测试
2026-10-25,在 iPad mini(A17 Pro)、iPadOS 26.5.2 上安装签名的 iOS arm64 Debug 测试包,启用 RFVP 和 AetherInternal,使用 《アストラエアの白き永遠》及显式 GBK 编码设置验证。游戏操作全部由脚本执行。
结果:23/23 步通过,0 个失败步骤;4 次启动、3 轮退出后重开,耗时 65.879 秒。
脚本还验证了:
engine is not initialized、SCRIPT ERROR、Game launch failed和Tick failed均为 0。cleanup_complete.exit_code = 0,设备测试进程已停止;测试前的配置、游戏库和封面元数据已按字节恢复并校验。验证范围为启动、退出后重开、输入触发游戏内退出、帧呈现和引擎清理。
其他验证
runtime_player_reopen_test.gd、runtime_regression_probe_test.gd、runtime_regression_touch_test.gd、RFVP 导入配置、启动入口、输入映射及存储切换检查通过。git diff --check通过。修复提交:
06fbe06e。自动测试支持及 iPad 真机验证提交:cfb782d4。合并前复查补齐了触屏回归测试中模拟播放器的
is_initialized()接口(732602b3),并再次运行重开、探针、触屏三项 Godot 回归及 Python runner 的 5 项检查,全部通过。该提交仅修改测试夹具,生产逻辑和 iPad 自动测试使用的探针代码均未改动。