Skip to content

Fix crashes with game client v48084#111

Closed
a5ehren wants to merge 6 commits intonetniV:devfrom
a5ehren:crash_tests
Closed

Fix crashes with game client v48084#111
a5ehren wants to merge 6 commits intonetniV:devfrom
a5ehren:crash_tests

Conversation

@a5ehren
Copy link
Copy Markdown
Contributor

@a5ehren a5ehren commented Mar 13, 2026

Introduce SAFE_STATIC_DETOUR macro that validates IL2CPP method parameter counts before installing hooks, preventing crashes from game signature changes. Applied to all patch files replacing manual GetMethod/null-check patterns.

Key fixes:

  • object_tracker: null guards for .ctor/OnDestroy resolution, GC finalizer null check, and signature scan size check before .get(0)
  • sync: update ProcessResultInternal hook from 4 to 2 params (v48084 API change), disable on ARM64 where spud trampoline can't relocate prologue
  • All patches now log actual parameter types on signature mismatch

a5ehren and others added 5 commits March 13, 2026 14:28
Introduce SAFE_STATIC_DETOUR macro that validates IL2CPP method parameter
counts before installing hooks, preventing crashes from game signature
changes. Applied to all patch files replacing manual GetMethod/null-check
patterns.

Key fixes:
- object_tracker: null guards for .ctor/OnDestroy resolution, GC finalizer
  null check, and signature scan size check before .get(0)
- sync: update ProcessResultInternal hook from 4 to 2 params (v48084 API
  change), disable on ARM64 where spud trampoline can't relocate prologue
- All patches now log actual parameter types on signature mismatch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…hods

Zoom: Disable SetDepth hook on macOS (ARM64 trampoline hang), expand zoom
range per-frame in Update hook instead. Use AnimateToZoomDistance for
absolute zoom presets to work with v48084's lerp-based animation system.
Simplify all zoom hooks to call original first, then override _maximum.

Sync: Rename HandleBinaryObjects to ParseBinaryObjectsHelper (2 params).
Comment out SlotDataContainer slot hooks pending rewrite for new API
(UpdateSlotData/RemoveSlotData with EntitySlot signature).

Safe detour: Add DumpClassMethods/DumpClassFields diagnostics, auto-dump
methods when SAFE_STATIC_DETOUR fails to find a method.

NavigationZoom.h: Add AnimateToZoomDistance method wrapper.

DMG script: Fix universal binary build with proper output directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
LDR literal (PC-relative load) instructions in hooked function prologues
were copied verbatim to trampolines without relocation, causing crashes
on Apple Silicon when the now-incorrect PC-relative offset pointed to
garbage memory. This adds detection in needs_relocate() and a new
ldr_literal_relocator that uses double-dereference (embed address, load
address, then dereference) to correctly handle LDR X, LDR W, and LDRSW
literal variants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GameServerModelRegistry and PlatformModelRegistry share the same compiled
ProcessResultInternal methodPointer on macOS ARM64. The second
SPUD_STATIC_DETOUR captured the first hook's absolute jump as the
"original prologue", creating a broken trampoline with UDF instructions
that crashed with EXC_BAD_INSTRUCTION.

Add a double-hook guard to SAFE_STATIC_DETOUR that tracks hooked
addresses and skips duplicates. Also add info-level logging of each
hook's target address and first instruction for diagnostics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add hidden MethodInfo* parameter to macOS ProcessResultInternal and
  ParseBinaryObjectsHelper hooks (fixes EXC_BAD_ACCESS in _gshared methods)
- Fix AnimateToZoomDistance to pass full IL2CPP method signature with
  MethodInfo* (fixes Delegate_Combine crash on zoom presets)
- Split sync hook implementations into proper #if _WIN32 / #else blocks
- Remove verbose per-hook success log from SAFE_STATIC_DETOUR macro
- Remove dead ResolutionListFix code and BattleTargetData hook

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@a5ehren a5ehren changed the title Add SAFE_STATIC_DETOUR macro and fix v48084 crash issues Fix crashes with game client v48084 Mar 16, 2026
@netniV
Copy link
Copy Markdown
Owner

netniV commented Mar 17, 2026

As there is a new PR, closing this one off.

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.

2 participants