Repository navigation
Conversation
The Witcher 3 5.0 update (build 5.0.0.1041720) sends every string in its debug protocol replies as UTF-8. Older builds sent some of them as UTF-16. rw3d decoded those with string_utf16(), which failed with "Type mismatch", so every command that returns text broke against 5.0: rootpath timed out, and reload stopped at the first compiler log line. string_utf16() and fixed_string_utf16() now accept either encoding, so older builds keep working unchanged. Requests are still sent as before; the 5.0 game accepts them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The localized change preserves the UTF-16 path and tests the new UTF-8 path.
Review effort: Balanced
Findings: None
What changed in this PR
This PR makes rw3d compatible with Witcher 3 5.0 debug replies that send UTF-8 strings where earlier builds sent UTF-16.
Changes:
- Accept either string type when reading UTF-16-expected fields, including fixed strings.
- Add a test for both formats and rejection of an unrelated type.
| File | Description |
|---|---|
crates/net/src/protocol/packet_assembly.rs |
Adds compatible string decoding and a unit test. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problem
In the 5.0 update of The Witcher 3 (Steam build 5.0.0.1041720), the debug protocol replies send every string as UTF-8. Older builds sent some of them as UTF-16. rw3d reads those with
WitcherPacketDisassembler::string_utf16(), which rejects aStringUTF8item, so any command whose reply contains text fails against 5.0:rootpath/modlist: the reply comes back (visible with-v, e.g.ScriptCompiler/RootPathConfirm/ the path asStringUTF8), but it's dropped and the command ends withWaited too long for the response.reload: the game starts compiling, then the client fails on the first compiler log line withlog::message: Type mismatch.Change
string_utf16()now accepts aStringUTF16or aStringUTF8item, andfixed_string_utf16()goes through it. Older builds send UTF-16, which is decoded exactly as before. Outgoing requests are unchanged, since the 5.0 game accepts them as they are. There's a unit test for the new behaviour, and all 28rw3d_nettests pass.Tested
Against the 5.0 game on Windows, started with
-net -debugscripts:rootpathandmodlistreturn their results.reloadstreams the full compiler output and ends withScript compilation finished successfully.execruns an exec function and streams its script log output.I haven't tested against a pre-5.0 build, but those replies still go through the old UTF-16 path.
AI Usage Disclosure
🤖 Generated with Claude Code