Skip to content

UI: the text page's progress bar and the round table at 100% - #429

Open
kotijekriv wants to merge 2 commits into
sourcehold:mainfrom
kotijekriv:reimpl/UI-B-round22-100
Open

kotijekriv wants to merge 2 commits into
sourcehold:mainfrom
kotijekriv:reimpl/UI-B-round22-100

Conversation

@kotijekriv

Copy link
Copy Markdown
Contributor

Two UI render functions at 100%, both moved out of our open draft PRs (#313 and #360) and both from gynt's drafts. No header changes.

Function Address Before reccmp raw Normalised
Rendering::RenderTextPageProgressBar 0x004DAFB0 67.8% in the draft PR (fb337c1); gynt's 45.28% (4778264) 100.0 100.0
Roundtable::MenuModalRenderFunction_Roundtable 0x004B1AC0 76.1% in the draft PR (8f2719d); gynt's newest scored draft 70.24% (f5c0549), and 32.54% (dd3b7dc) 100.0 100.0

Measured.

  • Setup: the bundled MSVC1400-SP1 against the Steam Stronghold Crusader.exe (3bb0a8c1…5387ac5a), and sourcehold's reccmp with --resolve-wrapped-calls --ignore-security-cookie. The struct resolvers and the function resolvers are enabled locally (not committed); in the full build 0x004314E0 (MapEditorLandscaping_GeneralButtons handler) is left out and its resolver stays off, as in main's baseline.
  • Narrow build: each function alone reads 100.0 raw and normalised on this head.
  • Full build: an all-on build of 9fd82e3ff on main 3458fea (the same tree as this head; only the last commit's message changed since): 0 failed of 2,425 compile steps, 99.58 over 2,441 functions, against 99.58 over 2,439 for main alone (built at f489b72; 3458fea only adds files under tools/). Both functions read 100.0 raw and normalised.
    • One function on main moved up: Constructor_MenuModal_Roundtable went from 93.8 to 100.0. It pushes the render function's address (0x004B1AC0), which now resolves to the reimplementation.
    • Two moved down, both a measurement artefact: Menu::handleMenuItems (100.0 to 97.9) and Menu::Constructor_Menu (100.0 to 98.4). Neither file changes here. Both compare against the menu item type 0x11000000, and in this build one of our own DLL's symbols happens to sit at exactly that address, so reccmp prints our operand as that symbol and counts five identical compares as mismatches. A branch adding a single unrelated function from main showed the same two drops.
  • Checks: openshc-pr-check gives 0 ERROR and 7 CHECK, all placeholder names (below). openshc-pr-fix finds nothing to change.
  • Not run in game.

What got them to 100%

RenderTextPageProgressBar (the scrolling text page's frame and its faded top and bottom edges)

  • The fade loops read destinationRect.left and destinationRect.top instead of separate left/top locals. The original keeps destinationRect.top in the RECT's own stack slot and reloads it for the second loop (mov ebx, [esp + 0x14]), with left in esi and the right edge in ebp for both loops. With the locals, top went to ebp and the right edge was recomputed in each iteration.
  • The second loop's row is a local, y = destinationRect.top + 220 - i * 2, passed as y and y + 1. Written out twice, the + 1 form became a second induction variable; the original has one (lea edx, [ebx + 1]).
  • sourceRect is filled left, right, top, bottom, which gives the original's registers for the zero and for 540.

MenuModalRenderFunction_Roundtable (the round table's player shields)

  • Behaviour fix: each shield's x is the seat's x plus the x parameter. Our draft added the group counter there, and so does gynt's newest scored draft, f5c0549, which uses the width parameter as the counter; the shields were drawn at the wrong place. The original reads x from its stack home for that argument (add ecx, dword ptr [esp + 0x58] with one push pending). gynt's first draft, dd3b7dc, has x, and so does the Roundtable from Wilps' work on gynt's fork (8ca7861 on reimpl/Wilps-2026-10-18, later the same day as f5c0549), which is at 0.0% Pending there.
  • From f5c0549: the seat table as constants, the two blend calls and the button rectangle. f5c0549 kept the counter in the width parameter; here it is its own local, which MSVC places in y's stack home as the original does, while y stays in ebp. With x back the registers matched at once.
  • The rest is order: tint and group are declared before the seat table (the original clears group in the middle of the table's stores), and DAT_ButtonY is set after DAT_ButtonX.

The checker's 7 CHECKs

Count Finding Why it stays
5 placeholder DAT_00ed2784 Ghidra has no name for it. Here it is the elapsed time / 80, at most 580, and the source rectangle's top row: the text page's scroll offset. The Wilps commit on gynt's fork (8ca7861) names it g_textPageScrollOffset, and the start time this function reads, DAT_ARRAY_00ed26d0, g_textPageStartTime
2 placeholder DAT_00df4288 Ghidra has no name for it. Here, when it is set, the bottom-left construction-cost text is drawn and the flag cleared; 8ca7861 names it g_roundtableNeedsRedraw

🤖 Generated with Claude Code

kotijekriv and others added 2 commits November 19, 2026 21:50
Rendering::RenderTextPageProgressBar, from gynt's draft (4778264, 45.28%) by way of my draft in the open draft
PR (fb337c1, 67.80%, "Loop registers and RECT spills differ"). reccmp 100.0 (normalized 100.0) on main 3458fea
with the data on.

Three changes took it from 67.8 to 100:
- The fade loops read destinationRect.left and destinationRect.top instead of separate left/top locals. The original
  keeps destinationRect.top in the RECT's own stack slot and reloads it for the second loop (`mov ebx, [esp + 0x14]`),
  with left in esi and the right edge in ebp for both loops; the locals put top in ebp and recomputed the right edge.
- The second loop's row is a local, `y = destinationRect.top + 220 - i * 2`, passed as y and y + 1. Written out twice,
  `... + 1` became a second induction variable; the original has one (`lea edx, [ebx + 1]`).
- sourceRect is filled left, right, top, bottom, which gives the original's zero register for `left` (ecx) and edi
  for 540.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Roundtable::MenuModalRenderFunction_Roundtable, from gynt's drafts (dd3b7dc, 32.54%; his newest scored draft
f5c0549, 70.24% on his reimpl/UI-MenuModals-development, "y kept in reg by orig") by way of my draft in the open
draft PR (8f2719d, 76.1%, built on f5c0549). reccmp 100.0 (normalized 100.0) on main 3458fea with the data on.

Behaviour fix against my draft and f5c0549: each shield's x is the seat's x plus the x parameter. Both added the
group counter there (mine as `group`, f5c0549 as the reused `width` parameter), which draws the shields at the
wrong place; the original reads x from its stack home for that argument (`add ecx, dword ptr [esp + 0x58]` with one
push pending). gynt's first draft, dd3b7dc, has x, and so does the Roundtable from Wilps' work on gynt's fork
(8ca7861 on reimpl/Wilps-2026-10-18, later the same day as f5c0549), which is at 0.0% Pending there.

From f5c0549: the seat table as constants, the two blend calls and the button rectangle. f5c0549 kept the
counter in the width parameter; here it is its own local, which MSVC places in y's home as the original does. With
x back the register assignment matched at once. The rest is order: tint and group are declared before the seat table
(the original clears group in the middle of the table's stores), and DAT_ButtonY is set after DAT_ButtonX.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant