Repository navigation
Conversation
…g-directdraw-development Their best match lives only on gynt's catch-all branches, which are ~2080 cpp files ahead of their merge base and 412 commits behind main. The cpp files are copied unchanged, without the headers of those branches: - gynt/archive/UI-MenuViews-merged-full@2755710f9 (1) - gynt/reimpl/UI-DisplayElements-pr-development@fbc092e15 (2) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
Renamed fields, globals and resolvers by address, enum-typed arguments, array fields indexed directly, clang-format. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
SHC_3BB0A8C1_0x004B2AE0 31.0% WindowMsgProcessingFunc SHC_3BB0A8C1_0x004DAE90 72.3% InsertElementIntoArrayAt_ec0348_2 SHC_3BB0A8C1_0x004E0A50 59.7% ProcessCreditsScriptCommands Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
72.3 -> 95.7 (normalized 97.4): the free-slot search is an indexed loop that leaves -1 when the 24 slots are full, which is what the original's leftover `cmp eax, -1` comes from, and field_0x28 is stored after fadeMode. The instructions match; what is left are data addresses only: the 31.0f constant is our own literal where the original loads the shared one at 0x5AB03C (no resolver for it yet), and the array-end address is labelled as a different global. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
59.7 -> 71.6 (normalized 76.9). The command loop is rebuilt from the original's jump table instead of Ghidra's goto web: - cases are in the original's layout order (1, 44, 2, 3, 4, ..., 19, 43, 20, 36, 37, 21, 23, 22, ...), which decides the jump-table targets - waiting commands leave the index alone, and the loop stops once a command leaves it unchanged - the float waits test `!(accum > (float)stream)`, the spelling that gives the original's `test ah, 5; jp` - the hit-test loop over the credit elements uses a `!= 24` bound so that MSVC does not unroll it six times Fixes a real bug: the mouse hit test in case 22 read xSpace/y and x/width, but the original compares the cursor against x..x+width and y..y+height. Left: the original keeps DAT_UnknownBinkIndex in esi across the loop and reloads it after each call, where we update it in memory; this shifts the register assignments. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
… first The original falls through into the message <= WM_KEYDOWN half and places the mouse and higher messages after it; swapping the two halves of the top-level if puts every block of the lower half back at its original offset (31.0 -> 37.1). The goto labels are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…jump tables Both switches now list their arms in the order the original's jump-table targets appear (31.0 -> 50.3 together with the earlier half swap): - the low-message switch: the reinitWindow block lives in WM_CREATE/WM_MOVE and WM_SIZE jumps back into it, WM_DISPLAYCHANGE gets an explicit break - the WM_KEYDOWN switch: the digit keys take the place of the decompiler's label inside the numpad arm, which falls into them as in the original, and F1 jumps to F3..F10 now that they are no longer adjacent Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…le order The three remaining switches now list their arms in the order of the original's jump-table targets (50.3 -> 51.2): WM_SYSKEYDOWN before WM_CHAR and WM_KEYUP, the arrow keys of WM_KEYUP as right/left/up/down, the ALT keys with the numpad arm falling into the digits, and the mouse buttons with the shared updateMousePositionAndClicks call held by WM_RBUTTONUP as in the original. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The number-key arm of WM_KEYDOWN now follows the original's layout (51.2 -> 68.4): - the barracks and mercenary assembly-point switches set an index per key and make one ToolbarButtonPressed call after the switch; the original's arms compute index + POINT1 at run time, which only a shared call produces - the engineers', tunnelers' and cathedral checks test wParam - '1' as the original's add/cmp sequences do - ctrl is tested first with the ctrl-held branch falling through, the current tribe ID is read only inside it, and alt jumps into the camera-hotkey block, which now lives in the WM_SYSKEYDOWN digit arm where the original holds it Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The original dispatches every message through one switch, which MSVC splits at WM_KEYDOWN and WM_MOUSEMOVE, so the top-level if/else halves become a single switch with the arms in the original's order (68.4 -> 70.2). The mouse coordinates are computed at each call, as the original does. Also: - the game-speed hotkey stops at 90 as the original's jge does; the decompiled `90 < level` let a press at 90 show the speed popup again - the shared speed popup call lives in the VK_ADD arm, as in the original - the F3..F10 and F11/F12 blocks live in the WM_SYSKEYDOWN arms that the original's WM_KEYDOWN cases jump into Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…lding Every building hotkey arm now ends in its own focusOnCoordinate and openBuildingStatusMenuForBuildingID calls instead of jumping into the decompiler's shared LAB_004b3a17/LAB_004b3b12/LAB_004b3a35 blocks, and both game-speed arms call the speed popup themselves. MSVC merges the identical tails itself and keeps the copies the original keeps (70.2 -> 71.0; the quick diff of the code alone goes 0.78 -> 0.89, the rest of reccmp's gap is the jump tables and branch displacements that shift with the remaining size difference). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…r arm The choose-game-type escape and the left/middle button-up arms make their own calls instead of jumping into the decompiler's shared LAB_004b3756 and LAB_004b4d15 blocks (71.0 -> 72.0). The remaining labels were measured the same way: duplicating LAB_004b2cfd, LAB_004b38a3 and LAB_004b4af5 loses match and the others are an exact tie, so they keep their gotos. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The ctrl+alt+digit camera hotkey stored screenPointToTileNumber[... - 8]; the original indexes the table with the orientation offset alone (8 for the default orientation), so the saved view was 8 entries off. The row sum is written in the original's operand order, and the four map-rotation sites use % 8 instead of the decompiled mask-and-repair (72.0 -> 74.6). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
- the camera hotkey block tests ctrl with the assign branch first, as the original falls through into it - the F1..F10 block no longer sets keyDownUnk: both WM_KEYDOWN and WM_SYSKEYDOWN have already set it on every path into the block, and the original has no store there - the engineers' guild key keeps wParam - '1' in a local, which the original reuses for the command number 74.6 -> 75.1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…hains The eight building hotkey arms are written as one if / else if / else over shift and ctrl with a single break, instead of a break per branch. Each branch then ends at its own join, which stops MSVC cross-jumping the identical ctrl tails into one copy; the original keeps one openBuildingStatusMenuForBuildingID call per arm (75.1 -> 77.2). The ctrl branches read the building into their own local. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The original's WM_SYSKEYDOWN switch covers wParam 0x0d..0xde: its index table has an entry for VK_RETURN separate from the default. An explicit VK_RETURN case plus an explicit default, both handing the message to DefWindowProcA as falling out of the switch did, restores that range and the index bytes (77.2 -> 83.5). A bare `case VK_RETURN: break;` is folded away before the table is built and changes nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
Pressing a unit group hotkey scans the group for its first unit. The decompiled loop stopped only once the counter exceeded 2500, one read past the 2500-entry group; the original's jge stops at 2500. The loop now reads hotkeyTribes[...].units by index instead of walking a raw pointer. The ALT+Enter case jumps to the shared DefWindowProcA call instead of making its own, which the original's index table points straight at (83.5 -> 83.8). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…ginal The credits click test compares the border-adjusted mouse position against the element's origin with the mouse on the left, as the original's cmp/jl does, and the timed-wait-or-click command resets its timer in each of its two exits rather than sharing one store (71.6 -> 72.7). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…able The original dispatches messages 0x101..0x105 through a five-entry jump table whose WM_DEADCHAR and WM_SYSKEYUP entries point at the DefWindowProcA block, so WM_SYSKEYUP was a case of its own there. An explicit case with that body restores the table in place of our compare chain (83.8 -> 85.1). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The original wraps the signpost index with `cmp eax, 8; jl` (signed `>= 8`) on the undefined4 global, and tests the tutorial step against 0x1d; the decompiler's `7 < x` on the unsigned global compiled to jbe. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
|
Style guide reading (advisory, posted once) 58 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 3 of the 3 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 1 — Drop the decompiler trailing
Rule 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
|
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
The instruction stream is identical (quick_diff 1.0000 over 47 instructions). reccmp reports 95.7% / normalized 97.4% only because the fld of the 31.0f literal reads the original's unlabelled constant at 0x5AB03C (shown as <OFFSET12>, not as a float) and the array-end compare lands on a different data symbol. Recorded as 100%, following main's precedent for float-constant-only differences (0x004E12C0, 0x004DB300). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…isible The original keeps DAT_UnknownBinkIndex in esi through the whole credits loop. MSVC only does that when it knows the three InsertElement* callees leave the caller's registers alone, i.e. when their bodies are in the same unit (function-visibility.txt) or linked with /GL. Both modes give the same instruction stream; the visibility build reads 87.8% normalized against 86.1% under /GL (label noise only), so both lists carry the files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
… pos ProcessCreditsScriptCommands: replace the advance flag with a goto past the index increment, and write case 22's hit scan as a while loop that returns when it runs off the end. Together with the callees being visible (previous commit) DAT_UnknownBinkIndex is now promoted to esi as in the original. Measured in the function-visibility build (also in the /GL list): 83.0% / 87.8% normalized, was 72.7%. Two differences remain: case 4 reloads esi after `test eax, eax` instead of before it, so it is not cross-jumped into case 2's tail, and case 22's `mov ebp, 2` edge block is placed at the end of the function instead of after the loop. The rest of the gap is jump-table entries shifted by those two blocks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…hoisted WindowMsgProcessingFunc, local shape fixes found section by section with quick_diff (0.9377 -> 0.9466): - WM_DISPLAYCHANGE stores depth first and takes the low word as (ushort); - WM_SIZE passes GetSystemMetrics() straight into SetRect, so SM_CYSCREEN is evaluated first as in the original; - the first zoom toggle is an if/else on isZoomedOutUnk instead of `(uint)!isZoomedOutUnk` (no sete); - the shared "reset viewport, trigger menu view" tail now sits in WM_PAINT, where the original has it; the second zoom toggle jumps there from each arm (the inner switch is followed directly by `break`, so behaviour is unchanged); - the pause toggle tests the paused branch first; - the chat text length uses strlen(). reccmp 85.4% -> 86.8% (function-visibility build). The remaining gap is mostly global register allocation: we keep 1 in ebp and -1 in edi for the whole function and the hwnd in esi, the original rematerialises 1/-1 locally and keeps hwnd in edi and wParam in esi inside WM_KEYDOWN. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
gynt
added a commit
to gynt/OpenSHC
that referenced
this pull request
Dec 4, 2026
…d#548) * reimplement: SHC_3BB0A8C1_0x004DAE90 100% InsertElementIntoArrayAt_ec0348_2 Taken from draft sourcehold#531. Measured on main 40cbb1c with only this file in .local and both resolver sets enabled: reccmp 95.7% raw, the only differences being the 31.0f float constant name and the array-end data label, so it is counted as 100% per main's convention. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * style: InsertElementIntoArrayAt_ec0348_2 per REIMPLEMENTATION_STYLE_GUIDE - named parameters (elementType, fadeMode, field20Unk/field24Unk/field28Unk) and freeIndex instead of param_N/_index - early returns instead of the nested ifs, else-if for the fade mode - countof(DAT_ARRAY_00ec0348::instance) instead of 24 - dropped the trailing return; namespace closing comments Re-measured on main 40cbb1c: unchanged at 95.7 / 94.7, only the 31.0f constant name and the array-end label differ. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * enum: CreditsElementType for CreditsRelatedStructure.type The values follow RenderActiveCreditsElements on main: 0 is a free slot, 1 an image, 2 text, 3 a hover image and 4 a bordered box. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * enum: CreditsFadeMode for CreditsRelatedStructure.fadeMode The values follow RenderActiveCreditsElements on main: 1 lowers blendStrength to below 1 and then clears the mode (fade in), 2 raises it past 31 and then frees the element (fade out). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * review: InsertElementIntoArrayAt_ec0348_2 uses the credits element enums CET_TEXT / CET_NONE for the element type and CFM_FADE_IN / CFM_FADE_OUT for the fade mode instead of raw numbers. Re-measured on main 592a17d with a full build and reccmp: unchanged at 95.7 / 94.7 (only the 31.0f constant name and the array-end label differ). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…irectdraw-development Conflicts resolved: InsertElementIntoArrayAt_ec0348_2.cpp and its status line taken from main (the enum version); compiler-flags-gl.txt keeps both sides' entries. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Re-measured with both resolver sets on (ProcessCreditsScriptCommands needs its InsertElement* callees built locally for LTCG) and the blockers recorded. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
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.
The window procedure, a credits array helper and the credits script interpreter.
InsertElementIntoArrayAt_ec0348_2differs only in data addresses. The functions were ported from gynt's catch-all branches: this branch is origin/main plus the copied files, compile fixes, matching work and status.Measured with reccmp, with both the struct and the function resolvers enabled and main's /GL callees on.
0 of 3 functions at 100%. The others hit a wall: the blocker named for each was measured, and the source forms tried against it tied or scored worse.
Hit a wall
Credits::InsertElementIntoArrayAt_ec0348_231.0fliteral at 0x5AB03C and an array-end label); the code itself matches.Global::WindowMsgProcessingFunceax/edxeach arm uses.(ushort)lParammeasured worse, a ternary toggle and<= VK_F1tie.Rendering::ProcessCreditsScriptCommandsDAT_UnknownBinkIndexinesiacross the loop and reloads it after each call; ours updates it in memory and enregisters 4 values instead of 2.intinstead ofbool advanceties, a duplicated check costs 83.Behaviour fixes
These were wrong in the decompiler output and are fixed against the binary:
ProcessCreditsScriptCommandscase 22: the mouse hit test read xSpace/y and x/width; the original compares the cursor against x..x+width and y..y+height.Type and header changes are in their own
types:commits. Resolver flags are not committed.🤖 Generated with Claude Code
https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ