diff --git a/projects/4eb30bec-355e-49d6-909c-e7868faef4f7/SOTFAssist 现在不能热更新功能代码.md b/projects/4eb30bec-355e-49d6-909c-e7868faef4f7/SOTFAssist 现在不能热更新功能代码.md new file mode 100644 index 0000000..49d6e2b --- /dev/null +++ b/projects/4eb30bec-355e-49d6-909c-e7868faef4f7/SOTFAssist 现在不能热更新功能代码.md @@ -0,0 +1,27 @@ +--- +title: SOTFAssist 现在不能热更新功能代码 +type: fact +permalink: main/projects/4eb30bec-355e-49d6-909c-e7868faef4f7/sotfassist-现在不能热更新功能代码 +stable_id: 20bf5f92-7790-4226-b9e4-519ea78b06ce +scope: project +memory_type: fact +project_id: 4eb30bec-355e-49d6-909c-e7868faef4f7 +usage_profile_id: 0c9feb46-d06e-43cd-9ef0-c5813c84a998 +status: active +revision: 1 +request_id: sotfassist-hotreload-eval-20261020 +created_at: '2026-10-19T20:17:36.270190+00:00' +updated_at: '2026-10-19T20:17:36.270190+00:00' +tags: +- SOTFAssist +- hotreload +- RedLoader +--- + +现在这套结构下,游戏开着时只改 SOTFAssist 功能代码不能热更新,必须退出游戏再进。界面 Ui/AssistView.cs 和 Harmony 补丁都在同一个 SOTFAssist.dll。编译复制到 Mods\SOTFAssist.dll。RedLoader 0.8.6 用 Assembly.LoadFrom 载入 Mods 里的模组,进程会锁住这个文件,且不会重载已加载的模组。构造函数里 HarmonyPatchAll = true,启动时对整个程序集 PatchAll 一次。 + +之前对话里看到的是第三方模组 Mod Hot Reloader v1.0.1(OhMyJeeves,2024-07,https://sotf-mods.com/mods/ohmyjeeves/mod-hot-reloader)。游戏目录没有装它,UnityExplorer 也只剩配置、没有 DLL。它要求另建不自动安装的工程,改 DLL 后用控制台命令 InvokeMethodWithinHotLoadedMod 手动调用,作者写明不适合界面,也不会自动替换已经挂上的 Harmony 补丁。 + +RedLoader 0.8.6 自带的是另一套:UserData\_Redloader.cfg 里 enable_script_loader 现在是 false。打开后只监视游戏根目录 Scripts\*.dll,类必须继承 RedScript,不要 manifest。文件变化约 1 秒后读入内存并改名程序集再 Assembly.Load,调 OnUnload 再 OnLoad。不会自动 Unpatch,旧程序集卸不掉。配置说明写的是 experimental。游戏里现在没有 Scripts 目录,日志也没有重载记录。这个也不能直接重载已经在 Mods 里跑着的 SOTFAssist。 + +以后若要少重启,最小改法是:界面留在原模组;功能补丁单独做成 RedScript,编译到 Scripts;开关状态留在不重载的界面程序集;OnLoad 自己打补丁,OnUnload 必须卸掉 Harmony 和 Il2Cpp 回调。改界面仍要重启。本次只评估,没有实现。 \ No newline at end of file