REDIVIVUS

Proposals / #1255

Mac GoldCalculations: void __fastcall (pUnit ECX, nGoldAmount EDX, int* pGoldAccepted, int* pGoldOverflow)

checked · by KierTaylor · submitted 2026-11-06

The Mac prologue takes ECX (pUnit; gold limit and stat 0xe gold are read from it) and EDX (nGoldAmount, kept in ESI). [EBP+8] is the accepted-gold out pointer (set to the amount, or clamped to limit-current) and [EBP+0xc] the overflow out pointer (zeroed, then set to the remainder). It ends in a plain RET with no return. Both PARTY_SplitGoldToPartyMembers sites load ECX/EDX and store LEA [EBP-0x14] to [ESP] and LEA [EBP-0x18] to [ESP+4], then read [EBP-0x14]. These are the same roles as the Windows twin 0x00540650 (pUnit, pnGoldAccepted, pnGoldOverflow, nGoldAmount), in Mac fastcall order. The pn prefix is refused, so the pointers are named pGold*.

Changes 1, applied together

  1. Set prototype mac 0x002772a8

    signatureundefined GoldCalculations(void)→void GoldCalculations(D2UnitStrc* pUnit, int32_t nGoldAmount, int* pGoldAccepted, int* pGoldOverflow)
    conventionunknown→__fastcall