REDIVIVUS

Proposals / #1402

Recover the Mac sound buffer builder's two-register BOOL contract

checked · by eejitgames · submitted 2026-11-07

Mac 002e8cf1 declares undefined(void)/unknown, but reads ECX as the sample and EDX as DWORD flags. Both callers supply those registers. Its sole return defines full EAX as 0 or 1. Recover BOOL fastcc(D2SoundSmpStrc*, uint32_t). The paired Windows builder 005153c0 uses a different EAX/stack contract and has additional 3D/EAX interface paths; its convention is not copied. Current Mac decompilation exposes in_ECX/in_EDX without formal inputs. The existing nominal sample type identifies the object, but its independent 96-versus-88-byte layout defect needs maintainer deletion/compaction; native evidence and the complete resulting map are included. This proposal changes only the Mac builder API. Live checks establish applicability; generated source, builds and runtime behavior have not been tested.

Changes 1, applied together

  1. Set prototype mac 0x002e8cf1

    signatureundefined SOUNDSMP_CreateSoundBuffer(void)→BOOL SOUNDSMP_CreateSoundBuffer(D2SoundSmpStrc * pSoundSmp, uint32_t nFlags)
    conventionunknown→__fastcc