REDIVIVUS

Proposals / #1097

Type five integer parameters as the char-select composite, gfx data, MPQ block or sound sample their callers pass

checked · by dtchitt · submitted 2026-11-03

Five parameters typed int or int32_t receive a field whose declared type is a struct pointer, and each body reads only fields of that struct at their width. D2COMP_GetNumFrames returns nNumFrames (0xc) of D2CharSelCompStrc, and D2COMP_SetUnitDisplayStrings copies into wszDisplayString1..4 (0xcc, 0x14c, 0x1cc, 0x1ec) and sets 0x22c and 0x230 of it; their callers pass a ->pComposite field of that type. GFXHASH_CalcDirectionIndex compares eUnitType (0x8) with 1 and 6, tests bit 2 of dwFlags (0x4) and 0x44, and divides nDirection (0x40) of D2GfxDataStrc. SFILE_ReadAdditionalAttributes fills ftFileTime (0x10), dwCRC32 (0x18) and abMD5 (0x24) of each D2MPQBlockEntryStrc from the attributes file, given the archive's block table. SOUNDSMP_SetFrequency writes its second argument to bLooping (0x40) of D2SoundSmpStrc, so its own name may need a look too.

Changes 5, applied together

  1. Retype variable win 0x00505230 Stack[0x4]

    typeint32_t→D2CharSelCompStrc *
  2. Retype variable win 0x00504270 Stack[0x4]

    typeint32_t→D2CharSelCompStrc *
  3. Retype variable win 0x0060ab80 ECX

    typeint32_t→D2GfxDataStrc *
  4. Retype variable win 0x0041b0b0 Stack[0x4]

    typeint→D2MPQBlockEntryStrc *
  5. Retype variable win 0x00515a30 ECX

    typeint32_t→D2SoundSmpStrc *