Repository navigation
Reimplement 2 UI::Rendering TextureRenderCore functions from gynt's asm drafts (draft, below 100%) - #363
Draft
kotijekriv wants to merge 7 commits into
Draft
Reimplement 2 UI::Rendering TextureRenderCore functions from gynt's asm drafts (draft, below 100%)#363kotijekriv wants to merge 7 commits into
kotijekriv wants to merge 7 commits into
Conversation
… path's surface pointer fixed Draft. renderUnitAnimationWithBlendingUnk blends a unit animation's TGX picture into the surface with the player's colour palette; four asm loops (RGB555 and RGB565, zoomed and not). From gynt's renderUnitAnimationWithBlendingUnk.cpp in 3c9bcdb (origin/reimpl/TextureRenderCore, 2026-10-04, 91.5% there, "Four asm loops recovered, stack slot allocation differs"). Fixed: his two zoomed-path asm blocks load the surface pointer from width, which that path never sets (only the unzoomed path assigns width = the surface pointer), so they draw through the picture width as a pointer; all four blocks now read DAT_TextureRenderCoreObject::instance.currentRenderSurface, as the original does, and the two width assignments are gone. Also: main's colorPaletteOverride for his mbr_0x70; 32, 32 * 512, 512 and 4056 * 2 for 0x20, 0x4000, 0x200 and 0x1fb0; the two unused usings dropped. Left: the stack slots. The asm-only _columnOffset always gets -4 in our listing where the original has it at -16, between colorPalette and dstFilter, which moves the C locals by one slot each; its declaration position, a block scope and a (void) reference do not move it. The C part also keeps height in another register (the original holds it in edi from the first test on). Measured in a clean alone build of the branch on main 1c29459: 92.5% raw, 84.8% normalized. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… extra locals Draft. moveOverlappingMenuPartsToMapSurface copies the parts of the open menu tab that reach over the map from the menu surface onto the map surface, all but the magenta pixels; the copy loop is handwritten assembly in the original. From gynt's asm version in c2e5474 (origin/reimpl/TextureRenderCore, 2026-10-04, 68.0% there). Changed: the colour key read from COL_MAGENTA in the asm and the record index inline, which drops his two extra stack slots (the original has ten); the tab in a local, read once as in the original; the line jumps computed before the width is read again, which gives the original's store order before the asm; main's field_0x3014 rows ([55][8], so (tab - 1) * 5) for his field166_0x2dfc; 4056 for 0xfd8. Left: the original computes the record offset, lea [eax + eax*4 - 5] and shl 5, twice and keeps the - 5 in the lea; ours computes it once and folds - 160 into the addresses. Index spellings, the pointers computed before the -1 test and a [11][40] table shape do not change that. Measured in a clean alone build of the branch on main 1c29459: 84.8% raw, 67.4% normalized. 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) 2 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 2 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 9 — Prefer
Rule 24 — Declare variables upon first use
|
…Core-development Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the original's shared blocks Draft. loadGMFile reads a .gm1 file, its header, the offsets, sizes and headers of its pictures and their data, and copies each picture's data behind the ones processed so far, or points it at the previous picture's or another one's data. Written from the original's instructions, with gynt's draft (63cc49f on his fork's reimpl/UI-Rendering-development, 84.5% there) for the reads. The two-way sharing test is one condition, which gives the original's one copy block and one sharing block (the draft's gotos measure lower: quick_diff 0.9326 -> 0.9091; nested if / else without them writes both blocks twice: 0.7759). DAT_GMImageSizes[picture + 115999] in the draft is DAT_GMImageOffsets[picture - 1], the previous picture's offset (the original reads [picture * 4 + 0x00D0BA0C]). Left: the original walks the picture headers with a pointer to alternativeImageIndexUnk and does not re-test (animatedColor & 4) after animatedColor == 0; ours points at animatedColor and re-tests. This file was measured as it stands in a clean alone build of the branch on main eef6f66: 93.1% raw, 79.7% normalized. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
…Core-development Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
Draft. moveOverlappingMenuPartsToMapSurface (adec92b, gynt's asm without his two extra locals) now takes the tab's record index, (tab - 1) * 5, into a local of its own for the four pointers. The original computes that index a second time after the -1 test (lea and shl again) instead of reusing the test's, and keeps the - 5 in the index rather than folding it into the addresses; with the index inline MSVC shares one computation, 98 instructions to the original's 100. The pointers are set up in the original's order (width, x, height, y). PR sourcehold#276's structural_diff.py now reads kind 1.000 with no instruction-mix delta (was 0.980, delta 2), and slot_map.py shows every stack slot at the original's offset. Left: the -1 test's own index still has its - 5 folded into the address (as a local, cast to a row pointer, as tab * 5 - 5, or as a second local, it folds the same). Measured in a build of the changed draft files alone on the branch (main e32319b): 96.5% raw, 88.1% normalized (was 84.8% and 67.4%). 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>
This was referenced Nov 9, 2026
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.
Two UI::Rendering
TextureRenderCorefunctions from gynt's asm drafts onorigin/reimpl/TextureRenderCorethat come close but don't reach 100%, so others can continue from them (the rule: ready functions in their own PR, the rest in a draft). One fixes a bug in his draft. Each status line says what is left; each commit body says what changed against his commit and credits him as co-author.Other PRs: the ready #348, #349, #352, #353, #354, #357, #358 and #359, and the drafts #313, #318, #321, #327, #328, #356 and #360. The ready TextureRenderCore PR (18 functions) follows shortly.
Built on top of
main(03827fa, merged in) 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; the numbers are from a clean alone build. None of it has been run in game.openshc-pr-checkgives no errors, andstatus_regression.pyfinds nothing below a known score.renderUnitAnimationWithBlendingUnk_columnOffsetat -16, ours at -4).moveOverlappingMenuPartsToMapSurfaceBehaviour fixed compared with the draft
renderUnitAnimationWithBlendingUnk: the two zoomed-path asm blocks in gynt's draft load the surface pointer from
width, which that path never sets (only the unzoomed path assigns the surface pointer to it), so they would draw through the picture width as a pointer. All four blocks now read the global surface pointer, as the original does.renderTextChar (0x00455540) isn't here: our version reaches 28.0%, below gynt's 39.6% on his branch, although his doesn't compile against today's headers.
🤖 Generated with Claude Code