REDIVIVUS

Proposals / #821

Type and name PLAYER_FreeAllCorpseUnits' player and SUNITPROXY_InitNpcTradeItems' table index

applied · by Captain-Fwiffo · submitted 2026-11-02, applied 2026-11-02

Ghidra v1809 · 6c26878

PLAYER_FreeAllCorpseUnits: the EAX parameter nParam is the player unit: the body reads its +0x60 (D2UnitStrc.pInventory, 0x00534970) and walks the corpse list. Its only caller, PLAYER_FreeAllResources(pGame, pUnit) (a player teardown), passes EAX = ESI at 0x005349f6, the same ESI it uses as pUnit (EDX=ESI) for the two calls just before. Retyped to D2UnitStrc * and renamed pPlayer (pUnit is already taken by a local). SUNITPROXY_InitNpcTradeItems: nParam1 is bounds-checked (> 0x10 halts) and used to index gaNpcItemTables[nParam1]; all 15 call sites in SUNITPROXY_AllocNpcControl load a small constant into EAX (e.g. 0xc at 0x00536282, 7 at 0x0053629c). Renamed nNpcTableIdx; type unchanged. The ESI source in PLAYER_FreeAllResources was read from the two preceding calls, not traced to entry.

Changes 3, applied together

  1. Retype variable win 0x00534970 EAX

    typeint32_t→D2UnitStrc *
  2. Rename variable win 0x00534970 EAX

    namenParam→pPlayer
  3. Rename variable win 0x00535fb0 EAX

    namenParam1→nNpcTableIdx