Repository navigation
UI: three more functions at 100%: the lobby's start button, the save list's header and the mission rows - #423
Merged
TheRedDaemon merged 8 commits intoNov 24, 2026
Conversation
LobbyMenu::MenuItemActionHandler_LobbyMenu_LobbyscreenStartButtonClick, from gynt's draft (c0a2f52 at 40.85% on his fork's development; c88d7a2 at 40.8% on upstream's reimpl/UI-MenuItems; f53ef94 to d81f02f, 54.93% to 69.03%, his fork's reimpl/UI-MenuItems; a4fb7c2 of 2026-10-28 on his fork's reimpl/Wilps-2026-10-18; 99cb905 at 80.53%, 35aef55 at 80.71% and dd1a7c4 of 2026-11-02, his newest commit on the file, on his fork's reimpl/UI-MenuItems-development) and our cb601a0 and 1918de9 in draft sourcehold#327 (90.7%). 90.3% -> 100.0% on main 3458fea: - case 4 sets the draw buffer back once, after the if / else that launches the game: the original pops three registers before that store in the skirmish arm (pop esi / pop ebp / pop ebx / mov / pop edi / ret); - the two keep-position loops read keepPositions[position].x where they use it, with no local, which gives lea ebp, [eax + edi + 572] with x as the base (a local gave [edi + eax + 572]); - the map index. Case 4 writes its two sums as DAT_MapSelectionScrollOffset + DAT_MapSelectionRelativeSelected, and case 105 takes its index through a local that is declared before the switch. That gives both cases the original's two loads and add (0x0044284E: edx, eax, add eax, edx; 0x00442AD8: ecx, edx, add edx, ecx). The three sums are coupled: of 32 combinations (each case's sum written out, as a block-scope local or as this local, in both operand orders) only this one and its twin with case 105's operands swapped match. A block-scope local in case 105 swaps case 4's loads, which is why the declaration stands before the switch, with one comment line. The local starts at 0, which nothing reads: declared without a value, style rule 24 asks for it in case 105, and the code is the same either way. quick_diff reads 0.9956: its two lines are a tail jump it prints as a label and the jmp over the first loop's alignment padding; it cannot see the load order, since it prints both fields as [G]. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SaveLoadMap::MenuItemActionHandler_SaveLoadMap_TableHeader, rewritten from the binary with gynt's draft for the names (f788afb at 17.2% on upstream's reimpl/UI-MenuItems; 54e57c4 and 21d4dcf at 47.81% and 49.40% on his fork's reimpl/UI-MenuItems; 8725ec5 at 49.4% on his reimpl/UI-MenuItems-development, his newest reimplement commit on the file). reccmp 100.0 (normalized 100.0) on main 3458fea with the data and its own function resolver on; the draft reads 47.8 there. The array index changed with the header. gynt's draft uses DAT_ArrayOfMapIndices[i - 1] and [i], which was right on his branch, where the array is declared at offset 0x884. Main's sync 12854bc (2026-11-04) moved the declared start to 0x880, so the original's 0x01126E28 and 0x01126E2C are [i] and [i + 1] here. - The order store is in each arm and previewedListIndex = -1 is written once after the if / else. MSVC copies that store into both arms, after the last pop, as the original has it; only the order store sits between the pops. Written in each arm, it keeps -1 in ebx and pushes ebx at the top, and the first sort's two loops lose their alignment padding. - The swap reads the moved element into a local inside the if. With both elements in locals before the test they land in each other's registers. - fileListEntryCount is read in the loop condition: the original reloads it after each swap's stores. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HistoricMissionSelect::MenuItemRenderFunction_HistoricMissionSelect_MissionRows, rewritten from the binary with gynt's draft for the names (298b3af at 20.6% on upstream's reimpl/UI-MenuItems; 633d784 at 41.41% on his fork's reimpl/UI-MenuItems; 626fd68 at 44.53% on his reimpl/UI-MenuItems-development, his newest reimplement commit on the file). reccmp 100.0 (normalized 100.0) on main 3458fea with the data and its own function resolver on; the draft reads 45.3 there. Behaviour: a mission not reached yet is drawn as a greyed cell and the function returns (0x00426A53). The draft went on and drew the number and the name over it. - The number and the name are written in each of the three arms, and DAT_ButtonUnknownZero = FALSE once after them: MSVC hoists the arms' common pushes and shares the tail, as the original has it. - The number's position is written out in each arm; with locals for it the two loads come in the other order. - In the selected arm the name's position and index are read into locals before the nested call, Y, X, then the index, which gives the original's registers for that call. - The locked test compares (int)(DAT_00b96100 - row - 1): the global is an undefined4, and the original's jle is signed. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 19, 2026
TheRedDaemon
requested changes
Nov 23, 2026
…e ints, and a FileListSortOrder enum DAT_00b96100 is the first mission of the historic campaign the mission list shows (1, 6, 11 or 16), and DAT_00b95b2c is that campaign's index (0 to 3). MenuView_HistoricMissionSelect_Prepare (0x00426830) picks the campaign from missionNumber1to20 and stores the index and index * 5 + 1 (0x00426879 / 0x0042687E and the two other arms). The mission rows compare DAT_00b96100 - row - 1 with that campaign's progress signed (jle at 0x00426A22), so DAT_00b96100 is an int, and DAT_00b95b2c, an index from 0 to 3, is one with it. Their data.asm symbols follow in the next commit. MenuTextInputState::fileListSortOrder holds one of four orders of the load / save file list, and the three savedListSortOrder fields hold copies of it; all four are now int. The values get names in a new FileListSortOrder enum: 0 by name, A to Z, as discoverMapFiles sorts the list, 1 Z to A, 2 by file time newest first, 3 oldest first. The table header's four sorts end in those values (0x00492FA2, 0x00492F69, 0x00492F25, 0x00492EB5). Only the table header includes the enum: included by MenuTextInputState.hpp, which many files include, its declarations swap two registers in LobbyscreenStartButtonClick and LaunchSinglePlayerGameUnk. Header changes only. The users on main 48f7e94 and on this branch compile to the same code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
data.asm names the instances at 0x00B96100 and 0x00B95B2C with the int type (H instead of I), as it does for main's other int globals, to go with the header commit before it. The Extern symbol's name carries the type, so a build with their struct resolvers off links only with both commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MissionRows tests DAT_00b96100, now an int, without a cast. The table header writes its sort orders as FileListSortOrder names, and its first switch's labels too: that switch is on -1 - button, the order the handler ends in. The listings are the same: narrow builds of this branch's files and of every user of the two globals and the four fields read 100.0 raw and normalised, with no diff line, before and after, and so do a full build of the branch merged with main 48f7e94 and narrow builds of these two files in their final form. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
added a commit
that referenced
this pull request
Nov 24, 2026
Main's header sync renamed the two globals to INT_00b95b2c and INT_00b96100, so main's two headers are taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's header sync named DAT_00b95b2c and DAT_00b96100 INT_00b95b2c and INT_00b96100. The mission rows, and main's General handler and Prepare view, include the new headers and use the new names. Main's two files have not compiled since the sync without this. The code is otherwise the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TheRedDaemon
approved these changes
Nov 24, 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.
Three more UI functions at 100%. From the review,
INT_00b96100andINT_00b95b2c(DAT_00b96100andDAT_00b95b2cuntil now) and the file list's sort order becameints, with aFileListSortOrderenum for the sort order's values. Main has these header changes since its Ghidra sync 8e1e77f, so the branch no longer changes a header. The lobby's start button comes from our draft #327, and the other two are rewritten from the binary with gynt's drafts for the names.LobbyMenu::MenuItemActionHandler_LobbyMenu_LobbyscreenStartButtonClickSaveLoadMap::MenuItemActionHandler_SaveLoadMap_TableHeaderHistoricMissionSelect::MenuItemRenderFunction_HistoricMissionSelect_MissionRowsMeasured.
Stronghold Crusader.exe(3bb0a8c1…5387ac5a), both resolver sets enabled locally (not committed), and sourcehold's reccmp with--resolve-wrapped-calls --ignore-security-cookie./GLlist, and with 0x004314E0 (theMapEditorLandscaping_GeneralButtonshandler) left out and its resolver off, as in main's baseline, together withrequestGoods(0x004D1F00) andMenuItemActionHandler_Allies_Main(0x004B12D0), which do not compile on 48f7e94 until Reimplement 29 Synchrony and Game functions at 100% #403 renames their twoPlayerDatafields: 0 failed of 2,469 compile steps, 99.59 over 2,485 functions, against 99.59 over 2,482 for main alone (unrounded 99.5920 and 99.5915 raw, 2,368 and 2,365 functions at 100.0). All three functions read 100.0 raw and normalised, with no diff entry. With the header changes, all eight of main's users ofDAT_00b96100,DAT_00b95b2c,fileListSortOrderandsavedListSortOrder1to3read 100.0 as before, and every other function reads exactly what it reads in the same build of main.FileListSortOrdernames with the same values. Narrow builds of the two files in their final form read 100.0 raw and normalised, with no diff line.openshc-pr-fixfinds nothing to change, andopenshc-pr-checkgave 0 ERROR and 27 CHECK; on the head it gives 30, all explained below.INT_00b95b2candINT_00b96100. 37802ec merges main in, and ac932fc moves the mission rows to the new names. It also moves main'sMenuItemActionHandler_HistoricMissionSelect_GeneralandMenuView_HistoricMissionSelect_Prepare, which still include the removedDAT_headers and so don't compile on 8e1e77f. A narrow real build of ac932fc reads MissionRows, the table header, General and Prepare at 100.0 raw and normalised, and the lobby's start button at 99.3 (83.3 normalised), as after the last main merge (see below). The fixer changes nothing, and the checker gives 0 ERROR and 30 CHECK.What got them to 100%
if/elsethat launches the game, because the original pops three registers before that store in the skirmish arm.keepPositions[position].xwhere they use it, with no local.LaunchSinglePlayerGameUnkon main. It reads 100.0% on this branch and with main up to d502a12; the source is unchanged.previewedListIndex = -1is written once after theif/else. MSVC copies that store into both arms after the last pop, as the original has it.if.fileListEntryCountis read in the loop condition, because the original reloads it after each swap's stores.Behaviour compared with the drafts
INT_00b95960 = -1on every path, and stops when no position is under the mouse.DAT_ArrayOfMapIndices[i - 1]was right on gynt's branch, where the array is declared at offset 0x884. Main's sync 12854bc moved the declared start to 0x880, so the index here is[i].Headers changed (from the review, now on main)
One header commit, e7d2efc, with data.asm's two symbols in the commit after it, 0ccba1a, so a build with their struct resolvers off links. Main has both since 8e1e77f, with the two globals named
INT_00b96100andINT_00b95b2c.INT_00b96100andINT_00b95b2c(DAT_…until now) areints.MenuView_HistoricMissionSelect_Prepare(0x00426830) works out the shown campaign frommissionNumber1to20and stores its index, 0 to 3, inINT_00b95b2cand its first mission,index * 5 + 1, inINT_00b96100(0x00426879 / 0x0042687E and the two other arms). MissionRows comparesINT_00b96100 - row - 1with that campaign's progress signed (jleat 0x00426A22), so the(int)cast is gone.FileListSortOrderis a new enum for the file list's sort order:FLSO_BY_NAME0 (the list asdiscoverMapFilessorts it, A to Z),FLSO_BY_NAME_REVERSED1,FLSO_BY_TIME_NEWEST_FIRST2 andFLSO_BY_TIME_OLDEST_FIRST3. The table header's four sorts end in these values (0x00492FA2, 0x00492F69, 0x00492F25, 0x00492EB5), and it now writes them by name, also as the labels of the arrows' switch, which is on-1 - button, the order the sort ends in.MenuTextInputState::fileListSortOrderand its saved copiessavedListSortOrder1to3are nowints, where they wereundefined4. They are not typed with the enum: withFileListSortOrder.hppincluded byMenuTextInputState.hpp, which many files include, its declarations swapped two registers inLobbyscreenStartButtonClickandLaunchSinglePlayerGameUnk, which don't use it. So only the table header includes the enum.What the placeholders hold
These are read from how the code uses them. Ghidra has no better names, so the names are unchanged.
DAT_00b960dc: the lobby's fade. It is non-zero while the menu fades in or out, and the handler ignores clicks while it is non-zero.DAT_00b960f4: the map description's scroll offset.INT_00b95b74: probably the description text's height, since the scroll limit is this value minus 114.INT_00b95960: the player position being dragged onto another keep, or -1 when nothing is being dragged.INT_00b95f64: the keep slot that position was picked up from.INT_00b96100: the first mission of the campaign the list shows (1, 6, 11 or 16); a row shows missionINT_00b96100 - row - 1.INT_00b95b2c: that campaign's index, 0 to 3, which indexes the four progress entries inScenarioProgress.MenuTextInputState::field_0x9c: set to 1 before the lobby opens the load dialog. I don't know what it means.The checker's 30 CHECKs
:201,:202,:203,:209,:210,:211,:212DAT_00b960f4:236,:246,:271INT_00b95960:237,:262,:263INT_00b95f64:41DAT_00b960dc:77field_0x9c:208INT_00b95b74:50:37FileListSortOrdernames:35,:50,:61,:71,:79INT_00b96100:36INT_00b95b2c:53:28, Prepare:41INT_00b96100:40INT_00b95b2c:39gotogoto; the bot comments only when a PR opensProposed, not changed here
ScenarioProgressas an array: MissionRows:36reads(&DAT_GameCore::instance.scenarioProgress.progressCallToArms)[INT_00b95b2c::instance], indexing the four campaign entries from the first one. They could be anint[4]indexed by a campaign enum in the fields' order (Call to Arms, Saladin's Conquest, The King's Crusade, Crusader States), which would make this a plain index. That changesGameCore.hpp, andConstructor_GameCoreandincrementMissionProgresson main, so it seems better done with the Ghidra sync. Not measured.loadOrSaveGame(int): the options click handler passes it 9 for Load (0x00496C85) and 10 for Save (0x00496CFA), which areMMT_LOAD_MAPandMMT_SAVE_MAP. Its parameter is probably aMenuModalType, and the lobby's9is probablyMMT_LOAD_MAP.One function leaves #327
The lobby's start button moves here from the draft #327. 942d855 on #327 takes it out of that draft.
🤖 Generated with Claude Code