Repository navigation
Fix SetActiveCreditsSequenceIndex after the INT_00ed3120 rename - #350
Merged
Merged
Conversation
The Ghidra header sync 7621d4f renamed the global DAT_00ed3120 to INT_00ed3120 (and declared it int), and UI/Credits/SetActiveCreditsSequenceIndex.cpp still includes and names it in the old form, so that file no longer compiles once it is in the build list (main's committed list is empty, so CI does not see it). This follows 7621d4f: the include and the name become INT_00ed3120, and clang-format re-sorts the include lines. The file's first include is written "../Credits.func.hpp", as the style guide's rule 14 asks (the same header). The store of 0 compiles the same for an int, so there is no behaviour change, and SetActiveCreditsSequenceIndex (0x004D9270) keeps its 100% status line. With this, a full build of every reimplemented file compiles and links. Globals: DAT_00ed3120 -> INT_00ed3120 (7621d4f) - UI/Credits/SetActiveCreditsSequenceIndex.cpp Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
approved these changes
Nov 6, 2026
kotijekriv
added a commit
to kotijekriv/OpenSHC
that referenced
this pull request
Nov 7, 2026
The Ghidra header sync 8125c61 renamed the global DAT_00eb0b24 to INT_00eb0b24 (it took in this branch's own int retype, so the merge above drops that header commit's file in favour of main's). The ScenarioDescription render (0x004D8570) still includes and names it in the old form, so it no longer compiles on main's headers. This follows 8125c61, as sourcehold#350 did for INT_00ed3120: the include and the name become INT_00eb0b24, and clang-format re-sorts the include lines. The type is int either way, so the generated code is the same and the function keeps its 100% status line. Globals: DAT_00eb0b24 -> INT_00eb0b24 (8125c61) - UI/MenuItems/ScenarioDescription/MenuItemActionHandler_ScenarioDescription_Main.cpp Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kotijekriv
added a commit
to kotijekriv/OpenSHC
that referenced
this pull request
Nov 7, 2026
…nc, sourcehold#355) into reimpl/UI-MenuViews-1-100
This was referenced Nov 7, 2026
6and8
pushed a commit
to 6and8/OpenSHC
that referenced
this pull request
Nov 8, 2026
…old#352) * reimplement: SHC_3BB0A8C1_0x004C1070 100.0% Reimplemented MenuItemRenderFunction_TraderSettings, from our draft on the fork branch reimpl/UI-MenuItems-3-development (88.0% there, in sourcehold#327). Each goods row shows the good's picture and "On" or "Off" (greyed out by blending when off); below 1000 are the dialog's own buttons, 1100 is the "Trader 1" header box and the rest is the goods list box. The "On" and "Off" texts take their position as locals, y then x (in the call: quick_diff 0.9570 -> 0.8865; x first: 0.9140), the draft's register blocker. The four kinds of button are one if/else-if chain with a single RT_MAP_GAME store at the end, which MSVC duplicates into each tail as the original has it (ties with the seven early returns). The parameter is button and the goods index row, as in main's TraderSettings handler; the shadow colours are COL_003E66 and COL_000000; partial pitch's picture is pitch's, with a comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x004ABEB0 100.0% Reimplemented MenuItemActionHandler_EditorMapTypeQuickChange_Main, from our draft on the fork branch reimpl/UI-MenuItems-3-development (94.5% there, in sourcehold#327). The editor's quick buttons set the map lock state (0 to 2), the map type (3 to 6, unless the map has an event that needs another), single or multiplayer (10, 11), or the map size (20 to 23, MC_MAP_SIZE_*), which resets the map and everything that depends on its size. The parameter is button, as in main's render function of this menu. The map size chain has no else, as in the original: button is 20 to 23 in that case, and the original's unreachable else reads mapSize unset, which MSVC keeps in the parameter's stack slot (`mov eax, [esp + 8]` at 0x004ABF39). An else keeping button measures reccmp 94.5% (the draft); reassigning the parameter instead of a mapSize local: reccmp 89.5%. The sizes are compared in turn (a switch: reccmp 85.5%). For the PR text: an uninitialised read, but only on a path no caller can reach. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x004B8BF0 100.0% Reimplemented MenuItemRenderFunction_EditScenario_EventAndInvasionList, rewritten from the binary (gynt's draft from his fork's reimpl/UI-MenuItems-development, 79.5% in sourcehold#328). One row of the scenario editor's event list: the selection is clamped to the list, the row's background, the event's month and year, and then by its kind an invasion ("Invasion", its unit count and the repeat) or an event (its name and the repeat). The draft returned when an event's text index went past 155. The original adds 21 there and goes on (the event names have 21 other texts after the 28th), so events of those kinds lost their name and repeat in the draft. Both kinds end in "Month" or "Months" written out in each case, with one ")" after the switch: MSVC merges the two if/else copies into the original's one tail (a flag set in both cases and one if after the switch: quick_diff 0.9831 -> 0.7973). The month goes into a local first (in the call: 0.9831 -> 0.9155) and the event name takes its position as y then x locals (0.9696); without them the scratch registers rotate and the copies don't merge. The event index is written out at each use because the original re-reads eventListScrollOffset after every call (an eventID local: 0.6609). The colour is set in each branch (a default overridden: reccmp 100.0% -> 99.3%, which quick_diff can't see: it shows both colour constants as one token). quick_diff's 0.9831 is all artifacts (colour immediates, ret). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * headers: MapPropertiesState::sumUnitCounts returns int sumUnitCounts (0x004B8000) adds up the unit counts of the current event, stores the sum at this+0x14548 and leaves it in eax. EditScenario's TextBoxLike render (0x004BF1D0) pushes that eax straight into renderNumberToScreen2 for box 101, so the function returns the sum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * headers: MapPropertiesState::indexStored is an int indexStored (0x00013580) picks the starting good, unit or popularity that the scenario editor's text box edits. EditScenario's TextBoxLike render (0x004BF1D0) compares it signed (cmp eax, 0x14 / jge at 0x004BF37C and cmp eax, 0x1e / jge at 0x004BF3AF), so the field is an int, not undefined4. Main's two users, EditScenario's EventAndInvasionList handler and the TraderSettings handler, stay at 100% with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * headers: MapPropertiesState::SEC_SiegeInformation is an int[20] The scenario editor's starting units sit at MapPropertiesState+0xEC, right after SEC_StartingResources. EditScenario's TextBoxLike render (0x004BF1D0) stores box 3's typed value for indexStored 20 to 29 at [indexStored*4 + 0x016538F4] (0x004BF3C9, 0x004BF3F5), which is element indexStored - 20 of the 20 ints at +0xEC, and sumUnitPoints (0x004B7FA0) adds them up from +0xEC. As an array the code indexes it inside its bounds instead of past the end of SEC_StartingResources. The units are in SiegeUnitCounts' order (archers first). No .cpp on main reads the field; MapAndTimeState::siegeInformation keeps SiegeUnitCounts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * headers: TextArrayIndexType gets TAIT_UNKNOWN_10, _12 and _14 EditScenario's TextBoxLike render (0x004BF1D0) compares the user text handler's textArrayIndex with 10, 12 and 14 (0x004BF281, 0x004BF331, 0x004BF426, 0x004BF47E) and reads those text slots, next to 11 and 15, which the enum already names TAIT_UNKNOWN_11 and TAIT_UNKNOWN_15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x004BF1D0 100.0% Reimplemented MenuItemRenderFunction_EditScenario_TextBoxLike, rewritten from the binary (gynt's draft from his fork's reimpl/UI-MenuItems-development, 81.2% in sourcehold#328). The scenario editor's text boxes: boxes 0 to 7 show a text slot of the user text handler, with the cursor when that slot is being typed into; box 3 stores the typed starting good, siege unit or popularity, box 7 an event condition value; 100 to 102 show unit totals. Each box renders its own text, as in the original: MSVC merges the identical endings, so each case keeps its own y, x and slot push before the shared getTextArrayPointer call (one call after the switch: quick_diff 0.9606 -> 0.9356). The y, x and text locals stay (positions in the call: 0.8724; the text in the call: 0.8459). The totals are read into locals before their render calls, as the original calls the sum first. quick_diff's 0.9606 is all artifacts (colour immediates, ret, the jump table). Box 3 with indexStored 20 to 29 stores into the siege units (SEC_SiegeInformation[indexStored - 20]); the draft wrote SEC_StartingResources[indexStored + 5], past the end of that array, which lands on the same address. reccmp reads 99.1%: only the call target of atol differs (the CRT's against the game's copy at 0x00583628), as in main's NewEvent handler, whose status line has the same remark. It needs the four header commits before it: sumUnitCounts returns int, indexStored is an int, SEC_SiegeInformation is an int[20], and TAIT_UNKNOWN_10/12/14. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * headers: DAT_00eb0b24 is an int DAT_00eb0b24 (0x00EB0B24) is a counter that ScenarioDescription's Main handler (0x004D8570, button -4) steps and wraps against INT_00ed27c4: mov eax, [0x00EB0B24] / add eax, 1 / cmp eax, [0x00ED27C4] / jl at 0x004D89B2. The compare is signed, so the global is an int, not undefined4. Nothing on main uses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * reimplement: SHC_3BB0A8C1_0x004D8570 100.0% Reimplemented MenuItemActionHandler_ScenarioDescription_Main, rewritten from the binary (gynt's draft from his fork's reimpl/UI-MenuItems-development, 64.5% in sourcehold#328). The mission briefing's buttons: 10 starts the mission (the map and its lord unless in the builder, then the build menu), 12 and 13 go back to the map choice in the builder, 11 goes back to the mission select (or asks first while a game is suspended), 6, 8 and 9 switch the help pages (9 opens mission<N>.hlp), -1 steps the difficulty, -2 views the briefing, -3 asks to restart the mission and -4 goes to the next description page. Three behaviour fixes against the draft, all from the binary: a mission number of 0 or less becomes 1 and the mission still starts (the draft returned), the difficulty wraps from 3 to 0 and is still stored (the draft returned), and -1 doesn't fall into -2 (the draft set DAT_00ed27bc there). Three more of the same kind: 11 with DAT_00ed27bc set clears it and returns, 11 outside a campaign mission returns after switching the menu, and 12 or 13 in the builder with a game suspended returns after the yes/no dialog (the draft fell through in all three). 12 and 13 fall into 11 outside the builder, as in the original. The build menu tab is BMTT_CASTLE (10; the draft had BASMTT_HUNTERSHUT, the same value in the building menu's enum) and the landscaping tab 231, as main's hideOrUnhideUI writes it. Needs the DAT_00eb0b24 header commit before it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: ScenarioDescription_Main after the INT_00eb0b24 rename The Ghidra header sync 8125c61 renamed the global DAT_00eb0b24 to INT_00eb0b24 (it took in this branch's own int retype, so the merge above drops that header commit's file in favour of main's). The ScenarioDescription render (0x004D8570) still includes and names it in the old form, so it no longer compiles on main's headers. This follows 8125c61, as sourcehold#350 did for INT_00ed3120: the include and the name become INT_00eb0b24, and clang-format re-sorts the include lines. The type is int either way, so the generated code is the same and the function keeps its 100% status line. Globals: DAT_00eb0b24 -> INT_00eb0b24 (8125c61) - UI/MenuItems/ScenarioDescription/MenuItemActionHandler_ScenarioDescription_Main.cpp Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * headers: DAT_00ed27bc is a BOOLEnum The scenario description's "briefing is open" flag only ever holds 0 or 1. Its three stores in the exe: 1 at 0x004D895F ("View Briefing", -2), 0 at 0x004D8788 (11, esi, which ScenarioDescription_Main zeroes there) and 0 at 0x004DD2CD (esi, the same register that resets the page index to 0 at 0x004DD2B7). Its readers compare it with 1 or with a zero register (0x004D8296, 0x004D877F, 0x004DD42D, 0x004DD6F4). BOOLEnum is a typedef of int, so the size and every access stay the same. Its only user on main and in this PR is ScenarioDescription_Main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style: ScenarioDescription_Main stores FALSE / TRUE into DAT_00ed27bc DAT_00ed27bc is a BOOLEnum since the header commit before this one; the two stores (11 closing the briefing, -2 opening it) use its names. The same code (reccmp 100.0%). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * MenuItemActionHandler_ScenarioDescription_Main: use main's INT_00ed27bc gynt's header sync (eef6f66) renamed DAT_00ed27bc to INT_00ed27bc, an int; this branch had typed it a BOOLEnum (8f6a96a), and the merge before takes main's. It is tested against 1 and set to 1 and 0, so TRUE and FALSE become 1 and 0. reccmp 100.0%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Main (da1fef5) has one
.cppfile that no longer compiles in a clean build: the Ghidra sync 7621d4f renamedDAT_00ed3120toINT_00ed3120(and declared itint), andUI/Credits/SetActiveCreditsSequenceIndex.cppstill includes and names the old one. This PR moves it to main's name and changes nothing else: no header and no status line. The function (0x004D9270) stays at 100%, the same as its status line. It's the only use of the old name left on main.UI/Credits/SetActiveCreditsSequenceIndex.cppDAT_00ed3120INT_00ed3120The include lines follow the name, sorted by clang-format. The first include is now written
"../Credits.func.hpp", as the style guide's rule 14 asks and most files on main do; it's the same header.Built with the bundled MSVC1400-SP1, natively on Windows, against the Steam
Stronghold Crusader.exe(3bb0a8c1…5387ac5a): a clean full build compiles every reimplemented file and links, and the function measures 100.0% with sourcehold's reccmp (--resolve-wrapped-calls --ignore-security-cookie).status_regression.pyfinds nothing below a known score. The same kind of fix as #343.Proposed, not changed here
UI::Credits::SetActiveCreditsSequenceIndexsets the rankings filter, not a credits sequence:DAT_00ed3124is 0 "All Games", 1 "Crusader Trail Only" or 2 "Custom Games Only" (cr.tex group 255, texts 7-9), andINT_00ed3120is the rankings list's first shown row, which it resets. It's called with 2 when the rankings open from the lobby (0x0046B6D9) and with 1 from the crusade map (0x0046B6F2). A name likeSetRankingsFilterwould say so; that's a rename in Ghidra, so it's yours.Other PRs: the ready #342, #348 and #349, and the drafts #313, #318, #321, #327 and #328.
🤖 Generated with Claude Code