REDIVIVUS

Proposals / #983

gnLadderScrollPageSize and gnLadderBoardSelectedRank are signed ints: the page-down clamp uses JGE

stale · by Niehztog · submitted 2026-11-02

Both globals (0x0077b0a0 gnLadderScrollPageSize and 0x0070cd7c gnLadderBoardSelectedRank) are already typed int in the database, so there is nothing left to apply. The JGE evidence was correct.

Both globals are undefined4 (emitted as uint32_t). CHATDLG_OnPressLadderPageDown computes rank + page size and compares it with total - page size, signed: 0043ed10 MOV ECX,[0x0077b0a0] (page size); 0043ed16 MOV EAX,[0x0077ad70] (gnLadderEntryTotal, already int); 0043ed1b MOV EDX,[0x0070cd7c] (selected rank); 0043ed21 SUB EAX,ECX; 0043ed23 ADD ECX,EDX; 0043ed25 CMP ECX,EAX; 0043ed27 JGE. With either operand unsigned the comparison would be unsigned (JAE), so both are signed; the rank is also initialised to -1. Recompiled with VC8 SP1 (oracle, tree 3dba660), CHATDLG_OnPressLadderPageDown goes from INSN_COUNT_MATCH (0.769) to INSN_MATCH (0.846), the same instructions as the original; no function lost.

Changes 2, applied together

  1. Retype global win 0x0077b0a0

    typeundefined4 (4 bytes)→int
  2. Retype global win 0x0070cd7c

    typeundefined4 (4 bytes)→int