Skip to content

Fix 21 files that stopped compiling after the 6823e33eab, efea7fccd7 and 1feb9c9821 header syncs - #546

Merged
gynt merged 3 commits into
sourcehold:mainfrom
kotijekriv:fix/sync-efea7fccd-renames
Dec 3, 2026
Merged

gynt merged 3 commits into
sourcehold:mainfrom
kotijekriv:fix/sync-efea7fccd-renames

Conversation

@kotijekriv

Copy link
Copy Markdown
Contributor

Main (624acf6) has 21 .cpp files that no longer compile since the Ghidra syncs of 2026-12-02. The syncs renamed four fields, globals and methods, merged the three SkMasters2 globals into one struct and gave three parameters a type, and these files still use the old names or pass plain numbers. This PR moves them to main's names and types and changes nothing else: no header and no status line. Each function compiles to the same code as before the syncs; the one exception moves toward the original (see Measured).

Files Was Main's now Sync
migrateGameStateForMapVersion, setAIControlStatusTo100000, UpdateArabianArcher, UpdateArabianSwordsman, UpdateCrusaderArcher, UpdateKnight, UpdatePikeman, UpdateSwordsman PlayerData::aiControlStatusRelated aiHoldBackTicks (the same int at 0x2274) efea7fc
setEntityParameters, tickEntityDecayCounter Entity::unkMinusOne blendStrength (the same short at 0xB0) 6823e33
ApplyBlending, BlitMapImageWithVerticalClip, RenderTerrainTilesCenterPiece DAT_00ed3154 (undefined4) INT_00ed3154 (int), with its header 1feb9c9
MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk MenuTextInputState::meth_0x4917c0 closeAllModalDialogs 6823e33
ReadSkMasters2, WriteSkMasters2, Skirmish_SortAIOpponentOrder, MenuItemActionHandler_RankingGames_Main DAT_SkMasters2Data_Version, _Count, DAT_SkMasters2DataArray DAT_SkMasters2Data::instance.version, .count, .entries 1feb9c9
MenuItemActionHandler_AlliesSendAndRequestGoods_Main, MenuItemActionHandler_BuildingAndStatusMenu_BuySellMenuButtonsAndHands SetStorageMarketFailState(3, …), storageMarketFailState == 6 the SMFS_ names 6823e33
ClickCreatePlateau DAT_GameCommandParam3 (undefined4) as the call's fourth argument a cast to Logic2 6823e33

Three commits: the eight files of efea7fc's rename; the eight other renames; the five files whose fix is already in your open PRs, with your lines unchanged and you as co-author. The include lines follow the names, sorted by clang-format. The style bot's comment will list main's own lines in these files (hex masks, += 1); this PR changes only the names and the five typed arguments.

Your open PRs

Fifteen of the files have the same lines in your open PRs: #501 (migrateGameStateForMapVersion, setAIControlStatusTo100000, UpdateArabianSwordsman, UpdateKnight, UpdateSwordsman), #291 (blendStrength), #295 (closeAllModalDialogs and the two SMFS_ handlers), #396 (ClickCreatePlateau), #525 and #529 (the SkMasters2 files). Each of those PRs merges with this branch the same way it merges with main (git merge-tree: #291, #295, #396 and #525 clean; #501 and #529 only the cmake/compiler-flags-gl.txt conflict they already have with main). The other six files are in no open PR: the three units from #512 and #518 and the three render functions.

Still not compiling

TransformAndRenderPercentage compiles again since #509.

Measured

Setup: the bundled MSVC1400-SP1 against the Steam Stronghold Crusader.exe (3bb0a8c1…5387ac5a), sourcehold's reccmp with --resolve-wrapped-calls --ignore-security-cookie, both resolver sets enabled locally (not committed).

  • Each file alone (quick_diff.py), against main before the syncs (a0dc309): the same code in 20 of the 21, but for the compiler's numbered temporaries in the SkMasters2 pair. In migrateGameStateForMapVersion two loads trade places (mov si / mov dx in front of the 0x51eb851f divide) and now stand in the original's order. That comes with the syncs' other header changes: main just before efea7fc (6823e33) gives the old order too, and the edit here is a name only.
  • Full build, option off: this branch merged with Reimplement UnitsState::prepareProjectileTarget at 100%, from gynt's text on main (one header line each in two files) #540, leaving out the two files above that still don't compile and TransformAndRenderPercentage (on our list from before Reimplement 59 TextManager and UserTextHandler functions at 100% #509): 3,102 files, it links, 3,120 functions compared. The 21 read as in our last full build before the syncs (the morning of 2026-12-02), but for migrateGameStateForMapVersion, which goes from 99.8 / 95.5 to 100.0 / 100.0. Seventeen are at 100.0; WriteSkMasters2 98.8, ReadSkMasters2 97.1, Skirmish_SortAIOpponentOrder 95.0 and BuySellMenuButtonsAndHands 93.9 are unchanged.
  • Five functions outside this PR read lower than in that morning build, their .cpp unchanged since: UpdateUnitLossSpeechFeedback (99.6 to 95.6), MenuItemRenderFunction_GameplayOptions_SpeedSlider (100.0 to 94.1), tracePathPlanToDestinationViaUnoccupiedTiles (100.0 to 99.5), MenuModalRenderFunction_TutorialBox (100.0 to 99.6) and MenuItemActionHandler_LobbyMenu_LobbyscreenStartButtonClick (99.6 to 99.3). We haven't looked into what moved them.
  • Not run in game.

Other PRs

Our open #536, #540 and #544 share no file with this one and merge with it cleanly.

🤖 Generated with Claude Code

kotijekriv and others added 3 commits December 3, 2026 01:59
The Ghidra sync efea7fc renamed PlayerData::aiControlStatusRelated to aiHoldBackTicks (the same int at
0x2274). migrateGameStateForMapVersion, setAIControlStatusTo100000 and six Update* unit functions still used
the old name; they move to main's name. No header or status line changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The syncs 6823e33 and 1feb9c9 renamed or merged four more things that eight files still used:

- Entity's short at 0xB0: unkMinusOne -> blendStrength (setEntityParameters, tickEntityDecayCounter).
- The global at 0x00ED3154: DAT_00ed3154 (undefined4) -> INT_00ed3154 (int), with its header
  (ApplyBlending, BlitMapImageWithVerticalClip, RenderTerrainTilesCenterPiece).
- MenuTextInputState's method at 0x004917C0: meth_0x4917c0 -> closeAllModalDialogs
  (MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk).
- The three SkMasters2 globals (version, count, entries) are now one struct, DAT_SkMasters2Data at 0x00DF6248
  (ReadSkMasters2, WriteSkMasters2).

No header or status line changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The syncs typed three things these files pass or compare as plain numbers, and merged the SkMasters2 globals:

- SetStorageMarketFailState takes a StorageMarketFailStateEnum: the SMFS_ names for the numbers it is
  given and the states compared after it (MenuItemActionHandler_AlliesSendAndRequestGoods_Main,
  MenuItemActionHandler_BuildingAndStatusMenu_BuySellMenuButtonsAndHands), as in gynt's sourcehold#295.
- The plateau call's fourth parameter is a Logic2: a cast on DAT_GameCommandParam3 (ClickCreatePlateau),
  as in gynt's sourcehold#396.
- DAT_SkMasters2DataArray is DAT_SkMasters2Data's entries (Skirmish_SortAIOpponentOrder,
  MenuItemActionHandler_RankingGames_Main), as in gynt's sourcehold#525 and sourcehold#529.

The hunks are gynt's, unchanged, so those PRs merge with this one.

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

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Match regression check

1 of the 20 status entries behind the files this PR changes are below the best match already known on HEAD or on a fork's branch:

file id here best known where known remark
src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_BuySellMenuButtonsAndHands.cpp SHC_3BB0A8C1_0x00467040 93.9% (Reimplemented, register choice only: the two player-index imuls swap ecx and edx and one load and one store take edx where the original has eax, which also moves two jne displacements by a byte (#414)) 100.0% origin/reimpl/UnitsState-100 Reimplemented

Percentages are read from the status/addresses-SHC-*.txt files as written; nothing is rebuilt here. If a figure above is stale, update the status file.

@gynt
gynt merged commit aaeecf4 into sourcehold:main Dec 3, 2026
4 of 5 checks passed
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.

2 participants