REDIVIVUS

Proposals / #986

gnChatHistoryEntryCount and gnChatTabCompletionIndex are signed ints: capped and wrapped with JL

applied · by Niehztog · submitted 2026-11-02, applied 2026-11-02

Ghidra v1846 · 4ca0e98

Both globals are undefined4 (emitted as uint32_t), and the original compares them signed. CHATDLG_AppendChatToHistory caps the count at ten: 0043f541 ADD EAX,1; 0043f544 CMP EAX,0xa; 0043f547 MOV [0x0077bd50],EAX; 0043f54c JL. CHATDLG_HandleTabCompletion wraps the completion index at the count: 0043fb09 ADD EDX,1; 0043fb0c CMP EDX,EAX; 0043fb0e MOV [0x0070cd74],EDX; 0043fb14 JL, then 0043fb16 XOR EDX,EDX. A comparison of the index with the count is signed only if both are, and the index is initialised to -1. Unsigned, VC8 emits JB at both sites. Recompiled with VC8 SP1 (oracle, tree 3dba660), both jumps come out as the original's JL; no function lost.

Changes 2, applied together

  1. Retype global win 0x0077bd50

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

    typeundefined4 (4 bytes)→int