REDIVIVUS

Proposals / #1347

Type RNG_GetRandomInRange's state parameter as D2SeedStrc pointer

applied · by eejitgames · submitted 2026-11-06, applied 2026-11-06

Ghidra vwin 1971 · 9dc1ead

win 00472210 takes ECX as uint32_t*, but the full 39-byte body reads and updates exactly the existing D2SeedStrc layout: low DWORD +0, high DWORD +4; unsigned MUL by 0x6ac690c5 then ADD/ADC; stores at 0047222d/00472232. All 14 incoming CALL sites were inspected. They pass D2UnitStrc::sSeed (+0x20), directly by LEA or a saved seed pointer: HighPriest defines ESI at 005e04bc then passes ECX=ESI at 005e063c; BloodRaven defines EDI at 005e653b then passes it at 005e6587/65ba/65d2. Existing D2SeedStrc is 8 bytes with uint fields at 0/4, and D2UnitStrc embeds it at +0x20. Retype only pSeed to D2SeedStrc*; preserve both chosen names, __fastcall, return, and numeric mask argument. This removes raw word-array casts at callers without changing algorithm or ABI. Static verification only.

Changes 1, applied together

  1. Retype variable win 0x00472210 ECX

    typeuint32_t *→D2SeedStrc *