From 96a5e29ac1c5c58cc6047ac3945d041c39476daf Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 6 Nov 2026 06:40:46 +0100 Subject: [PATCH 1/6] reimplement: SHC_3BB0A8C1_0x0047D330 100.0% Reimplemented Finished from gynt's draft on his fork (reimpl/UI-MenuItems, 79.2%, "Style pass, asm differs"). Behaviour fix: after scrolling down (event 6) the original also writes the new offset to *currentValue, as it does after scrolling up; the draft returned without it. Both scroll events now step the offset and store it in one tail, which the compiler shares the way the original does. quick_diff 0.8182 (43 instructions against 45) -> 45/45 with only the jump-table spelling and ret / ret 0 left (0.8667), same global order. Style pass: named parameters (scrollbarEvent, as main's map select scrollbar calls it), - 10 for + -10, ++ / --, no plate comment, and the namespace block its siblings on main use. Co-Authored-By: Claude Opus 5.5 --- ...ndler_FindingNetworkSessions_Scrollbar.cpp | 48 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Scrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Scrollbar.cpp new file mode 100644 index 0000000000..81188df3f1 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Scrollbar.cpp @@ -0,0 +1,48 @@ +#include "../FindingNetworkSessions.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + namespace FindingNetworkSessions { + + // FUNCTION: STRONGHOLDCRUSADER 0x0047D330 + void MenuItemActionHandler_FindingNetworkSessions_Scrollbar( + int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) + { + // ten sessions fit in the list + switch (scrollbarEvent) { + case 1: + *minValue = 0; + *maxValue = DAT_GameSynchronyState::instance.DPLAY_SessionsCount - 10; + *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; + return; + case 2: + case 3: + DAT_GameSynchronyState::instance.scrollBarItemOffset = *currentValue; + return; + case 4: + *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; + *maxValue = DAT_GameSynchronyState::instance.DPLAY_SessionsCount - 10; + return; + case 5: + if (DAT_GameSynchronyState::instance.scrollBarItemOffset > 0) { + --DAT_GameSynchronyState::instance.scrollBarItemOffset; + } + *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; + return; + case 6: + if (DAT_GameSynchronyState::instance.scrollBarItemOffset + < DAT_GameSynchronyState::instance.DPLAY_SessionsCount - 10) { + ++DAT_GameSynchronyState::instance.scrollBarItemOffset; + } + *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; + return; + } + } + + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 656f04baca..58d8f17659 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22313,7 +22313,7 @@ SHC_3BB0A8C1_0x0047D100 | 0.0% | Pending SHC_3BB0A8C1_0x0047D190 | 0.0% | Pending -SHC_3BB0A8C1_0x0047D330 | 0.0% | Pending +SHC_3BB0A8C1_0x0047D330 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D3CC | 0.0% | Pending From 5b17588f05395e96f027941d97730257881ccc56 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 6 Nov 2026 06:40:46 +0100 Subject: [PATCH 2/6] headers: DAT_00ed3120 and DAT_00eb9b60 are ints The ranking games scrollbar (0x004D9B30) compares the offset against the count less 8 with jge at 0x004D9BDD, which shows both are signed. It also tests the offset with jle at 0x004D9BBC and the count less 8 with jns at 0x004D9B92. DAT_00eb9b60 has no user on main; DAT_00ed3120's one user there, SetActiveCreditsSequenceIndex, only stores 0 in it, which compiles the same either way. Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Globals/DAT_00eb9b60.hpp | 4 ++-- src/OpenSHC/Globals/DAT_00ed3120.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenSHC/Globals/DAT_00eb9b60.hpp b/src/OpenSHC/Globals/DAT_00eb9b60.hpp index 2dc46b30ab..de0e84a91c 100644 --- a/src/OpenSHC/Globals/DAT_00eb9b60.hpp +++ b/src/OpenSHC/Globals/DAT_00eb9b60.hpp @@ -9,11 +9,11 @@ #pragma once // GLOBAL: STRONGHOLDCRUSADER 0x00EB9B60 -// StructResolver::Instance::instance +// StructResolver::Instance::instance namespace OpenSHC { -MACRO_STRUCT_RESOLVER(undefined4, false, Address::SHC_3BB0A8C1_0x00EB9B60) DAT_00eb9b60; +MACRO_STRUCT_RESOLVER(int, false, Address::SHC_3BB0A8C1_0x00EB9B60) DAT_00eb9b60; } // namespace OpenSHC MACRO_STRUCT_INSTANCE(Address::SHC_3BB0A8C1_0x00EB9B60); diff --git a/src/OpenSHC/Globals/DAT_00ed3120.hpp b/src/OpenSHC/Globals/DAT_00ed3120.hpp index 63da68afd7..c8adce99c7 100644 --- a/src/OpenSHC/Globals/DAT_00ed3120.hpp +++ b/src/OpenSHC/Globals/DAT_00ed3120.hpp @@ -9,11 +9,11 @@ #pragma once // GLOBAL: STRONGHOLDCRUSADER 0x00ED3120 -// StructResolver::Instance::instance +// StructResolver::Instance::instance namespace OpenSHC { -MACRO_STRUCT_RESOLVER(undefined4, false, Address::SHC_3BB0A8C1_0x00ED3120) DAT_00ed3120; +MACRO_STRUCT_RESOLVER(int, false, Address::SHC_3BB0A8C1_0x00ED3120) DAT_00ed3120; } // namespace OpenSHC MACRO_STRUCT_INSTANCE(Address::SHC_3BB0A8C1_0x00ED3120); From ca35aa2d9e4f49e5001100d01caceb77d349a434 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 6 Nov 2026 06:40:46 +0100 Subject: [PATCH 3/6] reimplement: SHC_3BB0A8C1_0x004D9B30 100.0% Reimplemented Finished from gynt's draft on his fork (reimpl/UI-MenuItems, 75.4%, "Style pass, asm differs"); it needs the header commit before this one. Behaviour fix: event 7 (a click on the track, off the thumb) sets *currentValue to 6 and returns, where the draft fell on into event 5 and scrolled up as well. For that event the menu passes its page step in that pointer, then moves the offset by it and sends event 2 (handleMenuElementsCallbacks), so the list pages by 6 of its 8 games. Events 5 and 6 step the offset and store it in one tail each, as the FindingNetworkSessions scrollbar does; the cases stay in the original's order (1, 2/3, 4, 7, 5, 6). Comments give what the other forms measured: the count read once into a local (reading it again for the test: quick_diff 0.8679 -> 0.7593), and the compare before each store (a plain store: quick_diff 0.8679 -> 0.7308 and reccmp 100.0% -> 78.3% for events 2 and 3, 0.6538 and 69.4% for event 4). quick_diff 0.7810 (52 instructions against 53) -> 53/53 with only the jump-table spelling and ret / ret 0 left (0.8679), same global order. The event parameter is scrollbarEvent, as main's map select scrollbar calls it. Co-Authored-By: Claude Opus 5.5 --- ...emActionHandler_RankingGames_Scrollbar.cpp | 63 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/RankingGames/MenuItemActionHandler_RankingGames_Scrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemActionHandler_RankingGames_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemActionHandler_RankingGames_Scrollbar.cpp new file mode 100644 index 0000000000..85025ce65b --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemActionHandler_RankingGames_Scrollbar.cpp @@ -0,0 +1,63 @@ +#include "../RankingGames.func.hpp" + +#include "OpenSHC/Globals/DAT_00eb9b60.hpp" +#include "OpenSHC/Globals/DAT_00ed3120.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004D9B30 + void RankingGames::MenuItemActionHandler_RankingGames_Scrollbar( + int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) + { + // eight games fit in the list + switch (scrollbarEvent) { + case 1: + *minValue = 0; + *maxValue = 1; + *currentValue = 0; + return; + case 2: + case 3: + // stores only on a change, as the original does (plain store: quick_diff 0.8679 -> 0.7308) + if (*currentValue != DAT_00ed3120::instance) { + DAT_00ed3120::instance = *currentValue; + } + return; + case 4: { + *minValue = 0; + // one read of the count (reading it again for the test: quick_diff 0.8679 -> 0.7593) + int const lastOffset = DAT_00eb9b60::instance - 8; + *maxValue = lastOffset; + if (lastOffset < 0) { + *maxValue = 0; + } + // stores only on a change, as the original does (plain store: quick_diff 0.8679 -> 0.6538) + if (*currentValue != DAT_00ed3120::instance) { + *currentValue = DAT_00ed3120::instance; + } + return; + } + case 7: + // a click on the track pages by 6 of the 8 games + *currentValue = 6; + return; + case 5: + if (DAT_00ed3120::instance > 0) { + --DAT_00ed3120::instance; + } + *currentValue = DAT_00ed3120::instance; + return; + case 6: + if (DAT_00ed3120::instance < DAT_00eb9b60::instance - 8) { + ++DAT_00ed3120::instance; + } + *currentValue = DAT_00ed3120::instance; + return; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 58d8f17659..c99a024fa1 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -36033,7 +36033,7 @@ SHC_3BB0A8C1_0x004D9730 | 0.0% | Pending SHC_3BB0A8C1_0x004D99F0 | 0.0% | Pending -SHC_3BB0A8C1_0x004D9B30 | 0.0% | Pending +SHC_3BB0A8C1_0x004D9B30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D9BF0 | 0.0% | Pending From 8a781f054f44ece69ddcde092a550dc1456d93fb Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 6 Nov 2026 06:40:47 +0100 Subject: [PATCH 4/6] reimplement: SHC_3BB0A8C1_0x004D8C10 100.0% Reimplemented Finished from gynt's draft on his fork (reimpl/UI-MenuItems-development, 78.7%, "Reimplemented, asm differs"). Each trail tests its own progress against its own length (20, 30 and 50 missions) inside its arm and starts the mission there; the compiler merges the three calls into the original's one. The draft's form, one call with mission and length locals, needs one more instruction (quick_diff 0.9545 -> 0.8764, reccmp 100.0% -> 80.9%); a comment says so. Question 7 of the yes/no dialog is "Quit Mission" (drawHeaderTextBanner(TEXT_GAME_OPTIONS, 7)). No casts (the progress fields are ints on main). quick_diff 0.8764 (45 instructions against 44) -> 44/44 with only ret / ret 0 left (0.9545), same global order. Co-Authored-By: Claude Opus 5.5 --- ...ActionHandler_CrusadeMissionIntro_Main.cpp | 64 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/CrusadeMissionIntro/MenuItemActionHandler_CrusadeMissionIntro_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/CrusadeMissionIntro/MenuItemActionHandler_CrusadeMissionIntro_Main.cpp b/src/OpenSHC/UI/MenuItems/CrusadeMissionIntro/MenuItemActionHandler_CrusadeMissionIntro_Main.cpp new file mode 100644 index 0000000000..2d8501b594 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/CrusadeMissionIntro/MenuItemActionHandler_CrusadeMissionIntro_Main.cpp @@ -0,0 +1,64 @@ +#include "../CrusadeMissionIntro.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/Skirmish.func.hpp" +#include "OpenSHC/Input/MouseState.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/Game/TrailType.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004D8C10 + void CrusadeMissionIntro::MenuItemActionHandler_CrusadeMissionIntro_Main(int button, ...) + { + if (button == 10) { + if (DAT_GameCore::instance.gameSuspended == 1) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_BUILD_MENU, 0); + MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + return; + } + // the next mission of the trail, while there is one: 20, 30 and 50 missions long + // one call per trail, which MSVC merges (one call with mission and length locals: 100.0% -> 80.9%) + if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_EXTREME) { + if (DAT_GameCore::instance.extremeTrailProgress < 20) { + MACRO_CALL(OpenSHC::Game::Skirmish_Func::SetupSkirmishMode)( + DAT_GameCore::instance.extremeTrailProgress); + } + } else if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_WARCHEST) { + if (DAT_GameCore::instance.warchestTrailProgress < 30) { + MACRO_CALL(OpenSHC::Game::Skirmish_Func::SetupSkirmishMode)( + DAT_GameCore::instance.warchestTrailProgress); + } + } else { + if (DAT_GameCore::instance.skirmishTrailProgress < 50) { + MACRO_CALL(OpenSHC::Game::Skirmish_Func::SetupSkirmishMode)( + DAT_GameCore::instance.skirmishTrailProgress); + } + } + MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + return; + } + if (button == 11) { + if (DAT_GameCore::instance.gameSuspended == 1) { + // the yes/no dialog asks "Quit Mission" + DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = 7; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_YES_NO_DIALOG); + return; + } + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_CRUSADE_MAP, 0); + } + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index c99a024fa1..91c5e1b088 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -36005,7 +36005,7 @@ SHC_3BB0A8C1_0x004D8AE0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D8BB0 | 0.0% | Pending -SHC_3BB0A8C1_0x004D8C10 | 0.0% | Pending +SHC_3BB0A8C1_0x004D8C10 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D8CB0 | 0.0% | Pending From e9bb744641e1d92655ed63481b2a4d1d36de6c77 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 6 Nov 2026 06:40:47 +0100 Subject: [PATCH 5/6] reimplement: SHC_3BB0A8C1_0x004934F0 100.0% Reimplemented Finished from gynt's draft on his fork (reimpl/UI-MenuItems, 94.4%, "Style pass, asm differs"). Each path makes its own renderTextToScreen call, which the compiler merges into the original's one call site (0x00493556); one call with a colour local measures 100.0% -> 62.5%. Each path also computes the text position itself: the compiler hoists the identical computations above the branch the way the original does, while the position declared once above the `if` (as main's OptionsMenu_SubOptionsButtons has it) schedules one `push 0` later, 100.0% -> 97.2%. A comment gives both. quick_diff 0.8889 -> 0.9167 at 36/36 instructions; the three lines it still marks are its own artefacts: the two colour immediates, which fall in the exe's address range so it prints them as globals on the original's side, and ret / ret 0. Names as on main: textIndex, as in its other TEXT_GAME_OPTIONS lookups, textX and textY, and the namespace block the other General files use. Co-Authored-By: Claude Opus 5.5 --- ...Function_General_GameOptionsTextButton.cpp | 48 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_GameOptionsTextButton.cpp diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_GameOptionsTextButton.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_GameOptionsTextButton.cpp new file mode 100644 index 0000000000..7e4e17fdae --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_GameOptionsTextButton.cpp @@ -0,0 +1,48 @@ +#include "../General.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" + +#include "OpenSHC/Globals/AlphaAndButtonSurfaceObj.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + namespace General { + + // FUNCTION: STRONGHOLDCRUSADER 0x004934F0 + void MenuItemRenderFunction_General_GameOptionsTextButton(int textIndex, ...) + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderBasicButton, + AlphaAndButtonSurfaceObj::ptr)(0, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED); + // one call and position per path, which MSVC merges (colour local: 100.0% -> 62.5%; x, y above: 97.2%) + if (!DAT_ButtonCurrentlyInteracting::instance) { + int const textX = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + int const textY = DAT_ButtonY::instance + 7; + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, textIndex), + textX, textY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 18, FALSE, 0); + return; + } + int const textX = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + int const textY = DAT_ButtonY::instance + 7; + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, textIndex), + textX, textY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_CCFAFF, 18, FALSE, 0); + } + + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 91c5e1b088..3e3135ce74 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23621,7 +23621,7 @@ SHC_3BB0A8C1_0x004934E4 | 0.0% | Pending SHC_3BB0A8C1_0x004934E5 | 0.0% | Pending -SHC_3BB0A8C1_0x004934F0 | 0.0% | Pending +SHC_3BB0A8C1_0x004934F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00493560 | 0.0% | Pending From cf1fa27a4eb67020ee6fc1ef711e1af41b520000 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 6 Nov 2026 04:37:14 +0100 Subject: [PATCH 6/6] reimplement: SHC_3BB0A8C1_0x004D8BB0 100.0% Reimplemented Finished from gynt's draft on his fork (reimpl/UI-MenuItems, 60.9%, "rebuilt control flow from asm"). Each trail sets the flag with an `if` inside its own arm, so the compiler shares one `jl` and `mov eax, 1` between the three arms, as the original does. The flag is a BOOLEnum: the original zeroes it with xor and tests it with cmp, so it is an int and not a bool. No casts (the progress fields are ints on main). quick_diff 24/24, only the tail jump's target differs (0.9583). Co-Authored-By: Claude Opus 5.5 --- ...enderFunction_CrusadeMissionIntro_Main.cpp | 46 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/CrusadeMissionIntro/MenuItemRenderFunction_CrusadeMissionIntro_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/CrusadeMissionIntro/MenuItemRenderFunction_CrusadeMissionIntro_Main.cpp b/src/OpenSHC/UI/MenuItems/CrusadeMissionIntro/MenuItemRenderFunction_CrusadeMissionIntro_Main.cpp new file mode 100644 index 0000000000..eaca13b013 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/CrusadeMissionIntro/MenuItemRenderFunction_CrusadeMissionIntro_Main.cpp @@ -0,0 +1,46 @@ +#include "../CrusadeMissionIntro.func.hpp" + +#include "OpenSHC/UI/MenuItems/General.func.hpp" +#include "OpenSHC/Game/TrailType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004D8BB0 + void CrusadeMissionIntro::MenuItemRenderFunction_CrusadeMissionIntro_Main(int button, ...) + { + // the trail is finished once its progress reaches its length: 20, 30 and 50 missions + BOOLEnum trailComplete = FALSE; + DAT_ButtonUnknownZero::instance = FALSE; + if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_EXTREME) { + if (DAT_GameCore::instance.extremeTrailProgress >= 20) { + trailComplete = TRUE; + } + } else if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_WARCHEST) { + if (DAT_GameCore::instance.warchestTrailProgress >= 30) { + trailComplete = TRUE; + } + } else if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_FIRST_EDITION) { + if (DAT_GameCore::instance.skirmishTrailProgress >= 50) { + trailComplete = TRUE; + } + } + if (button == 10 && trailComplete) { + DAT_ButtonUnknownZero::instance = TRUE; + DAT_ButtonCurrentlyInteracting::instance = FALSE; + } + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3e3135ce74..3c666ecb78 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -36003,7 +36003,7 @@ SHC_3BB0A8C1_0x004D8AB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D8AE0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004D8BB0 | 0.0% | Pending +SHC_3BB0A8C1_0x004D8BB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D8C10 | 100.0% | Reimplemented