REDIVIVUS

Proposals / #1469

Mac SFILE_ReadFileChecked: BOOL __fastcc 7-arg (nFileOffset ECX, pFilePosOut EDX, hFile, pOutputBuf, ...)

checked · by KierTaylor · submitted 2026-11-08

ECX -> EDI = offset (-1 = no seek, else SetFilePointer(hFile, EDI) 0x00014cd5). EDX -> [EBP-0x14] = out position ([EDX] = bytes read + offset at 0x00014d03). [EBP+8] = OS handle (EBX, ReadFile [ESP]), [EBP+0xc] = buffer, [EBP+0x10] = byte count (compared at 0x00014d61), [EBP+0x14] = out bytes-read (ESI), [EBP+0x18] = the MPQ file (passed to the IO-error callback). It returns EBX (1 on a full read, else 0) via MOV EAX,EBX. SFILE_SyncReadFile 0x0001503e sets all seven. Same seven values as Windows twin 0x004154b0. pn/pdw are refused, so the pointers are named pBytesRead/pFilePosOut.

Changes 1, applied together

  1. Set prototype mac 0x00014c64

    signatureundefined SFILE_ReadFileChecked(void)→BOOL SFILE_ReadFileChecked(int32_t nFileOffset, uint32_t* pFilePosOut, void* hFile, void* pOutputBuf, uint32_t nBytesToRead, uint32_t* pBytesRead, D2MPQFileStrc* pMPQFile)
    conventionunknown→__fastcc