REDIVIVUS

Proposals / #746

Return item pointers from the Mac primary and secondary weapon selectors

applied · by Commit-Will · submitted 2026-11-01, applied 2026-11-02

Ghidra vmac 109 · 39698f0

The complete150/185-byte selectors return either null or an unadjusted D2UnitStrc* obtained from body-grid cells4/5. The complete grid getter and439-byte grid provider prove the existing D2InventoryGridInfoStrc.pGridCells -> D2UnitStrc* chain; the selectors compare unit GUID+12 with inventory primary GUID+28. False ITEMS_IsA paths explicitly zero the selected pointer, not return that status. Every path reaches MOV EAX,ESI from a unit pointer or zero. Windows0063bef0/0063bf90 already have D2UnitStrc* returns and the same selection behavior. All46 incoming Mac calls were verified as original E8 edges; complete shared dual-wield/stat callers corroborate pointer use. Change only these two return types by preserving both one-argument cdecl signatures, chosen names and stack slots. No shared layout, input, Windows name, runtime or matching change.

Changes 2, applied together

  1. Set prototype mac 0x0016860a

    signatureundefined INVENTORY_GetPrimaryWeapon(D2InventoryStrc * pInventory)→D2UnitStrc * INVENTORY_GetPrimaryWeapon(D2InventoryStrc * pInventory)
    convention__cdecl
  2. Set prototype mac 0x001686a0

    signatureundefined INVENTORY_GetSecondaryWeapon(D2InventoryStrc * pInventory)→D2UnitStrc * INVENTORY_GetSecondaryWeapon(D2InventoryStrc * pInventory)
    convention__cdecl