Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Their sources are unchanged; the percentages moved because caller and callee are now built with /GL (see the compiler-flags-gl.txt commit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # AGENTS.md # IMPLEMENTATION_CHEAT_SHEET.md # cmake/compiler-flags-gl.txt # src/OpenSHC/Map/Buildings/Building.hpp # src/OpenSHC/Map/TerrainDefinedData.hpp # src/OpenSHC/Map/TileMapState/clearMoatData.cpp # src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp # src/OpenSHC/Map/TileMapState/getUnownedMoatCount.cpp # src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp # src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp # src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp # src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp # src/OpenSHC/Map/TileMapState/resetMoatArray.cpp # src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp # src/OpenSHC/Map/TileMapState/setMapRotation.cpp # src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp # src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp # src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp # src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp # src/OpenSHC/Map/TileMapState/toggleFlatView.cpp # src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp # src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp # tools/mcp/openshcmcp.py # tools/reimplementation-helper/batch/README.md # tools/reimplementation-helper/batch/common.py # tools/reimplementation-helper/batch/declare_at_use.py # tools/reimplementation-helper/batch/diff_jcc.py # tools/reimplementation-helper/batch/quick_diff.py
…main This branch was 141 commits behind main and did not compile at all against main's regenerated headers, so it had never been measured. 179 of its 186 TileMapState sources now build, link and score. Merging main conflicted on 17 TileMapState sources that main has since gained independently, plus the docs, tools and two headers; all of those took main's side. The branch still contributes 169 sources main does not have, so it is not superseded. TerrainDefinedData.hpp is the one file where taking main's side was wrong, and it is resolved by hand instead. Main guesses `unkXYOffsets_0x384[8]`, `field132_0x3c4[8]` and `padding_0x404[64]` over 0x384..0x444; the branch had researched the same 192 bytes as `keepOutbuildingOffsets_0x384[3][4]` and `keepOutbuildingOffsets_0x3e4[3][4]`, which is what placeKeep and demolishBuildingsInKeepsConstructionFootprint index as [variant][group]. The researched pair is restored over main's three, same span, and sizeof(TerrainDefinedData) stays 14252. Main's own gains in that header (ConstructionSpriteRotationTable, MacroLayerScanOffsets) are kept. The bulk of the work is stale generated field names. Main's Ghidra regenerations renamed or renumbered fields that the branch still referenced, e.g. field80_0x554894 -> editorRockType, unknownTime_0x5549bc -> cursorAnimationTime, field84_0x5548a4 -> screenSouthEastDirection, field151_0x554998 -> placementOnWall. These were resolved mechanically: the offset is encoded in the old identifier, so each was rewritten to whatever the header now declares at that same offset, and only where the offset resolved to exactly one field. field889_0x2be0 needed the array form - it is 4 bytes into attackedByPlayerArrayUnk[10][8] at 0x2BDC, so [0][1]. Three other classes of breakage: - clearBuildingTilesAndTrees walked Building* through the tileRefs int array (`_pTileRef = &_pTileRef->tileRefs[1]`), which stopped being an lvalue of that type once Building became a real struct. It now walks int*, same arithmetic. It also needed explicit Logic1.hpp usings for the L_* flags that used to arrive transitively. - Six place* sources passed a default-constructed TextMessageBLLookupStructUnion to setBottomLeftTextDisplayText, whose param_4 is now int; that is 0. - Seven sources are still raw decompiler output (`._0_2_`, `::constant`, in_EAX) and are left out of the build list rather than guessed at: placeApplefarm, placeBarracks, placeBuilding, placeDairyfarm, placeDrawbridge, placeHopfarm, placeWheatfarm. They need real reimplementation, not a rename. Files that clang-format flagged were formatted; 20 of them were already non-conformant at HEAD, so part of that churn predates this change. First measurement, reimplemented data and all 179 resolvers enabled: BUILD_OK, avg 73.07 over 179, with 142 functions below 100. That is the real starting point for this branch - no match work is attempted here, because none was possible until it built. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Fzi11pcBU1Y7Y4oanrZQL
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
… tile Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
… bogu Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
…re an Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
…store Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
… tile Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
…store Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVYWDtHk2xzvq9hszJRS9r
Round 5: 153 -> 159 of 187 at 100%, avg 98.13 -> 98.54Measured with a full build and reccmp, both resolver sets on. One function came out slightly worse and was reverted: placeDefensiveStructureTile, -0.1 raw (+3 norm). Its replacement form drops the Now at 100%: eraseAreaWithBrush, prepareAreaForBuildingPlacement, renderPreviewMapperWithBrush, renderWallPlacementPreview, setupBuildingSizeIndexMappingForBuildingWithSize, updateLogicalTileMapRelatedSections. Big moves below 100:
Behaviour fix
Why some forms look odd (all measured; the plain form loses)
Compiler findings (c2.dll)
Still walls
|
…talHeightAtTile The original getHeightAtTileIncludingOwnersBuildings calls two functions with byte-identical bodies that its linker folded into 0x004FFB10. Only distinct call targets keep c2 from tail-merging the gatehouse arm into the keep/tower arm. A second resolver at the same address is not possible (AddressUsageKeeper aborts on a second registration), so the twin has no resolver and is only called from reimplemented code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmb6xg8rirS2UbTZA3i
getHeightAtTileIncludingOwnersBuildings: linker-folded twin (a32b7c0, 37a928f)The keep/tower arm and the gatehouse arm both end in
updatePathLinkagesForBuilding's remaining diff (tail-jump targets only) looks like the same kind of folding and could get the same treatment once its twins are identified. |
Why
|
The original only reads the parameter as a word (movsx ecx, word ptr [esp+0x2c]) or a byte. As a 2-byte symbol it sorts ahead of the 4-byte stack elements, which gives the original's slot layout (96.8 -> 100 with the .cpp signature updated). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmb6xg8rirS2UbTZA3i
Round 6: 160 -> 164 of 187 at 100%, avg 98.60 -> 98.88Measured with a full build and reccmp, both resolver sets on. Nothing got worse. checkBuildingCanBePlacedHere's round-6 change rose on quick_gl but dropped in reccmp (93.4 -> 92.7), so it was reverted. Now at 100%: placeApplefarm, placeDefensiveStructureTile, renderWallDragPreview, setupMovementDirectionTranslationMatrix, validateWallBuildPath. Big moves below 100:
Header change (separate
|
… directly
c2 inlines only __forceinline callees once global optimisation is off
(InlCallTupleIsCandidate, test ecx,0x2080 at 0x10b69d48 when _Globopt_flag
is 0). Functions under #pragma optimize("", off), or turned /Od by C4740,
therefore compiled every MACRO_CALL to `call get` + `call eax` where the
original has one direct call. Optimised functions already inlined get(),
so their code is unchanged.
setBitFlagBasedOnWallTowerGatehouseOrKeep, setTerrain, updateGFXLayers,
updateMacroLayerRelated and updateGfxLayer go to 100%. The status refresh
also records clearSizeFiveBuildingFootprintAndMoats at 100% (its earlier /GL
gain) and placeStockpile at 99.3%.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmaL4CQf53VmKTVHqhH
The /Od inlining gate, the unroll veto, scheduler edges from address-taken locals, copy-preference order, the airlock reload at a loop latch, the volatile ?: refusal, FgCodeMotion's fall-through rule and stack weights counted before cross-jumping, each with its c2.dll addresses and the source lever where one was found. Also notes that a src/precomp header edit does not rebuild the PCH. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmaL4CQf53VmKTVHqhH
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmaL4CQf53VmKTVHqhH
Needs #366 to be merged first obviously