Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
85ad303
reimplement: SHC_3BB0A8C1_0x00425720 100.0% Reimplemented
gynt Nov 9, 2026
762c592
reimplement: SHC_3BB0A8C1_0x00425C20 100.0% Reimplemented
gynt Nov 9, 2026
8811a14
reimplement: SHC_3BB0A8C1_0x00426B80 100.0% Reimplemented
gynt Nov 9, 2026
72af158
reimplement: SHC_3BB0A8C1_0x00426ED0 100.0% Reimplemented
gynt Nov 9, 2026
bae71c1
reimplement: SHC_3BB0A8C1_0x00427080 100.0% Reimplemented
gynt Nov 9, 2026
1e52fc1
reimplement: SHC_3BB0A8C1_0x00428980 100.0% Reimplemented
gynt Nov 9, 2026
f196635
reimplement: SHC_3BB0A8C1_0x00428A60 100.0% Reimplemented
gynt Nov 9, 2026
2efd915
reimplement: SHC_3BB0A8C1_0x0042B470 100.0% Reimplemented
gynt Nov 9, 2026
112abc2
reimplement: SHC_3BB0A8C1_0x0042DC60 100.0% Reimplemented
gynt Nov 9, 2026
456ec52
reimplement: SHC_3BB0A8C1_0x0042DEB0 100.0% Reimplemented
gynt Nov 9, 2026
366ef86
reimplement: SHC_3BB0A8C1_0x0042DF40 100.0% Reimplemented
gynt Nov 9, 2026
60963ab
reimplement: SHC_3BB0A8C1_0x0042EDF0 100.0% Reimplemented
gynt Nov 9, 2026
eb69106
reimplement: SHC_3BB0A8C1_0x0042EF80 100.0% Reimplemented
gynt Nov 9, 2026
c487d43
reimplement: SHC_3BB0A8C1_0x0042F2B0 100.0% Reimplemented
gynt Nov 9, 2026
d0c2c87
reimplement: SHC_3BB0A8C1_0x0047E3E0 100.0% Reimplemented
gynt Nov 9, 2026
04a5f17
reimplement: SHC_3BB0A8C1_0x00491CE0 100.0% Reimplemented
gynt Nov 9, 2026
491e50d
reimplement: SHC_3BB0A8C1_0x00492BA0 100.0% Reimplemented
gynt Nov 9, 2026
559ee57
reimplement: SHC_3BB0A8C1_0x004932A0 100.0% Reimplemented
gynt Nov 9, 2026
c530cf6
reimplement: SHC_3BB0A8C1_0x00493BD0 100.0% Reimplemented
gynt Nov 9, 2026
6d46922
reimplement: SHC_3BB0A8C1_0x00493D30 100.0% Reimplemented
gynt Nov 9, 2026
a4af953
reimplement: SHC_3BB0A8C1_0x004948C0 100.0% Reimplemented
gynt Nov 9, 2026
3e8b10c
reimplement: SHC_3BB0A8C1_0x004B0F70 100.0% Reimplemented
gynt Nov 9, 2026
dbd405a
reimplement: SHC_3BB0A8C1_0x004B1000 100.0% Reimplemented
gynt Nov 9, 2026
0dc8bad
reimplement: SHC_3BB0A8C1_0x004B6530 100.0% Reimplemented
gynt Nov 9, 2026
afad59e
reimplement: SHC_3BB0A8C1_0x004B65A0 100.0% Reimplemented
gynt Nov 9, 2026
ee33b77
reimplement: SHC_3BB0A8C1_0x004B65F0 100.0% Reimplemented
gynt Nov 9, 2026
5acc0b6
reimplement: SHC_3BB0A8C1_0x004B94A0 100.0% Reimplemented
gynt Nov 9, 2026
22d9e5f
reimplement: SHC_3BB0A8C1_0x004BA560 100.0% Reimplemented
gynt Nov 9, 2026
a092184
reimplement: SHC_3BB0A8C1_0x004BF720 100.0% Reimplemented
gynt Nov 9, 2026
28805e7
reimplement: SHC_3BB0A8C1_0x004D6F20 100.0% Reimplemented
gynt Nov 9, 2026
76c0003
reimplement: SHC_3BB0A8C1_0x004D9C10 100.0% Reimplemented
gynt Nov 9, 2026
3163ef0
reimplement: SHC_3BB0A8C1_0x004DA050 100.0% Reimplemented
gynt Nov 9, 2026
44344dd
fix: main's names and types since gynt's base, in 13 of the batch's f…
kotijekriv Nov 9, 2026
3f91b18
style: the review asks over the batch: decimals, compound assignment,…
kotijekriv Nov 9, 2026
3553943
style: no imported plate comments, declarations at first use
kotijekriv Nov 9, 2026
3c288d3
style: names for the decompiler's locals and labels, // comments, col…
kotijekriv Nov 9, 2026
a9abca0
style: the new loops step with ++i up to countof, and the kept goto s…
kotijekriv Nov 9, 2026
95ba5bd
fix: SaveMap_TableContent indexes DAT_ArrayOfMapIndices from main's base
kotijekriv Nov 9, 2026
1563658
headers: GameCommandType value 96 as GCT_UNKNOWN_96
kotijekriv Nov 9, 2026
43e6ffc
headers: SoundEffectID values 260 and 261 as SEID_UNKNOWN_0x104 and S…
kotijekriv Nov 9, 2026
ebfbc60
fix: MapEventIconUnk shifts spawnMomentY and spawnMoment by their own…
kotijekriv Nov 9, 2026
3d21358
fix: UnusedSomeMissionStartUnk writes its build menu tab as BMTT_CASTLE
kotijekriv Nov 9, 2026
a782be3
style: the review's names, casts, early returns and includes over the…
kotijekriv Nov 9, 2026
92c4600
style: the second review's comments, conditions, case braces and earl…
kotijekriv Nov 9, 2026
78cc7cb
MenuItems backlog: the >= 4 comments give their measurement
kotijekriv Nov 9, 2026
0cc8ccc
Merge main (d5d965db8) into reimpl/UI-gynt-backlog-MenuItems-2
kotijekriv Nov 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include "../HistoricCampaignSelect.func.hpp"

#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp"
#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_GameState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00425720
void HistoricCampaignSelect::MenuItemActionHandler_HistoricCampaignSelect_Main(int button, ...)
{
switch (button) {
case 1:
DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty;
DAT_GameCore::instance.gameSuspended = 0;
DAT_GameCore::instance.missionNumber1to20 = 1;
DAT_GameCore::instance.historicCampaignNumber = 1;
MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0);
for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) {
DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i]
= DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i];
}
return;
case 2:
DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty;
DAT_GameCore::instance.gameSuspended = 0;
DAT_GameCore::instance.missionNumber1to20 = 6;
DAT_GameCore::instance.historicCampaignNumber = 2;
MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0);
for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) {
DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i]
= DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i];
}
return;
case 3:
DAT_GameCore::instance.gameSuspended = 0;
DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty;
DAT_GameCore::instance.missionNumber1to20 = 11;
DAT_GameCore::instance.historicCampaignNumber = 3;
MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0);
for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) {
DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i]
= DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i];
}
return;
case 4:
DAT_GameCore::instance.gameSuspended = 0;
DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty;
DAT_GameCore::instance.missionNumber1to20 = 16;
DAT_GameCore::instance.historicCampaignNumber = 4;
MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0);
for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) {
DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i]
= DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i];
}
return;
case 5:
MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
UI::Enums::MVT_MAIN_MENU, 0);
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include "../HistoricMissionSelect.func.hpp"

#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/Game/GameMode2.hpp"
#include "OpenSHC/UI/Enums/MenuModalType.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/BOOL_CurrentMenuClickState.hpp"
#include "OpenSHC/Globals/DAT_00b96100.hpp"
#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_GameState.hpp"
#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp"
#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00426B80
void HistoricMissionSelect::MenuItemActionHandler_HistoricMissionSelect_General(int button, ...)
{
if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU
&& DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) {
// a sparse switch; the original lays its arms out default, 20, 18, 13
switch (button) {
default: {
BOOL_CurrentMenuClickState::instance = FALSE;
DAT_GameCore::instance.missionNumber1to20 = DAT_00b96100::instance - button - 1;
DWORD const clickTime = timeGetTime();
if (DAT_GameCore::instance.missionNumber1to20
!= DAT_MenuTextInputState::instance.lastClickedListIndex
|| (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime) >= 500) {
DAT_MenuTextInputState::instance.lastClickedListIndex
= DAT_GameCore::instance.missionNumber1to20;
DAT_MenuTextInputState::instance.lastListClickTime = clickTime;
return;
}
// the original shares this tail with case 13; writing it out twice adds 9 instructions
goto startMission;
}
case 20:
++DAT_GameState::instance.mapAndTime.difficulty;
// >= 4, not > 3 (> 3: quick_diff 0.9111 -> 0.8667)
if (DAT_GameState::instance.mapAndTime.difficulty >= 4) {
DAT_GameState::instance.mapAndTime.difficulty = 0;
}
return;
case 18:
MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
OpenSHC::UI::Enums::MVT_HISTORIC_CAMPAIGN_SELECT, 0);
return;
case 13:
startMission:
--DAT_GameCore::instance.missionNumber1to20;
DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_CAMPAIGN_MISSION;
DAT_GameCore::instance.field_0x74 = 1;
MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::incrementMissionProgress, DAT_GameCore::ptr)();
return;
}
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "../IdentityOptions.func.hpp"

#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp"
#include "OpenSHC/Text/UserTextHandler.func.hpp"
#include "OpenSHC/UI/MenuTextInputState.func.hpp"
#include "OpenSHC/Commands/GameCommandType.hpp"
#include "OpenSHC/Game/GameMode.hpp"
#include "OpenSHC/Text/TextArrayIndexType.hpp"

#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"
#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp"
#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00493D30
void IdentityOptions::MenuItemActionHandler_IdentityOptions_Confirm(int button, ...)
{
if (button == 17) {
DAT_UserTextHandlerState::instance.allowUserTextInput = 0;
MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(
Text::TAIT_NINE__FILTER_B);
DAT_UserTextHandlerState::instance.allowUserTextInput = 1;
MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)();
if (DAT_GameSynchronyState::instance.currentGameMode != Game::GM_SOLITARY) {
MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(
Commands::GCT_UNKNOWN_96);
}
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "../IdentityOptions.func.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00491CE0
void IdentityOptions::MenuItemActionHandler_IdentityOptions_LordIcons(int button, ...)
{
if (button == 21) {
DAT_GameCore::instance.selectedLordTypeUnk = 0;
if (DAT_GameCore::instance.lordIconUnk < 20) {
DAT_GameCore::instance.lordIconUnk = 2;
}
} else if (button == 22) {
DAT_GameCore::instance.selectedLordTypeUnk = 1;
if (DAT_GameCore::instance.lordIconUnk < 20) {
DAT_GameCore::instance.lordIconUnk = 3;
}
} else if (button == 40) {
--DAT_GameCore::instance.lordIconUnk;
if (DAT_GameCore::instance.lordIconUnk < 2) {
DAT_GameCore::instance.lordIconUnk = 21;
}
} else if (button == 41) {
++DAT_GameCore::instance.lordIconUnk;
if (DAT_GameCore::instance.lordIconUnk > 21) {
DAT_GameCore::instance.lordIconUnk = 2;
}
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "../InGameMenu.func.hpp"

#include "OpenSHC/Rendering/ViewportRenderState.func.hpp"

#include "OpenSHC/Globals/DAT_MinimapViewState.hpp"
#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x004B6530
void InGameMenu::MenuItemActionHandler_InGameMenu_MapEventIconUnk(int unused, ...)
{
MACRO_CALL_MEMBER(
OpenSHC::Rendering::ViewportRenderState_Func::focusOnCoordinate, DAT_ViewportRenderState::ptr)(
DAT_MinimapViewState::instance.spawnMomentX[0], DAT_MinimapViewState::instance.spawnMomentY[0]);
for (int eventIndex = 1; eventIndex < DAT_MinimapViewState::instance.spawnMomentCount; ++eventIndex) {
DAT_MinimapViewState::instance.spawnMomentX[eventIndex - 1]
= DAT_MinimapViewState::instance.spawnMomentX[eventIndex];
DAT_MinimapViewState::instance.spawnMomentY[eventIndex - 1]
= DAT_MinimapViewState::instance.spawnMomentY[eventIndex];
DAT_MinimapViewState::instance.spawnMoment[eventIndex - 1]
= DAT_MinimapViewState::instance.spawnMoment[eventIndex];
}
--DAT_MinimapViewState::instance.spawnMomentCount;
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "../InGameMenu.func.hpp"

#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eGM.hpp"
#include "OpenSHC/Rendering/Enums/RenderTarget.hpp"

#include "OpenSHC/Globals/DAT_ButtonX.hpp"
#include "OpenSHC/Globals/DAT_ButtonY.hpp"
#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp"
#include "OpenSHC/Globals/DAT_VideoBikQueue.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x004B65F0
void InGameMenu::MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield(int unused, ...)
{
if (DAT_VideoBikQueue::instance.mbr_0x928) {
dword shieldIndex = DAT_VideoBikQueue::instance.mbr_0x928;
if ((int)DAT_VideoBikQueue::instance.mbr_0x928 < 0) {
shieldIndex = -DAT_VideoBikQueue::instance.mbr_0x928;
}
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU;
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, shieldIndex + 469,
DAT_ButtonX::instance, DAT_ButtonY::instance);
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME;
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "../InGameMenu.func.hpp"

#include "OpenSHC/Game/GameStateStructures.func.hpp"
#include "OpenSHC/UI/MenuItems/General.func.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp"
#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_GameState.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"
#include "OpenSHC/Globals/DAT_MiniMapDefinedData.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

using OpenSHC::WindowsHelper::Enums::BOOLEnum;

// FUNCTION: STRONGHOLDCRUSADER 0x004B65A0
void InGameMenu::MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol(int unused, ...)
{
BOOLEnum const keepEnclosed = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::checkKeepEnclosed,
DAT_GameState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID);
if (keepEnclosed != DAT_MiniMapDefinedData::instance.cachedKeepEnclosed) {
DAT_GameCore::instance.countdown = 2;
}
DAT_MiniMapDefinedData::instance.cachedKeepEnclosed = keepEnclosed;
if (!keepEnclosed) {
DAT_ButtonUnknownZero::instance = TRUE;
return;
}
DAT_ButtonUnknownZero::instance = FALSE;
MACRO_CALL(OpenSHC::UI::MenuItems::General_Func::
MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)();
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "../LoadMap.func.hpp"

#include "OpenSHC/UI/MenuItems/SaveLoadMap.func.hpp"

#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x004948C0
void LoadMap::MenuItemActionHandler_LoadMap_TableContent(int row, ...)
{
DWORD const clickTime = timeGetTime();
if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + row
< DAT_MenuTextInputState::instance.fileListEntryCount) {
DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = row;
if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + row
== DAT_MenuTextInputState::instance.lastClickedListIndex
&& (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime) < 500) {
MACRO_CALL(OpenSHC::UI::MenuItems::SaveLoadMap_Func::MenuItemActionHandler_SaveLoadMap_Buttons)(2);
}
DAT_MenuTextInputState::instance.lastClickedListIndex
= DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex
+ DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset;
DAT_MenuTextInputState::instance.lastListClickTime = clickTime;
}
}

}
}
}
Loading
Loading