REDIVIVUS

Proposals / #817

Type and name the pet-type parameter of PLAYERPETS_RemoveConflictingPetsByGroup and PETS_UpdatePetData

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

Ghidra v1809 · 6c26878

In both functions the generic nParam is the pet type index: PLAYERPETS_RemoveConflictingPetsByGroup bounds-checks it against sgptDataTable->nTxtPetTypeSize (+0xbf0), indexes pTxtPetType[nParam].group and compares it with the ePetType loop variable; PETS_UpdatePetData bounds-checks it against the same size (CMP ESI,[ECX+0xbf0] at 0x005749cd) and uses it to index pPlayerData->pPets->pPetList. The caller of the first, SKILL_ResummonPet, pushes ESI, which it compares with nTxtPetTypeSize just before (0x00575dc1-ce). ePetType is a 4-byte enum, so the width is kept; generic nParam renamed nPetType. Callers of PETS_UpdatePetData (_oldSaveGameLoadingPart8, LoadMerc) were not checked.

Changes 4, applied together

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

    typeint32_t→ePetType
  2. Rename variable win 0x00575720 Stack[0x4]

    namenParam→nPetType
  3. Retype variable win 0x005749b0 EDX

    typeint32_t→ePetType
  4. Rename variable win 0x005749b0 EDX

    namenParam→nPetType