Repository navigation
Reimplement 3 UI::DisplayElements and PencilRenderCore functions (draft, below 100%) - #360
Draft
kotijekriv wants to merge 33 commits into
Draft
kotijekriv wants to merge 33 commits into
kotijekriv wants to merge 33 commits into
Conversation
MenuModalRenderFunction_ChooseNetworkServiceProvider, from gynt's reimpl/UI-MenuModals-development (PR sourcehold#252, closed unmerged) (65.3% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 65.3%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_CreditsScroll, from gynt's reimpl/UI-MenuModals-development (PR sourcehold#252, closed unmerged) (40.8% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 41.0%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_FindingNetworkSessions, from gynt's reimpl/UI-MenuModals-development (PR sourcehold#252, closed unmerged) (66.9% there). Restyled, with main's rename field135_0x474 -> field_0x474: the list's frame as named positions. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 66.9%: register mismatch: the original keeps the right column in ebp and reloads x. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_ProgressBarBox, from gynt's reimpl/UI-MenuModals-development (PR sourcehold#252, closed unmerged) (96.3% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 96.3%: only the spill slot of the bar's x differs (the original uses y's home). Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MenuModalRenderFunction_Roundtable, from gynt's reimpl/UI-MenuModals-development (PR sourcehold#252, closed unmerged) (70.2% there). Rewritten from the binary: the seat positions as an initialised array, the seat loop and the group tint as named locals. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 76.1%: register mismatch: the original keeps y in ebp and the group counter in y's home. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderDebugNumbersDisplayElement, from gynt's reimpl/UI-DisplayElements-pr-development (PR sourcehold#249, closed unmerged) (78.7% there). His draft as it is (every loop form tried compiles the same). The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 78.7%: register mismatch: durationSum stays in a register where the original keeps elementState. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderInGameWinDefeatWindowDisplayElement, from gynt's reimpl/UI-DisplayElements-pr-development (PR sourcehold#249, closed unmerged) (81.0% there). His draft, with the alive-flag pointers short* for today's short playerIsAlive. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 82.0%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderPlayerInfoOnHoverDisplayElement, from gynt's reimpl/UI-DisplayElements-pr-development (PR sourcehold#249, closed unmerged) (62.0% there). His draft, with main's rename viewportState.field0_0x0 -> field_0x0. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 62.0%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawBorderedBoxWithBlendedBackground, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (32.8% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 32.8%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawBoxWithRoundedEdges, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (38.9% there). His draft, with main's rename TextInputDefinedData::field0_0x0 -> field_0x0. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 38.9%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawCurrentPixel, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (4.5% there). His draft, with the optimize pragma moved above the FUNCTION line so the function is found. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 4.5%: heavy structural mismatch. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawHeaderBanner, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (52.0% there). His draft, with main's rename GMTotalPicturesProcessed -> GMFirstPictureIndex. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 52.0%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawHeaderTextBanner, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (51.6% there). His draft, with main's rename GMTotalPicturesProcessed -> GMFirstPictureIndex. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 52.4%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawLine, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (56.3% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 56.3%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawPixelPattern4x4, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (9.3% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 9.3%: heavy structural mismatch. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawScrollbar, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (60.1% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 60.1%: asm differs. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
drawTableCellBackground, from gynt's reimpl/UI-Rendering-development (PR sourcehold#255, closed unmerged) (75.5% there). His draft as it is. Three differences are known: the stripe row loads with movzx where the original sign-extends (a char parameter does not change it), the width test is the other way round, and the first cap is drawn at the global x instead of the local copy; fixing the last two alone measured worse (65.2%) with the registers that follow. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 78.4%: asm differs: stripe row zero-extended, width test inverted. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Below 100% main's commit_progress_batch.py writes the blocker as the remark ("Style pass, asm differs"), not
"Reimplemented". This draft's seventeen status lines keep their percentages and blocker remarks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Style guide reading (advisory, posted once) 82 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 10 of the 17 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 9 — Prefer
Rule 16 — Give variables a name that says what they hold
Rule 18 — Use the name, not the number
Rule 20 — Keep nesting low; no
Rule 24 — Declare variables upon first use
|
…opment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Core-2-100 has at 100% drawCurrentPixel (0x00468F20), drawPixelPattern4x4 (0x00468F70), drawBoxWithRoundedEdges (0x004710A0), drawBorderedBoxWithBlendedBackground (0x00471340) and drawLine (0x00472B20) are reimplemented at reccmp 100.0% on reimpl/UI-PencilRenderCore-2-100, rewritten from the binary. Their drafts here (3e7ec7e, 2c99182, ea42833, 8543e6b and cfbab8e, from gynt's drafts) go, with their status lines back to main's, so that the two branches merge cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
…rCore-3-100 has at 100% drawHeaderBanner (0x00468FE0), drawHeaderTextBanner (0x00475CC0) and drawScrollbar (0x004690E0) are at 100% on reimpl/UI-PencilRenderCore-3-100. Their drafts here (402dc08, 9c437b0, 074c788) go, and their status lines return to main's, so the two branches merge cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PencilRenderCore::drawTableCellBackground, from gynt's draft (b184193, 26.83%; 7c68476, 26.8%, in his closed sourcehold#255; the same body with his style passes at 63cc49f on his fork's reimpl/UI-Rendering-development; our 4d8dc93, 78.4%, before this). The two highlighted branches (selected, or the button being interacted with), their left end, middle pieces and right end with the middle's mask, the run of stripes otherwise, and the button width raised to 21 when it is narrower are his. New here: the width tests as > 20 and > 21, the binary's jle 0x14 / jle 0x15 with the draw first; x passed for the left end too; the pictures named; the stripe picture without the (char) cast, which made MSVC load the byte zero-extended and in eax before the pushes (quick_diff 0.8339 -> 0.9481, reccmp 78.4% -> 89.7%). Left: the original reads the index as a sign-extended byte (movsx edi, byte ptr [esp + 0x10]), which no form tried reproduces (a char parameter, a char local, casts, ternary and if forms all give movzx), and its second branch keeps ButtonY and the loop bound in other registers than its identical first branch. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 9, 2026
Roundtable::MenuModalRenderFunction_Roundtable (0x004B1AC0) reaches reccmp 100.0 (normalized 100.0) on main 3458fea and goes out with the ready branch reimpl/UI-B-round22-100 (9d405f2), with a behaviour fix: this draft added the group counter to each shield's x where the original adds the x parameter. Its file leaves this draft and its status line goes back to main's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreditsScroll::MenuModalRenderFunction_CreditsScroll (0x004AAB50) reaches reccmp 100.0 (normalized 100.0) on main 3458fea and goes out with the ready branch reimpl/UI-B-round26-100 (015b79f). Its file leaves this draft and its status line goes back to main's. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
DisplayElements::RenderInGameWinDefeatWindowDisplayElement (0x004AFB30) reaches reccmp 100.0 (normalized 100.0) on main 3458fea and goes out with the ready branch reimpl/UI-B-round26-100 (015b79f). Its file leaves this draft and its status line goes back to main's. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…5 too low ChooseNetworkServiceProvider::MenuModalRenderFunction_ChooseNetworkServiceProvider: a behaviour fix in the draft. The second box, drawn on the modem tab, reaches from y + 265 to y + 345. The original takes the top first (lea ebx, [edi + 0x109] at 0x0047C9C5) and then moves y on to the bottom (add edi, 0x159). The draft moved y first and then wrote the top as y + 265, which made it y + 610, 345 pixels below where it belongs (265 below the box's bottom), and the frame's lines with it. The top is a local again, set in front of `y += 345`. Where it came from: gynt's 968b1ee ("65.32% esi/edi split, orig lea x3", on his fork's reimpl/UI-MenuModals-development) replaced the local of his 8f37773 (65.13%) by `(y + 0x109)` behind the move, and our c8ff9d9 took that file over as it was. So the 0.2 points between the two were a changed value, not a better match. sourcehold's reimpl/UI-MenuModals has the top right, and so has the newest commit on the file, af1d790 on his fork's reimpl/UI-MenuItems-development (the older text, 35.3% there). Measured: reccmp 65.1% (normalized 65.1%) in a narrow build of the file on main 3458fea, with TEXT_MULTIPLAYER_CONNECTION in place of 76 so that it compiles there, data resolvers and its own resolver on; 65.3% with the wrong top. Not run in game. What is left: x and y swap esi and edi, and x + 440 keeps a register where the original keeps y + 85 and works x + 440 out again at each use. Tried without a gain: both boxes written from x and y alone, with and without locals for their sides (0.56 to 0.61 in quick_diff against this form's 0.68), and the second box as `y += 180` in front of the first box's text. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…st arm; one byte read left PencilRenderCore::drawTableCellBackground, 89.7% to 95.2% (91.5% normalized), on top of be147ca (our rewrite with gynt's draft). gynt's commits on it: 7c68476 at 26.8% on sourcehold's reimpl/UI-Rendering, b184193 at 26.83% and 63cc49f, the newest, on his fork's reimpl/UI-Rendering-development, whose status line records 75.5%. The second arm's registers match now. The selected cell and the cell under the mouse draw the same pieces, and the original gives the second arm's three scratch registers in another order than the first's (the row's y in ecx at 0x004693AB against eax at 0x00469310, and so on round). Our two arms had the first arm's order twice. Written with the right piece inside the first arm, followed by a return, and once more behind the second arm, both arms come out as the original's; the compiler still emits the right piece once (0x00469426). The lever: a block that follows an if / else join, written out inside one arm, changes that arm's registers. Left is one instruction: the original reads the stripe index as a sign-extended byte (movsx edi, byte ptr [esp + 0x10] at 0x004692E8), ours as a dword. It is one byte longer, so reccmp also counts the four jumps across the loop's padding (jge 0x0046934E, jmp 0x0046938B, je 0x00469397 and jge 0x004693EA) and the padding itself, which is a jmp plus a lea in ours where the original has one lea (137 instructions against 136, 130 of them the same: 2 x 130 / 273 = 95.2). quick_diff shows only the byte read (0.9926, 135 instructions on both sides). Tried for the byte read, all without it: the parameter as a char (header and resolver changed locally, not committed) with the picture's expression in nine spellings, among them an int local set from it, step by step assignments, casts to int, uint and short, a shift, a conditional expression and an inline helper that takes an int: every one reads movzx into eax and copies it to edi later, which also turns the arms' registers back. The char parameter updated in place does byte arithmetic in al. A cast on the int parameter reads movzx as well. With % 2 in place of & 1 the char parameter is read with movsx, but into eax, and the remainder's code is longer. Measured in a narrow build of the file on main 3458fea, data resolvers and its own resolver on. Not run in game. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ProgressBarBox::MenuModalRenderFunction_ProgressBarBox (0x00493560) reaches reccmp 100.0 (normalized 100.0) on main 3458fea, off the /GL list and on it, and goes out with the ready branch reimpl/UI-A-progressbarbox-100 (bfac9fd). Its file leaves this draft and its status line goes back to main's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ChooseNetworkServiceProvider::MenuModalRenderFunction_ChooseNetworkServiceProvider (0x0047C860) reaches reccmp 100.0 (normalized 100.0), off the /GL list and on it, and goes out with the ready branch reimpl/UI-A-netmodals-100 (5a9422d, on main 0e4a83b). Its file leaves this draft and its status line goes back to main's. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FindingNetworkSessions::MenuModalRenderFunction_FindingNetworkSessions (0x0047D190) reaches reccmp 100.0 (normalized 100.0), off the /GL list and on it, and goes out with the same ready branch, reimpl/UI-A-netmodals-100 (11d13f1, on main 0e4a83b). Its file leaves this draft and its status line goes back to main's. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DisplayElements::RenderDebugNumbersDisplayElement: the sum loop is a plain loop over the 100 entries. The compiler unrolls it five times and adds each group of five into a partial sum first, which is the original's loop instruction for instruction (0x004AF8A0 to 0x004AF8E8), so the hand-unrolled sums of gynt's draft are gone. The duration sum is declared before the tick sum (the other order: 78.7). The maximum keeps the draft's pointer walk, five entries at a time: as a plain loop the duration sum takes ebp for the whole function (71.9). Also: the locals without the leading underscore, countof() as the sum loop's bound, the unused BOOLEnum.hpp include and the stale "enrolled loop?" comment dropped (the same listing). From gynt's draft: his e03f57b (78.70%, "index the sum loop") and ff0d33f ("two exact ties that remove decompiler artefacts", 2026-10-27, his newest) on his fork's reimpl/UI-DisplayElements-pr-development, and af5b08c ("the pointer walks are the original's") on reimpl/UI-MenuItems-development. Left: two places. The sum loop's registers: the original adds into esi and keeps the duration sum in ecx and the tick sum in edx, so the frame's duration value stays in edi; ours adds into edi with the sums in edx and esi, and the duration waits in ecx. And the maximum's pointer walk: ours counts 20 rounds down in edi with the pointer two entries ahead, where the original compares the pointer with the end (0x004AF934 to 0x004AF975). A plain loop over the entries gives the original's maximum loop, but then the duration sum takes ebp (71.9). Measured in a narrow build of sourcehold#360's three files on its head e58da0e, both resolver sets on: 80.0% raw, 70.1% normalised (78.7 / 68.2 before). Not run in game. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
added a commit
to kotijekriv/OpenSHC
that referenced
this pull request
Nov 24, 2026
…cehold#437) * reimplement: SHC_3BB0A8C1_0x004AAB50 100.0% Reimplemented CreditsScroll::MenuModalRenderFunction_CreditsScroll, rewritten from the original's listing. gynt's drafts: a4ce8c2 at 37.8% on sourcehold's reimpl/UI-MenuModals and 934219c at 40.84% ("allocator only") on his fork's reimpl/UI-MenuModals-development; the newest commit on the file, 1eaeddd, is on his fork's reimpl/UI-MenuItems-development. Our draft be9edd1 (41.0%, in the draft PR sourcehold#360) was his code, not reworked. The drafts had the decompiler's text: 21 counters in locals, each stepped by hand, and all of it twice. The listing shows what they are. The scroll fades to black towards its top and bottom edge over 30 rows of four pixels, each row over its 20 leftmost columns, and the blend of column c in row r is (r - 30) * (c + 1) / 20 + 32. Written that way, with the row as the only variable, the compiler makes the same counters by itself, down to the one it does not make: column 3's product 4 * (r - 30) comes from the row's y, which also steps by four (mov edx, [esp + 0x60]; lea ecx, [edx + esi] at 0x004AACAA). Three things the match needs: - Each column is its own call. As a loop over the columns the compiler keeps the loop (102 instructions against 709), so the 20 calls are written out. - The first column is 32 - (30 - r) / 20, not (r - 30) / 20 + 32. The original keeps 30 - r as a counter of its own for it (0x004AAC27, used at 0x004AAC38) and leaves the loop by the second column's counter (0x004AAFD5). With the first column in the others' form the compiler has no such counter and ends the loop by counting down (700 instructions). - One row variable for both loops. The original has both loops' row counter in [esp + 0x10]; with a counter of its own in each loop, the second loop's 20 counters land one slot off (reccmp 91.4%). Measured: quick_diff 1.0000 with 709 instructions on both sides, also with the stack slots kept; reccmp 100.0% (normalized 100.0%) alone, data resolvers and its own resolver on. Not run in game. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x004AFB30 100.0% Reimplemented DisplayElements::RenderInGameWinDefeatWindowDisplayElement, rewritten from the original's listing. gynt's drafts are on his fork's reimpl/UI-DisplayElements-pr-development: 3c85538 at 65.16%, 7648a6d at 76.62% and 7a4656b at 80.97%, which the branch's status line records as 81.0% (158fe8d at 87.80% was reverted in 94926b6; ff0d33f is the newest commit on the file there). Our draft d0fbcd5 (82.0%, in the draft PR sourcehold#360) was his code. The drafts walked three pointers through the players' arrays and kept the window's y in a second variable, as the decompiler shows it. Written with the arrays indexed by the player and the y parameter itself counted on, the compiler makes the same three pointers, and four differences go: - The window's y. posY += -28 - height / 2, with posY used from there on, gives the original's mov edx, -28; sub edx, eax; add esi, edx (0x004AFC25). With the sum in a variable of its own the compiler folded it into two subtractions, in every form. - The loop over the players ends at the array's length, player < countof(playerIsAlive), which is 9 (the jl at 0x004AFD7D, behind a compare with the array's end, 0x0117EF52). - The count of the players alive is a loop as well; the compiler unrolls it into the original's eight tests. - "Wins" behind each name: its colour and its x are locals in front of the call, the colour first. The original loads the colour and works out x where the call's pushes begin (0x004AFCE1 to 0x004AFCF8). Written in the call, x was finished behind the pushes and in another register. The security cookie: the original has one, and an 8-byte frame (the cookie and the players' pointer), so its source had a buffer whose address was taken. Nothing reads it, so `char unused[8]; char* unusedPointer = unused;` is a guess at its type and length. An unused array alone gets no cookie. gynt's 7a4656b found the cookie first, with a ushort[3] whose address went into the loop's pointer; our draft d0fbcd5 had made that a short[3]. Measured: quick_diff 0.9893 with 187 instructions on both sides (what differs is how the two listings print the cookie's address and an import call); reccmp 100.0% (normalized 100.0%) alone, data resolvers and its own resolver on. Not run in game. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
kotijekriv
added a commit
to kotijekriv/OpenSHC
that referenced
this pull request
Nov 24, 2026
…d FindingNetworkSessions (sourcehold#474) * reimplement: SHC_3BB0A8C1_0x0047C860 100.0% Reimplemented ChooseNetworkServiceProvider::MenuModalRenderFunction_ChooseNetworkServiceProvider, moved out of our draft sourcehold#360 (5485692, 65.1%), from Gynt's draft (968b1ee at 65.32% on his fork's reimpl/UI-MenuModals-development; his closed sourcehold#252 had an earlier version). One behaviour fix against his draft, already in sourcehold#360: the modem tab's second box reaches from y + 265 to y + 345; his draft moved y on to the bottom first and then drew the top at y + 265 from there (y + 610). The original takes the top first (0x0047C9C5), as sourcehold's reimpl/UI-MenuModals has it and as this does. Both frames, the list's (y + 85 to y + 165) and the modem tab's (y + 265 to y + 345), run from x + 40 to x + 460: the outline is one pixel outside that (x + 39 to x + 461), and the dimmed box ends at the scroll bar's column line at x + 440. Each is written in a block with its four edges as int const locals (left = x + 40, top, right = x + 460, bottom) and every coordinate written from them. The original keeps each frame's top in ebx (0x0047C907, 0x0047C9C5). In the list's frame it keeps the left edge less 1 in y's stack slot (0x0047C91C, read back at 0x0047C934, 0x0047C94A and 0x0047C96E) and computes x + 461 again for each line that uses it; in the modem box's it keeps x + 440 in that slot (0x0047C9E3) and x + 461 in esi (0x0047C9F8). In the draft x and y swapped esi and edi, and x + 440 kept ebx, where the original keeps the list's top (quick_diff 0.6780, 177 instructions against 177). With only the list's frame in a block, the modem box's top and left edge swap ebx and ebp (0.9435); with both blocks the listing is the original's (1.0000). Both orders tried for the edges (left, top, right, bottom and right, left, top, bottom) give the same listing, and so does int without const. A comment on each block says why it is one. On main since sourcehold#387 drawHeaderTextBanner takes an eTextSections: the banner's 76 is TEXT_MULTIPLAYER_CONNECTION. y - 0x3c is written y - 60, and the kick timer's test the other way round (timeGetTime() - kickedAtTime > 5000), with the same listing; an unused include is dropped, and so are the casts on the lines' colour (the same listing). Gynt's newest commit on the file, af1d790 on his reimpl/UI-MenuItems-development (2026-11-02, 45.8% there), writes that test as `DVar2 > 5000 - kickedAtTime`, which is a different test; the original subtracts first (`sub eax`, `cmp eax, 0x1388`, `jbe`), as this does. No line for cmake/compiler-flags-gl.txt: the file reads 100.0% off the /GL list, and 100.0% on it too. reccmp in a build of main's whole /GL list (the 133 files that exist) and this file, off the list, with every resolver of those files on: 144 functions, average 99.56. The function 100.0% raw and normalised, no differing line; the other 143 functions read the same as without the file. That build had the casts, the include and shorter comments; quick_diff gives the same 177 instructions, line for line, for this text. The sources were main's at 3458fea; main's commits since add cmake files and tools, and two other UI functions' files (sourcehold#466, sourcehold#467). 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> * reimplement: SHC_3BB0A8C1_0x0047D190 100.0% Reimplemented FindingNetworkSessions::MenuModalRenderFunction_FindingNetworkSessions, moved out of our draft sourcehold#360 (e01e709, 66.9%), from Gynt's draft (9ae7d0b at 66.91% on his fork's reimpl/UI-MenuModals-development, "orig spills one local"; before it 57.97% at e4d0a08, 58.30% at 861024c and 39.1% at 4462f5d / 70f15af; his closed sourcehold#252 had an earlier version). The draft computes what the original computes; no behaviour is changed against it. The session list's frame (a dimmed box, its outline, the scroll bar's column and the column's two squares) is written in a block with its four edges as int const locals, declared left, top, right, bottom (left = x + 40, top = y + 85, right = x + 460, bottom = y + 285), and every coordinate is written from them. That is how the original computes them: x's register becomes the right edge (add ebp, 0x1cc at 0x0047D1C7) and y's the bottom (add edi, 0x11d at 0x0047D1CD), and the left edge less 1 is taken from x's stack slot (0x0047D1EB, 0x0047D1F8) and kept in a slot of its own (0x0047D1FC). In the draft, with the top, the bottom, the right edge and the outline's two edges (right + 1, x + 39) as locals and the box's left edge written out, the right edge did not take x's register, x was not read again, and the function came out four instructions shorter, without the 4-byte frame (quick_diff 0.6691, 134 instructions against 138). Of the 24 declaration orders, the three with left before right, top before bottom and right before bottom give the original's listing (left, top, right, bottom as here; top, left, right, bottom; left, right, top, bottom). The other 21 keep 138 instructions: with the bottom declared before the right edge only the two additions swap (3 orders, quick_diff 0.9855); with right before left or bottom before top the registers differ (18 orders, 0.8478 to 0.9638). A comment on the block says why it is one. On main since sourcehold#387 drawHeaderTextBanner takes an eTextSections: the banner's 76 is TEXT_MULTIPLAYER_CONNECTION, and eTextSections.hpp is included. No line for cmake/compiler-flags-gl.txt: the file reads 100.0% off the /GL list, and 100.0% on it too. reccmp in a build of main's whole /GL list (the 133 files that exist) and this file, off the list, with every resolver of those files on: 144 functions, average 99.56. The function 100.0% raw and normalised, no differing line; the other 143 functions read the same as without the file. That build had a shorter comment on the block; quick_diff gives the same 138 instructions, line for line, for this text. The sources were main's at 3458fea; main's commits since add cmake files and tools, and two other UI functions' files (sourcehold#466, sourcehold#467). Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…he maximum's walk as a for loop Two changes to RenderDebugNumbersDisplayElement, 80.0% to 80.6% raw (70.1% to 72.0% normalised) in a narrow build of the PR's three files on this head merged with main 0268112. The other two read as before (62.0 and 95.2), and so do all three in the same build of the head's texts. - The two sums are declared first, ahead of the frame's duration and tick reads and the buffer writes; declared at the index wrap test as before, they take other registers (quick_diff 0.8179 to 0.8371). - The maximum's pointer walk is a `for` loop instead of a `do` / `while` (the style guide asks for for loops); the code is the same. The function is gynt's draft: his e03f57b (78.70%, "index the sum loop") and ff0d33f ("two exact ties that remove decompiler artefacts", his newest) on his fork's reimpl/UI-DisplayElements-pr-development, and af5b08c ("the pointer walks are the original's", the maximum's walk kept here) on reimpl/UI-MenuItems-development. What is left is the same in kind. Ours adds each group of five into `edi` with the duration sum in `edx` and the tick sum in `esi`, and keeps the duration in `ecx`; the original adds into `esi` with the sums in `ecx` and `edx` and keeps the duration in `edi`. The maximum's loop still counts 20 rounds down in `edi`, where the original compares the pointer with the end. None of 64 combinations reads better: the maximum as a pointer walk or an index loop, the sums' place and order, loop-local sums copied out of a block, and the order of the two reads and of the two writes. The index loop gives the original's maximum loop exactly, but then the duration sum takes `ebp` (quick_diff 0.7806). Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s, not an anonymous enum PencilRenderCore::drawTableCellBackground (0x004692E0) named its pictures in GID_INTERFACE_ICONS_3 and the 20-pixel piece width in an anonymous enum declared in the .cpp. gynt on sourcehold#488: "When declaring new types, create new .hpp files, don't hide them in .cpp files!" These are numbers, not a type, so they become plain `int const`s with the same names, as main writes FACE_SIZE in readBitmapFace. The listing is the same (quick_diff 0.9926, the same 135 instructions). 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>
6and8
pushed a commit
to 6and8/OpenSHC
that referenced
this pull request
Nov 24, 2026
…#467) ProgressBarBox::MenuModalRenderFunction_ProgressBarBox, moved out of our draft sourcehold#360 (f860f20, Gynt's code with the fixer's rewrites), from Gynt's draft (217700a at 96.33% on his fork's reimpl/UI-MenuModals-development, "spill slot differs"). That draft computes what the original computes; no behaviour is changed against it. His earlier copies (45.2% at 266d7a5, in his closed sourcehold#252; 48.6% at 6987e8c) have no else on the second test and dim the filled box; he put the else in in 85a110f (85.97%), as the original has it (it returns at 0x00493642), and it is here. His draft has the original's 109 instructions; four of them use another stack slot. The original keeps the bar's x in the second parameter's slot: computed at 0x0049360F, stored there in front of the draw (0x00493620) and read back for progressBarX (0x0049362F; 0x0049364E, 0x0049365E and 0x0049366D in the other arm). The draft assigns the value to height, the unused fourth parameter, and gets the fourth slot. Here: - the bar's x is assigned to y. On its own that keeps the value in y's register (105 instructions), an own local gets a new stack slot (112 instructions), and so does the expression written out at both uses (112); - so y is read through a local, top, that is assigned from y in each arm of the language test, where the original loads the second parameter (0x00493572, 0x004935A2). Then top gets y's register (edi), y is not kept in a register, and its new value lives in its own slot: 109 instructions against 109. Declared with y as its value (int top = y; or int const top = y;), top is loaded at the function's start and the match is lost (107 instructions); the unused height as the copy gives the same listing as top; - the bar's bottom is written out in the two calls (as a local, the same listing), and the casts on the text's number and on the box's colour are dropped (the same listing). No line for cmake/compiler-flags-gl.txt: the file reads 100.0% off the /GL list, and 100.0% on it too. reccmp in a build of main's whole /GL list (the 133 files that exist) and this file, off the list, with every resolver of those files on: 144 functions, average 99.56. The function 100.0% raw and normalised, no differing line, and the same with the file on the list. The other 143 functions of main's list read the same as without the file. Both builds had an earlier text of this file (one unused include more, and the bar's bottom in a local); quick_diff gives the same 109 instructions, line for line, for that text and for this one. The sources are main's at 3458fea; main's two commits since (02fab42, 812d149) add cmake files only, with the new option off. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <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.
Three functions in UI::DisplayElements and UI::Rendering's PencilRenderCore that don't reach 100% yet, so others can continue from them (the rule: ready functions in their own PR, the rest in a draft). These are the areas gynt agreed on Discord (2026-11-06) we may continue from his drafts; none of the three is in an open PR of anyone else. Each status line gives the reccmp % as measured and what is left; each commit body says where the code came from and what was tried.
Fourteen functions that started here have left:
xparameter;Built on top of
main(eef6f66, merged in d00cf56) with the bundled MSVC1400-SP1 against the SteamStronghold Crusader.exe(3bb0a8c1…5387ac5a), resolvers enabled locally (not committed), sourcehold's reccmp with--resolve-wrapped-calls --ignore-security-cookie. None of it has been run in game. The fixer and the checker's mechanical items were applied (colours by name, line comments, decimal and signed constants, duplicate includes,countof, clang-format); the decompiler's local names (iVar1) are left as they are, as in other drafts.esiwith the sums inecxandedx, so the duration stays inedi), and the maximum's loop counts down inedi; see the note belowmovsx edi, byte ptr [esp + 0x10]), ours as a dword. It is a byte longer, so reccmp also counts the four jumps across the loop's padding and the padding itself (ajmpplus aleain ours where the original has onelea: 137 instructions against 136); see the note belowDebugNumbers, for whoever continues it. Written as a plain
forloop over both buffers, the sum loop unrolls by itself into the original's five-wide loop, adding each group of five into a partial sum first, so the draft's hand-unrolled sums are gone (f13d688). With the duration sum declared before the tick sum (the other order reads 78.7%), the sums sit in the original's two stack slots behind the loop ([esp + 0x10],[esp + 0x14], an 8-byte frame), and posX and posY inebpandebx. Since 30e750f the two sums are declared first, ahead of the duration and tick reads and the buffer writes (80.6%, 72.0% normalised; declared at the index wrap test they take other registers), and the maximum's pointer walk is aforloop with the same code. Two things are left. First, the sum loop's registers: the original adds intoesiwith the duration sum inecxand the tick sum inedx, so the frame's duration value stays inedi; ours adds intoediwith the sums inedxandesi, and the duration waits inecx. Second, the maximum's pointer walk: ours counts 20 rounds down inediwith the pointer two entries ahead, where the original compares the pointer with the end (0x004AF934 to 0x004AF975). A plain loop over the entries gives the original's maximum loop exactly, but then the duration sum takesebpfor the whole function: 71.9% raw (72.4% normalised, above this form's 70.1%). A union, pointers and references to the sums compile to the same code as two plain locals; an array or a struct is taken apart into two registers as well, and its loop then adds one element at a time.drawTableCellBackground, for whoever continues it. The second arm's registers match since 68b56e4: the right piece is written inside the first arm, followed by a return, and once more behind the second arm. The compiler still emits it once, and the two arms get the original's two different orders of the three scratch registers (the lever: a block that follows an
if/elsejoin, written out inside one arm, changes that arm's registers). What is left is the byte read of the stripe index. With the parameter as achar(header and resolver changed locally, not committed) every spelling of the picture's expression we tried readsmovzxintoeaxand copies it toedilater, which also turns the arms' registers back: a plain expression, anintlocal set from the parameter, step-by-step assignments, casts toint,uintandshort, a shift, a conditional expression and an inline helper that takes anint. Thecharparameter updated in place does byte arithmetic inal, and a cast on theintparameter readsmovzxas well. With% 2in place of& 1thecharparameter is read withmovsx, but intoeax, and the remainder's code is longer. A signed(char)remainder (% 2) keeps themovsx(with the remainder's sign fix-up after it), so it is the compiler narrowingsign-extended byte & 1to amovzxthat every& 1spelling runs into. Its pictures and piece width are plainint consts since 5287581, not an anonymous enum in the .cpp (gynt on #488: "When declaring new types, create new .hpp files, don't hide them in .cpp files!"; these are numbers, not a type, so no header). Same code: quick_diff 0.9926 before and after, 95.2% raw in a narrow build.Every commit built on gynt's draft credits him as co-author.
🤖 Generated with Claude Code