Skip to content

Reimplement 5 UI::MenuModals functions at 100% - #355

Merged
TheRedDaemon merged 5 commits into
sourcehold:mainfrom
kotijekriv:reimpl/UI-MenuModals-1-100
Nov 7, 2026
Merged

TheRedDaemon merged 5 commits into
sourcehold:mainfrom
kotijekriv:reimpl/UI-MenuModals-1-100

Conversation

@kotijekriv

@kotijekriv kotijekriv commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Five UI::MenuModals render functions at 100%, each with its status line: the "waiting for host" dialog and four ally and opponent dialogs (the allies' order, request goods and send goods boxes, and the random number of enemies).

This is our first PR in UI::MenuModals, which gynt agreed on Discord (2026-11-06) we may continue from his drafts. All five are his code from his fork's reimpl/UI-MenuModals-100 (25e0f9f, his closed #252), where they read 94.7-95.5% ("asm differs"). Unchanged, they measure 100.0% on today's main with today's headers, the resolvers on and --ignore-security-cookie. These commits only restyle them, and each commit credits him as co-author. His newer reimpl/UI-MenuModals (2026-11-02) has an older decompiler-style form of them at 80-86%; we didn't use it. No header change.

Other PRs: the ready #348, #349, #352 and #353, the ready #354 (scenario editor), and the drafts #313, #318, #321, #327 and #328.

Built on top of main (8125c61) with the bundled MSVC1400-SP1, natively on Windows, against the Steam Stronghold Crusader.exe (3bb0a8c1…5387ac5a), with the struct and function resolvers enabled locally (not committed), using sourcehold's reccmp with --resolve-wrapped-calls --ignore-security-cookie. None of it has been run in game.

It went through the same checks as #353: a fresh-eyes review of every file (texts, positions, alignment, colours, fonts and the wrap width checked against the original's disassembly and cr.tex; its points applied and measured), openshc-pr-check with no errors and no CHECKs, and status_regression.py, which finds nothing below a known score on main or any fork.

Class Function Address Raw On gynt's fork
WaitingForHost MenuModalRenderFunction_WaitingForHost 0x0047E3A0 100.0% 95.5%
AlliesOrder MenuModalRenderFunction_AlliesOrder 0x004AD2B0 100.0% 95.0%
AlliesRequestGoods MenuModalRenderFunction_AlliesRequestGoods 0x004AD780 100.0% 94.7%
AlliesSendGoods MenuModalRenderFunction_AlliesSendGoods 0x004ADD90 100.0% 94.7%
ChooseRandomNumberOfEnemies MenuModalRenderFunction_ChooseRandomNumberOfEnemies 0x004AE070 100.0% 94.7%

What changed against gynt's drafts

The same generated code in all five (quick_diff and reccmp unchanged); every argument value is the same.

  • Decimal constants, COL_C2F0EB / COL_CCFAFF, and line comments with each text in place of the script's block comments.
  • The unused using-declarations and the BOOLEnum.hpp include go; BGR24.hpp becomes ColorsEnum.hpp.
  • The text positions go straight into the calls instead of single-use locals (x + width / 2, y + 23 and the like). That's a tie: the arguments are pushed right to left, so y is still computed before x, as in the original. In AlliesOrder, RequestGoods and SendGoods, int xParam; from the top is gone with them.
  • ChooseRandomNumberOfEnemies: iVar2-iVar5 are named or inlined, and the script's triple space in "You can still" in the comment is a single one.

The font numbers 15, 17 and 18 stay numbers: they index TextManager::fontSizeClassArray[20], which has no enum.

Proposed, not changed here

  • renderMultilineText5Unk is a null-checked wrapper around FontSizeClass::renderMultilineTextUnk (mode 0); renderWrappedText would say what it does, and its colour parameter could be BGR24.

🤖 Generated with Claude Code

kotijekriv and others added 5 commits November 7, 2026 01:27
MenuModalRenderFunction_WaitingForHost, gynt's code from his fork, branch reimpl/UI-MenuModals-100 (25e0f9f,
95.5% "asm differs" there). Unchanged, it measures reccmp 100.0% here, with today's headers, the resolvers on and
--ignore-security-cookie. His newer reimpl/UI-MenuModals (2026-11-02) has an older decompiler-style form of it at
80-86%; that one is not used.

Against the draft: decimal constants, COL_C2F0EB, a line comment with the text in place of the script's block
comment, the four unused using-declarations (eTextSections, BGR24, TextAlignment, BOOLEnum) and the BOOLEnum.hpp
include dropped, BGR24.hpp becomes ColorsEnum.hpp. His yParam / xParam locals go: the position is passed straight
into the call (x + width / 2, y + 23; his width / 2 + x order is a tie), which gives the same code, as the
arguments are pushed right to left and y is still computed before x. Same generated code (quick_diff and reccmp
unchanged).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_AlliesOrder, gynt's code from his fork, branch reimpl/UI-MenuModals-100 (25e0f9f, 95.0%
"asm differs" there). Unchanged, it measures reccmp 100.0% here, with today's headers, the resolvers on and
--ignore-security-cookie. His newer reimpl/UI-MenuModals (2026-11-02) has an older decompiler-style form of it at
80-86%; that one is not used.

Against the draft: decimal constants, COL_CCFAFF, a line comment with the text in place of the script's block
comment, the four unused using-declarations (eTextSections, BGR24, TextAlignment, BOOLEnum) and the BOOLEnum.hpp
include dropped, BGR24.hpp becomes ColorsEnum.hpp. His yParam / xParam locals go: the position is passed straight
into the call (x + 30, y + 25), which gives the same code, as the arguments are pushed right to left and y is
still computed before x. His int xParam; declared before the BuildEnemyPlayerList call goes with them. The list is
still rebuilt first on every render, as the original does. Same generated code (quick_diff and reccmp unchanged).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_AlliesRequestGoods, gynt's code from his fork, branch reimpl/UI-MenuModals-100 (25e0f9f,
94.7% "asm differs" there). Unchanged, it measures reccmp 100.0% here, with today's headers, the resolvers on and
--ignore-security-cookie. His newer reimpl/UI-MenuModals (2026-11-02) has an older decompiler-style form of it at
80-86%; that one is not used.

Against the draft: decimal constants, COL_CCFAFF, a line comment with the text in place of the script's block
comment, the four unused using-declarations (eTextSections, BGR24, TextAlignment, BOOLEnum) and the BOOLEnum.hpp
include dropped, BGR24.hpp becomes ColorsEnum.hpp. His yParam / xParam locals go: the position is passed straight
into the call (x + 20, y + 25), which gives the same code, as the arguments are pushed right to left and y is
still computed before x. His int xParam; declared first goes with them. Same generated code (quick_diff and reccmp
unchanged).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_AlliesSendGoods, gynt's code from his fork, branch reimpl/UI-MenuModals-100 (25e0f9f,
94.7% "asm differs" there). Unchanged, it measures reccmp 100.0% here, with today's headers, the resolvers on and
--ignore-security-cookie. His newer reimpl/UI-MenuModals (2026-11-02) has an older decompiler-style form of it at
80-86%; that one is not used.

Against the draft: decimal constants, COL_CCFAFF, a line comment with the text in place of the script's block
comment, the four unused using-declarations (eTextSections, BGR24, TextAlignment, BOOLEnum) and the BOOLEnum.hpp
include dropped, BGR24.hpp becomes ColorsEnum.hpp. His yParam / xParam locals go: the position is passed straight
into the call (x + 20, y + 25), which gives the same code, as the arguments are pushed right to left and y is
still computed before x. His int xParam; declared first goes with them. The comment keeps cr.tex's "Send Goods"
(the draft had both "Send goods" and "Send Goods"). Same generated code (quick_diff and reccmp unchanged).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_ChooseRandomNumberOfEnemies, gynt's code from his fork, branch reimpl/UI-MenuModals-100
(25e0f9f, 94.7% "asm differs" there). Unchanged, it measures reccmp 100.0% here, with today's headers, the
resolvers on and --ignore-security-cookie. His newer reimpl/UI-MenuModals (2026-11-02) has an older
decompiler-style form of it at 80-86%; that one is not used.

Against the draft: decimal constants, COL_CCFAFF, a line comment with the text in place of the script's block
comment, the four unused using-declarations (eTextSections, BGR24, TextAlignment, BOOLEnum) and the BOOLEnum.hpp
include dropped, BGR24.hpp becomes ColorsEnum.hpp. The decompiler's iVar2 to iVar5 go: both texts' positions
(x + 300, y + 100 and x + 100, y + 300), the font sizes, the wrap width 400 and the blend 0 are passed straight
into the calls, which gives the same code. The second comment drops the script's triple space after "You can"
(cr.tex has one space); the two one-line calls are clang-formatted. Same generated code (quick_diff and reccmp
unchanged).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TheRedDaemon
TheRedDaemon added this pull request to the merge queue Nov 7, 2026
Merged via the queue into sourcehold:main with commit 1c29459 Nov 7, 2026
5 checks passed
kotijekriv added a commit to kotijekriv/OpenSHC that referenced this pull request Nov 7, 2026
kotijekriv added a commit to kotijekriv/OpenSHC that referenced this pull request Nov 7, 2026
gynt added a commit that referenced this pull request Nov 7, 2026
The branch's status updates were generated from a snapshot taken before
#355 landed, so committing them downgraded the 5 UI::MenuModals
functions (0x0047E3A0, 0x004AD2B0, 0x004AD780, 0x004ADD90, 0x004AE070)
from "100.0% | Reimplemented" back to "0.0% | Pending". Only lines for
functions this branch actually touches should change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmasN7c2wmSWi212e7H
gynt added a commit that referenced this pull request Nov 7, 2026
These are the functions from #355, which landed on main after this
branch's merge of it. This branch never touched their lines; bringing
them forward only keeps `git diff origin/main..HEAD` limited to the
functions this branch actually works on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmasN7c2wmSWi212e7H
gynt added a commit that referenced this pull request Nov 7, 2026
This reverts commit d677bbe. The commit was based on a misreading: the
5 UI::MenuModals lines were never changed by this branch. They are
identical to the merge base here, and main moved ahead of that base when
#355 landed, which is all `git diff origin/main..HEAD` was showing.
Merging main resolves these lines in main's favour without help, since
only main's side touched them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmasN7c2wmSWi212e7H
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.

2 participants