Repository navigation
UI: OptionsMenu Buttons at 96.5%, a register rename in the death check (draft) - #422
Draft
kotijekriv wants to merge 3 commits into
Draft
kotijekriv wants to merge 3 commits into
kotijekriv wants to merge 3 commits into
Conversation
…eath check, sourcehold#414 not settled OptionsMenu::MenuItemRenderFunction_OptionsMenu_Buttons, rewritten from the binary with gynt's draft for the names (979ff34, 05e10b3 and 4e64ac5 on his fork's reimpl/UI-MenuItems, 62.41% there; ce267a9 at 62.54% on his reimpl/UI-MenuItems-development, his newest reimplement commit on the file). gynt's draft measures 0.7698 in quick_diff on main. It draws Load (2), Save (3), Briefing (39) and the other options buttons enabled or greyed, and Restart Mission (44) with its own greyed form. Load, Save and Restart Mission use the same tests as the buttons' click handler (0x00496B80). Briefing is also greyed when field_0x6c is set, which the handler's case 39 does not test. Load from the main menu skips the tests, and the greyed tests are one condition, so the enabled and the greyed draws are each written once, as the original lays them out: written as separate returns MSVC does not merge them (223 instructions against 143), and a greyed flag keeps its test (0.5411). The online tests sit in the condition's `? :` on the game mode; written with gotos into the two draws instead, the code is the same to the byte. The text position goes in locals before the hover test, so the three text calls share their tail (0.8472 -> 0.9650). What is left is a register rename, and sourcehold#414 is not settled, so the status line records the raw 96.5. reccmp reads 96.5 (normalized 80.0) in a build on main 3458fea with the data and its own function resolver on, and diff_triage's register-blind ratio is 1.000 (0.800 before renaming registers). The five line pairs that differ are the player's death check (slot * 0x39f4): the original keeps its temporary in ebx and ours in edi (push, mov, imul, cmp, pop). Same 143 instructions, same mnemonics in the same order, and the same memory operands apart from that temporary as the base register of the cmp at 0x004918BF. Spellings of the read, nesting, an inline helper, the condition order and the enabled block's shape all leave it in edi. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LobbyMenu::MenuView_LobbyMenu_DoEveryFrame, rewritten from the binary with gynt's draft for the names (d283417 at 50.97% on his fork's development; e9e2437 at 54.19% on his reimpl/UI-MenuViews-development; 08c492b of 2026-11-02 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; quick_diff reads the draft 0.6142 there. The array index changed with the header. gynt's draft uses DAT_ArrayOfMapIndices[i - 1], which was right on his branch, where the array is declared at offset 0x884 and his loop's counter starts at 0. Main's sync 12854bc (2026-11-04) moved the declared start to 0x880, so the original's 0x01126E28 (0x004487E9, 0x004488B0) is element 0 and the index here is [i]. - The step to the next face is written in both arms of the loop. As one copy after the arms the count is kept on the stack and every register in the loop moves (0.9385 against 0.9855 in quick_diff). - The two searches for a map with enough places keep three gotos, because both end in the same block. The style bot reports them (rule 20), so this function waits in a draft for the maintainers' answer. The forms measured in quick_diff, on an original of 724 instructions (0.9938 is quick_diff's ceiling on this function): gotos, as committed 723 instructions 0.9938 reccmp 100.0 a found index 730 instructions 0.9464 __forceinline helpers, early returns 740 instructions 0.9385 static or inline helpers, not inlined 688 instructions 0.9391 - The search starts from the sum of scroll offset and selection written out; a local for it swaps a mov and a cmp. - The box's positions are declared with left before right and top before bottom, after the flag is cleared: those six orders tie at 0.9938 in quick_diff and the others read lower. - RelativeSelected = -1 is stored again right after the test for -1, which the original does (0x00448950). 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) 3 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 1 of the 2 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 20 — Keep nesting low; no
|
gynt
approved these changes
Nov 24, 2026
gynt
requested changes
Nov 24, 2026
gynt
left a comment
Contributor
There was a problem hiding this comment.
No goto but you probably already knew that.
MenuView_LobbyMenu_DoEveryFrame leaves this draft for its ready branch, reimpl/UI-B-lobbydoeveryframe-100 (f1fcf329c). This branch's question about its three gotos is answered: gynt wrote on sourcehold#396 that the gotos are necessary for the match there. The file goes, and its status line goes back to main's. OptionsMenu Buttons stays here with its sourcehold#414 question. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Draft: one function, finished as far as I can take it, with an open question. It is rewritten from the binary, with gynt's draft for the names.
LobbyMenu::MenuView_LobbyMenu_DoEveryFrameleft this draft for its ready PR #500 (a1aa274): gynt's answer on #396 settled its question about the gotos.OptionsMenu::MenuItemRenderFunction_OptionsMenu_ButtonsNo header changes.
The question: does
MenuItemRenderFunction_OptionsMenu_Buttonscount as finished under #414?What is left is a register rename. In the player's death check the original keeps its temporary in
ebxand ours keeps it inedi, across five line pairs. Both sides have the same 143 instructions and the same mnemonics in the same order. The memory operands are the same apart from that temporary, which is the base register of thecmpat 0x004918BF:[ebx + 0x115E03C]in the original and[edi + 0x115E03C]in ours. #414 isn't settled, so the status line records the raw 96.5.What the placeholders hold
These are read from how the code uses them, and the names are unchanged.
GameCore::field_0x6c: greys Load, Save and Briefing in the options menu, and limits Restart Mission. I don't know what it means.The checker's 2 CHECKs
openshc-pr-checkgives 0 ERROR and 2 CHECK, andopenshc-pr-fixfinds nothing to change.:52,:71field_0x6c🤖 Generated with Claude Code