fix(compat): pad AC unpack buffers correctly above 2 GB (2026.10.5.23)
AC pads its pack/unpack cursor to 4 bytes with a signed "ptr % 4". In the large-address-aware client a buffer above 0x80000000 gives a negative remainder, AC pads 4 bytes too many, zeroes live data and parses garbage counts: kelpie's open-world crashes in motion-table and setup unpacks (dump 2026-10-10 10:32, motion table 0x09000009 at 0x80438034). Early init now rewrites the 190 padding sites (and r, 0x80000003 followed by the sign fix-up and the "already aligned" je) to and r, 3 in memory. Kill-switch: engine.json EnableLargeAddressAlignmentFix=false. Offline checks in tools/LargeAddressAlignmentTests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
8922c2d06a
commit
fdc7ea71bc
7 changed files with 517 additions and 0 deletions
|
|
@ -0,0 +1,64 @@
|
|||
# RynthCore 2026.10.5.23: fix AC crashes when its memory goes above 2 GB
|
||||
|
||||
Released 2026-10-10. Previous release: 2026.10.5.22 (Buffs picker).
|
||||
No plugin changes; any RynthAi version works with it.
|
||||
|
||||
## What's fixed
|
||||
|
||||
- **Random client crashes on long open-world sessions** (hunting nav routes across many
|
||||
landblocks while fighting and looting). Windows reported them as faults in `acclient.exe`
|
||||
(`+0x1271C3`, `+0x12718B`, `+0x126A70`, `+0x139153`) or, when they passed through an engine
|
||||
hook, in `coreclr.dll`.
|
||||
|
||||
## Cause
|
||||
|
||||
Asheron's Call pads its read and write position to a multiple of 4 bytes when it unpacks dat
|
||||
files and network messages. It works the padding out as a *signed* `address % 4`. The client
|
||||
runs large-address-aware, so once a session has used enough memory, AC gets buffers above
|
||||
2 GB. Their addresses count as negative, the remainder comes out negative, and AC pads 4
|
||||
bytes too many. It then reads every later field from the wrong place, writes zeros over real
|
||||
data, and reads garbage counts until it runs off the end of the memory region.
|
||||
|
||||
A crash dump of kelpie (10 October, 10:32) showed motion table 0x09000009 being unpacked into a
|
||||
buffer at 0x80438034. The data on disk was fine, but 21 bytes of the in-memory copy were zeroed.
|
||||
Replaying AC's padding code at that address zeroes the same 21 bytes, and reads the modifier
|
||||
count as 0xFFFF0000, the value on the crashed stack. At an address below 2 GB the same data
|
||||
unpacks cleanly.
|
||||
|
||||
## The fix
|
||||
|
||||
At startup the engine finds every place in `acclient.exe` that pads this way (190 in the
|
||||
retail client) and changes `and reg, 0x80000003` to `and reg, 3` in memory. The remainder is
|
||||
then 0 to 3 at any address, so AC pads correctly above 2 GB too. Below 2 GB nothing changes.
|
||||
`acclient.exe` on disk is not modified. A site is only changed when it is followed by AC's
|
||||
"already aligned" check, so a signed `% 4` of a value that can really be negative is left
|
||||
alone (one in the retail client: a 16-bit ring index).
|
||||
|
||||
The change stays for the life of the client: a hot reload finds every site already patched
|
||||
and logs `0 site(s) patched, 190 already patched`.
|
||||
|
||||
To turn it off for diagnostics, add `"EnableLargeAddressAlignmentFix": false` to
|
||||
`%APPDATA%\RynthCore\engine.json`. The launcher keeps that setting when it saves.
|
||||
|
||||
## Files
|
||||
|
||||
- `Compatibility/LargeAddressAlignmentScan.cs` (new): the byte-pattern scan for the padding
|
||||
code.
|
||||
- `Compatibility/LargeAddressAlignmentPatch.cs` (new): finds `.text` in the loaded client,
|
||||
rewrites each site's immediate (one byte, page protection restored per site), flushes the
|
||||
instruction cache, and logs the counts.
|
||||
- `EntryPoint.cs`: runs the patch in early init, right after the multi-client hooks.
|
||||
- `Plugins/EngineSettings.cs`: the `EnableLargeAddressAlignmentFix` kill-switch.
|
||||
- `tools/LargeAddressAlignmentTests` (new): offline checks.
|
||||
|
||||
## Checks
|
||||
|
||||
- `tools/LargeAddressAlignmentTests` (31 checks) pass:
|
||||
- The real `acclient.exe` has 190 sites, including the ones in the crash dumps.
|
||||
- The 16-bit ring index is left alone.
|
||||
- A patched image rescans as fully patched.
|
||||
- Bytes that only look like the pattern are refused.
|
||||
- The padding above and below 2 GB comes out as expected.
|
||||
- Release publish of the CoreCLR engine succeeds.
|
||||
- Not yet run in game. The engine log should show
|
||||
`Compat: large-address alignment fix - 190 site(s) patched`.
|
||||
Loading…
Reference in a new issue