REDIVIVUS

Proposals / #992

Return a signed byte count from the client packet decompressor

applied · by Commit-Will · submitted 2026-11-02, applied 2026-11-02

Ghidra v1846 · 3cfe190

The full original body returns a byte count, not an address: it subtracts the saved destination base from the advancing output pointer, or writes full EAX=0 when output capacity is exhausted. The sole caller tests the result with signed JLE and adds positive values to the existing int nCount field at +1976; its parser uses a signed comparison and subtracts consumed byte counts. Use existing int32_t for that signed scalar result. In the valid buffer domain results are nonnegative; the earlier recv negative-failure check belongs to a separate call, not this decoder. Preserve all four chosen parameter names/types, ordinary __fastcall storage, return width and both RET 8 purges. No algorithm or runtime behavior change is claimed.

Changes 1, applied together

  1. Set prototype win 0x0040b260

    signaturebyte * NET_D2GS_CLIENT_DecompressPacket(char * pBuffer, size_t nBufferSize, char * pBytes, size_t nBytesSize)→int32_t NET_D2GS_CLIENT_DecompressPacket(char * pBuffer, size_t nBufferSize, char * pBytes, size_t nBytesSize)
    convention__fastcall