REDIVIVUS

Proposals / #1410

Correct the Mac unit-SFX insertion wrapper's numeric channel-handle argument

checked · by eejitgames · submitted 2026-11-07

Mac AllocUnitSfxData00128de2 mis-types its second input as D2UnitStrc*32. Its sole caller passes channel+8: a numeric handle produced by incrementing a counter, returned as an integer by SOUND_PlaySound, then forwarded unchanged by this wrapper. Retype Stack8 to int32_t and name default nParam as nChannelHandle, matching Windows004ca8a0. Native code proves a scalar DWORD; signed spelling follows the existing Windows API, not INC/MOV alone. Preserve unit input, void result, cdecl and chosen function name. The downstream generic list helper can carry numeric handles encoded as opaque values; this correction does not replace or withdraw1401's separately reviewed void* edit. Full paired wrappers, complete sole callers and handle producers verified. No list-node/layout or Windows edit; no source/build/runtime improvement claimed.

Changes 2, applied together

  1. Retype variable mac 0x00128de2 Stack[0x8]

    typeD2UnitStrc *32→int32_t
  2. Rename variable mac 0x00128de2 Stack[0x8]

    namenParam→nChannelHandle