Repository navigation
Reimplement 5 UI::MenuItems scrollbar, crusade intro and options functions at 100% - #342
Merged
Merged
Conversation
Finished from gynt's draft on his fork (reimpl/UI-MenuItems, 79.2%, "Style pass, asm differs"). Behaviour fix: after scrolling down (event 6) the original also writes the new offset to *currentValue, as it does after scrolling up; the draft returned without it. Both scroll events now step the offset and store it in one tail, which the compiler shares the way the original does. quick_diff 0.8182 (43 instructions against 45) -> 45/45 with only the jump-table spelling and ret / ret 0 left (0.8667), same global order. Style pass: named parameters (scrollbarEvent, as main's map select scrollbar calls it), - 10 for + -10, ++ / --, no plate comment, and the namespace block its siblings on main use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ranking games scrollbar (0x004D9B30) compares the offset against the count less 8 with jge at 0x004D9BDD, which shows both are signed. It also tests the offset with jle at 0x004D9BBC and the count less 8 with jns at 0x004D9B92. DAT_00eb9b60 has no user on main; DAT_00ed3120's one user there, SetActiveCreditsSequenceIndex, only stores 0 in it, which compiles the same either way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finished from gynt's draft on his fork (reimpl/UI-MenuItems, 75.4%, "Style pass, asm differs"); it needs the header commit before this one. Behaviour fix: event 7 (a click on the track, off the thumb) sets *currentValue to 6 and returns, where the draft fell on into event 5 and scrolled up as well. For that event the menu passes its page step in that pointer, then moves the offset by it and sends event 2 (handleMenuElementsCallbacks), so the list pages by 6 of its 8 games. Events 5 and 6 step the offset and store it in one tail each, as the FindingNetworkSessions scrollbar does; the cases stay in the original's order (1, 2/3, 4, 7, 5, 6). Comments give what the other forms measured: the count read once into a local (reading it again for the test: quick_diff 0.8679 -> 0.7593), and the compare before each store (a plain store: quick_diff 0.8679 -> 0.7308 and reccmp 100.0% -> 78.3% for events 2 and 3, 0.6538 and 69.4% for event 4). quick_diff 0.7810 (52 instructions against 53) -> 53/53 with only the jump-table spelling and ret / ret 0 left (0.8679), same global order. The event parameter is scrollbarEvent, as main's map select scrollbar calls it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finished from gynt's draft on his fork (reimpl/UI-MenuItems-development, 78.7%, "Reimplemented, asm differs"). Each trail tests its own progress against its own length (20, 30 and 50 missions) inside its arm and starts the mission there; the compiler merges the three calls into the original's one. The draft's form, one call with mission and length locals, needs one more instruction (quick_diff 0.9545 -> 0.8764, reccmp 100.0% -> 80.9%); a comment says so. Question 7 of the yes/no dialog is "Quit Mission" (drawHeaderTextBanner(TEXT_GAME_OPTIONS, 7)). No casts (the progress fields are ints on main). quick_diff 0.8764 (45 instructions against 44) -> 44/44 with only ret / ret 0 left (0.9545), same global order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finished from gynt's draft on his fork (reimpl/UI-MenuItems, 94.4%, "Style pass, asm differs"). Each path makes its own renderTextToScreen call, which the compiler merges into the original's one call site (0x00493556); one call with a colour local measures 100.0% -> 62.5%. Each path also computes the text position itself: the compiler hoists the identical computations above the branch the way the original does, while the position declared once above the `if` (as main's OptionsMenu_SubOptionsButtons has it) schedules one `push 0` later, 100.0% -> 97.2%. A comment gives both. quick_diff 0.8889 -> 0.9167 at 36/36 instructions; the three lines it still marks are its own artefacts: the two colour immediates, which fall in the exe's address range so it prints them as globals on the original's side, and ret / ret 0. Names as on main: textIndex, as in its other TEXT_GAME_OPTIONS lookups, textX and textY, and the namespace block the other General files use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finished from gynt's draft on his fork (reimpl/UI-MenuItems, 60.9%, "rebuilt control flow from asm"). Each trail sets the flag with an `if` inside its own arm, so the compiler shares one `jl` and `mov eax, 1` between the three arms, as the original does. The flag is a BOOLEnum: the original zeroes it with xor and tests it with cmp, so it is an int and not a bool. No casts (the progress fields are ints on main). quick_diff 24/24, only the tail jump's target differs (0.9583). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
Main's sync took in this branch's header change: DAT_00ed3120 and DAT_00eb9b60 are now INT_00ed3120 and INT_00eb9b60, declared int. Main's two headers are taken as they are, so the branch's header commit leaves no diff, and RankingGames_Scrollbar follows the rename (11 and 3 uses, and its two includes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
This was referenced Nov 6, 2026
gynt
approved these changes
Nov 6, 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.
Five UI::MenuItems functions at 100%, each with its status line: the scrollbars of two lists (network sessions and ranking games), the crusade mission intro's handler and render, and the text button of the game options menus.
All five continue gynt's drafts on his fork (
reimpl/UI-MenuItemsand-development, at 60.9-94.4% there). Every commit body says what changed against the draft and why. No header change left: main's Ghidra sync 7621d4f took ours in (below), and main is merged in.Other PRs: the ready #348 and #349, and the drafts #313, #318, #321, #327 and #328.
Built on top of
main(d972299, and it merges cleanly into 57d3334) with the bundled MSVC1400-SP1, natively on Windows, against the SteamStronghold Crusader.exe(3bb0a8c1…5387ac5a). The branch was built and measured on its own, 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 #331 and #340: the points from the reviews of #311, #312 and #323, a fresh-eyes review of every file (the behaviour fixes checked against the original's disassembly, every text comment against the code that reads it; its points applied and measured),
openshc-pr-checkwith no errors, main'sstyle_lint.pywith nothing to report, andstatus_regression.py, which finds nothing below a known score on main or any fork.Header change (now on main)
DAT_00ed3120andDAT_00eb9b60are ints on main since its sync 7621d4f, renamedINT_00ed3120andINT_00eb9b60; this branch now uses those names. The evidence was: the ranking games scrollbar compares the offset against the count less 8 withjgeat 0x004D9BDD, which shows both are signed, and it tests the offset withjleat 0x004D9BBC and the count less 8 withjnsat 0x004D9B92.Behaviour fixed compared with the draft
Read from the original's asm; the commit body gives the details.
*currentValue, through themov [edx], eaxat 0x0047D3C5 that scrolling up uses too. The draft returned right after the increment, so*currentValuewas never written after a scroll down.*currentValueto 6 and returns (mov dword ptr [edx], 6; retat 0x004D9BAA, with its own jump-table entry). The draft had nobreak, so it fell into event 5, scrolled up one and overwrote the 6. The menu then pages the list by 6 of its 8 games.MenuItemActionHandler_FindingNetworkSessions_ScrollbarMenuItemActionHandler_RankingGames_Scrollbarrow < 8).MenuItemActionHandler_CrusadeMissionIntro_MainMenuItemRenderFunction_General_GameOptionsTextButtonMenuItemRenderFunction_CrusadeMissionIntro_MainBOOLEnum: the original zeroes it withxorand tests it withcmp.Kept as they are, and why
Each was measured; a one-line comment in the code says why.
renderTextToScreencall and computes its own position, which MSVC merges into the original's one call at 0x00493556 (one call with a colour local: 100.0% -> 62.5%; the position declared once above theif: 97.2%).SetupSkirmishModecall per trail, which MSVC merges (one call with mission and length locals: quick_diff 0.9545 -> 0.8764, reccmp 100.0% -> 80.9%).gameSuspended == 1: the original compares with 1, as main'sResetEventStatusUnkdoes.Proposed, not changed here
DAT_00eb9b60is the number of leaderboard entries left after the filter: written bySkirmish_PrepareLeaderboardView(0x004D9400), read bySkirmish_SortAIOpponentOrderandRankingGames_Main(0x004D9730).DAT_00ed3120is the ranking list's scroll offset.DAT_ButtonUnknownZerolooks like a "button disabled" flag: the intro render sets it for button 10 once the trail is complete.🤖 Generated with Claude Code