Skip to content

Reimplement 17 UI::MenuModals, DisplayElements and PencilRenderCore functions (draft, below 100%) - #360

Draft
kotijekriv wants to merge 22 commits into
sourcehold:mainfrom
kotijekriv:reimpl/UI-A-areas-development
Draft

kotijekriv wants to merge 22 commits into
sourcehold:mainfrom
kotijekriv:reimpl/UI-A-areas-development

Conversation

@kotijekriv

Copy link
Copy Markdown
Contributor

Seventeen functions in UI::MenuModals, 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 seventeen is in an open PR of anyone else (his #294's three PencilRenderCore files are other functions). 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.

Other PRs: the ready #348, #349, #352, #353, #354, #357, #358 and #359, and the drafts #313, #318, #321, #327, #328 and #356.

Built on top of main (8125c61; it merges cleanly with today's main) with the bundled MSVC1400-SP1 against the Steam Stronghold 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.

Area Function Address Raw Left
MenuModals ChooseNetworkServiceProvider 0x0047C860 65.3% gynt's draft, not reworked
MenuModals CreditsScroll 0x004AAB50 41.0% gynt's draft, not reworked
MenuModals FindingNetworkSessions 0x0047D190 66.9% Rewritten; the original keeps the right column's x in ebp and reloads x from its home
MenuModals ProgressBarBox 0x00493560 96.3% Only the spill slot of the bar's x differs (the original uses y's home)
MenuModals Roundtable 0x004B1AC0 76.1% Rewritten; the original keeps y in ebp and the group counter in y's home
DisplayElements DebugNumbers 0x004AF860 78.7% durationSum stays in a register where the original keeps elementState
DisplayElements WinDefeatWindow 0x004AFB30 82.0% Asm differs
DisplayElements PlayerInfoOnHover 0x004B0390 62.0% Asm differs
PencilRenderCore drawTableCellBackground 0x004692E0 78.4% The stripe row is zero-extended and the width test inverted; a char parameter doesn't change it
PencilRenderCore drawScrollbar 0x004690E0 60.1% Asm differs
PencilRenderCore drawLine 0x00472B20 56.3% Asm differs
PencilRenderCore drawHeaderTextBanner 0x00475CC0 52.4% Asm differs
PencilRenderCore drawHeaderBanner 0x00468FE0 52.0% Asm differs
PencilRenderCore drawBoxWithRoundedEdges 0x004710A0 38.9% Asm differs
PencilRenderCore drawBorderedBoxWithBlendedBackground 0x00471340 32.8% Asm differs
PencilRenderCore drawPixelPattern4x4 0x00468F70 9.3% Heavy structural mismatch
PencilRenderCore drawCurrentPixel 0x00468F20 4.5% Heavy structural mismatch

Every commit built on gynt's draft credits him as co-author.

🤖 Generated with Claude Code

kotijekriv and others added 18 commits November 7, 2026 02:23
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>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

Style guide reading (advisory, posted once)

82 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 10 of the 17 reimplemented .cpp file(s) in this PR.

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.

rule what it asks hits
9 Prefer for over while/do 17
16 Give variables a name that says what they hold 45
18 Use the name, not the number 9
20 Keep nesting low; no goto 2
24 Declare variables upon first use 9
Where

Rule 9 — Prefer for over while/do

  • src/OpenSHC/UI/DisplayElements/RenderDebugNumbersDisplayElement.cpp:40 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/DisplayElements/RenderDebugNumbersDisplayElement.cpp:59 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp:99 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:46 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:135 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp:20 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp:28 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp:39 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp:22 — do-loop; the guide asks for a for
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp:30 — do-loop; the guide asks for a for
  • ... and 7 more

Rule 16 — Give variables a name that says what they hold

  • src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp:29 — decompiler name iVar4
  • src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp:30 — decompiler name piVar5
  • src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp:31 — decompiler name local_8
  • src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp:76 — decompiler name iVar3
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:17 — decompiler name iVar1
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:23 — decompiler name local_58
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:25 — decompiler name local_10
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:26 — decompiler name local_14
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:27 — decompiler name local_18
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:28 — decompiler name local_1c
  • ... and 35 more

Rule 18 — Use the name, not the number

  • src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp:132 — hex constant 0x53E9A; use a name, or decimal
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:28 — hex constant 0x1FE; use a name, or decimal
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:29 — hex constant 0x1E0; use a name, or decimal
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:117 — hex constant 0x1FE; use a name, or decimal
  • src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp:118 — hex constant 0x1E0; use a name, or decimal
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp:24 — hex constant 0xFFFFFFFA; use a name, or decimal
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp:27 — hex constant 0xB37CE8; use a name, or decimal
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp:26 — hex constant 0xFFFFFFFA; use a name, or decimal
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp:36 — hex constant 0xFFFFFFFA; use a name, or decimal

Rule 20 — Keep nesting low; no goto

  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp:39 — goto; check how many predecessors the target has first
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp:43 — goto; check how many predecessors the target has first

Rule 24 — Declare variables upon first use

  • src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp:29 — declare iVar4 where it is first assigned
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp:20 — declare _drawReady where it is first assigned
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp:22 — declare iVar4 where it is first assigned
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp:23 — declare _textY where it is first assigned
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp:24 — declare _width where it is first assigned
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp:25 — declare iVar2 where it is first assigned
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp:26 — declare iVar3 where it is first assigned
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp:28 — declare _textX where it is first assigned
  • src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp:14 — declare _drawReady where it is first assigned

kotijekriv and others added 2 commits November 7, 2026 18:11
…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>
kotijekriv and others added 2 commits November 8, 2026 00:44
…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>
6and8 pushed a commit to 6and8/OpenSHC that referenced this pull request Nov 8, 2026
…cehold#370)

* headers: TextInputDefinedData::field_0x0 is two tables, of 5 and 6 rows

field_0x0[11] at 0x00B37CBC holds 5, 3, 2, 1, 1 and then 6, 4, 3, 2, 1, 1: two tables of row indents for rounded
box corners, each starting with its row count (a corner's outermost row is indented by its radius), as
field_0x2c[22] at 0x00B37CE8 (22, 19, 16, ..., 1, 1) is the RBERL_STRONG table. The exe uses only the first five:
drawBoxWithRoundedEdgesAndColor and drawBoxWithRoundedEdges load 0x00B37CBC for RBERL_SLIGHT (5) (mov ebx, 0xb37cbc
at 0x00470EFE and 0x004710BE) and read rows 0 to roundingLevel - 1 of it. Nothing refers to the 6-row table at
0x00B37CD0: no instruction in .text has an immediate or a displacement from 0x00B37CBC up to below 0x00B37D40,
where UserTextHandler_CharacterFilter_B_1_8_9 starts (0x00469984 and 0x00474146 read that address itself), other
than those two loads and mov ebx, 0xb37ce8 (0x00470EF7, 0x004710B7), and no dword in any section points into that
range. So field_0x0 becomes int[5] and the 6-row table field_0x14 int[6], named in Ghidra's style. The struct's
size is unchanged and no user's code changes: the two rounded-box functions in this branch take field_0x0 as an
int*, and main's other users of the struct (the three file filters and four FontSizeClass functions) read other
fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00468DE0 100.0% Reimplemented

PencilRenderCore::drawHorizontalLine, from gynt's draft (f98d57a, 21.05%, "orig keeps this in ecx at /Od";
b8ff55d, 21.1%, in his closed sourcehold#255; the same body at 63cc49f on his fork's reimpl/UI-Rendering-development).
His plate comment already found what the function does: it copies drawStartX, drawStartY, drawEndX and drawColor
into locals and writes the row through the global pencil's surface and stride (0x0191D724 / 0x0191D728), not
through this.

New here: the loop is handwritten assembly in the original (mov edx, 2 as the step, the row offset through mul), so
it is transcribed into an __asm block, as main's renderMinimapPreview does; the four copies are int const locals
the asm reads from their frame slots; the asm block is what gives the frame pointer and the saved ebx / edi, so his
#pragma optimize("gy", off) goes; and a sizeof line instantiates DAT_PencilRenderCore before the asm names it, as
main's ApplyBlending does. reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00468E40 100.0% Reimplemented

PencilRenderCore::drawVerticalLine, from gynt's draft (e24b66b, 21.05%, "orig keeps this in ecx at /Od";
88f785c, 21.1%, in his closed sourcehold#255; the same body at 63cc49f on his fork's reimpl/UI-Rendering-development).
His draft already had the shape: four local copies, the global pencil's surface, and a step of the global's
horizontalByteSize per row.

New here, as in drawHorizontalLine: the loop transcribed from the binary into an __asm block (it reads the stride
into edx again for the step), the copies as int const locals, the pragma gone and the sizeof line. reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00468EA0 100.0% Reimplemented

PencilRenderCore::dimHorizontalLine, from gynt's draft (82f902f, 15.56%, "orig keeps this in ecx at /Od";
18ad79e, 15.6%, in his closed sourcehold#255; the same body at 63cc49f on his fork's reimpl/UI-Rendering-development).
The mask choice by the colour mode and its explanation are his: the mask clears the lowest bit of every colour
channel before the shift, 0xf7de for RGB565 and 0x7bde for RGB555, so that halving a pixel moves no bit into the
channel below.

New here: the loop transcribed from the binary into an __asm block like drawHorizontalLine; the masks named and
written as every bit but the lowest of each channel (no hex left for the style-lint bot); the test written
colorBitMode == RGB_555 first, as main's ApplyBlending does, which compiles to the original's neg / sbb / and
0x7c00 / add 0x7bde as the other order does; int const copies; the pragma gone and the sizeof line. reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00470EE0 100.0% Reimplemented

PencilRenderCore::drawBoxWithRoundedEdgesAndColor, from gynt's draft (4ac54a9, 29.47%; b77851e, 29.5%, in his
closed sourcehold#255; at 63cc49f on his fork's reimpl/UI-Rendering-development it no longer compiles on today's headers,
TextInputDefinedData::field0_0x0). The table choice by rounding level (0x00B37CBC for RBERL_SLIGHT, 0x00B37CE8 for
RBERL_STRONG) and the three-loop shape (the first rows indented by the table from the top edge, the middle rows
full width, the last rows by the table backwards) are his.

New here, fixed against the binary: any other rounding level returns without drawing (jne 0x00470FEF), where the
draft went on with the strong table; the tables are the fields field_0x0 and field_0x2c of DAT_TextInputDefinedData
(split by the header commit before) rather than a cast address; a switch gives the original's cmp 5 / je, cmp 0x16
/ jne order; drawStartX / drawEndX are restored once after the first loop, where the draft reset them on every
pass; and the middle loop decrements the height before it moves drawStartY, both in the for's step. quick_diff
leaves only an alignment jmp; reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00471440 100.0% Reimplemented

PencilRenderCore::drawBorderedBoxWithCustomBlendedBackground, from gynt's draft (16efb3f, 36.87%; 08d3970,
36.9%, in his closed sourcehold#255; 7cca78d, 40.93%, and the same body with his style passes at 63cc49f, both on his
fork's reimpl/UI-Rendering-development). The drawing is his: the box rounded up to whole 24-pixel tiles, the
pictures of GID_INTERFACE_ICONS_3 by row (1, 7 and 13 start the top, middle and bottom rows, + 1 and + 2 for the
middle and right tiles, + 3 for each mask), the inside tiles skipped, the renderGMWithAlphaMask call per tile and
the background's (blendStrength - 32) * 16 / 32 + 32.

New here: drawBlendedBlackBox on the global pencil (mov ecx, 0x0191D720), where the draft passed this; width and
height rounded up in place, as the original stores the rounded width in width's own stack slot, which puts xPos +
width in the original's lea order (quick_diff 0.9720 -> 0.9813, where only the imul constant's display differs);
the pictures named; and the row's first picture by an if / else if chain instead of the masked ternary. The tile's
picture keeps the original's nested shape (a flat else-if chain: quick_diff 0.8000). reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00468F20 100.0% Reimplemented

PencilRenderCore::drawCurrentPixel, from gynt's drafts. 9f37b52 (0.00%, "orig is /Od, frame 0xc") and cc7f83f
(0.0%, in his closed sourcehold#255) write the pixel through this, with no locals, no global and no pragma. At 63cc49f on
his fork's reimpl/UI-Rendering-development he copied currentX, currentY and drawColor into locals, wrote the pixel
through the global pencil's surface and stride, and added #pragma optimize("g", off); our 3e7ec7e (4.5%, in the
draft sourcehold#360) is that body.

New here: the store is handwritten assembly in the original, transcribed from the binary like drawHorizontalLine,
with the copies as int const locals and the sizeof line. The original is not /Od: it has no frame pointer (sub esp,
0xc; locals at esp), which is what MSVC builds for this function, so the pragma goes. quick_diff leaves only ret /
ret 0; reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00468F70 100.0% Reimplemented

PencilRenderCore::drawPixelPattern4x4, from gynt's drafts (f19bf37, 0.00%; ec6bf49, 0.0%; c5cc82e, 4.8%,
"Running row offset and global instance"; at 63cc49f on his fork's reimpl/UI-Rendering-development the same rows,
with the row pixels and the right pair in two locals, the right pair kept across three rows as the original keeps
it in ebx; our 2c99182, 9.3%, in the draft sourcehold#360, is that body). The pattern is his: the four rows of two dword
stores through the global pencil's surface, with the original's pixel pairs and a running row offset.

New here: the whole body is handwritten assembly in the original (mov ecx, 0 and mov eax, 0 materialise zero), so
it is one __asm block transcribed from the binary; the colours are named by their RGB565 channels (PATTERN_GREY
0x7bcf, PATTERN_WHITE 0xffff, PATTERN_DARK_GREY 0x39c7) and each pixel pair is built from them in the asm operand,
which assembles to the original's immediates (0xffff7bcf, 0x39c70000, 0x7bcf7bcf, 0x39c739c7). No frame pointer, as
in the original. quick_diff differs only in how it displays the constants; reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x004710A0 100.0% Reimplemented

PencilRenderCore::drawBoxWithRoundedEdges, from gynt's draft (8fcbd14, 32.43%; c890ad0, 32.4%, in his closed
sourcehold#255; the same body with his style passes at 63cc49f on his fork's reimpl/UI-Rendering-development; our
ea42833, 38.9%, in the draft sourcehold#360). It is drawBoxWithRoundedEdgesAndColor with colour 0 for setupPencil and
dimHorizontalLine for drawHorizontalLine, so it darkens a rounded box instead of filling it; that, the table choice
and the three-loop shape are his, as in that function.

New here: the same fixes as in drawBoxWithRoundedEdgesAndColor (other rounding levels return, the tables as fields,
the switch, drawStartX / drawEndX restored once after the first loop, the middle loop's decrement order). The exe's
two functions differ in push 0 at 0x004710D4, where the other loads the colour (and the stack offsets and registers
that follow from one argument less), and in the three calls to 0x00468EA0. quick_diff 1.0000; reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00471340 100.0% Reimplemented

PencilRenderCore::drawBorderedBoxWithBlendedBackground, from gynt's draft (8e91764, 31.79%; c6809d4, 31.8%, in
his closed sourcehold#255; the same body with his style passes at 63cc49f on his fork's reimpl/UI-Rendering-development;
our 8543e6b, 32.8%, in the draft sourcehold#360). It is drawBorderedBoxWithCustomBlendedBackground with fixed blends, 0 for
the border tiles and 16 for the background; the drawing and both blend values are his, as in that function.

New here: the same changes as in drawBorderedBoxWithCustomBlendedBackground (drawBlendedBlackBox on the global
pencil, mov ecx, 0x0191D720, where the draft passed this; the in-place rounding; the names; the if / else if chain
for the row; the tile's nested shape, which a flat chain loses, quick_diff 0.9637). quick_diff 0.9792, where only
the imul constant's display differs; reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00472B20 100.0% Reimplemented

PencilRenderCore::drawLine, from gynt's draft (8a94992, 47.89%; dbccd67, 47.9%, in his closed sourcehold#255; the same
body with his style passes at 63cc49f on his fork's reimpl/UI-Rendering-development; our cfbab8e, 56.3%, in the
draft sourcehold#360). The four calls and their conditions are his.

New here: a return after each call (ret at 0x00472B5B, 0x00472B6D, 0x00472B7C). The draft had none, so every line
also went through drawDiagonalWiderThanHighUnk, a vertical one through drawDiagonalHeigherThanWideUnk too, and a
single point through drawVerticalLine, drawHorizontalLine and drawDiagonalWiderThanHighUnk. quick_diff 1.0000;
reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Gynt <gynt@users.noreply.github.com>
6and8 pushed a commit to 6and8/OpenSHC that referenced this pull request Nov 8, 2026
… 100% (sourcehold#376)

* reimplement: SHC_3BB0A8C1_0x00468FE0 100.0% Reimplemented

PencilRenderCore::drawHeaderBanner, from gynt's draft (2a0beda, 40.22%, then 8f3b5da, 40.22%, and fc63cfd,
43.58%, on his fork's reimpl/UI-MenuItems-development; 7719115, 40.2%, in his closed sourcehold#255; his style passes
81e1041, a389f84, dd14331, 9205629 and cee658d; at 63cc49f on his fork's reimpl/UI-Rendering-development
he moved yPos + 8 into yPos itself and tested the right tile against the banner's width - 8; our 402dc08, 52.0%,
in the draft sourcehold#360, is that body). The drawing is his: eight rows of 8 by 8 tiles of GID_INTERFACE_ICONS_3 (48, 54
and 60 start the top, middle and bottom rows, + 1 and + 2 for the middle and right tiles, + 3 for each mask), the
rows counted in xPos from his first draft on, one tile in from the top and both sides, and the end caps 91 / 92
three pixels in from each end, the right one placed by the cap's width.

New here: the banner's width is width itself, reduced in place (width -= 16), as the original keeps it in width's
register and puts the row's y in width's stack slot (an innerWidth local: quick_diff 0.6353 -> 1.0000); the rows
are counted in a y local, which MSVC also puts in xPos's slot; the pictures are named; the masked row-picture
ternary is an if / else if chain and the tile's comma condition a nested if (a flat if / else if chain: quick_diff
1.0000 -> 0.9827); the cap width is read inline between the two cap calls, where the original reads it. reccmp
100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00475CC0 100.0% Reimplemented

PencilRenderCore::drawHeaderTextBanner, from gynt's draft (9a19144, 35.96%, then 6ae321d, 35.96%, and
e69b74d, 37.72%, on his fork's reimpl/UI-MenuItems-development; daeda89, 39.6%, in his closed sourcehold#255; his style
passes 81e1041, a389f84, b8ab787, dd14331, 9205629 and cee658d; the same body with his style passes at
63cc49f on his fork's reimpl/UI-Rendering-development; our 9c437b0, 52.4%, in the draft sourcehold#360). It is
drawHeaderBanner's banner with a text centred on it; the banner and the text call (getTextStringInGroupAtOffset
nested in renderTextToScreen, centred, COL_C2F0EB, size 15) are his.

New here: the banner written as in drawHeaderBanner (yPos += 8 and width -= 16 in place, a y local, the pictures
named, the if / else if chain over the rows and the nested tile test: a flat chain, quick_diff 0.9909 -> 0.9774;
the cap width inline), so the text sits at width / 2 + left and yPos + 14. The text group keeps its eTextSections
cast because the header declares textGroupIndex as int, although every caller passes an eTextSections value; that
type is a proposal for the PR text. quick_diff differs only in the colour immediate, which it shows as a data
symbol; reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x004690E0 100.0% Reimplemented

PencilRenderCore::drawScrollbar, from gynt's draft (c808751, 30.77%, on his fork's reimpl/UI-MenuItems-development;
3d9ca03, 30.8%, in his closed sourcehold#255; his style passes 81e1041, a389f84, dd14331 and cee658d; the same body
with his style passes at 63cc49f on his fork's reimpl/UI-Rendering-development; 5fa1b20 on his fork's
reimpl/UI-MenuItems-development turns the thumb test 10 < thumbHeight - 10 into thumbHeight > 10 - 10, where the
binary tests thumbHeight - 10 > 10 (sub ebx, 0xa; cmp ebx, 0xa), as this commit does; our 074c788, 60.1%, in the
draft sourcehold#360). The pictures and their order are his: the track in 20-pixel pictures (79) and then single rows (95);
the thumb small (89, up to 20 high) or as a 10-pixel top (100), single middle rows (101) and a 10-pixel bottom
(102); each with its mask (80, 96, 90; 103 to 105).

Fixed here: a dragged thumb is drawn once, without masks, and the function returns (ret 0x1c at 0x00469189 and
0x004691EB). In the drafts the dragged branch had no return, so a dragged thumb of up to 20 pixels drew picture 89
and then the large thumb too, and every dragged thumb was then drawn a second time with masks.

New here: the draft's hand-made countdown loops and shared final call are plain for loops and one call per branch,
which MSVC compiles to the original's countdowns and shared tail; the track walks yPos itself while top keeps its
first value (a copy of yPos walking instead: quick_diff 0.8158 -> 0.9474); the thumb loop lowers thumbHeight and
advances thumbYPos in place, as the original updates them (0.9474 -> 0.9737 -> 1.0000); the pictures are named;
xPos is passed without the (int) casts. reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00468C80 100.0% Reimplemented

PencilRenderCore::setupPencil, from gynt's draft (3957761, 18.82%, on his fork's reimpl/UI-MenuItems-development;
44a1588, 18.8%, in his closed sourcehold#255; his 3d17527 on his fork's reimpl/UI-MenuItems-development puts the map
branch first, 19.6%, as this commit does). The clipping is his: left and right clamped to the surface's width (the
map surface's 4056 pixels, or resolutionX for the menu surface), top and bottom to the surface's height range, FALSE
when the rectangle lies wholly off the surface, then the pencil's size, position, directions and drawing bounds. The
note that right and bottom are inclusive is TheRedDaemon's comment in the draft, now one line.

Fixed here: the map surface's three width tests are >= 4056, where the draft had 4056 < left and 4056 < right, so
4056 itself was neither clipped nor counted as off the surface: left >= 4056 (cmp edi, 0xfd8; jl at 0x00468CB8),
right >= 4056 for the wholly-off test (cmp esi, 0xfd8; jge at 0x00468CC0) and right >= 4056 for the clip (cmp esi,
0xfd8; jl at 0x00468CD5).

New here: each branch clips top and bottom against its own height range, read in place, and MSVC merges the
identical tails at 0x00468D45 as in the original (the draft's two range locals clip once after the branches); the
two sizes, the directions and the drawing bounds are if / else (the sizes as ternaries keep this in ecx: quick_diff
0.5204, if / else 1.0000; the directions and the Y bounds tie either way); 4056 is named MAP_SURFACE_WIDTH. reccmp
100.0%; its callers dimBox and drawColorBox stay at 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x004B20B0 100.0% Reimplemented

RenderNoRushDisplayElementUnk, gynt's function on main (b0a49d0, 67.57%, and 96008db, 82.43%, "shared arm fold
direction"; the .cpp and its 82.4% status line came to main in sourcehold#199 as 648b0c6, and the re-measured 83.1% in
sourcehold#269, his 272decc, as 4b30c73). The function is his: the battle horn and the unlimited display once the no-rush
time is over, otherwise the text width, the bar's position by resolution, the blended box, the text, the border and
the bar filled by the remaining ticks.

New here: the resolutions are tested by separate ifs instead of an else-if chain, in the same order. The original
keeps each offset that two resolutions share (-240, -400, -560 and -880) in the first of the two and jumps back to
it from the second (je 0x004B212C at 0x004B2144); the else-if chain puts the copy in the second, separate ifs put it
in the first, and MSVC still skips the remaining tests once one matches (quick_diff 0.9054 -> 0.9797, the rest being
the listing's ret 0 and the colour immediate shown as a data symbol). reccmp 100.0%.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* style: RenderNoRushDisplayElementUnk without its unused usings and includes

The six using declarations and the Helpers and Rendering function headers were unused: the code names everything in
full. x += -18 - (barWidth / 2) becomes x -= 18 + barWidth / 2. quick_diff 0.9797 before and after.

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 Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant