Skip to content

Add macOS readMtgaInventory via heap signature scan#6

Open
dan-blanchard wants to merge 2 commits intomtgatool:mainfrom
dan-blanchard:feat/macos-readMtgaInventory
Open

Add macOS readMtgaInventory via heap signature scan#6
dan-blanchard wants to merge 2 commits intomtgatool:mainfrom
dan-blanchard:feat/macos-readMtgaInventory

Conversation

@dan-blanchard
Copy link
Copy Markdown

Scans for ClientPlayerInventory in Arena's heap using a class-pointer-set pre-filter plus value plausibility and activity-score ranking. Returns wildcards, gold, gems, and vault progress.

Depends on #3 for the scanner infrastructure.

Key discovery

vaultProgress is an 8-byte double (not int32 as the existing IL2CPP research summary suggested). Field spacing confirms it: vaultProgress @ 0x30, boosters @ 0x38 = 8-byte field. The stored value is the UI percentage directly (58.9 means "Vault: 58.9%").

How the scanner works

  1. find_all_classes_by_name("ClientPlayerInventory") collects every matching Il2CppClass* in __DATA (handles metadata-vs-runtime class duplication)
  2. Heap scan pre-filters by class-pointer set membership (avoids per-candidate name resolution)
  3. Plausibility check on field values (wildcards ≤ 99K, gold ≤ 1B, gems ≤ 10M, at least one nonzero)
  4. Activity-score ranking picks the live instance over cached/zombie copies

Diagnostic cascade on failure dumps pointer occurrences and nearby inventory-related classes.

Testing

Verified against live Arena on macOS arm64:

  • Returns correct wildcard counts, gold, gems, vault progress
  • Ground-truth match against Arena UI (37 common, 11 uncommon, 1 rare, 1 mythic, 825 gold, 610 gems, 58.9% vault at time of initial verification)
  • MTGA_DEBUG_INVENTORY=1 produces useful diagnostic output

🤖 Generated with Claude Code

dan-blanchard and others added 2 commits April 12, 2026 23:22
Bypasses the broken PAPA walker by scanning Arena's heap directly for
the card-collection Dictionary<int,int>. Identifies it via the hash==key
invariant for DefaultEqualityComparer<int>.

Returns ~4300 cards in <1s. Requires sudo for task_for_pid.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scans for ClientPlayerInventory using class-pointer-set pre-filter
plus value plausibility and activity-score ranking. Returns wildcards,
gold, gems, and vault progress.

Key discovery: vaultProgress is an 8-byte double (not int32), storing
the UI percentage directly (e.g. 58.9%). Ground-truth verified against
Arena's UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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