Repository navigation
Reimplement 40 UI::MenuModals, DisplayElements and Rendering functions: gynt's finished backlog (100%) - #380
Merged
gynt merged 58 commits intoNov 10, 2026
Conversation
RenderAndPlayKeepAndGranaryPlacementInfoDisplayElement, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr-100 at f87b2f2 (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderBottomLeftDateDisplayElement, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr at 140bef0 (2026-10-03), where its status line reads 100.0%; the file was last changed in 5cda263 (2026-10-02, "reimplement: SHC_3BB0A8C1_0x00433D00 100.0% Reimplemented"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderConnectAndPathLinkageInfoTextDisplayElement, gynt's version as it stands on his fork's archive/UI-MenuViews-development-second-pass at 32939bb (2026-10-25), where its status line reads 100.0%; the file was last changed in a389f84 (2026-10-04, "style: drop the redundant OpenSHC:: prefix, as origin/main does"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderDisplayElementsUnk, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr-100 at f87b2f2 (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderGamePausedTextDisplayElement, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr at 140bef0 (2026-10-03), where its status line reads 100.0%; the file was last changed in 1877b09 (2026-10-02, "reimplement: SHC_3BB0A8C1_0x004B1E60 100.0% Reimplemented"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderGameSpeedTextDisplayElement, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr at 140bef0 (2026-10-03), where its status line reads 100.0%; the file was last changed in d9c4bcb (2026-10-02, "reimplement: SHC_3BB0A8C1_0x004B07C0 100.0% Reimplemented"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderMissionWinDefeatBannerDisplayElement, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr-100 at f87b2f2 (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderPeopleLeftToPlaceDisplayElement, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr at 140bef0 (2026-10-03), where its status line reads 100.0%; the file was last changed in c286c13 (2026-10-02, "reimplement: SHC_3BB0A8C1_0x004B0AC0 100.0% Reimplemented"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderPlayerPingUnkDisplayElement22, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr-100 at f87b2f2 (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderSomeMultiplayerInfoUnkDisplayElement19, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr-100 at f87b2f2 (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderStartingGoodDisplayElement, gynt's version as it stands on his fork's reimpl/UI-DisplayElements-pr-development at fbc092e (2026-11-04), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_AiLordSelect, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_Allies, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_BuildingAvailability, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_Chat, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_DebugDataAivStateUnk, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunctionMenuModal_DeleteGameRecord, gynt's version as it stands on his fork's reimpl/UI-MenuModals at 6d5d3fb (2026-11-02), where its status line reads 100.0%; the file was last changed in d817410 (2026-10-03, "reimplement: SHC_3BB0A8C1_0x004D9CC0 100.0% Reimplemented"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_IdentityOptions, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_LoadMap, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_NewEventCondition, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_OnlineVoteQuitGame, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_OverlaySlider, gynt's version as it stands on his fork's archive/UI-MenuViews-development-second-pass at 32939bb (2026-10-25), where its status line reads 100.0%; the file was last changed in 637c6b0 (2026-10-06, "style: write BOOLEnum FALSE-comparisons as truth tests"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_ReceiveMapFrom, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_SaveMap, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_SendMapTo, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_TacticalPowerBar, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_TriggerEventSlider, gynt's version as it stands on his fork's archive/UI-MenuViews-development-second-pass at 32939bb (2026-10-25), where its status line reads 100.0%; the file was last changed in cf563c2 (2026-10-10, "style: declare 605 locals at their first use"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_UnusedChooseMessageBox, gynt's version as it stands on his fork's archive/UI-MenuViews-development-second-pass at 32939bb (2026-10-25), where its status line reads 100.0%; the file was last changed in a389f84 (2026-10-04, "style: drop the redundant OpenSHC:: prefix, as origin/main does"). Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_UnusedCreateMessageEvent, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_UnusedCreateTimedMessageEvent, gynt's version as it stands on his fork's reimpl/UI-MenuModals-100 at 25e0f9f (2026-10-27), where its status line reads 100.0%; that commit is also the last one to change the file. Taken unchanged; what main needs on top follows in our own commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…L, doubled includes Mechanical fixes over 35 of gynt's files: text colours written as numbers use their ColorsEnum names (COL_C2F0EB, COL_CCFAFF, COL_B8EEFB, COL_0080FF), the "added by script" block comments become // "text" lines and other block comments // lines, the decompilerscript plate comments and the trailing return;s go, (T*)0x0 is NULL, and the nine includes of a file's own .func.hpp under its full path (next to "../X.func.hpp") are dropped. quick_diff identical for every file. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… first use Main's declare_at_use.py over the 40 files: in six of them the decompiler's leading declarations move down to the first assignment (style guide 24), and declarations nothing uses go. quick_diff identical for every file. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in two display elements The four files of gynt's that wrote file names and texts as literals use main's s_ pointers (style guide 12), each for the address the original pushes. RenderSomeMultiplayerInfoUnkDisplayElement19 loses the decompiler's argument locals (two runs of them were dead stores), names the title's y, the autosave line's y, the minutes since the last save and the cancel button's left edge, and tests isMouseInsideBox directly; RenderAndPlayKeepAndGranaryPlacementInfoDisplayElement names the text and its measured height and width, writes its numbers in decimal and its colour as COL_CCFAFF. quick_diff identical for every file. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…piler's argument locals The title's y, the shared x of both texts and the message's y are named; the other arguments are written in the calls, the colour is COL_CCFAFF, and the time is now. quick_diff identical (0.9245). Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two gotos go: the death and team checks are an if of their own ahead of one test for the victory and defeat timers (the original's second solitary test stays in that test), and the jump to the drawing loop was to the next line. The start goods are counted by one for-loop over startResources (MSVC unrolls it by five, as the hand-walked pointer did, without its [-1]), and the drawing loop is a for over the good and its picture. quick_diff identical (0.9735). Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ead of the decompiler's locals In RenderGameSpeedTextDisplayElement, RenderGamePausedTextDisplayElement, RenderPeopleLeftToPlaceDisplayElement, RenderBottomLeftDateDisplayElement and MenuModalRenderFunctionMenuModal_DeleteGameRecord the locals the decompiler made for each argument (alignment, colours, font size, the shadow flag, positions) are written in the calls, and unused ones go; DeleteGameRecord keeps its centred x, which the original computes before the text call. RenderDisplayElementsUnk declares its two positions where it computes them (inlining them there lost: quick_diff 0.9605 -> 0.7947). quick_diff identical for every file. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in nine files, one goto Nine more files of gynt's: MenuModalRenderFunction_Chat names its title position and the cursor's x; RenderCurrentMenuView walks menuView in its for; MenuModalRenderFunction_TriggerEventSlider sets its icon in each branch in place of the goto (the compiler shares the store again); RenderPlayerPingUnkDisplayElement22 names the player and the lag pointer and ends that pointer at connectionLagInfoArray[9].average2 rather than instance + 0x7ac48 (an indexed for loses, measured in its comment); clearSomeMemory passes the arrays with sizeof counts; transformGmColorTableFromRGB555To565IfRequired keeps its pointer do-while under names (a for loses, measured in its comment); MenuModalRenderFunction_OverlaySlider and createCrusaderWindow test their calls directly; MenuModalRenderFunction_DebugDataAivStateUnk counts aivIndex in a for, picks its colour (COL_0000FF or COL_C2F0EB) in an if/else and names the placement fit. quick_diff identical for every file. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The usings the earlier passes left unused go (the fixer, 11 files); MenuModalRenderFunction_SendMapTo loops over playerID with indexed player names, transfer states, colours and buffer counts in place of the walked pointers and byte offsets (and no instance + 0x109daa end); the remaining text colours are COL_CCFAFF and COL_FFFFFF; and the defeat banner's box is written in decimal. quick_diff identical for every file. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_Chat (0x004ABD20) tests the user text handler's index against 4 and resets it to 4 (push 4 before resetToTextIndex), which the enum leaves out between TAIT_THREE__FILTER_A and TAIT_FIVE__NUMERIC_DOT; TheRedDaemon asked for such values on sourcehold#300. Used in the next commit; code generation is the same. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nts, names, early returns Across the 40 files: - the (ushort) casts on the COL_ shortValues dropped (shortValue is already a ushort); - the unused BOOLEnum and BGR24 includes dropped (TRUE/FALSE are Windows macros; the colour parameters' headers bring BGR24 themselves); - a // "text" comment above each statement that passes an s_ string pointer; - the underscore locals named and declared at first use (RenderDisplayElementsUnk, RenderBottomLeftDate, drawLoadingBarUnk, adaptGmColorsToRGB565IfRequired); RenderBottomLeftDate passes FALSE and COL_000000 instead of reusing the zero it had just tested; - decimal for the hex numbers the fixer leaves alone because they look like masks (font sizes, offsets, a case label, a 30 ms interval); - the text groups of drawHeaderTextBanner by their eTextSections names, in twelve of its fifteen calls; - TAIT_UNKNOWN_4 for the chat's text index (the header commit before this one); - truth tests on the BOOLEnum mouse fields, and casts dropped where the value already has the type (DAT_InsultTextIndex, the menu's y, BGR24 colours passed as uint); - DebugDataAivStateUnk's loop bound as countof(DAT_AIVPlacementFit::instance); - an early return for the first test of RenderBottomLeftDate, and in adaptGmColorsToRGB565IfRequired and transformGmColorTableFromRGB555To565IfRequired (each ties with the nested form). Every function is quick_diff-identical to before, and all 40 are 100% in a full reccmp build. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every write in the binary stores 0 or 1 (mov dword ptr [0x01A26A18], 0 at 0x0048FC80, and in RenderSomeMultiplayerInfoUnkDisplayElement19 the stores at 0x004B0134 and 0x004B0324 from registers holding 1 and 0), and of its two reads 0x004B00A2 compares it with zero while 0x004AFE24 uses the 0/1 value in the box height ((x * 3 + 12) * 16). No .cpp on main uses it; the next commit's RenderSomeMultiplayerInfoUnkDisplayElement19 is its only user and writes TRUE/FALSE. Code generation is the same. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… image sizes, early returns
- Text comments in the right branch (Victory/Defeat, Sending/Receiving game state, auto save on/off) and the ones
that were missing (Starting/Captured goods, the keep and granary prompts, the AI lord hint); the fixer's leftover
in PeopleLeftToPlace and the speech lines nobody can check go.
- The last bare text groups (TriggerEventSlider, UnusedChooseMessageBox, VideoOptions) by their eTextSections names;
Chat's two (int) casts on getCurrentFontSize go; `!= false` on the tactical-powers bool is a truth test.
- RenderStartingGood reads the icons' sizes as DAT_GMImageHeaders.imh[...].width/.height (main's TraderSettings
form) in place of the pun past PTR_ARRAY_Unknown_UnitGMHeights; its heading and label arguments are in the calls
(the label's position stays named, which keeps the original's registers), one playerSlotID plus the second read
the original makes after the text calls, an else-if for the popup state, `+= 2`, `204 + scrollIconIndex % 6`,
and a for over the 25 goods with a continue. startGoodsCount stays above the early returns, where the original
zeroes it.
- connectionInfoExpanded (previous commit) is tested and stored as TRUE/FALSE, and its clicks are
`if (leftClickStart) { ... } return;`.
- Early returns or continues in RenderBottomLeftDate (both tests), NewEventCondition, DebugDataAivStateUnk,
SendMapTo, RenderDisplayElementsUnk, RenderCurrentMenuView, createCrusaderWindow and drawLoadingBarUnk;
ConnectAndPathLinkage tests its second tile type with else if; YesNoDialog stores
currentMenu->zero once; RenderDisplayElementsUnk's x test is a switch like its y test; adaptGmColors uses an
else-if chain; TriggerEventSlider tests the event number twice in declaration order; transformGmColorTable's
pointer walk is a for (countof for the palette size), so its do-while and the measured comment go.
- drawGfxOnFlaggedSurface adds to the buffer pointer, as main's renderGfxTgxWithBlending does, with its comment.
- RenderCurrentMenuView loses the imported Ghidra comments and calls through menuView->prepare() etc.
- The DisplayElements files use main's `namespace DisplayElements { ... }` form; names (secondsLeft, centerX,
autoSaveY, rgb555), GM_BODY_LORD and GM_BODY_ARABIC_LORD for the sprite IDs, redundant casts and some redundant
parentheses go.
Kept, measured: RenderSomeMultiplayerInfoUnkDisplayElement19's nested if (isHost) (an early `if (!isHost)` return:
quick_diff 0.9516 -> 0.9183), the lag
walk as an int* (an indexed for or a ConnectionLagInfo* walk: 0.9595 -> 0.9364), AiLordSelect's second test
(0.9412 -> 0.9185), Chat's currentText local (0.9588 -> 0.9223), the keep and granary text calls as they are (all
inline 0.9620 -> 0.8481, all through text 0.7407), ReceiveMapFrom's second width / 4 (reusing left 0.9851 -> 0.5496),
DebugDataAivStateUnk's colour set in both branches (one override: 0.9697 -> 0.8265) and its three reads of the
placement fit (one const local: 0.6458).
Every other change is quick_diff-identical. Full build: 39 functions reccmp 100.0; RenderStartingGood reads 99.2,
and its two differing lines are the size reads' data address alone. imh[i - 1] folds to DAT_GMImageHeaders - 16,
which in the original's layout is PTR_ARRAY_Unknown_UnitGMHeights[28] (the address the game uses) and with the
struct resolvers on lands just before our DAT_GMImageHeaders. Main records the same imh[... - 1] form at 100% in
MenuItemRenderFunction_NewInvasion_UnitButtons, MenuItemRenderFunction_TriggerInvasion_Main and getWidthOfText.
Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a for, two comments RenderPlayerPingUnkDisplayElement22's while over the lag entries is a for now, with the pointer still set before yPosition, as the original orders the two: quick_diff output identical to the while. With the pointer declared in the for's header, MSVC moves one add ahead (0.9595 -> 0.9480), so the header leaves the init out. Its comment says why the pointer is compared as int (the original's jl). Two comments lose an escaped apostrophe. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Style guide reading (advisory, posted once) 2 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 1 of the 40 reimplemented The match comes first. Where the ugly form is what matched, it stays -- that is the guide's own overriding rule, and rule 21 asks for a one-line comment saying what was measured so the next reader does not retry it. This report is posted once, when the PR opens, and is not repeated on later pushes.
WhereRule 18 — Use the name, not the number
|
This was referenced Nov 9, 2026
Main's Ghidra sync 6c1e0bd brought this branch's header changes; main's versions are kept. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… sync (TAIT_UNKNOWN, INT_00b9840c) Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR lands 40 more of gynt's finished UI functions (21 MenuModals, 11 DisplayElements, 8 Rendering), as he OK'd on Discord on 2026-11-09 ("Yes you can make a PR for them and check they still build. Cleaning up the backlog, love it"). It's the sibling of #379 (MenuViews).
Each function read 100% on his fork but was never in a PR. Each comes in as a commit authored by him: his file as it stands at the last commit that touched it on his fork, where its status line reads 100%. The commit body names the branch and commit, and the table at the end lists them. What main needed on top follows in our own commits, which credit him as co-author.
Measured on today's main (9528350). The setup:
Stronghold Crusader.exe(3bb0a8c1…5387ac5a);--resolve-wrapped-calls --ignore-security-cookie.A full build reads 39 of the 40 at 100.0% raw.
RenderStartingGoodDisplayElementreads 99.2% raw / 100% normalized; see below.openshc-pr-checkgives no errors, andstatus_regression.pyfinds no status line that dropped. None of it has been run in game.Our commits on top of his
Main's names. Five files didn't compile against today's headers:
field76_0xbe8;GMTotalPicturesProcessed→GMFirstPictureIndex;DAT_MenuLoadGameRelativeSelection*→menuLoadGameRelativeSelection*;field44_0xa0;PTR_ARRAY_00c9a510/00d7d250→TGX_RepeatRunHandlers/TGX_StreamRunHandlers.Two functions needed small changes to stay at 100% on main:
DAT_MenuOptionsActionParameterthrough(int). Main's field isundefined4where gynt's branch hadint; without the cast it reads 65.5%.The style fixer's pass, then colour names,
NULL, and doubled includes dropped.String pointers from
string-literals.hpp, each with its text in a// "…"comment above it.Names. The decompiler's locals and gynt's underscore locals are named and declared at first use, and the arguments are written in the calls.
Text groups by their
eTextSectionsnames (TEXT_SCENARIO, TEXT_GAME_OPTIONS, and so on). The sprite IDs areGM_BODY_LORD/GM_BODY_ARABIC_LORD, and the loop bound usescountof.Early returns or
continues in nine functions. Also:currentMenu->zeroonce;else ifchains where one value is tested several times;menuView->prepare()etc. and loses the imported Ghidra comments.RenderStartingGoodDisplayElement.
forover the 25 goods, and204 + scrollIconIndex % 6.DAT_GMImageHeaders.imh[...].width/.height, in place of the read past the end ofPTR_ARRAY_Unknown_UnitGMHeights.Pointer arithmetic.
for.forwith the pointer set before it. That form compiles exactly like thewhile; declaring the pointer in theforheader moves oneadd(quick_diff 0.9595 → 0.9480).Namespaces. The DisplayElements files use main's
namespace DisplayElements { … }form.RenderStartingGoodDisplayElement at 99.2% raw. Its only two differing lines are the data address of the icon-size reads:
imh[i - 1]folds toDAT_GMImageHeaders - 16.PTR_ARRAY_Unknown_UnitGMHeights[28], the address the game uses.Main records the same
imh[… - 1]form at 100% in MenuItemRenderFunction_NewInvasion_UnitButtons, MenuItemRenderFunction_TriggerInvasion_Main and getWidthOfText, and the status line here says 100.0% the same way. Gynt's pun reads 100.0 raw, if that's preferred; it's a one-line change.Header changes (each in a commit of its own)
Main's Ghidra sync (6c1e0bd) brought these header lines, and main (d5d965d) is merged in, with our code following main's spellings (
TAIT_UNKNOWNfor text index 4,INT_00b9840c), so the declaration check passes now.TextArrayIndexTypegetsTAIT_UNKNOWN_4(6e938c5). MenuModalRenderFunction_Chat resets the user text handler to 4. This is the same line as in Reimplement 47 UI::MenuViews functions: gynt's finished backlog (100%) #379, so the two merge in either order.GameSynchronyState::connectionInfoExpandedis aBOOLEnum(16bb3e0). It wasundefined4.mov dword ptr [0x01A26A18], 0at 0x0048FC80, and two stores from registers holding 1 and 0 in RenderSomeMultiplayerInfoUnkDisplayElement19.TRUE/FALSEand tests it by truthiness.Kept as they are, measured with quick_diff
if (isHost)if (!isHost)return: 0.9516 → 0.9183int*over the lag entriesforor aConnectionLagInfo*walk: 0.9595 → 0.9364<= 8testyPos += 76in the else: 0.9412 → 0.9185currentTextlocaltext: 0.7407width / 4left: 0.9851 → 0.5496(int)casts in RenderSomeMultiplayerInfoUnkDisplayElement19: the original dividescurrentPacketTotalSizeandresyncTransferTotalSizesigned, but the header has them asundefined4.DAT_MenuOptionsActionParameterhas no enum. The values are the TEXT_GAME_OPTIONS number of the button that opened the dialog: 7 "Quit Mission", 9 "Exit Crusader", 44 "Restart Mission", and also 30/43/47/49. -7 and 1000 come from ScenarioDescription, and 2000 is the receive-map case.0xfc00and0x3e0in transformGmColorTable, are RGB555 channel masks used with&. Hex with&is gynt's rule (Reimplement 32 rendering and UI rendering functions at 100% #311).timeGetTime()and drops the result;Header changes we didn't make (suggestions)
MenuTextInputState::DAT_MenuOptionsActionParameter→int, which would drop YesNoDialog's cast. All 12 of main's users only store to it.currentPacketTotalSize/resyncTransferTotalSize→int, which would drop MP19's casts.DAT_CurrentlyRenderedSpriteID→eGM.drawLoadingBarUnk(GmID currentGmId, int barLengthUnk)really takes(int progress, int progressMax); main's callers cast int progress values toGmID.GMFileHeaderColorpalette::colorPalette(short[10][256]) holds RGB555 colours. AsRGB15it would drop transformGm's(ushort*).savedListOffset/Selection/SortOrder1-3look like a struct[3].DEID_PLAYER_PING_Unk_19has the value 22.What some placeholders hold
field_0xbe8: a millisecond timestamp compared withlastAutoSaveTime; the difference / 60000 is the minutes since the last save.DAT_00df42b0: a 0/1 toggle flipped every 500 ms.invasionEventContent.field_0xa0: the selected event's TEXT_SCENARIO text number. 148 shows 146's text with an icon.someCount45: the goods popup's state (1 starting goods, 2 captured goods).someCount47: the icon's scroll position.selectedLordTypeUnk: 0 for the European lord, otherwise the Arabic one.mapSendingByteBufferAddress[9]: the bytes transferred per player, not an address.hInstanceUnk_0xa8: the HINSTANCE passed to createCrusaderWindow.windowRenderTimeUnk_0x1e0: when the window was set up.The 40 functions
Function, address, and gynt's branch and commit it comes from
Destructor_TextureRenderCorearchive/UI-MenuViews-development-second-pass32939bbMenuModalRenderFunctionMenuModal_DeleteGameRecordreimpl/UI-MenuModals6d5d3fbMenuModalRenderFunction_AiLordSelectreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_Alliesreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_BuildingAvailabilityreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_Chatreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_DebugDataAivStateUnkreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_IdentityOptionsreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_LoadMapreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_NewEventConditionreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_OnlineVoteQuitGamereimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_OverlaySliderarchive/UI-MenuViews-development-second-pass32939bbMenuModalRenderFunction_ReceiveMapFromreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_SaveMapreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_SendMapToreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_TacticalPowerBarreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_TriggerEventSliderarchive/UI-MenuViews-development-second-pass32939bbMenuModalRenderFunction_UnusedChooseMessageBoxarchive/UI-MenuViews-development-second-pass32939bbMenuModalRenderFunction_UnusedCreateMessageEventreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_UnusedCreateTimedMessageEventreimpl/UI-MenuModals-10025e0f9fMenuModalRenderFunction_VideoOptionsarchive/UI-MenuViews-development-second-pass32939bbMenuModalRenderFunction_YesNoDialogreimpl/UI-MenuModals-10025e0f9fRenderAndPlayKeepAndGranaryPlacementInfoDisplayElementreimpl/UI-DisplayElements-pr-100f87b2f2RenderBottomLeftDateDisplayElementreimpl/UI-DisplayElements-pr140bef0RenderConnectAndPathLinkageInfoTextDisplayElementarchive/UI-MenuViews-development-second-pass32939bbRenderCurrentMenuViewarchive/UI-MenuViews-development-second-pass32939bbRenderDisplayElementsUnkreimpl/UI-DisplayElements-pr-100f87b2f2RenderGamePausedTextDisplayElementreimpl/UI-DisplayElements-pr140bef0RenderGameSpeedTextDisplayElementreimpl/UI-DisplayElements-pr140bef0RenderMissionWinDefeatBannerDisplayElementreimpl/UI-DisplayElements-pr-100f87b2f2RenderPeopleLeftToPlaceDisplayElementreimpl/UI-DisplayElements-pr140bef0RenderPlayerPingUnkDisplayElement22reimpl/UI-DisplayElements-pr-100f87b2f2RenderSomeMultiplayerInfoUnkDisplayElement19reimpl/UI-DisplayElements-pr-100f87b2f2RenderStartingGoodDisplayElementreimpl/UI-DisplayElements-pr-developmentfbc092eadaptGmColorsToRGB565IfRequiredarchive/UI-MenuViews-development-second-pass32939bbclearSomeMemoryarchive/UI-MenuViews-development-second-pass32939bbcreateCrusaderWindowreimpl/UI-Rendering-10011cb30edrawGfxOnFlaggedSurfacearchive/UI-MenuViews-development-second-pass32939bbdrawLoadingBarUnkarchive/UI-MenuViews-development-second-pass32939bbtransformGmColorTableFromRGB555To565IfRequiredarchive/UI-MenuViews-development-second-pass32939bbOther PRs:
🤖 Generated with Claude Code