Repository navigation
Reimplement 5 UI::MenuItems functions at 100% - #351
Merged
Merged
Conversation
From gynt's reimpl/UI-MenuItems (PR sourcehold#254, closed), 62.9% there. Behaviour fix: the original returns after drawing the sorted column's header (ret at 0x004AE7B6); the draft went on to RenderButtonImageWithBlending and drew the default picture over it. The position goes straight into the renderGM call, as the original pushes it before calling getPictureNumberInGm. quick_diff leaves only ret / ret 0; reccmp 100% in a trial build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gynt's reimpl/UI-MenuItems (PR sourcehold#254, closed), 64.3% there. The hover caption is drawn in two calls, "Skip Current Mission" while skips are left and "No Chickens Left" otherwise (cr.tex section 256, texts 0 and 1), which MSVC merges but for the text index, as the original's push 0 at 0x004D8E90 and push 1 at 0x004D8EA8; the draft's (count < 1) index compiled to a setl. The caption's position is computed before the test, y first. DAT_SkirmishTrailRelated1 is declared unsigned and the original compares it signed (jle at 0x004D8E8E), hence the (int). reccmp 100% in a trial build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gynt's reimpl/UI-MenuItems (PR sourcehold#254, closed), 70.3% there, after main's renames (field_0x0, wallDragButtonUp, field_0x1dc). Behaviour fix: the original returns after drawing the wall preview while the drag goes on (ret at 0x0043805E), so the wall is only placed once the drag has stopped; the draft went on and could queue GCT_PLACE_WALL during the drag. The arms of three ifs now come in the original's order: the click first, the flat view's setupMouseTileXY2 first, the illegal build first. The six command parameters are set in address order, which MSVC compiles to the original's store order (Param1, Param0, Param2, Param4, Param3, Param5 from 0x0043809B on); the draft had copied that compiled order, and written so ours came out in address order (reccmp 93.3%). quick_diff 0.8186 -> 0.9748, which leaves only ret / ret 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gynt's reimpl/UI-MenuItems (PR sourcehold#254, closed), 53.0% there. Built with /GL (added to cmake/compiler-flags-gl.txt): the original keeps the button's address in ecx across getPictureNumberInGm (0x004630B0, 100% and already in the list) and reads the GM ID through it afterwards (mov ecx, [ecx] at 0x00464040). Each use indexes the array afresh: the original computes the byte offset once and forms the address in each path (lea ecx at 0x00464028 and 0x00464081), where a pointer local moved it ahead of the branch (70.7% with /GL). reccmp 100% in a clean alone build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gynt's fork branch reimpl/UI-MenuItems-development, 54.6% there. The game's results are copied with one struct assignment (rep movsd of 0x1DE dwords at 0x004D97B6) and the end-screen picture names with plain strcpy calls from the S_* literals, which MSVC inlines as the original does (six dword moves, five dword moves, rep movsd plus movsb, and five dwords and a byte); the draft had a hand-written loop and a memcpy with a masked byte. Button 11 is an if/else of the two switchToMenuView calls followed by one store of the stored game mode, which MSVC duplicates into both paths with the original's registers (two separate returns: quick_diff 0.9506 -> 0.8519). The scroll offset and the game count are main's INT_00ed3120 and INT_00eb9b60, declared int since 7621d4f. quick_diff then leaves only its spelling of rep movsd and ret / ret 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
approved these changes
Nov 6, 2026
This was referenced Nov 6, 2026
kotijekriv
added a commit
to kotijekriv/OpenSHC
that referenced
this pull request
Nov 7, 2026
…nc, sourcehold#355) into reimpl/UI-MenuViews-1-100
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 greatest lord table's header render, the crusade map's skip button caption, the in-game wall placement command, a button render on the screen menu surface, and the rankings screen's buttons.
All five continue gynt's drafts on his fork: four from
reimpl/UI-MenuItems(the branch of PR #254), the rankings handler fromreimpl/UI-MenuItems-development. Every commit body says what changed against the draft and why. No header change. One file is added tocmake/compiler-flags-gl.txt(below).Other PRs: the ready #342, #348, #349 and #350 (a fix for main), and the drafts #313, #318, #321, #327 and #328.
Built on top of
main(da1fef5) with the bundled MSVC1400-SP1, natively on Windows, against the SteamStronghold Crusader.exe(3bb0a8c1…5387ac5a). The branch was built clean 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 #349: a fresh-eyes review of every file (behaviour checked against the original's disassembly, texts against cr.tex; its points applied and measured),
openshc-pr-checkwith no errors, andstatus_regression.py, which finds nothing below a known score on main or any fork.Behaviour fixed compared with the drafts
retat 0x004AE7B6). The draft went on toRenderButtonImageWithBlendingand drew the default picture over it.retat 0x0043805E). The draft went on, so during a drag it could queueGCT_PLACE_WALL, and show the fail-reason text, every frame.MenuItemRenderFunction_GreatestLord_MainMenuItemRenderFunction_General_CrusadeMapAndEndscreenMenuItemActionHandler_InGameMenu_TriggerPlaceWallCommandMenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface/GL.MenuItemActionHandler_RankingGames_MainKept as they are, and why
Each was measured; a one-line comment in the code says why where the shape isn't obvious. quick_diff compiles without LTCG, so its baselines here read below 1.0.
/GL: aftercall 0x004630B0(getPictureNumberInGm) the original reads through the preservedecx(mov ecx, [ecx]at 0x00464040), which needs/GL; the callee's file is already in the list and at 100%. Each use indexesButtonGmDataArrayafresh, as the original forms the address in each path (lea ecxat 0x00464028 and 0x00464081); aButtonGmData*local, as inRenderButtonImageWithBlending, moves it ahead of the branch (70.7%).DAT_ButtonCurrentlyInteracting: 0.8000).(int)DAT_SkirmishTrailRelated1, because the header hasundefined4and the original compares it signed (jleat 0x004D8E8E).(ushort)currentMapperCommandin both calls: the original passes the mapper's low word, zero-extended (movzxat 0x00437FD8 and 0x00438019), to anundefined4 commandparameter.getWallTilesThatCanBeBuilt(..., Resources::RT_STONE)for every wall tool, the wooden wall included: the original pushes 4 at 0x00437FB7.switchToMenuViewcalls and one store of the stored game mode (two separate returns: quick_diff 0.9506 -> 0.8519);1 - descending(!descending: 0.9354); the clamp written twice, as the original has it twice (0x004D9981, 0x004D99D2); the results copied with one struct assignment (rep movsdof 0x1DE dwords at 0x004D97B6) and the picture names with plainstrcpy, which MSVC inlines as the original does.Proposed, not changed here
DAT_00ed3124is the rankings filter: 0 "All Games", 1 "Crusader Trail Only", 2 "Custom Games Only" (cr.tex group 255, texts 7-9); an enum would name them.INT_00ed3120is the rankings list's first shown row andINT_00eb9b60the number of games in it (counted in Skirmish_PrepareLeaderboardView, 0x004D9400). Main'sSetActiveCreditsSequenceIndex(0x004D9270) sets the filter and resets the first row (see Fix SetActiveCreditsSequenceIndex after the INT_00ed3120 rename #350).DAT_00ed2788: the game record the delete dialog removes (read at 0x004D9D67, passed to 0x004D5370).DAT_CurrentMenuID_3: the menu the rankings were opened from (stored at 0x0046B6E6 / 0x0046B700).DAT_StoredGameMode:undefined4->GameModeInt(MenuView_RankingGames_Prepare savescurrentGameModeinto it; button 11 restores it).INT_00ed2bdc: "skip button hovered", aBOOLEnum(three stores in the exe, all 0 or 1).DAT_SkirmishTrailRelated1(0x00ED27C0): the crusade trail's chickens (skips) left, anint: set to 3 at 0x004D8D48, lowered and clamped at 0 in 0x004D8CB0, lowered again at 0x004D8F3B, always compared signed. As anintit would drop the cast above.BOOLEnumcandidates (only 0/1 stored, tested by truthiness):MissionDefinedData::descending,TileMapState::wallDragButtonUp(seteat 0x00438034), andGameCore::skipStoreSKMasters(abyte; about 30 stores, all 0/1).MouseState::field_0x1dcis a mouse mode: -1, 0-5, or 1000 here (a switch at 0x004EC5D6 has a case for 1000), so an enum candidate.TileMapState::validateWallBuildPath/renderWallDragPreview: the last parameter isundefined4 command, but every caller passes the mapper's low word; it may be a 16-bit type.🤖 Generated with Claude Code