REDIVIVUS

Proposals / #1468

Mac SFILE_SyncReadFile: BOOL __fastcc (pFileHandle ECX, nFileOffset EDX, pOutputBuf, nBytesToRead, pBytesRead)

checked · by KierTaylor · submitted 2026-11-08

ECX = the MPQ file: +0x110 is the OS handle ([ESP]) and +8 goes as [ESP+0x10] to SFILE_ReadFileChecked. EDX = the offset: it becomes ECX of ReadFileChecked, which compares it with -1 and seeks to it (0x00014cb6-0x00014cd5). [EBP+8] = the buffer, [EBP+0xc] = the byte count (ESI, compared with the bytes read), [EBP+0x10] = an optional out count (NULL-tested, then [ECX]=read). It returns SETZ(read==requested). The five roles match Windows twin 0x00415560 (pOutputBuf, nBytesToRead, pnBytesRead, nFileOffset, pFileHandle). pn is refused, so the out count is named pBytesRead.

Changes 1, applied together

  1. Set prototype mac 0x00014ffd

    signatureundefined SFILE_SyncReadFile(void)→BOOL SFILE_SyncReadFile(D2MPQFileStrc* pFileHandle, int32_t nFileOffset, void* pOutputBuf, uint32_t nBytesToRead, uint32_t* pBytesRead)
    convention__fastcc