REDIVIVUS

Proposals / #1033

RENDERER_GLIDE_CalculateTextureSize's texture sizes are ints: compared with JG/JGE and shifted with SAR

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

nTexWidthPow2 (EDX) and nTexHeightPow2 (EAX) are only ever compared signed, and the height is shifted arithmetically: 0050a35d CMP EDX,EAX / 0050a365 JG; 0050a3a4 CMP EDX,EAX / 0050a3aa JNZ / 0050a3b5 JGE; the doubling loop 0050a3c0 ADD EDX,EDX / 0050a3c2 CMP EDX,EAX / 0050a3c4 JG; then 0050a3ce SAR EAX,CL. Ghidra leaves both undefined4 and resolves them to uint, so the generator declares uint32_t and the first compare comes out unsigned (JA). Recompiled with VC8 SP1 (the 1.14d compiler) on main f26206a with both as int: every conditional jump in the function matches the original's condition, and no function in the TU changes status.

Changes 2, applied together

  1. Retype variable win 0x0050a2d0 EDX

    typeundefined4→int
  2. Retype variable win 0x0050a2d0 EAX

    typeundefined4→int