Repository navigation
Reimplement 28 Map::Buildings Update* functions that are 100% - #281
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
field202_0x2c8 -> field201_0x2c8, field201_0x2c6 -> field200_0x2c6, field162_0x280 -> field161_0x280: these files no longer compiled after the Ghidra sync. Same change as in sourcehold#280 and sourcehold#273. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…with /GL Without LTCG knowledge of updateVisuallyActiveState, validateBuildingTetheredUnits, buildingHasSpaceForResource and getBuildingResourceAmountByUid the eight /GL Update* functions keep the building ID across those calls and do not match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The /GL list change stays; the Globals/*.hpp and *.func.hpp edits were local reccmp flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
previously approved these changes
Oct 28, 2026
This was referenced Oct 28, 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.
28
Map::Buildingsper-building-typeUpdate*functions that measure 100% with reccmp--resolve-wrapped-calls(struct and function resolvers enabled locally, not committed), with their status entries. These are the free functionsupdateBuildingsdispatches to (one per building type, declared inBuildings.func.hpp).UpdateAppleFarm,UpdateArmorersWorkshop,UpdateBadBuildingChoppingBlock,UpdateBakery,UpdateBarracks,UpdateBlacksmithsWorkshop,UpdateBuildingShared2,UpdateCampGround,UpdateCathedral,UpdateFletchersWorkshop,UpdateGoodBuildingShrine,UpdateGoodBuildingStatue,UpdateHovel,UpdateHuntersPost,UpdateInn,UpdateIronMine,UpdateKeepDoor,UpdateKeepDoorLeft,UpdateKeepDoorRight,UpdateMercenaryPost,UpdatePitchRig,UpdatePoleturnersWorkshop,UpdateStables,UpdateTunnel,UpdateTunnelersGuild,UpdateWellOrWaterpot,UpdateWoodGate1,UpdateWoodcuttersHut.Built and measured on its own on top of current
main(main's BuildingsState sources plus these 28): all 152 functions measure 100%.Eight of them are built with
/GL(cmake/compiler-flags-gl.txt): the five workshops (armorer, fletcher, poleturner, blacksmith, bakery),UpdateInn,UpdateIronMineandUpdateStables. They also need theirBuildingsStatecallees frommainbuilt with/GL:updateVisuallyActiveState,validateBuildingTetheredUnits,buildingHasSpaceForResourceandgetBuildingResourceAmountByUid(still 100% that way). Without LTCG knowledge of those callees the compiler keeps the building ID in a register across the calls, where the original reloads it, and the eight drop to 27-63%.The second commit renames the Building fields in
main's own users (field202_0x2c8->field201_0x2c8, ...), which no longer compile after the Ghidra sync; it is the same change as in #280 and #273. The third commit accidentally included my local reccmp resolver flags (Globals/*.hpp,*.func.hpp); the fourth reverts them, so the PR diff has none (37 files).No header changes are needed. The other 43
Update*functions are reimplemented too but not yet at 100%; I'll keep improving them locally and send them separately, like #273.Faithful quirks, commented in the source:
UpdateInnclears the sprite it just animated, andUpdateHuntersPoststores the value it just compared against.Cheat sheet candidates
gotointo a label in the later arm (UpdateFletchersWorkshop).UpdateTunnel).movsxof ashortfield followed by a 32-bit compare: read the field into anintlocal first (UpdateHuntersPost).else ifarms instead of||(UpdateIronMine).Built with the bundled MSVC1400-SP1, natively on Windows.
🤖 Generated with Claude Code