Mad Bomber WinMM error-text source review — 2026-10-20

Historical source last updated, 2026-10-20. Runtime and implementation claims below describe that dated source; see current app notes and source for subsequent changes.

Task: MADBOMBER-WINMM-ERROR-TEXT-20261019.

Contract and source review

Microsoft's waveOutGetErrorText documentation specifies character capacity, truncated NUL-terminated descriptions, successful zero-capacity no-op, and MMSYSERR_BADERRNUM for out-of-range codes. It does not prescribe exact English wording. The implementation supplies English descriptions for common MMSYSERR 0–21 and WAVERR 32–35, all below MAXERRORLENGTH (256). A writes single-byte ASCII; W writes UTF-16LE. Truncation reserves one character for NUL; capacity 1 writes only NUL. Unknown codes return 9 without changing output. A non-null output with capacity zero returns 0 even for an unknown code.

Null output returns MMSYSERR_INVALPARAM (11), including capacity zero. This precedence follows the Wine implementation, not an explicit Microsoft guarantee for invalid pointers. The host also rejects a written prefix outside its ArrayBuffer without partial writes. This is a host-pointer bounds check, not proof that arbitrary non-null invalid guest pointers return 11: guest accessibility remains the existing translator's responsibility. This review does not introduce a new guest pointer policy. Exact localized Windows resource wording is not implemented or claimed.

The actual host contract is createHostImports spreading createAudioHost(ctx, shared).imports. wave_error_text is synchronous, reads ctx.getMemory() only when writing, and uses the existing optional ctx.exports.page_watch_write notification convention. It neither opens a voice nor invokes device playback. Internal mode 2 returns the needed character count without a buffer; WAT limits the gathered span to the smaller of that count and the unsigned caller capacity, then scales by 1/2 for A/W. Consequently UINT_MAX capacity does not cause a huge copy or overflow.

guest_span_in provides either direct storage or a gathered noncontiguous span; guest_span_writeback scatters and releases the latter and notifies writes for the direct case. The handler pairs these operations. Both handlers return MMRESULT in EAX and pop the return address plus three stdcall arguments (16 bytes). They contain no LastError setter. Actual compiled dispatch, noncontiguous writeback, LastError and stack behavior still require full-VM validation.

Both API entries remain at 4590/4591, three arguments, stdcall. Main has 4593 entries versus WIP's 4592; the entire WIP prefix is unchanged. Dispatch, hashes and import signature mirrors are current. Nothing was renumbered or regenerated.

Evidence and checks

Self-contained evidence: scratch/runs/20261020-madbomber-wave-error-text-review/. receipt.json, verification.log, source-identities.json, source-review.txt, verify.js, copied full-VM test, prior caller note and prior original output are retained there with SHA256SUMS.json. Artifact references are local to that folder. No screenshot or gameplay result is inferred from source tests.

Passed:

Remaining prerequisite and stopping point

node test/test-wave-error-text-native.js --wasm=build/wine-assembly.wasm --sha256=EXACT_MODULE_SHA256

The harness uses the real production module and host imports, public LoadLibrary/GetProcAddress, distinct A/W thunks, stdcall cleanup, LastError, valid/unknown errors, capacities through UINT_MAX, null buffers and split noncontiguous guest pages. Its fixture uses a 512-MB shared memory; unsupported engine features or fixture failures must be reported, not replaced with mocks. A normal build must pass its full source gates; this sparse review is not a substitute.

Only after that qualification may the coordinator separately authorize an original Mad Bomber observation with complete original assets and boot closure. The prior observation (f75d53311; copied note/log in this evidence folder) showed original CRT DllMain returning 1 but SDL returning 0 after the missing waveOutGetErrorTextA lookup. It did not establish gameplay. No diagnosis or original run was repeated here.