Repository navigation
Reimplement 5 UI::MenuViews functions at 100% - #353
Merged
Merged
Conversation
From gynt's fork branch reimpl/UI-MenuViews-development (97.9% there), after a style pass; the statements are his. What changed: the four picture names "c1pic.tgx" to "c4pic.tgx" are s_ pointers, with each name's comment above its statement; (int)(historicCampaignNumber * 6 + -2) and + -1 are written * 6 - 2 and - 1; the unused using of eTextSections goes; two comments say what the switch and the two texts are (cr.tex group 179 has six texts per campaign, and the last two are "Aftermath" and the closing text). quick_diff 0.9762, which leaves only the original's jump-table spelling and ret / ret 0. The strings are the s_ pointers from string-literals.hpp, with their text above them (SG 19), as in main's sibling PrepareHistoryBook (the original pushes each address; the S_ macros are for inline copies); the pointer swap measures the same as the S_ macros did. This file was measured as it stands, not only the draft: 100.0% raw and 100.0% normalized in reccmp in a clean alone build of the branch on main da1fef5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gynt's fork branch archive/UI-MenuViews-merged-full (97.2% there), after a style pass. His live reimpl/UI-MenuViews-development has another draft of it, also 97.2%, with two gotos; the merged-full one already writes the video and view-switch test as an if, so it was the shorter way to a goto-free function. What changed: the decompiler's hand-written security cookie and its MSVC_SecurityCookie.hpp include go (MSVC emits the cookie for the buffer itself); the buffer is char version[100], declared where it is first used; the goto that skipped the idle video becomes if (!flag), which measures the same (quick_diff 0.9725 both); (HBINK)0x0 is NULL; the (int) casts on currentNumber1 and y + 588 go; 0 < flag is flag > 0; 0x1fc, 0x16 and 0x13 are 508, 22 and 19; the colour 0x7caaaf is main's COL_7CAAAF; the stray ; and return go, and so do three using lines and the BOOLEnum.hpp include. The comment on the roll is a fixme: SEC_RNG's table comes from rand(), so currentNumber1 % 3 is 0 to 2 and every roll leaves the flag 0, and the sword swing never starts from here (only from MainMenu_DoInitial 0x00424CD0), as in the original. quick_diff 0.9725, which leaves the security cookie, the colour immediate and ret / ret 0. The strings are the s_ pointers from string-literals.hpp, with their text above them (SG 19), as in main's sibling PrepareHistoryBook (the original pushes each address; the S_ macros are for inline copies); the pointer swap measures the same as the S_ macros did. playBINK takes a char*, so its strings are cast with (char*), as main's playBikVideoFromPlayer.cpp does. This file was measured as it stands, not only the draft: 100.0% raw and 100.0% normalized in reccmp in a clean alone build of the branch on main da1fef5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gynt's fork branch reimpl/UI-MenuViews-development (96.8% there), after a style pass. What changed: pcVar1 goes and
the three text calls feed StoreStringInMenuStringArray directly; _tgxFileName is fileName, declared after
PrepareHistoryBook where it is first used; the text group missionNumber1to20 * 4 + 95 is written (missionNumber1to20 -
1) * 4 + TEXT_MISSION1_STORY, the mission's story group ("Mission N", the title and the story; it measures the same as
the draft's + 95); the casts in the eTextSections and TrimStoredMenuString arguments and a stray ; go; comments say what
the picture, the texts and the trim are. The three calls stay three (a loop over the text number: quick_diff 0.9677 ->
0.6903). quick_diff 0.9677, which leaves the security cookie and ret / ret 0. The strings are the s_ pointers from
string-literals.hpp, with their text above them (SG 19), as in main's sibling PrepareHistoryBook (the original pushes
each address; the S_ macros are for inline copies); the pointer swap measures the same as the S_ macros did. This file
was measured as it stands, not only the draft: 100.0% raw and 100.0% normalized in reccmp in a clean alone build of the
branch on main da1fef5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gynt's fork branch reimpl/UI-MenuViews-development (96.2% there), after a style pass. What changed: pcVar1 goes and
the two text calls are inline; local_14 is fileName, in the same place; + -1 is - 1; the text group is
(missionNumber1to20 - 1) * 4 + TEXT_MISSION1_STORY ("Mission N" and the title; it measures the same as the draft's +
95); a stray ; goes; comments say which picture (the campaign's: five missions each) and which texts. quick_diff 0.9623,
which leaves the security cookie and ret / ret 0. The strings are the s_ pointers from string-literals.hpp, with their
text above them (SG 19), as in main's sibling PrepareHistoryBook (the original pushes each address; the S_ macros are
for inline copies); the pointer swap measures the same as the S_ macros did. This file was measured as it stands, not
only the draft: 100.0% raw and 100.0% normalized in reccmp in a clean alone build of the branch on main da1fef5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gynt's fork branch reimpl/UI-MenuViews-development (99.1% there), after main's renames (INT_00ec082c, CHAR_00eb0e44) and a style pass. What changed: DVar2 = timeGetTime() is folded into the subtraction; the two tab stores are activeMenuTab.tabType = BASMTT_NONE and BASMTT_KEEP_OR_MPMENU_IPX, as main's MissionEndscreen_Main pairs them with INT_00ec082c 0 and 2 (the draft had (BuildMenuTabType)0 and 2 in buildMenuTab, the same int at the same offset); DAT_SomeTextArrayIndex = 9 is TAIT_NINE__FILTER_B, as main writes it; the (ushort) cast on COL_BLACK goes; menuY and menuX are const and pMVar1 is Menu* const menu; the missions 6 to 10 test is a range; 0x50 and 0x3c are 80 and 60; six using lines and the BOOLEnum.hpp include go. currentMenu is still read once into the local, as the draft had it (read twice: quick_diff 0.9909 -> 0.9774). The four playBINK calls stay four, as the original's compiler merged their tails (one call after picking the file: quick_diff 0.9909 -> 0.7282). quick_diff 0.9909, which leaves only the timeGetTime import call. The strings are the s_ pointers from string-literals.hpp, with their text above them (SG 19), as in main's sibling PrepareHistoryBook (the original pushes each address; the S_ macros are for inline copies); the pointer swap measures the same as the S_ macros did. playBINK takes a char*, so its strings are cast with (char*), as main's playBikVideoFromPlayer.cpp does. This file was measured as it stands, not only the draft: 100.0% raw and 100.0% normalized in reccmp in a clean alone build of the branch on main da1fef5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
…d screen The comment said "outside skirmish", but the video is skipped only in GM_SKIRMISH_END_OF_GAME_SINGLE_PLAYER (666); a skirmish game (GM_SKIRMISH_SINGLE_PLAYER, 99) gets it. Comment only: quick_diff 0.9909 before and after. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
…nc, sourcehold#355) into reimpl/UI-MenuViews-1-100
It was an int. Every store is 0 or 1: 0 at 0x004D55EC (this PR's MenuView_GameLost_Prepare) and 0x004E1B5F
(MenuView_MissionFinishedTransition_Prepare), both from a zeroed ebx, and 1 at 0x004D6C23
(MenuItemActionHandler_MissionEndscreen_Main, on main); the two reads, at 0x004DC5B5 and 0x004DCA5C, compare it with a
register and with 0. The name stays INT_00ed279c, a proposal for Ghidra's side ("end screen continue pressed"). BOOLEnum
is BOOL, an int, so main's MissionEndscreen_Main compiles the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The file name is only read: the function compares it with each loaded sound's name through __stricmp, which takes char const* (main's getSoundVolumeForFilename.cpp, 0x0044A240). Every caller passes a char* and compiles the same; the change lets playBINK pass its own file name on as const. The definition follows in the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… declared with Follows the header commit before this one. Same code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
binkFileName is only read: main's playBINK.cpp (0x00408ED0) passes it to resolveResourceFileName, which takes char const*, and to getSoundVolumeForFilename, which does since the header commit before. Callers that pass a char* compile the same; the s_ pointers from string-literals.hpp no longer need a (char*) cast. The definition follows in the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows the header commit before this one. Touching the file brings it under the checker, so it also gets the first include of its class (../BinkControlClass.func.hpp, SG 14; Rendering.func.hpp moves into the include list) and declares the sound volume where it is assigned (SG 24). Same code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ayBINK no longer needs playBINK takes its file name as char const* since the header commit before this one, so the s_ pointers go in uncast; GameLost_Prepare also stores FALSE in INT_00ed279c, a BOOLEnum now. Same code (quick_diff unchanged). Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cpp-linter checks whole changed files: the two declarations changed to char const* are wrapped the way clang-format wraps them. Whitespace only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
The sync renamed INT_00ed279c to BOOLEnum_00ed279c with the BOOLEnum type this branch gave it, so main's header is taken and MenuView_GameLost_Prepare uses the new name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
gynt
approved these changes
Nov 7, 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::MenuViews functions at 100%, each with its status line: the historic campaign outro, the main menu's every-frame handler, the historic mission intro and picture, and the "game lost" screen.
This is our first PR in UI::MenuViews, which gynt agreed on Discord (2026-11-06) we may continue from his drafts, only the ones not in one of his open PRs. All five are his drafts from his fork, statement for statement, after a style pass; each commit body names the draft's branch and lists every change against it. Gynt's drafts were already near 100% on today's main: most of their gap was the security cookie, which reccmp now ignores. No header change is left: gynt's Ghidra sync eef6f66 took all three into main (
INT_00ed279casBOOLEnum_00ed279c), main is merged in, and GameLost uses the new name (fbec174).Other PRs: the ready #348, #349 and #352, and the drafts #313, #318, #321, #327 and #328.
Built on top of
main(da1fef5; it merges cleanly with today's main) with the bundled MSVC1400-SP1, natively on Windows, against the SteamStronghold Crusader.exe(3bb0a8c1…5387ac5a). Each file was measured as it stands: 100.0% raw and 100.0% normalized in a clean alone build, 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 #351: 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. Nothing else touches these files: no branch of ours and no open PR (gynt's #253 had them and was closed unmerged on 2026-10-03). 6and8 has his own rewrites of eight other MenuViews functions on his fork, and we left those alone.MenuView_HistoricCampaignOutro_Preparereimpl/UI-MenuViews-development, 97.9%MenuView_MainMenu_DoEveryFramearchive/UI-MenuViews-merged-full, 97.2%COL_7CAAAF.MenuView_HistoricMissionIntro_Preparereimpl/UI-MenuViews-development, 96.8%MenuView_HistoricMissionPicture_Preparereimpl/UI-MenuViews-development, 96.2%MenuView_GameLost_Preparereimpl/UI-MenuViews-development, 99.1%tabType = BASMTT_NONE/BASMTT_KEEP_OR_MPMENU_IPXand the text indexTAIT_NINE__FILTER_B, as main writes them.The file names are the
s_pointers fromstring-literals.hpp, each with its text above it, as in main's sibling PrepareHistoryBook (the original pushes each address);playBINKtakes achar*, so its names are cast with(char*), as main'splayBikVideoFromPlayerdoes. The mission text group is written(missionNumber1to20 - 1) * 4 + TEXT_MISSION1_STORY: the mission's story group, whose texts 0, 1 and 2 are "Mission N", the mission's title and the story (the drafts'* 4 + 95measures the same).Header changes
Update: all three are on main since eef6f66. Main's own
playBINK.cppandgetSoundVolumeForFilename.cppdon't compile there until this PR lands, because it carries their definitions (3cf47bd, 9dc005d below); the other files the sync broke are in #368.INT_00ed279cis aBOOLEnum(b953b94; the type only, the name kept): it stores 0 at 0x004D55EC / 0x004E1B5F and 1 at 0x004D6C23, and is tested at 0x004DC5B5 / 0x004DCA5C. GameLost storesFALSE.getSoundVolumeForFilenametakes achar const*(6445c6e, and 3cf47bd for its definition on main): it only passes the name to__stricmp.playBINKtakes achar const*(8a97d31, and 9dc005d for its definition on main): it only passes the name on toresolveResourceFileName(char const*) andgetSoundVolumeForFilename. GameLost and MainMenu drop their(char*)casts (ad1bb39).Main's playBINK.cpp and getSoundVolumeForFilename.cpp compile the same (quick_diff 0.9315 and 1.0000 before and after), and so do GameLost (0.9909) and MainMenu (0.9725). The definition commits follow the header commits because each header change stays in a commit of its own; touching playBINK.cpp also fixed its first include and one local, which our checker flags.
Behaviour
None of the five differs from the original. One thing worth knowing about
MainMenu_DoEveryFrame, kept as the original has it and marked with afixmeline: its sword-swing branch can never run.SEC_RNG's table comes fromrand()(0 to 32767), socurrentNumber1 % 3is 0 to 2 and every roll leaves the flag at 0; the sword swing only plays fromMainMenu_DoInitial(0x00424CD0).Kept as they are, and why
Each was measured; for the first two, a one-line comment in the code says why. quick_diff's baselines below 1.0 here are the security cookie, a colour immediate, an import call and
ret/ret 0.currentMenuread once into aMenu* constlocal, as the draft had it (read twice: quick_diff 0.9909 -> 0.9774); the fourplayBINKcalls stay four, as the original's compiler merged their tails (one call after picking the file: 0.7282).StoreStringInMenuStringArraycalls (a loop over the text number: quick_diff 0.9677 -> 0.6903).if (!flag), which measures the same (0.9725 both).Proposed, not changed here
DAT_00eb0b20: the history book picture's gfx index (loadGfxFile's result after PrepareHistoryBook's nine files; the DoEveryFrame functions draw it at 43,63).DAT_00ed2780: the history book's page-turn state (Prepare sets 1; DoEveryFrame tests 0, 1 and 2 and sets 2), andFLOAT_00ec0834its progress, 0 to 31.INT_00ed279c: "end screen continue pressed" (MissionEndscreen_Main's button -1 sets it, this clears it, the GameLost and MissionFinishedTransition DoEveryFrame functions test it); itsBOOLEnumtype is in this PR now.INT_00ec082c: the end screen's page, 0 to 3 (MissionEndscreen_Main's -100 / -101 step it;activeMenuTab.tabTypemirrors it).DWORD_00ed27b4: thetimeGetTime()stamp for the end screen's 5000 ms wait.DAT_00eb9af8: the row index intoMissionDefinedData.GreatestLordTextEntries(MissionEndscreen's render sets 16 and 17).gynt's other commits on these functions
Each commit body names the commits it continues. gynt has more on the same functions on his fork, and they are credited here too: his best-scoring commit on the address and his newest one on the file, where the body doesn't name them. Where one of them is at 100%, his version already matched the original, and a fix this text describes for that function was only against the earlier draft it names.
MenuView_HistoricCampaignOutro_PrepareMenuView_MainMenu_DoEveryFrameMenuView_HistoricMissionIntro_PrepareMenuView_HistoricMissionPicture_PrepareMenuView_GameLost_Prepare🤖 Generated with Claude Code