Skip to content

迁移到 Reforge 无 Harmony 重写版并修复 beta 兼容问题和超过 7 人无法联机问题 - #23

Open
zuiter wants to merge 6 commits into
Rain156:mainfrom
zuiter:reforge-migration-0.1.8-beta
Open

迁移到 Reforge 无 Harmony 重写版并修复 beta 兼容问题和超过 7 人无法联机问题#23
zuiter wants to merge 6 commits into
Rain156:mainfrom
zuiter:reforge-migration-0.1.8-beta

Conversation

@zuiter

@zuiter zuiter commented May 27, 2026

Copy link
Copy Markdown

修改内容

本 PR 将旧的 Harmony 实现迁移为 Reforge 无 Harmony 重写版。
主要改动:

  • 移除旧 Harmony patch 实现,改为 ModInitializer + ReflectionCache + Godot 节点模块
  • 使用 RMP 扩展大厅协议处理 5-16 人大厅同步
  • 修复 beta 0.106 中第一个宝箱后可能数据不同步的问题
  • 修复 beta 0.106.1 下 INetMessage.ShouldBuffer 导致的模组加载失败
  • 更新 README.md / README_ZH.md,保留截图、功能说明、配置说明和鸣谢
  • 删除旧的已跟踪 build/ 二进制产物
  • 发布脚本改为自动解析 sts2.dllSteamworks.NET.dll

说明

Reforge 版本不再使用 Harmony / MonoMod / Transpiler,也不再依赖运行时方法替换。
当前实现通过游戏自带的 Mod 初始化入口加载模块,并使用反射缓存、Godot 节点轮询和 RMP 扩展网络协议来处理多人大厅、UI 布局、宝箱房和难度缩放等功能。
0.1.8-beta 中房间人数上限固定为 16,旧配置中的 max_player_limit 会被忽略;配置文件仅保留 difficulty_scaling 和 macOS TLS 兼容补丁相关选项。

已验证

  • dotnet build .\RemoveMultiplayerPlayerLimit.csproj -c Release 通过
  • tools/build_release.ps1 完整打包通过
  • 成功生成 sts2-RMP-0.1.8-beta.zip
  • git diff --cached --check 通过
  • 确认源码和 .csproj 中没有 Harmony / MonoMod patch 引用

未验证

  • 尚未进行真实 5-16 人联机实测
  • macOS / Linux 运行环境未实机验证

Replace the old runtime-patching implementation with the Reforge module system: official mod initializer, reflection cache, injected Godot nodes, and the RMP extended lobby protocol for large-lobby synchronization. The migration also refreshes player-facing README content, restores screenshot assets and contributor credits, removes tracked build outputs, and teaches release scripts to resolve both sts2.dll and Steamworks.NET.dll from the installed game.

Constraint: Current project rules forbid Harmony, MonoMod, runtime transpilers, and JSON config files.
Constraint: Slay the Spire 2 beta 0.106.1 requires INetMessage.ShouldBuffer to be compiled against the current game assembly.
Rejected: Patch the old Harmony implementation in place | this PR is intentionally the Reforge migration requested by maintainers.
Rejected: Commit generated DLL/PCK/ZIP artifacts | build outputs are reproducible and already ignored.
Confidence: medium
Scope-risk: broad
Directive: Do not reintroduce runtime patching frameworks; keep game-internal access behind ReflectionCache and RMP protocol boundaries.
Tested: dotnet build .\RemoveMultiplayerPlayerLimit.csproj -c Release with installed beta sts2.dll and Steamworks.NET.dll
Tested: powershell -ExecutionPolicy Bypass -File tools\build_release.ps1 -Configuration Release -Sts2AssemblyPath <installed sts2.dll> -SteamworksAssemblyPath <installed Steamworks.NET.dll>
Tested: git diff --cached --check
Not-tested: In-game multiplayer session with 5-16 real clients
@zuiter
zuiter force-pushed the reforge-migration-0.1.8-beta branch from 7666149 to e6670c9 Compare May 27, 2026 10:59
zuiter added 5 commits June 19, 2026 21:31
The current game renamed StartRunLobby's private beginning-run flag and still serializes vanilla lobby player slot IDs with two bits. If RMP's button rewiring misses the original ready callback, five-plus-player lobbies can fall back to the vanilla ready/start path and fail to start correctly until the lobby drops back to four players. The fix keeps the beginning-run reflection compatible with the new field name, disconnects vanilla ready button callbacks by inspecting the signal connection list, and adds a host-side extended-start retry while the lobby is active.

Constraint: Do not change version numbers for 0.1.8-beta

Constraint: Keep the Reforge migration free of Harmony, MonoMod, PatchAll, and runtime method replacement

Rejected: Rely only on periodic host polling | host-local vanilla ready can run before the polling tick when the host is the last ready player

Confidence: medium

Scope-risk: narrow

Directive: Do not route five-plus-player begin-run through vanilla LobbyBeginRunMessage because LobbyPlayer.slotId still serializes with two bits

Tested: dotnet build Release against Slay the Spire 2 v0.107.1 assemblies

Tested: tools/build_release.ps1 with Godot 4.5.1 generated build/sts2-RMP-0.1.8-beta.zip

Not-tested: Real five-plus-player multiplayer lobby after the game update
The build has moved out of the beta-suffixed package name, so the manifest, startup log, readmes, and changelog headings now use 0.1.8. The release script derives the archive name from the manifest version, producing sts2-RMP-0.1.8.zip.

Constraint: User explicitly requested renaming the version to 0.1.8

Scope-risk: narrow

Confidence: high

Tested: dotnet build Release against current Slay the Spire 2 assemblies

Tested: tools/build_release.ps1 generated build/sts2-RMP-0.1.8.zip

Not-tested: Real multiplayer session with the renamed package
The extended lobby snapshot now adopts the host's complete player order before notifying listeners, preventing peers from retaining divergent lobby ordering. The English and Chinese READMEs now describe 0.1.8 as the formal Reforge release and record its v0.107.1/v0.108.0 compatibility status.

Constraint: Version must remain 0.1.8 and the shared protocol must stay compatible with v0.107.1
Rejected: Add a v0.108-only implementation branch | current game contracts and the RMP wire format remain compatible
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep lobby.Players in host snapshot order before dispatching connection or state-change callbacks
Tested: Full Release package build against v0.108.0; reflection contract checker; PCK cover load; git diff --cached --check
Not-tested: Live 5-16 player multiplayer session; final DLL launch after switching the installed game back to v0.107.1
Slay the Spire 2 v0.109.0 can connect the vanilla ready callbacks after RMP's first screen pass, routing extended-slot readiness through the unsafe vanilla protocol. Maintain stable RMP callables continuously, isolate each maintenance lane, and support the settings panel's new reflection signature while retaining older behavior.

Constraint: Keep the mod version at 0.1.8
Constraint: Preserve compatibility with v0.107.1 and v0.108.0 without changing the extended lobby wire format
Constraint: Keep the Reforge build free of Harmony, MonoMod, transpilers, and runtime method replacement
Rejected: Patch each lobby screen only once | v0.109.0 screen initialization can reconnect vanilla callbacks after that pass
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Do not route 5+ player ready or begin-run flow through vanilla LobbyBeginRunMessage because LobbyPlayer.slotId remains two-bit serialized
Tested: dotnet build Release against Slay the Spire 2 v0.109.0 assemblies with zero warnings and errors
Tested: reflection compatibility check passed against v0.109.0 commit c12f634d
Tested: tools/build_release.ps1 generated build/sts2-RMP-0.1.8.zip
Tested: launched v0.109.0 to main menu; RMP initialized and logged active ready-handler maintenance without RMP exceptions
Not-tested: Real five-plus-player multiplayer session
Player logs from v0.109.0 showed the extended begin-run path bypassing vanilla message buffering while repeated lobby snapshots disposed PeerInputSynchronizer through remote cursor reinitialization. Match the vanilla transition order and leave cursor synchronizer lifecycle to the lobby screens that own it.

Constraint: Version remains 0.1.8 and protocol v2 remains unchanged for v0.107.1 compatibility

Rejected: Reinitialize the remote cursor container after each snapshot | the game disposes the synchronizer and unregisters its PeerInputMessage handler

Confidence: high

Scope-risk: narrow

Directive: Do not initialize the remote cursor container from the snapshot path without first proving the existing synchronizer will not be disposed

Tested: v0.109.0 Release build (0 warnings, 0 errors); reflection and compiled-IL call-order checks; full 0.1.8 release package; main-menu startup

Not-tested: Real 5+ player multiplayer run; v0.107.1 runtime on a live client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant