Repository navigation
tools: Enable-Reimplemented-Functions also flips resolvers wrapped after the flag - #375
Merged
gynt merged 1 commit intoNov 8, 2026
Conversation
…ter the flag The script matched `, false` followed by `, Address::...` with exactly one space, so a resolver that clang-format wrapped after the flag (`false,` then a line break and `Address::...`) was never flipped. 540 of main's 3,663 function resolvers are wrapped that way. With such a callee left off, nothing hooks or calls our function, and /GL gives it a register calling convention, which reccmp then reads low. That is what sourcehold#357's GetIfDisplayElementStateNotZero (81.8) and RenderTimeUntilDefeatDisplayElement (54.5) showed in a full build: their resolvers are wrapped, FindDisplayElementWithID's is not. In an alone build of the three, the old pattern flips only FindDisplayElementWithID and reads 100.0 / 81.8 / 54.5; `\s*,\s*Address` flips all three and reads 100.0 / 100.0 / 100.0. The batch helpers (enable_local_functions.py, common.py) already allow the line break. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
approved these changes
Nov 8, 2026
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.
tools/reimplementation-control/Enable-Reimplemented-Functions.ps1misses every function resolver that clang-format wrapped after its flag. Its pattern expects, falseand then, Address::SHC_3BB0A8C1_...with exactly one space between them, so a resolver written asfalse,+ line break +Address::...is never flipped. 540 of main's 3,663 function resolvers are wrapped that way. This PR allows any whitespace there (\s*,\s*Address), the same as the batch helpers (enable_local_functions.py,common.py) already do. Nothing else changes.What it fixes
With such a resolver left off, nothing hooks or calls our function, and with
/GLthe compiler is free to give it a register calling convention, which reccmp then reads low. #357's/GLtrio showed it in a full build: FindDisplayElementWithID's resolver isn't wrapped, the other two are.FindDisplayElementWithIDGetIfDisplayElementStateNotZeroRenderTimeUntilDefeatDisplayElementThe hooked calls the game makes are not affected either way: a function is hooked only when its resolver is on, and then its address is taken, so its calling convention stays standard. The low readings came only from the measurement setup.
Measured
A full build of main (303fe1c, every
.cppundersrc/OpenSHC, the struct resolvers on, the function resolvers flipped as each script flips them), with the bundled MSVC1400-SP1 against the SteamStronghold Crusader.exe(3bb0a8c1…5387ac5a) and sourcehold's reccmp (cce67bcab,--resolve-wrapped-calls --ignore-security-cookie):To link, that build needed two local edits in the generated
src/symbols/data.asm, which #368 describes (DAT_PerformanceCounterFrequencydeclared as aU_LARGE_INTEGERstruct where_LARGE_INTEGERis a union, andDPLAY_InterfacePointerin adplaynamespace). They're not in this PR.Enable-Reimplemented-Data.ps1doesn't have the problem: its pattern doesn't depend on what follows the flag, and no struct resolver on main is wrapped.Other PRs: the ready #354 and #374 (a fix for main), and the drafts #313, #318, #321, #327, #328, #356, #360 and #363.
🤖 Generated with Claude Code