From c8ff9d9d9b65258566742cc3758ee9746a715b51 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:27 +0100 Subject: [PATCH 01/29] reimplement: SHC_3BB0A8C1_0x0047C860 65.3% Reimplemented MenuModalRenderFunction_ChooseNetworkServiceProvider, from gynt's reimpl/UI-MenuModals-development (PR #252, closed unmerged) (65.3% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 65.3%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...rFunction_ChooseNetworkServiceProvider.cpp | 78 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp diff --git a/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp b/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp new file mode 100644 index 0000000000..fb33a6cc50 --- /dev/null +++ b/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp @@ -0,0 +1,78 @@ +#include "../ChooseNetworkServiceProvider.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuModals { + + // FUNCTION: STRONGHOLDCRUSADER 0x0047C860 + void ChooseNetworkServiceProvider::MenuModalRenderFunction_ChooseNetworkServiceProvider( + int x, int y, int width, int height) + { + // "Service Providers" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, + DAT_PencilRenderCore::ptr)(76, 6, x, y, width, height); + if (DAT_GameSynchronyState::instance.kickedAtTime != 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x, y - 0x3c, x + width, y - 18, 16); + // "You Were Ejected!" + 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_XPLAY_WAITING_ROOM, 92), + width / 2 + x, y - 50, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_CCFAFF, 16, FALSE, + 0); + if (5000 < timeGetTime() - DAT_GameSynchronyState::instance.kickedAtTime) { + DAT_GameSynchronyState::instance.kickedAtTime = 0; + } + } + int listBottom = y + 165; + int listTop = y + 85; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( + x + 40, listTop, x + 440, listBottom); + int listLeft = x + 39; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + listLeft, listTop - 1, x + 461, listTop - 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + listLeft, listBottom + 1, x + 461, listBottom + 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + listLeft, listTop, listLeft, listBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + x + 461, listTop, x + 461, listBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + x + 440, listTop, x + 440, listBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + if (DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM) { + y += 345; + int modemRight = x + 440; + int modemLeft = x + 40; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( + modemLeft, (y + 265), modemRight, y); + x += 461; + --modemLeft; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + modemLeft, (y + 265) - 1, x, (y + 265) - 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + modemLeft, y + 1, x, y + 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + modemLeft, (y + 265), modemLeft, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + x, (y + 265), x, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + modemRight, (y + 265), modemRight, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + } + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index a105efbb9b..1d832ee7ab 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22253,7 +22253,7 @@ SHC_3BB0A8C1_0x0047C5D0 | 0.0% | Pending SHC_3BB0A8C1_0x0047C670 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0047C860 | 0.0% | Pending +SHC_3BB0A8C1_0x0047C860 | 65.3% | Reimplemented, asm differs SHC_3BB0A8C1_0x0047CA80 | 0.0% | Pending From be9edd1fdcd2bd1cf8bceb5f78de4a9598138fdf Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:34 +0100 Subject: [PATCH 02/29] reimplement: SHC_3BB0A8C1_0x004AAB50 41.0% Reimplemented MenuModalRenderFunction_CreditsScroll, from gynt's reimpl/UI-MenuModals-development (PR #252, closed unmerged) (40.8% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 41.0%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MenuModalRenderFunction_CreditsScroll.cpp | 207 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp diff --git a/src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp b/src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp new file mode 100644 index 0000000000..086c8edc79 --- /dev/null +++ b/src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp @@ -0,0 +1,207 @@ +#include "../CreditsScroll.func.hpp" + +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuModals { + + // FUNCTION: STRONGHOLDCRUSADER 0x004AAB50 + void CreditsScroll::MenuModalRenderFunction_CreditsScroll(int x, int y, int width, int height) + { + int iVar1; + if (DAT_TextEditorState::instance.pendingCreditsFadeBorder) { + DAT_TextEditorState::instance.pendingCreditsFadeBorder = FALSE; + MACRO_CALL_MEMBER( + OpenSHC::Text::TextEditorState_Func::setTextRenderingLogic, DAT_TextEditorState::ptr)(); + int right = x - 1 + width; + int local_58 = 0; + int left = x + 1; + int local_10 = -600; + int local_14 = -570; + int local_18 = -540; + int local_1c = -0x1fe; + int local_20 = -0x1e0; + int local_24 = -450; + int local_28 = -420; + int local_2c = -390; + int local_30 = -360; + int local_34 = -330; + int local_38 = -300; + int local_3c = -270; + int local_40 = -0xf0; + int local_44 = -210; + int local_48 = -180; + int local_4c = -150; + int local_50 = -90; + int local_54 = -0x3c; + int local_c = 0x1e; + int fadeCol3 = -0x78; + int iVar2 = y; + do { + iVar1 = iVar2 + 3; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x, iVar2, x, iVar1, 32 - local_c / 20); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(left, iVar2, left, iVar1, local_54 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 2, iVar2, x + 2, iVar1, local_50 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 3, iVar2, x + 3, iVar1, fadeCol3 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 4, iVar2, x + 4, iVar1, local_4c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 5, iVar2, x + 5, iVar1, local_48 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 6, iVar2, x + 6, iVar1, local_44 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 7, iVar2, x + 7, iVar1, local_40 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 8, iVar2, x + 8, iVar1, local_3c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 9, iVar2, x + 9, iVar1, local_38 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 10, iVar2, x + 10, iVar1, local_34 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 11, iVar2, x + 11, iVar1, local_30 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 12, iVar2, x + 12, iVar1, local_2c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 13, iVar2, x + 13, iVar1, local_28 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 14, iVar2, x + 14, iVar1, local_24 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 0xf, iVar2, x + 0xf, iVar1, local_20 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 16, iVar2, x + 16, iVar1, local_1c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 17, iVar2, x + 17, iVar1, local_18 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 18, iVar2, x + 18, iVar1, local_14 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 19, iVar2, x + 19, iVar1, local_10 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 20, iVar2, right, iVar1, local_58 + 2); + local_50 += 3; + fadeCol3 += 4; + local_4c += 5; + local_48 += 6; + local_44 += 7; + local_40 += 8; + local_3c += 9; + local_38 += 10; + local_34 += 11; + local_30 += 12; + local_2c += 13; + local_28 += 14; + local_24 += 0xf; + local_20 += 16; + local_1c += 17; + local_18 += 18; + local_14 += 19; + local_10 += 20; + ++local_58; + --local_c; + local_54 += 2; + iVar2 += 4; + } while (local_54 < 0); + local_58 = 0; + local_50 = -600; + local_4c = -570; + local_48 = -540; + local_44 = -0x1fe; + local_40 = -0x1e0; + local_3c = -450; + local_38 = -420; + local_34 = -390; + local_30 = -360; + local_2c = -330; + local_28 = -300; + local_24 = -270; + local_20 = -0xf0; + local_1c = -210; + local_18 = -180; + local_14 = -150; + local_54 = -0x78; + local_10 = -90; + local_c = -0x3c; + int local_8 = 0x1e; + iVar2 = y + height; + do { + iVar1 = iVar2 + 3; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x, iVar2, x, iVar1, 32 - local_8 / 20); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(left, iVar2, left, iVar1, local_c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 2, iVar2, x + 2, iVar1, local_10 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 3, iVar2, x + 3, iVar1, local_54 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 4, iVar2, x + 4, iVar1, local_14 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 5, iVar2, x + 5, iVar1, local_18 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 6, iVar2, x + 6, iVar1, local_1c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 7, iVar2, x + 7, iVar1, local_20 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 8, iVar2, x + 8, iVar1, local_24 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 9, iVar2, x + 9, iVar1, local_28 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 10, iVar2, x + 10, iVar1, local_2c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 11, iVar2, x + 11, iVar1, local_30 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 12, iVar2, x + 12, iVar1, local_34 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 13, iVar2, x + 13, iVar1, local_38 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 14, iVar2, x + 14, iVar1, local_3c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 0xf, iVar2, x + 0xf, iVar1, local_40 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 16, iVar2, x + 16, iVar1, local_44 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 17, iVar2, x + 17, iVar1, local_48 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 18, iVar2, x + 18, iVar1, local_4c / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 19, iVar2, x + 19, iVar1, local_50 / 20 + 32); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(x + 20, iVar2, right, iVar1, local_58 + 2); + local_10 += 3; + local_14 += 5; + local_18 += 6; + local_1c += 7; + local_20 += 8; + local_24 += 9; + local_28 += 10; + local_2c += 11; + local_30 += 12; + local_34 += 13; + local_38 += 14; + local_3c += 0xf; + local_40 += 16; + local_44 += 17; + local_48 += 18; + local_4c += 19; + local_50 += 20; + local_54 += 4; + ++local_58; + --local_8; + local_c += 2; + iVar2 -= 4; + } while (local_c < 0); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 1d832ee7ab..73bc50749d 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25537,7 +25537,7 @@ SHC_3BB0A8C1_0x004AAB20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AAB40 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004AAB50 | 0.0% | Pending +SHC_3BB0A8C1_0x004AAB50 | 41.0% | Reimplemented, asm differs SHC_3BB0A8C1_0x004AB440 | 100.0% | Reimplemented From e01e70978bfa49783179cfb1e1f7f4f8b814a4d0 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:35 +0100 Subject: [PATCH 03/29] reimplement: SHC_3BB0A8C1_0x0047D190 66.9% Reimplemented MenuModalRenderFunction_FindingNetworkSessions, from gynt's reimpl/UI-MenuModals-development (PR #252, closed unmerged) (66.9% there). Restyled, with main's rename field135_0x474 -> field_0x474: the list's frame as named positions. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 66.9%: register mismatch: the original keeps the right column in ebp and reloads x. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...lRenderFunction_FindingNetworkSessions.cpp | 63 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuModals/FindingNetworkSessions/MenuModalRenderFunction_FindingNetworkSessions.cpp diff --git a/src/OpenSHC/UI/MenuModals/FindingNetworkSessions/MenuModalRenderFunction_FindingNetworkSessions.cpp b/src/OpenSHC/UI/MenuModals/FindingNetworkSessions/MenuModalRenderFunction_FindingNetworkSessions.cpp new file mode 100644 index 0000000000..8b4945263b --- /dev/null +++ b/src/OpenSHC/UI/MenuModals/FindingNetworkSessions/MenuModalRenderFunction_FindingNetworkSessions.cpp @@ -0,0 +1,63 @@ +#include "../FindingNetworkSessions.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + +#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_ProtocolDefinedData.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/UI_NetworkSessionsShadeLogic.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuModals { + + // FUNCTION: STRONGHOLDCRUSADER 0x0047D190 + void FindingNetworkSessions::MenuModalRenderFunction_FindingNetworkSessions(int x, int y, int width, int height) + { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + // "Finding Sessions" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, + DAT_PencilRenderCore::ptr)(76, 11, x, y, width, height); + int const top = y + 85; + int const bottom = y + 285; + int const right = x + 460; + // The session list: a dimmed box with a frame, a header row and a scrollbar column + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( + x + 40, top, right - 20, bottom); + int const outerRight = right + 1; + int const outerLeft = x + 39; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + outerLeft, top - 1, outerRight, top - 1, COL_VERY_SOFT_YELLOW::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + outerLeft, bottom + 1, outerRight, bottom + 1, COL_VERY_SOFT_YELLOW::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + right - 20, top + 20, outerRight, top + 20, COL_VERY_SOFT_YELLOW::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + outerLeft, top, outerLeft, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + outerRight, top, outerRight, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + right - 20, top, right - 20, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + right - 19, bottom - 20, right, bottom - 20, COL_VERY_SOFT_YELLOW::instance.shortValue); + // The searching animation, a frame every second call + int const shadeTick = UI_NetworkSessionsShadeLogic::instance + 1; + UI_NetworkSessionsShadeLogic::instance = shadeTick; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, + DAT_ProtocolDefinedData::instance.field_0x474[shadeTick / 2 % 32] + 398, width / 2 - 14 + x, y + 312); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + if (DAT_GameSynchronyState::instance.scrollBarIndex == -1 + && DAT_GameSynchronyState::instance.DPLAY_SessionsCount != 0) { + DAT_GameSynchronyState::instance.scrollBarIndex = 0; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 73bc50749d..11dda1d0f6 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22311,7 +22311,7 @@ SHC_3BB0A8C1_0x0047D0E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D100 | 0.0% | Pending -SHC_3BB0A8C1_0x0047D190 | 0.0% | Pending +SHC_3BB0A8C1_0x0047D190 | 66.9% | Reimplemented, register mismatch: the original keeps the right column in ebp and reloads x SHC_3BB0A8C1_0x0047D330 | 100.0% | Reimplemented From f860f20f385f35a69a9fcffec34a18d5cca21f8a Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:35 +0100 Subject: [PATCH 04/29] reimplement: SHC_3BB0A8C1_0x00493560 96.3% Reimplemented MenuModalRenderFunction_ProgressBarBox, from gynt's reimpl/UI-MenuModals-development (PR #252, closed unmerged) (96.3% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 96.3%: only the spill slot of the bar's x differs (the original uses y's home). Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...MenuModalRenderFunction_ProgressBarBox.cpp | 66 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuModals/ProgressBarBox/MenuModalRenderFunction_ProgressBarBox.cpp diff --git a/src/OpenSHC/UI/MenuModals/ProgressBarBox/MenuModalRenderFunction_ProgressBarBox.cpp b/src/OpenSHC/UI/MenuModals/ProgressBarBox/MenuModalRenderFunction_ProgressBarBox.cpp new file mode 100644 index 0000000000..f83f19281e --- /dev/null +++ b/src/OpenSHC/UI/MenuModals/ProgressBarBox/MenuModalRenderFunction_ProgressBarBox.cpp @@ -0,0 +1,66 @@ +#include "../ProgressBarBox.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/GameLanguage.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuModals { + + // FUNCTION: STRONGHOLDCRUSADER 0x00493560 + void ProgressBarBox::MenuModalRenderFunction_ProgressBarBox(int x, int y, int width, int height) + { + if (DAT_TextManagerObject::instance.gameLanguage == OpenSHC::Text::GL_ENGLISH + || DAT_TextManagerObject::instance.gameLanguage == OpenSHC::Text::GL_AMERICAN) { + 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, + (int)(DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter)), + width / 2 + x, y + 25, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 16, FALSE, + 0); + } else { + 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, + (int)(DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter)), + width / 2 + x, y + 25, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 18, FALSE, + 0); + } + if (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY + && DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER + && DAT_GameSynchronyState::instance.saveRelated != 0) { + int barInset = (width - 300) / 2; + int barY = y + 65; + int barBottom = y + 80; + height = barInset + x; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)(height, + barY, (x - barInset) + width, barBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + DAT_MenuTextInputState::instance.progressBarY = barY; + DAT_MenuTextInputState::instance.progressBarX = height; + } else { + int barInset = (width - 300) / 2; + int barY = y + 65; + int barBottom = y + 80; + height = barInset + x; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( + height, barY, (x - barInset) + width, barBottom); + DAT_MenuTextInputState::instance.progressBarY = barY; + DAT_MenuTextInputState::instance.progressBarX = height; + } + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 11dda1d0f6..c774861a9a 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23623,7 +23623,7 @@ SHC_3BB0A8C1_0x004934E5 | 0.0% | Pending SHC_3BB0A8C1_0x004934F0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00493560 | 0.0% | Pending +SHC_3BB0A8C1_0x00493560 | 96.3% | Reimplemented, only the spill slot of the bar's x differs (the original uses y's home) SHC_3BB0A8C1_0x00493690 | 0.0% | Pending From 8f2719d98639b04e685db9e35662345877853671 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:36 +0100 Subject: [PATCH 05/29] reimplement: SHC_3BB0A8C1_0x004B1AC0 76.1% Reimplemented MenuModalRenderFunction_Roundtable, from gynt's reimpl/UI-MenuModals-development (PR #252, closed unmerged) (70.2% there). Rewritten from the binary: the seat positions as an initialised array, the seat loop and the group tint as named locals. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 76.1%: register mismatch: the original keeps y in ebp and the group counter in y's home. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MenuModalRenderFunction_Roundtable.cpp | 83 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp diff --git a/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp b/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp new file mode 100644 index 0000000000..45dd14b449 --- /dev/null +++ b/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp @@ -0,0 +1,83 @@ +#include "../Roundtable.func.hpp" + +#include "OpenSHC/UI/BottomLeftTextDisplayState.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_00df4288.hpp" +#include "OpenSHC/Globals/DAT_BottomLeftTextDisplayState.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuModals { + + // FUNCTION: STRONGHOLDCRUSADER 0x004B1AC0 + void Roundtable::MenuModalRenderFunction_Roundtable(int x, int y, int width, int height) + { + if (DAT_MouseState::instance.rightClickStart != 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)(2, x + 8, y + 8); + // Each seat's shield position at the table, clockwise from the top left + int seatPositions[8][2] = { + { 12, 12 }, + { 216, 12 }, + { 398, 12 }, + { 397, 103 }, + { 398, 193 }, + { 216, 192 }, + { 12, 193 }, + { 12, 103 }, + }; + // Players sit in their groups' order; each new group switches between the plain and the tinted shields + int tint = 1; + int group = 0; + for (int seat = 1; seat < countof(DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray); ++seat) { + int const player = DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[seat]; + if (player < 1 || DAT_GameSynchronyState::instance.DAT_PlayerGroupArray[player] < 1) { + break; + } + if (DAT_GameSynchronyState::instance.DAT_PlayerGroupArray[player] > group) { + ++group; + ++tint; + if (tint > 1) { + tint = 0; + } + } + if (tint == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, + DAT_TextureRenderCoreObject::ptr)( + seat + 2, seatPositions[seat - 1][0] + group, seatPositions[seat - 1][1] + y, 16); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, + DAT_TextureRenderCoreObject::ptr)( + seat + 2 + tint * 8, seatPositions[seat - 1][0] + group, seatPositions[seat - 1][1] + y, 20); + } + } + DAT_ButtonY::instance = y + 380; + DAT_ButtonX::instance = x + 24; + DAT_ButtonW::instance = 380; + DAT_ButtonH::instance = 40; + if (DAT_00df4288::instance != 0) { + MACRO_CALL_MEMBER( + OpenSHC::UI::BottomLeftTextDisplayState_Func::renderCurrentlyDisplayedTextConstructionCost, + DAT_BottomLeftTextDisplayState::ptr)(0); + DAT_00df4288::instance = 0; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index c774861a9a..40af789ead 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25989,7 +25989,7 @@ SHC_3BB0A8C1_0x004B1990 | 0.0% | Pending SHC_3BB0A8C1_0x004B19E0 | 0.0% | Pending -SHC_3BB0A8C1_0x004B1AC0 | 0.0% | Pending +SHC_3BB0A8C1_0x004B1AC0 | 76.1% | Reimplemented, register mismatch: the original keeps y in ebp and the group counter in y's home SHC_3BB0A8C1_0x004B1C30 | 0.0% | Pending From 2ec470f4a3d06705b5f2219f269a1f3baf909ba0 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:36 +0100 Subject: [PATCH 06/29] reimplement: SHC_3BB0A8C1_0x004AF860 78.7% Reimplemented RenderDebugNumbersDisplayElement, from gynt's reimpl/UI-DisplayElements-pr-development (PR #249, closed unmerged) (78.7% there). His draft as it is (every loop form tried compiles the same). The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 78.7%: register mismatch: durationSum stays in a register where the original keeps elementState. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../RenderDebugNumbersDisplayElement.cpp | 107 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/DisplayElements/RenderDebugNumbersDisplayElement.cpp diff --git a/src/OpenSHC/UI/DisplayElements/RenderDebugNumbersDisplayElement.cpp b/src/OpenSHC/UI/DisplayElements/RenderDebugNumbersDisplayElement.cpp new file mode 100644 index 0000000000..64acf4a038 --- /dev/null +++ b/src/OpenSHC/UI/DisplayElements/RenderDebugNumbersDisplayElement.cpp @@ -0,0 +1,107 @@ +#include "../DisplayElements.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_CurrentFramerate.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameLoopDurationBuffer.hpp" +#include "OpenSHC/Globals/DAT_GameLoopStopwatch.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TickRateBuffer.hpp" +#include "OpenSHC/Globals/INT_GameLoopTimeDataIndex.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004AF860 + void DisplayElements::RenderDebugNumbersDisplayElement(int posX, int posY, DWORD elementState) + { + int* _millisecLoopPointer; + int _tickRateSum; + int _averageMillisecLoopMain; + dword _lastGameLoopDuration; + dword _lastGameTickRate; + int _loopAddressByteCounter; + _lastGameTickRate = DAT_GameCore::instance.gameTicksThisLoop; + _lastGameLoopDuration = DAT_GameLoopStopwatch::instance.duration_0x0; + DAT_GameLoopDurationBuffer::instance[INT_GameLoopTimeDataIndex::instance] = _lastGameLoopDuration; + DAT_TickRateBuffer::instance[INT_GameLoopTimeDataIndex::instance] = _lastGameTickRate; + ++INT_GameLoopTimeDataIndex::instance; + _tickRateSum = 0; + int _gameLoopDurationBufferSum = 0; + if (INT_GameLoopTimeDataIndex::instance == 100) { + INT_GameLoopTimeDataIndex::instance = 0; + } + // Maybe this is an enrolled loop? -TheRedDaemon + int _loopIndex = 0; + do { + _gameLoopDurationBufferSum = _gameLoopDurationBufferSum + DAT_GameLoopDurationBuffer::instance[_loopIndex] + + DAT_GameLoopDurationBuffer::instance[_loopIndex + 1] + + DAT_GameLoopDurationBuffer::instance[_loopIndex + 2] + + DAT_GameLoopDurationBuffer::instance[_loopIndex + 4] + + DAT_GameLoopDurationBuffer::instance[_loopIndex + 3]; + _tickRateSum = _tickRateSum + DAT_TickRateBuffer::instance[_loopIndex + 4] + + DAT_TickRateBuffer::instance[_loopIndex + 3] + DAT_TickRateBuffer::instance[_loopIndex + 2] + + DAT_TickRateBuffer::instance[_loopIndex + 1] + DAT_TickRateBuffer::instance[_loopIndex]; + _loopIndex += 5; + } while (_loopIndex < 100); + _averageMillisecLoopMain = _gameLoopDurationBufferSum / 100; + if ((int)elementState != -1000) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + _lastGameLoopDuration, posX, posY + 5, OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_0080FF, + 0, 15, FALSE, 0); + } + int _maxLoopDurationOfTheLast100 = -1; + _millisecLoopPointer = DAT_GameLoopDurationBuffer::instance; + do { + if (_millisecLoopPointer[0] > _maxLoopDurationOfTheLast100) { + _maxLoopDurationOfTheLast100 = _millisecLoopPointer[0]; + } + if (_millisecLoopPointer[1] > _maxLoopDurationOfTheLast100) { + _maxLoopDurationOfTheLast100 = _millisecLoopPointer[1]; + } + if (_millisecLoopPointer[2] > _maxLoopDurationOfTheLast100) { + _maxLoopDurationOfTheLast100 + = _millisecLoopPointer[2]; // written out as in the draft; not tried as a loop + } + if (_millisecLoopPointer[3] > _maxLoopDurationOfTheLast100) { + _maxLoopDurationOfTheLast100 = _millisecLoopPointer[3]; + } + if (_millisecLoopPointer[4] > _maxLoopDurationOfTheLast100) { + _maxLoopDurationOfTheLast100 = _millisecLoopPointer[4]; + } + _millisecLoopPointer += 5; + } while (_millisecLoopPointer < DAT_GameLoopDurationBuffer::instance + 100); + if ((int)elementState != -1000) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + _averageMillisecLoopMain, posX + 48, posY, OpenSHC::Text::TTA_LEFT, + OpenSHC::Rendering::Colors::COL_0080FF, 0, 17, FALSE, 0); + } + if (_averageMillisecLoopMain == 0) { + _averageMillisecLoopMain = 1; + } + if ((int)elementState != -1000) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + 1000 / _averageMillisecLoopMain, posX + 48, posY + 20, OpenSHC::Text::TTA_LEFT, + OpenSHC::Rendering::Colors::COL_0080FF, 0, 17, FALSE, 0); + } + DAT_CurrentFramerate::instance = 1000 / _averageMillisecLoopMain; + if (_tickRateSum == 0) { + _tickRateSum = 1; + } + int _someRelationBetweenLoopDurationAndTickrate = _gameLoopDurationBufferSum / _tickRateSum; + if (_someRelationBetweenLoopDurationAndTickrate == 0) { + _someRelationBetweenLoopDurationAndTickrate = 1; + } + if ((int)elementState != -1000) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + 1000 / _someRelationBetweenLoopDurationAndTickrate, posX + 48, posY + 40, OpenSHC::Text::TTA_LEFT, + OpenSHC::Rendering::Colors::COL_0080FF, 0, 17, FALSE, 0); + } + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 40af789ead..38acc9ff9c 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25921,7 +25921,7 @@ SHC_3BB0A8C1_0x004AF820 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AF840 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004AF860 | 0.0% | Pending +SHC_3BB0A8C1_0x004AF860 | 78.7% | Reimplemented, register mismatch: durationSum stays in a register where the original keeps elementState SHC_3BB0A8C1_0x004AFA50 | 100.0% | Reimplemented From d0fbcd57914808c92e3ee9d7523fba8b812c5f65 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:37 +0100 Subject: [PATCH 07/29] reimplement: SHC_3BB0A8C1_0x004AFB30 82.0% Reimplemented RenderInGameWinDefeatWindowDisplayElement, from gynt's reimpl/UI-DisplayElements-pr-development (PR #249, closed unmerged) (81.0% there). His draft, with the alive-flag pointers short* for today's short playerIsAlive. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 82.0%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...derInGameWinDefeatWindowDisplayElement.cpp | 137 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp diff --git a/src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp b/src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp new file mode 100644 index 0000000000..8e906862d2 --- /dev/null +++ b/src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp @@ -0,0 +1,137 @@ +#include "../DisplayElements.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/GameLanguage.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004AFB30 + void DisplayElements::RenderInGameWinDefeatWindowDisplayElement(int posX, int posY, DWORD elementState) + { + char (*textAddress)[250]; + int iVar4; + int* piVar5; + short* local_8; + // The original is built with /GS and sets up a security cookie here, so its source declared a local buffer + // larger than 4 bytes whose address escaped. Nothing in the original reads that buffer, so its element type + // and length cannot be recovered - this is the smallest declaration that reproduces the cookie and the + // original's 8-byte frame exactly. It is a reconstruction of the frame, not a recovered name. + short _securityCookieBuffer[3]; + local_8 = _securityCookieBuffer; + DWORD DVar1 = timeGetTime(); + if (8000 < DVar1 - DAT_GameState::instance.mapAndTime.gameOverTime) { + if (DAT_GameState::instance.mapAndTime.playerIsAlive[DAT_GameSynchronyState::instance.currentPlayerSlotID] + != 0) { + DAT_GameCore::instance.isVictoryOrDefeatUnk = 0; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_MISSION_FINISHED_TRANSITION, 0); + } else { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_GAME_LOSTUnk, 0); + } + } + int _alivePlayerCount = 0; + if (DAT_GameState::instance.mapAndTime.playerIsAlive[1] != 0) { + _alivePlayerCount = 1; + } + if (DAT_GameState::instance.mapAndTime.playerIsAlive[2] != 0) { + ++_alivePlayerCount; // written out as in the draft; not tried as a loop + } + if (DAT_GameState::instance.mapAndTime.playerIsAlive[3] != 0) { + ++_alivePlayerCount; + } + if (DAT_GameState::instance.mapAndTime.playerIsAlive[4] != 0) { + ++_alivePlayerCount; + } + if (DAT_GameState::instance.mapAndTime.playerIsAlive[5] != 0) { + ++_alivePlayerCount; + } + if (DAT_GameState::instance.mapAndTime.playerIsAlive[6] != 0) { + ++_alivePlayerCount; + } + if (DAT_GameState::instance.mapAndTime.playerIsAlive[7] != 0) { + ++_alivePlayerCount; + } + if (DAT_GameState::instance.mapAndTime.playerIsAlive[8] != 0) { + ++_alivePlayerCount; + } + DAT_PencilRenderCore::instance.surfaceTarget = OpenSHC::Rendering::Enums::RT_MAP_GAME; + int iVar3 = _alivePlayerCount * 0x1e - 6; + iVar3 += (29 - (iVar3 + 29) % 0x1e); + iVar4 = posY + (-28 - iVar3 / 2); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderedBoxWithBlendedBackground, + DAT_PencilRenderCore::ptr)(posX - 264, iVar4 - 19, 528, iVar3 + 96); + DAT_PencilRenderCore::instance.surfaceTarget = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + // "Defeat" + if (DAT_GameState::instance.mapAndTime.playerIsAlive[DAT_GameSynchronyState::instance.currentPlayerSlotID] + != 0) { + 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_MAINOPTIONS, 16), + posX, iVar4, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 15, FALSE, 0); + } else { + 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_MAINOPTIONS, 17), + posX, iVar4, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 15, FALSE, 0); + } + iVar4 += 57; + piVar5 = DAT_BlendingDefinedData::instance.PlayerSlotUnitColor + 1; + textAddress = DAT_GameSynchronyState::instance.DAT_PlayerNames + 1; + local_8 = DAT_GameState::instance.mapAndTime.playerIsAlive + 1; + do { + if (*local_8 != 0) { + if ((DAT_TextManagerObject::instance.gameLanguage == OpenSHC::Text::GL_ENGLISH) + || (DAT_TextManagerObject::instance.gameLanguage == OpenSHC::Text::GL_AMERICAN)) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, + DAT_TextManagerObject::ptr)(*textAddress, posX - 28, iVar4, OpenSHC::Text::TTA_CENTER, + DAT_RenderingDefinedData::instance.ColorArray[*piVar5], 0, 17, FALSE, 0); + // "Wins" + MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 64), + DAT_TextManagerObject::instance.currentXOffset_0x0 / 2 - 22 + posX, iVar4, + OpenSHC::Text::TTA_LEFT, DAT_RenderingDefinedData::instance.ColorArray[*piVar5], 0, 17, FALSE, + 0); + } else { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, + DAT_TextManagerObject::ptr)(*textAddress, posX - 78, iVar4, OpenSHC::Text::TTA_CENTER, + DAT_RenderingDefinedData::instance.ColorArray[*piVar5], 0, 18, FALSE, 0); + // "Wins" + MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 64), + DAT_TextManagerObject::instance.currentXOffset_0x0 / 2 - 72 + posX, iVar4, + OpenSHC::Text::TTA_LEFT, DAT_RenderingDefinedData::instance.ColorArray[*piVar5], 0, 18, FALSE, + 0); + } + iVar4 += 0x1e; + } + ++local_8; + ++piVar5; + ++textAddress; + } while ((int)local_8 < (int)&DAT_GameState::instance + 0x53e9a); + ; + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 38acc9ff9c..de710e5a85 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25929,7 +25929,7 @@ SHC_3BB0A8C1_0x004AFA80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AFB00 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004AFB30 | 0.0% | Pending +SHC_3BB0A8C1_0x004AFB30 | 82.0% | Reimplemented, asm differs SHC_3BB0A8C1_0x004AFDA0 | 0.0% | Pending From 8aa5e9ca222075bc46e7690b6556c70ad215896f Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:37 +0100 Subject: [PATCH 08/29] reimplement: SHC_3BB0A8C1_0x004B0390 62.0% Reimplemented RenderPlayerInfoOnHoverDisplayElement, from gynt's reimpl/UI-DisplayElements-pr-development (PR #249, closed unmerged) (62.0% there). His draft, with main's rename viewportState.field0_0x0 -> field_0x0. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 62.0%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../RenderPlayerInfoOnHoverDisplayElement.cpp | 202 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/DisplayElements/RenderPlayerInfoOnHoverDisplayElement.cpp diff --git a/src/OpenSHC/UI/DisplayElements/RenderPlayerInfoOnHoverDisplayElement.cpp b/src/OpenSHC/UI/DisplayElements/RenderPlayerInfoOnHoverDisplayElement.cpp new file mode 100644 index 0000000000..f02d4340cc --- /dev/null +++ b/src/OpenSHC/UI/DisplayElements/RenderPlayerInfoOnHoverDisplayElement.cpp @@ -0,0 +1,202 @@ +#include "../DisplayElements.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" +#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_00df5530.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" +#include "OpenSHC/Globals/INT_00df552c.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::Map::Buildings::BuildingTypeShort; + + // FUNCTION: STRONGHOLDCRUSADER 0x004B0390 + void DisplayElements::RenderPlayerInfoOnHoverDisplayElement(int posX, int posY, DWORD elementState) + { + int aiIndex = 0; + if (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SOLITARY) { + if (DAT_GameCore::instance.currentMenuViewType != OpenSHC::UI::Enums::MVT_BUILD_MENU) + return; + if (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_EDITOR) + return; + } + int hoveredOwner = 0; + if (DAT_GameCore::instance.currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILDING_AND_STATUS_MENU) { + if (DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM) { + posY -= 40; + } else if (DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_MERCENARYPOST) { + posY -= 40; + } else { + posY -= 20; + } + } + if ((DAT_ViewportRenderState::instance.viewportState.mouseRayBuildingID == 0) + || (DAT_ViewportRenderState::instance.viewportState.field_0x0 == 0)) { + if (DAT_ViewportRenderState::instance.viewportState.cursorWallTile != 0 + && DAT_ViewportRenderState::instance.viewportState.field_0x0 != 0 + && (hoveredOwner + = (DAT_TileMapState::instance + .WallOwnerLayer[DAT_ViewportRenderState::instance.viewportState.cursorWallTile] + & 7) + + 1, + DAT_GameCore::instance.mapU4Int0 != 0) + && hoveredOwner == DAT_GameState::instance.mapAndTime.somePlayerID) + return; + } else { + BuildingTypeShort _buildingType + = DAT_BuildingsState::instance + .buildings[DAT_ViewportRenderState::instance.viewportState.mouseRayBuildingID] + .buildingType; + if (_buildingType == OpenSHC::Map::Buildings::BT_PITCHDITCH) + return; + if (_buildingType == OpenSHC::Map::Buildings::BT_KILLINGPIT) + return; + if (_buildingType == OpenSHC::Map::Buildings::BT_SIGNPOST) + return; + if ((DAT_GameCore::instance.mapU4Int0 != 0) + && (DAT_BuildingsState::instance + .buildings[DAT_ViewportRenderState::instance.viewportState.mouseRayBuildingID] + .owner + == DAT_GameState::instance.mapAndTime.somePlayerID)) + return; + hoveredOwner = (int)DAT_BuildingsState::instance + .buildings[DAT_ViewportRenderState::instance.viewportState.mouseRayBuildingID] + .owner; + } + if (DAT_MenuModalComposition2::instance.activeModalDialogID + == OpenSHC::UI::Enums::MMT_DISPLAY_AI_LORD_MESSAGE) { + DAT_00df5530::instance = 0; + return; + } + uint blendStrength = 0; + if (hoveredOwner != 0) { + DAT_00df5530::instance = hoveredOwner; + INT_00df552c::instance = timeGetTime(); + } else if (DAT_00df5530::instance != 0) { + uint elapsed = timeGetTime() - INT_00df552c::instance; + if (720 <= elapsed) { + DAT_00df5530::instance = 0; + } else if (400 < elapsed) { + blendStrength = (elapsed - 400) / 10; + } + } + if ((DAT_GameCore::instance.currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU) + && (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR)) { + if (DAT_00df5530::instance == 0) + return; + MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::computeTextWidthForTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_BUBBLE_HELP_TEXT, DAT_00df5530::instance + 204, 16); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_BUBBLE_HELP_TEXT, DAT_00df5530::instance + 204, posX, posY - 20, + OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 0, 16, FALSE); + return; + } + if (DAT_00df5530::instance == 0) + return; + int textWidth = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::computeTextWidth, + DAT_TextManagerObject::ptr)(DAT_GameSynchronyState::instance.DAT_PlayerNames[DAT_00df5530::instance], 16); + int halfWidth = textWidth / 2; + if (blendStrength == 0) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance.DAT_PlayerNames[DAT_00df5530::instance], posX + 40, posY, + OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 0, 16, FALSE, 0); + int iconX = posX + (-48 - halfWidth); + if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[DAT_00df5530::instance] == -1) { + aiIndex = DAT_GameSynchronyState::instance.currentAIArray[DAT_00df5530::instance]; + } + int iconY = posY - 38; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, DAT_00df5530::instance + 546, iconX, iconY); + if (aiIndex == 0) { + if (DAT_GameCore::instance.lordIcons[DAT_00df5530::instance] == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 539, iconX, iconY); + } else if (DAT_GameCore::instance.lordIcons[DAT_00df5530::instance] == 1) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 540, iconX, iconY); + } else if (0 < DAT_TextureRenderCoreObject::instance.bitmapFaceSizes[DAT_00df5530::instance + 19]) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 541, iconX, iconY); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawBitmapFace, + DAT_TextureRenderCoreObject::ptr)(DAT_00df5530::instance + 19, iconX + 4, posY - 34); + } + } else { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, aiIndex + 522, iconX, iconY); + } + int playerGroup = DAT_GameState::instance.mapAndTime.playerGroupArray[DAT_00df5530::instance]; + if (playerGroup <= 0) + return; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, playerGroup * 2 + 493, iconX + 76, iconY); + } else { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance.DAT_PlayerNames[DAT_00df5530::instance], posX + 40, posY, + OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 0, 16, FALSE, (int)(blendStrength)); + int iconX = posX + (-48 - halfWidth); + if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[DAT_00df5530::instance] == -1) { + aiIndex = DAT_GameSynchronyState::instance.currentAIArray[DAT_00df5530::instance]; + } + int iconY = posY - 38; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, + DAT_00df5530::instance + 546, iconX, iconY, (int)(blendStrength)); + if (aiIndex == 0) { + if (DAT_GameCore::instance.lordIcons[DAT_00df5530::instance] == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)( + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 539, iconX, iconY, (int)(blendStrength)); + } else if (DAT_GameCore::instance.lordIcons[DAT_00df5530::instance] == 1) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)( + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 540, iconX, iconY, (int)(blendStrength)); + } else if (0 < DAT_TextureRenderCoreObject::instance.bitmapFaceSizes[DAT_00df5530::instance + 19]) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)( + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 541, iconX, iconY, (int)(blendStrength)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawBitmapFaceWithBlendUnk, + DAT_TextureRenderCoreObject::ptr)( + DAT_00df5530::instance + 19, iconX + 4, posY - 34, (int)(blendStrength)); + } + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)( + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, aiIndex + 522, iconX, iconY, (int)(blendStrength)); + } + int playerGroup = DAT_GameState::instance.mapAndTime.playerGroupArray[DAT_00df5530::instance]; + if (playerGroup <= 0) + return; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, playerGroup * 2 + 493, + iconX + 76, iconY, (int)(blendStrength)); + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index de710e5a85..92ff0adced 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25935,7 +25935,7 @@ SHC_3BB0A8C1_0x004AFDA0 | 0.0% | Pending SHC_3BB0A8C1_0x004AFE10 | 0.0% | Pending -SHC_3BB0A8C1_0x004B0390 | 0.0% | Pending +SHC_3BB0A8C1_0x004B0390 | 62.0% | Reimplemented, asm differs SHC_3BB0A8C1_0x004B07C0 | 0.0% | Pending From 8543e6b97f9b3e67824b1d6fa3c8a819813e4bb8 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:38 +0100 Subject: [PATCH 09/29] reimplement: SHC_3BB0A8C1_0x00471340 32.8% Reimplemented drawBorderedBoxWithBlendedBackground, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (32.8% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 32.8%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../drawBorderedBoxWithBlendedBackground.cpp | 58 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp new file mode 100644 index 0000000000..4c5f606121 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp @@ -0,0 +1,58 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00471340 + void PencilRenderCore::drawBorderedBoxWithBlendedBackground(int xPos, int yPos, int width, int height) + { + int iVar4; + int iVar1 = ((height - 1) / 24 + 1) * 24; + int iVar2 = ((width - 1) / 24 + 1) * 24; + int iVar3 = 0; + if (0 < iVar1) { + do { + if (iVar3 == 0) { + iVar4 = 1; + } else { + iVar4 = (-(uint)(iVar3 != iVar1 - 24) & 0xfffffffa) + 13; + } + int iVar5 = 0; + if (0 < iVar2) { + do { + int imageID = iVar4; + if (iVar5 == 0) { + LAB_004713ce: + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + imageID, iVar5 + xPos, iVar3 + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + imageID + 3, 0); + } else { + if (iVar5 == iVar2 - 24) { + imageID = iVar4 + 2; + goto LAB_004713ce; + } + if (iVar4 != 7) { + imageID = iVar4 + 1; + goto LAB_004713ce; + } + } + iVar5 += 24; + } while (iVar5 < iVar2); + } + iVar3 += 24; + } while (iVar3 < iVar1); + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, this)( + xPos + 24, yPos + 24, xPos - 25 + iVar2, yPos - 25 + iVar1, 16); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 92ff0adced..6da5d379f1 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -21285,7 +21285,7 @@ SHC_3BB0A8C1_0x00471280 | 0.0% | Pending SHC_3BB0A8C1_0x004712E0 | 0.0% | Pending -SHC_3BB0A8C1_0x00471340 | 0.0% | Pending +SHC_3BB0A8C1_0x00471340 | 32.8% | Reimplemented, asm differs SHC_3BB0A8C1_0x00471440 | 0.0% | Pending From ea42833c196c095a583021e159bf852c40155561 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:39 +0100 Subject: [PATCH 10/29] reimplement: SHC_3BB0A8C1_0x004710A0 38.9% Reimplemented drawBoxWithRoundedEdges, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (38.9% there). His draft, with main's rename TextInputDefinedData::field0_0x0 -> field_0x0. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 38.9%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../drawBoxWithRoundedEdges.cpp | 73 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp new file mode 100644 index 0000000000..1394d6fd09 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp @@ -0,0 +1,73 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/UI/Enums/RoundedBoxEdgeRoundingLevel.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_TextInputDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::UI::Enums::RoundedBoxEdgeRoundingLevel; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // Found no moment, where this one was used. --TheRedDaemon + // FUNCTION: STRONGHOLDCRUSADER 0x004710A0 + void PencilRenderCore::drawBoxWithRoundedEdges( + int left, int top, int right, int bottom, RoundedBoxEdgeRoundingLevel roundingLevel) + { + BOOLEnum _drawReady; + TextInputDefinedData* pTVar3; + int iVar4; + if (roundingLevel == OpenSHC::UI::Enums::RBERL_SLIGHT) { + pTVar3 = DAT_TextInputDefinedData::ptr; + } else { + if (roundingLevel != OpenSHC::UI::Enums::RBERL_STRONG) {} + pTVar3 = (TextInputDefinedData*)0xb37ce8; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencilSurface, this)(); + _drawReady = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencil, this)( + left, top, right, bottom, 0); + dword dVar2 = this->drawEndX; + dword dVar1 = this->drawStartX; + if (_drawReady && (int)(roundingLevel * 2) <= (int)(this->drawEndY - this->drawStartY)) { + iVar4 = 0; + this->drawStartX = dVar1; + this->drawEndX = dVar2; + if (0 < (int)roundingLevel) { + do { + this->drawStartX = dVar1; + this->drawEndX = dVar2; + if (this->currentHeight_0x2c < 0) + break; + this->drawStartX = pTVar3->field_0x0[iVar4] + dVar1; + this->drawEndX = dVar2 - pTVar3->field_0x0[iVar4]; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimHorizontalLine, this)(); + --this->currentHeight_0x2c; + ++this->drawStartY; + ++iVar4; + this->drawStartX = dVar1; + this->drawEndX = dVar2; + } while (iVar4 < (int)roundingLevel); + } + for (; (int)roundingLevel <= this->currentHeight_0x2c; + this->currentHeight_0x2c = this->currentHeight_0x2c - 1) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimHorizontalLine, this)(); + ++this->drawStartY; + } + for (; + (0 <= (int)(roundingLevel - ((RoundedBoxEdgeRoundingLevel)1)) && (0 <= this->currentHeight_0x2c)); + this->currentHeight_0x2c = this->currentHeight_0x2c - 1) { + this->drawStartX = pTVar3->field_0x0[roundingLevel - 1] + dVar1; + this->drawEndX = dVar2 - pTVar3->field_0x0[roundingLevel - 1]; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimHorizontalLine, this)(); + ++this->drawStartY; + roundingLevel = (RoundedBoxEdgeRoundingLevel)(roundingLevel - 1); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 6da5d379f1..3813ec9c29 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -21275,7 +21275,7 @@ SHC_3BB0A8C1_0x00471000 | 0.0% | Pending SHC_3BB0A8C1_0x00471050 | 0.0% | Pending -SHC_3BB0A8C1_0x004710A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004710A0 | 38.9% | Reimplemented, asm differs SHC_3BB0A8C1_0x004711B0 | 0.0% | Pending From 3e7ec7ef84d50ae3e58a9e7b37449641884ac52a Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:39 +0100 Subject: [PATCH 11/29] reimplement: SHC_3BB0A8C1_0x00468F20 4.5% Reimplemented drawCurrentPixel, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (4.5% there). His draft, with the optimize pragma moved above the FUNCTION line so the function is found. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 4.5%: heavy structural mismatch. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../PencilRenderCore/drawCurrentPixel.cpp | 23 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawCurrentPixel.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawCurrentPixel.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawCurrentPixel.cpp new file mode 100644 index 0000000000..302c415523 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawCurrentPixel.cpp @@ -0,0 +1,23 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + +#pragma optimize("g", off) + // FUNCTION: STRONGHOLDCRUSADER 0x00468F20 + void PencilRenderCore::drawCurrentPixel() + { + uint _currentX = this->currentX; + uint _currentY = this->currentY; + ushort _drawColor = this->drawColor; + *(ushort*)((int)DAT_PencilRenderCore::instance.surfacePtr + _currentX * 2 + + _currentY * DAT_PencilRenderCore::instance.horizontalByteSize) = _drawColor; + } +#pragma optimize("g", on) + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3813ec9c29..c51e323ca5 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20107,7 +20107,7 @@ SHC_3BB0A8C1_0x00468E40 | 0.0% | Pending SHC_3BB0A8C1_0x00468EA0 | 0.0% | Pending -SHC_3BB0A8C1_0x00468F20 | 0.0% | Pending +SHC_3BB0A8C1_0x00468F20 | 4.5% | Reimplemented, heavy structural mismatch SHC_3BB0A8C1_0x00468F70 | 0.0% | Pending From 402dc083dd6ffc38106257b39afd45816b563f88 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:39 +0100 Subject: [PATCH 12/29] reimplement: SHC_3BB0A8C1_0x00468FE0 52.0% Reimplemented drawHeaderBanner, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (52.0% there). His draft, with main's rename GMTotalPicturesProcessed -> GMFirstPictureIndex. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 52.0%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../PencilRenderCore/drawHeaderBanner.cpp | 54 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp new file mode 100644 index 0000000000..a7df2e75cf --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp @@ -0,0 +1,54 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" + +#include "OpenSHC/Globals/DAT_GMImageHeaders.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/GMFirstPictureIndex.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00468FE0 + void PencilRenderCore::drawHeaderBanner(int xPos, int yPos, int width, int unusedUnk) + { + int iVar4; + yPos += 8; + int iVar1 = xPos + 8; + int iVar2 = width - 16; + xPos = 0; + do { + if (xPos == 0) { + iVar4 = 48; + } else { + iVar4 = (-(uint)(xPos != 56) & 0xfffffffa) + 60; + } + int iVar3 = 0; + if (0 < iVar2) { + do { + int _imageID = iVar4; + if ((iVar3 != 0) && (_imageID = iVar4 + 2, iVar3 != iVar2 - 8)) { + _imageID = iVar4 + 1; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, _imageID, + iVar3 + iVar1, xPos + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, _imageID + 3, 0); + iVar3 += 8; + } while (iVar3 < iVar2); + } + xPos += 8; + } while (xPos < 64); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 91, iVar1 + 3, yPos + 9, + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 92, 0); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 91, + (iVar1 - DAT_GMImageHeaders::instance.imh[GMFirstPictureIndex::instance[156] + 90].width) - 3 + iVar2, + yPos + 9, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 92, 0); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index c51e323ca5..04f7f4f767 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20111,7 +20111,7 @@ SHC_3BB0A8C1_0x00468F20 | 4.5% | Reimplemented, heavy structural mismatch SHC_3BB0A8C1_0x00468F70 | 0.0% | Pending -SHC_3BB0A8C1_0x00468FE0 | 0.0% | Pending +SHC_3BB0A8C1_0x00468FE0 | 52.0% | Reimplemented, asm differs SHC_3BB0A8C1_0x004690E0 | 0.0% | Pending From 9c437b0358bf4209c1889a35fe2edf20552b08a7 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:40 +0100 Subject: [PATCH 13/29] reimplement: SHC_3BB0A8C1_0x00475CC0 52.4% Reimplemented drawHeaderTextBanner, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (51.6% there). His draft, with main's rename GMTotalPicturesProcessed -> GMFirstPictureIndex. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 52.4%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../PencilRenderCore/drawHeaderTextBanner.cpp | 70 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp new file mode 100644 index 0000000000..ec62db845d --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp @@ -0,0 +1,70 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GMImageHeaders.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/GMFirstPictureIndex.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00475CC0 + void PencilRenderCore::drawHeaderTextBanner( + int textGroupIndex, int textNumInGroup, int xPos, int yPos, int width, int param_6) + { + int _textY; + int _width; + int iVar2; + int iVar3; + int iVar4; + int _textX; + int iVar1 = xPos; + iVar2 = xPos + 8; + _width = width - 16; + for (int xPos = 0; xPos < 64; xPos = xPos + 8) { + if (xPos == 0) { + iVar4 = 48; + } else { + iVar4 = (-(uint)(xPos != 56) & 0xfffffffa) + 60; + } + iVar3 = 0; + if (0 < _width) { + do { + int imageID = iVar4; + if ((iVar3 != 0) && (imageID = iVar4 + 2, iVar3 != width - 24)) { + imageID = iVar4 + 1; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, imageID, + iVar3 + iVar2, xPos + yPos + 8, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, imageID + 3, + 0); + iVar3 += 8; + } while (iVar3 < _width); + } + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 91, iVar1 + 11, + yPos + 17, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 92, 0); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 91, + (iVar2 - DAT_GMImageHeaders::instance.imh[GMFirstPictureIndex::instance[156] + 90].width) - 3 + _width, + yPos + 17, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 92, 0); + _textY = yPos + 22; + _textX = _width / 2 + iVar2; + 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::eTextSections)textGroupIndex, textNumInGroup), + _textX, _textY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 15, FALSE, 0); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 04f7f4f767..65ca68faac 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -21933,7 +21933,7 @@ SHC_3BB0A8C1_0x00475B90 | 0.0% | Pending SHC_3BB0A8C1_0x00475BE0 | 0.0% | Pending -SHC_3BB0A8C1_0x00475CC0 | 0.0% | Pending +SHC_3BB0A8C1_0x00475CC0 | 52.4% | Reimplemented, asm differs SHC_3BB0A8C1_0x00475E00 | 0.0% | Pending From cfbab8e4bb7d63230b0feb12c226c6d66c901cbc Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:41 +0100 Subject: [PATCH 14/29] reimplement: SHC_3BB0A8C1_0x00472B20 56.3% Reimplemented drawLine, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (56.3% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 56.3%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../Rendering/PencilRenderCore/drawLine.cpp | 35 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp new file mode 100644 index 0000000000..a6cbf7fdc2 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp @@ -0,0 +1,35 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00472B20 + void PencilRenderCore::drawLine(int x1, int y1, int x2, int y2, ushort color) + { + BOOLEnum _drawReady; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencilSurface, this)(); + _drawReady = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencil, this)( + x1, y1, x2, y2, color); + if (_drawReady) { + if (this->currentWidth_0x28 == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawVerticalLine, this)(); + } + if (this->currentHeight_0x2c == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHorizontalLine, this)(); + } + if (this->currentWidth_0x28 < this->currentHeight_0x2c) { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawDiagonalHeigherThanWideUnk, this)(); + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawDiagonalWiderThanHighUnk, this)(); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 65ca68faac..75c775b62a 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -21417,7 +21417,7 @@ SHC_3BB0A8C1_0x004729B0 | 0.0% | Pending SHC_3BB0A8C1_0x00472A90 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00472B20 | 0.0% | Pending +SHC_3BB0A8C1_0x00472B20 | 56.3% | Reimplemented, asm differs SHC_3BB0A8C1_0x00472B90 | 0.0% | Pending From 2c99182cf2b61e47d57d8f046b24fa5b8921f22f Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:41 +0100 Subject: [PATCH 15/29] reimplement: SHC_3BB0A8C1_0x00468F70 9.3% Reimplemented drawPixelPattern4x4, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (9.3% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 9.3%: heavy structural mismatch. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../PencilRenderCore/drawPixelPattern4x4.cpp | 36 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4.cpp new file mode 100644 index 0000000000..7af1037589 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4.cpp @@ -0,0 +1,36 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00468F70 + void PencilRenderCore::drawPixelPattern4x4(int drawX, int drawY) + { + int _drawPtr = (int)DAT_PencilRenderCore::instance.surfacePtr + drawX * 2 + + (uint)drawY * DAT_PencilRenderCore::instance.horizontalByteSize; + dword _rowOffset = 0; + dword _horizontalByteSize = DAT_PencilRenderCore::instance.horizontalByteSize; + undefined4 _rowPixels = (undefined4)-33841; + undefined4 _rightPixels = 969342976; + *(undefined4*)(_drawPtr + _rowOffset) = _rowPixels; + *(undefined4*)(_drawPtr + _rowOffset + 4) = _rightPixels; + _rowOffset += _horizontalByteSize; + _rowPixels = 2077195215; + *(undefined4*)(_drawPtr + _rowOffset) = _rowPixels; + *(undefined4*)(_drawPtr + _rowOffset + 4) = _rightPixels; + _rowOffset += _horizontalByteSize; + _rowPixels = 969357767; + *(undefined4*)(_drawPtr + _rowOffset) = _rowPixels; + *(undefined4*)(_drawPtr + _rowOffset + 4) = _rightPixels; + _rowOffset += _horizontalByteSize; + _rowPixels = 0; + *(undefined4*)(_drawPtr + _rowOffset) = _rowPixels; + *(undefined4*)(_drawPtr + _rowOffset + 4) = _rowPixels; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 75c775b62a..1ea9975af1 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20109,7 +20109,7 @@ SHC_3BB0A8C1_0x00468EA0 | 0.0% | Pending SHC_3BB0A8C1_0x00468F20 | 4.5% | Reimplemented, heavy structural mismatch -SHC_3BB0A8C1_0x00468F70 | 0.0% | Pending +SHC_3BB0A8C1_0x00468F70 | 9.3% | Reimplemented, heavy structural mismatch SHC_3BB0A8C1_0x00468FE0 | 52.0% | Reimplemented, asm differs From 074c7882905f27920994bd6d557143dc72689e08 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:42 +0100 Subject: [PATCH 16/29] reimplement: SHC_3BB0A8C1_0x004690E0 60.1% Reimplemented drawScrollbar, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (60.1% there). His draft as it is. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 60.1%: asm differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../PencilRenderCore/drawScrollbar.cpp | 90 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp new file mode 100644 index 0000000000..caed392dc6 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp @@ -0,0 +1,90 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004690E0 + void PencilRenderCore::drawScrollbar( + uint xPos, int yPos, int height, int thumbYPos, BOOLEnum isDragged, int thumbHeight, int blendStrength) + { + int alphaImageID; + int _yPosEnd = height + yPos; + int _yPos = yPos; + if (yPos <= _yPosEnd - 20) { + do { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 79, (int)(xPos), + _yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 80, blendStrength); + _yPos += 20; + } while (_yPos <= _yPosEnd - 20); + } + for (; _yPos < _yPosEnd; ++_yPos) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 95, (int)(xPos), + _yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 96, blendStrength); + } + if (isDragged) { + if (thumbHeight <= 20) { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 89, (int)(xPos), yPos + thumbYPos); + } + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 100, (int)(xPos), thumbYPos + yPos); + _yPos = thumbYPos + 10; + if (10 < thumbHeight - 10) { + _yPosEnd = thumbHeight - 20; + do { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 101, (int)(xPos), _yPos + yPos); + ++_yPos; + --_yPosEnd; + } while (_yPosEnd != 0); + } + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 102, (int)(xPos), yPos + _yPos); + } + if (thumbHeight <= 20) { + alphaImageID = 90; + _yPosEnd = 89; + _yPos = thumbYPos; + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 100, (int)(xPos), + thumbYPos + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 103, blendStrength); + _yPos = thumbYPos + 10; + if (10 < thumbHeight - 10) { + thumbYPos = thumbHeight - 20; + do { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 101, + (int)(xPos), _yPos + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 104, + blendStrength); + ++_yPos; + --thumbYPos; + } while (thumbYPos != 0); + } + alphaImageID = 105; + _yPosEnd = 102; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, _yPosEnd, (int)(xPos), + yPos + _yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, alphaImageID, blendStrength); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 1ea9975af1..68f1fce0cf 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20113,7 +20113,7 @@ SHC_3BB0A8C1_0x00468F70 | 9.3% | Reimplemented, heavy structural mismatch SHC_3BB0A8C1_0x00468FE0 | 52.0% | Reimplemented, asm differs -SHC_3BB0A8C1_0x004690E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004690E0 | 60.1% | Reimplemented, asm differs SHC_3BB0A8C1_0x00469290 | 0.0% | Pending From 4d8dc9310b413b642477f76331ceebbd041d1a64 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 02:17:42 +0100 Subject: [PATCH 17/29] reimplement: SHC_3BB0A8C1_0x004692E0 78.4% Reimplemented drawTableCellBackground, from gynt's reimpl/UI-Rendering-development (PR #255, closed unmerged) (75.5% there). His draft as it is. Three differences are known: the stripe row loads with movzx where the original sign-extends (a char parameter does not change it), the width test is the other way round, and the first cap is drawn at the global x instead of the local copy; fixing the last two alone measured worse (65.2%) with the registers that follow. The fixer's mechanical rewrites (decimal constants, compound assignments, - N for + -N, truth tests, unused using-declarations dropped) are applied; nothing else is restyled yet. reccmp reads 78.4%: asm differs: stripe row zero-extended, width test inverted. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../drawTableCellBackground.cpp | 76 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp new file mode 100644 index 0000000000..72d955b564 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp @@ -0,0 +1,76 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.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_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004692E0 + void PencilRenderCore::drawTableCellBackground(BOOLEnum isSelected, int indexToGetStripes, int blendStrength) + { + int iVar1 = DAT_ButtonX::instance; + uint imageID = ((int)(char)indexToGetStripes & 1U) * 2 | 0x45; + if (isSelected) { + if (DAT_ButtonW::instance < 21) { + ++DAT_ButtonW::instance; + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 73, + (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance), + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 76, blendStrength); + iVar1 += 20; + } + while (iVar1 < DAT_ButtonW::instance - 20 + DAT_ButtonX::instance) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 74, iVar1, + (int)(DAT_ButtonY::instance), OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 77, blendStrength); + iVar1 += 20; + } + } else if (DAT_ButtonCurrentlyInteracting::instance) { + if (DAT_ButtonW::instance < 21) { + ++DAT_ButtonW::instance; + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 73, + (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance), + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 76, blendStrength); + iVar1 += 20; + } + while (iVar1 < DAT_ButtonW::instance - 20 + DAT_ButtonX::instance) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 74, iVar1, + (int)(DAT_ButtonY::instance), OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 77, blendStrength); + iVar1 += 20; + } + } else { + // The unselected, untouched cell is drawn as a run of stripes rather than end-cap plus middles + while (iVar1 < DAT_ButtonW::instance + DAT_ButtonX::instance) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, (int)(imageID), + iVar1, (int)(DAT_ButtonY::instance), OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + (int)(imageID + 1), blendStrength); + iVar1 += 20; + } + return; + } + if (21 < DAT_ButtonW::instance) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 75, iVar1, + (int)(DAT_ButtonY::instance), OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 77, blendStrength); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 68f1fce0cf..a9785cb519 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20117,7 +20117,7 @@ SHC_3BB0A8C1_0x004690E0 | 60.1% | Reimplemented, asm differs SHC_3BB0A8C1_0x00469290 | 0.0% | Pending -SHC_3BB0A8C1_0x004692E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004692E0 | 78.4% | Reimplemented, asm differs: stripe row zero-extended, width test inverted SHC_3BB0A8C1_0x004694A0 | 0.0% | Pending From 7736f7e6f0ee1d079ceadbbf2a00beba5e7c68de Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 04:39:06 +0100 Subject: [PATCH 18/29] status: the draft's remarks say what is left, not Reimplemented Below 100% main's commit_progress_batch.py writes the blocker as the remark ("Style pass, asm differs"), not "Reimplemented". This draft's seventeen status lines keep their percentages and blocker remarks. Co-Authored-By: Claude Opus 5.5 --- status/addresses-SHC-3BB0A8C1.txt | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index a9785cb519..7fd66d40e2 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20107,17 +20107,17 @@ SHC_3BB0A8C1_0x00468E40 | 0.0% | Pending SHC_3BB0A8C1_0x00468EA0 | 0.0% | Pending -SHC_3BB0A8C1_0x00468F20 | 4.5% | Reimplemented, heavy structural mismatch +SHC_3BB0A8C1_0x00468F20 | 4.5% | Heavy structural mismatch -SHC_3BB0A8C1_0x00468F70 | 9.3% | Reimplemented, heavy structural mismatch +SHC_3BB0A8C1_0x00468F70 | 9.3% | Heavy structural mismatch -SHC_3BB0A8C1_0x00468FE0 | 52.0% | Reimplemented, asm differs +SHC_3BB0A8C1_0x00468FE0 | 52.0% | Asm differs -SHC_3BB0A8C1_0x004690E0 | 60.1% | Reimplemented, asm differs +SHC_3BB0A8C1_0x004690E0 | 60.1% | Asm differs SHC_3BB0A8C1_0x00469290 | 0.0% | Pending -SHC_3BB0A8C1_0x004692E0 | 78.4% | Reimplemented, asm differs: stripe row zero-extended, width test inverted +SHC_3BB0A8C1_0x004692E0 | 78.4% | Asm differs: stripe row zero-extended, width test inverted SHC_3BB0A8C1_0x004694A0 | 0.0% | Pending @@ -21275,7 +21275,7 @@ SHC_3BB0A8C1_0x00471000 | 0.0% | Pending SHC_3BB0A8C1_0x00471050 | 0.0% | Pending -SHC_3BB0A8C1_0x004710A0 | 38.9% | Reimplemented, asm differs +SHC_3BB0A8C1_0x004710A0 | 38.9% | Asm differs SHC_3BB0A8C1_0x004711B0 | 0.0% | Pending @@ -21285,7 +21285,7 @@ SHC_3BB0A8C1_0x00471280 | 0.0% | Pending SHC_3BB0A8C1_0x004712E0 | 0.0% | Pending -SHC_3BB0A8C1_0x00471340 | 32.8% | Reimplemented, asm differs +SHC_3BB0A8C1_0x00471340 | 32.8% | Asm differs SHC_3BB0A8C1_0x00471440 | 0.0% | Pending @@ -21417,7 +21417,7 @@ SHC_3BB0A8C1_0x004729B0 | 0.0% | Pending SHC_3BB0A8C1_0x00472A90 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00472B20 | 56.3% | Reimplemented, asm differs +SHC_3BB0A8C1_0x00472B20 | 56.3% | Asm differs SHC_3BB0A8C1_0x00472B90 | 0.0% | Pending @@ -21933,7 +21933,7 @@ SHC_3BB0A8C1_0x00475B90 | 0.0% | Pending SHC_3BB0A8C1_0x00475BE0 | 0.0% | Pending -SHC_3BB0A8C1_0x00475CC0 | 52.4% | Reimplemented, asm differs +SHC_3BB0A8C1_0x00475CC0 | 52.4% | Asm differs SHC_3BB0A8C1_0x00475E00 | 0.0% | Pending @@ -22253,7 +22253,7 @@ SHC_3BB0A8C1_0x0047C5D0 | 0.0% | Pending SHC_3BB0A8C1_0x0047C670 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0047C860 | 65.3% | Reimplemented, asm differs +SHC_3BB0A8C1_0x0047C860 | 65.3% | Asm differs SHC_3BB0A8C1_0x0047CA80 | 0.0% | Pending @@ -22311,7 +22311,7 @@ SHC_3BB0A8C1_0x0047D0E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D100 | 0.0% | Pending -SHC_3BB0A8C1_0x0047D190 | 66.9% | Reimplemented, register mismatch: the original keeps the right column in ebp and reloads x +SHC_3BB0A8C1_0x0047D190 | 66.9% | Register mismatch: the original keeps the right column in ebp and reloads x SHC_3BB0A8C1_0x0047D330 | 100.0% | Reimplemented @@ -23623,7 +23623,7 @@ SHC_3BB0A8C1_0x004934E5 | 0.0% | Pending SHC_3BB0A8C1_0x004934F0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00493560 | 96.3% | Reimplemented, only the spill slot of the bar's x differs (the original uses y's home) +SHC_3BB0A8C1_0x00493560 | 96.3% | Only the spill slot of the bar's x differs (the original uses y's home) SHC_3BB0A8C1_0x00493690 | 0.0% | Pending @@ -25537,7 +25537,7 @@ SHC_3BB0A8C1_0x004AAB20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AAB40 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004AAB50 | 41.0% | Reimplemented, asm differs +SHC_3BB0A8C1_0x004AAB50 | 41.0% | Asm differs SHC_3BB0A8C1_0x004AB440 | 100.0% | Reimplemented @@ -25921,7 +25921,7 @@ SHC_3BB0A8C1_0x004AF820 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AF840 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004AF860 | 78.7% | Reimplemented, register mismatch: durationSum stays in a register where the original keeps elementState +SHC_3BB0A8C1_0x004AF860 | 78.7% | Register mismatch: durationSum stays in a register where the original keeps elementState SHC_3BB0A8C1_0x004AFA50 | 100.0% | Reimplemented @@ -25929,13 +25929,13 @@ SHC_3BB0A8C1_0x004AFA80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AFB00 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004AFB30 | 82.0% | Reimplemented, asm differs +SHC_3BB0A8C1_0x004AFB30 | 82.0% | Asm differs SHC_3BB0A8C1_0x004AFDA0 | 0.0% | Pending SHC_3BB0A8C1_0x004AFE10 | 0.0% | Pending -SHC_3BB0A8C1_0x004B0390 | 62.0% | Reimplemented, asm differs +SHC_3BB0A8C1_0x004B0390 | 62.0% | Asm differs SHC_3BB0A8C1_0x004B07C0 | 0.0% | Pending @@ -25989,7 +25989,7 @@ SHC_3BB0A8C1_0x004B1990 | 0.0% | Pending SHC_3BB0A8C1_0x004B19E0 | 0.0% | Pending -SHC_3BB0A8C1_0x004B1AC0 | 76.1% | Reimplemented, register mismatch: the original keeps y in ebp and the group counter in y's home +SHC_3BB0A8C1_0x004B1AC0 | 76.1% | Register mismatch: the original keeps y in ebp and the group counter in y's home SHC_3BB0A8C1_0x004B1C30 | 0.0% | Pending From afe0a5bb7ad9dbefbb0c6963816da7b742654de7 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 7 Nov 2026 20:24:20 +0100 Subject: [PATCH 19/29] drafts: drop five PencilRenderCore drafts that reimpl/UI-PencilRenderCore-2-100 has at 100% drawCurrentPixel (0x00468F20), drawPixelPattern4x4 (0x00468F70), drawBoxWithRoundedEdges (0x004710A0), drawBorderedBoxWithBlendedBackground (0x00471340) and drawLine (0x00472B20) are reimplemented at reccmp 100.0% on reimpl/UI-PencilRenderCore-2-100, rewritten from the binary. Their drafts here (3e7ec7ef8, 2c99182cf, ea42833c1, 8543e6b97 and cfbab8e4b, from gynt's drafts) go, with their status lines back to main's, so that the two branches merge cleanly. Co-Authored-By: Claude Opus 5.5 --- .../drawBorderedBoxWithBlendedBackground.cpp | 58 --------------- .../drawBoxWithRoundedEdges.cpp | 73 ------------------- .../PencilRenderCore/drawCurrentPixel.cpp | 23 ------ .../Rendering/PencilRenderCore/drawLine.cpp | 35 --------- .../PencilRenderCore/drawPixelPattern4x4.cpp | 36 --------- status/addresses-SHC-3BB0A8C1.txt | 10 +-- 6 files changed, 5 insertions(+), 230 deletions(-) delete mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp delete mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp delete mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawCurrentPixel.cpp delete mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp delete mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp deleted file mode 100644 index 4c5f606121..0000000000 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBorderedBoxWithBlendedBackground.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "../PencilRenderCore.func.hpp" - -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" -#include "OpenSHC/IO/Graphics/GmID.hpp" - -#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" - -namespace OpenSHC { -namespace UI { - namespace Rendering { - - // FUNCTION: STRONGHOLDCRUSADER 0x00471340 - void PencilRenderCore::drawBorderedBoxWithBlendedBackground(int xPos, int yPos, int width, int height) - { - int iVar4; - int iVar1 = ((height - 1) / 24 + 1) * 24; - int iVar2 = ((width - 1) / 24 + 1) * 24; - int iVar3 = 0; - if (0 < iVar1) { - do { - if (iVar3 == 0) { - iVar4 = 1; - } else { - iVar4 = (-(uint)(iVar3 != iVar1 - 24) & 0xfffffffa) + 13; - } - int iVar5 = 0; - if (0 < iVar2) { - do { - int imageID = iVar4; - if (iVar5 == 0) { - LAB_004713ce: - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, - imageID, iVar5 + xPos, iVar3 + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, - imageID + 3, 0); - } else { - if (iVar5 == iVar2 - 24) { - imageID = iVar4 + 2; - goto LAB_004713ce; - } - if (iVar4 != 7) { - imageID = iVar4 + 1; - goto LAB_004713ce; - } - } - iVar5 += 24; - } while (iVar5 < iVar2); - } - iVar3 += 24; - } while (iVar3 < iVar1); - } - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, this)( - xPos + 24, yPos + 24, xPos - 25 + iVar2, yPos - 25 + iVar1, 16); - } - - } -} -} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp deleted file mode 100644 index 1394d6fd09..0000000000 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawBoxWithRoundedEdges.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "../PencilRenderCore.func.hpp" - -#include "OpenSHC/UI/Enums/RoundedBoxEdgeRoundingLevel.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -#include "OpenSHC/Globals/DAT_TextInputDefinedData.hpp" - -namespace OpenSHC { -namespace UI { - namespace Rendering { - - using OpenSHC::UI::Enums::RoundedBoxEdgeRoundingLevel; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - // Found no moment, where this one was used. --TheRedDaemon - // FUNCTION: STRONGHOLDCRUSADER 0x004710A0 - void PencilRenderCore::drawBoxWithRoundedEdges( - int left, int top, int right, int bottom, RoundedBoxEdgeRoundingLevel roundingLevel) - { - BOOLEnum _drawReady; - TextInputDefinedData* pTVar3; - int iVar4; - if (roundingLevel == OpenSHC::UI::Enums::RBERL_SLIGHT) { - pTVar3 = DAT_TextInputDefinedData::ptr; - } else { - if (roundingLevel != OpenSHC::UI::Enums::RBERL_STRONG) {} - pTVar3 = (TextInputDefinedData*)0xb37ce8; - } - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencilSurface, this)(); - _drawReady = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencil, this)( - left, top, right, bottom, 0); - dword dVar2 = this->drawEndX; - dword dVar1 = this->drawStartX; - if (_drawReady && (int)(roundingLevel * 2) <= (int)(this->drawEndY - this->drawStartY)) { - iVar4 = 0; - this->drawStartX = dVar1; - this->drawEndX = dVar2; - if (0 < (int)roundingLevel) { - do { - this->drawStartX = dVar1; - this->drawEndX = dVar2; - if (this->currentHeight_0x2c < 0) - break; - this->drawStartX = pTVar3->field_0x0[iVar4] + dVar1; - this->drawEndX = dVar2 - pTVar3->field_0x0[iVar4]; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimHorizontalLine, this)(); - --this->currentHeight_0x2c; - ++this->drawStartY; - ++iVar4; - this->drawStartX = dVar1; - this->drawEndX = dVar2; - } while (iVar4 < (int)roundingLevel); - } - for (; (int)roundingLevel <= this->currentHeight_0x2c; - this->currentHeight_0x2c = this->currentHeight_0x2c - 1) { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimHorizontalLine, this)(); - ++this->drawStartY; - } - for (; - (0 <= (int)(roundingLevel - ((RoundedBoxEdgeRoundingLevel)1)) && (0 <= this->currentHeight_0x2c)); - this->currentHeight_0x2c = this->currentHeight_0x2c - 1) { - this->drawStartX = pTVar3->field_0x0[roundingLevel - 1] + dVar1; - this->drawEndX = dVar2 - pTVar3->field_0x0[roundingLevel - 1]; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimHorizontalLine, this)(); - ++this->drawStartY; - roundingLevel = (RoundedBoxEdgeRoundingLevel)(roundingLevel - 1); - } - } - } - - } -} -} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawCurrentPixel.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawCurrentPixel.cpp deleted file mode 100644 index 302c415523..0000000000 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawCurrentPixel.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "../PencilRenderCore.func.hpp" - -#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" - -namespace OpenSHC { -namespace UI { - namespace Rendering { - -#pragma optimize("g", off) - // FUNCTION: STRONGHOLDCRUSADER 0x00468F20 - void PencilRenderCore::drawCurrentPixel() - { - uint _currentX = this->currentX; - uint _currentY = this->currentY; - ushort _drawColor = this->drawColor; - *(ushort*)((int)DAT_PencilRenderCore::instance.surfacePtr + _currentX * 2 - + _currentY * DAT_PencilRenderCore::instance.horizontalByteSize) = _drawColor; - } -#pragma optimize("g", on) - - } -} -} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp deleted file mode 100644 index a6cbf7fdc2..0000000000 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawLine.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "../PencilRenderCore.func.hpp" - -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -namespace OpenSHC { -namespace UI { - namespace Rendering { - - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - // FUNCTION: STRONGHOLDCRUSADER 0x00472B20 - void PencilRenderCore::drawLine(int x1, int y1, int x2, int y2, ushort color) - { - BOOLEnum _drawReady; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencilSurface, this)(); - _drawReady = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencil, this)( - x1, y1, x2, y2, color); - if (_drawReady) { - if (this->currentWidth_0x28 == 0) { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawVerticalLine, this)(); - } - if (this->currentHeight_0x2c == 0) { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHorizontalLine, this)(); - } - if (this->currentWidth_0x28 < this->currentHeight_0x2c) { - MACRO_CALL_MEMBER( - OpenSHC::UI::Rendering::PencilRenderCore_Func::drawDiagonalHeigherThanWideUnk, this)(); - } - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawDiagonalWiderThanHighUnk, this)(); - } - } - - } -} -} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4.cpp deleted file mode 100644 index 7af1037589..0000000000 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "../PencilRenderCore.func.hpp" - -#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" - -namespace OpenSHC { -namespace UI { - namespace Rendering { - - // FUNCTION: STRONGHOLDCRUSADER 0x00468F70 - void PencilRenderCore::drawPixelPattern4x4(int drawX, int drawY) - { - int _drawPtr = (int)DAT_PencilRenderCore::instance.surfacePtr + drawX * 2 - + (uint)drawY * DAT_PencilRenderCore::instance.horizontalByteSize; - dword _rowOffset = 0; - dword _horizontalByteSize = DAT_PencilRenderCore::instance.horizontalByteSize; - undefined4 _rowPixels = (undefined4)-33841; - undefined4 _rightPixels = 969342976; - *(undefined4*)(_drawPtr + _rowOffset) = _rowPixels; - *(undefined4*)(_drawPtr + _rowOffset + 4) = _rightPixels; - _rowOffset += _horizontalByteSize; - _rowPixels = 2077195215; - *(undefined4*)(_drawPtr + _rowOffset) = _rowPixels; - *(undefined4*)(_drawPtr + _rowOffset + 4) = _rightPixels; - _rowOffset += _horizontalByteSize; - _rowPixels = 969357767; - *(undefined4*)(_drawPtr + _rowOffset) = _rowPixels; - *(undefined4*)(_drawPtr + _rowOffset + 4) = _rightPixels; - _rowOffset += _horizontalByteSize; - _rowPixels = 0; - *(undefined4*)(_drawPtr + _rowOffset) = _rowPixels; - *(undefined4*)(_drawPtr + _rowOffset + 4) = _rowPixels; - } - - } -} -} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 1a3a7480b4..783b00e141 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20107,9 +20107,9 @@ SHC_3BB0A8C1_0x00468E40 | 0.0% | Pending SHC_3BB0A8C1_0x00468EA0 | 0.0% | Pending -SHC_3BB0A8C1_0x00468F20 | 4.5% | Heavy structural mismatch +SHC_3BB0A8C1_0x00468F20 | 0.0% | Pending -SHC_3BB0A8C1_0x00468F70 | 9.3% | Heavy structural mismatch +SHC_3BB0A8C1_0x00468F70 | 0.0% | Pending SHC_3BB0A8C1_0x00468FE0 | 52.0% | Asm differs @@ -21275,7 +21275,7 @@ SHC_3BB0A8C1_0x00471000 | 0.0% | Pending SHC_3BB0A8C1_0x00471050 | 0.0% | Pending -SHC_3BB0A8C1_0x004710A0 | 38.9% | Asm differs +SHC_3BB0A8C1_0x004710A0 | 0.0% | Pending SHC_3BB0A8C1_0x004711B0 | 0.0% | Pending @@ -21285,7 +21285,7 @@ SHC_3BB0A8C1_0x00471280 | 0.0% | Pending SHC_3BB0A8C1_0x004712E0 | 0.0% | Pending -SHC_3BB0A8C1_0x00471340 | 32.8% | Asm differs +SHC_3BB0A8C1_0x00471340 | 0.0% | Pending SHC_3BB0A8C1_0x00471440 | 0.0% | Pending @@ -21417,7 +21417,7 @@ SHC_3BB0A8C1_0x004729B0 | 0.0% | Pending SHC_3BB0A8C1_0x00472A90 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00472B20 | 56.3% | Asm differs +SHC_3BB0A8C1_0x00472B20 | 0.0% | Pending SHC_3BB0A8C1_0x00472B90 | 0.0% | Pending From 6e510e647c70246d0bed69f388289a26664f44b8 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sun, 8 Nov 2026 00:44:16 +0100 Subject: [PATCH 20/29] drafts: drop three PencilRenderCore drafts that reimpl/UI-PencilRenderCore-3-100 has at 100% drawHeaderBanner (0x00468FE0), drawHeaderTextBanner (0x00475CC0) and drawScrollbar (0x004690E0) are at 100% on reimpl/UI-PencilRenderCore-3-100. Their drafts here (402dc083d, 9c437b035, 074c78829) go, and their status lines return to main's, so the two branches merge cleanly. Co-Authored-By: Claude Opus 5.5 --- .../PencilRenderCore/drawHeaderBanner.cpp | 54 ----------- .../PencilRenderCore/drawHeaderTextBanner.cpp | 70 --------------- .../PencilRenderCore/drawScrollbar.cpp | 90 ------------------- status/addresses-SHC-3BB0A8C1.txt | 6 +- 4 files changed, 3 insertions(+), 217 deletions(-) delete mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp delete mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp delete mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp deleted file mode 100644 index a7df2e75cf..0000000000 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "../PencilRenderCore.func.hpp" - -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" -#include "OpenSHC/IO/Graphics/GmID.hpp" - -#include "OpenSHC/Globals/DAT_GMImageHeaders.hpp" -#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" -#include "OpenSHC/Globals/GMFirstPictureIndex.hpp" - -namespace OpenSHC { -namespace UI { - namespace Rendering { - - // FUNCTION: STRONGHOLDCRUSADER 0x00468FE0 - void PencilRenderCore::drawHeaderBanner(int xPos, int yPos, int width, int unusedUnk) - { - int iVar4; - yPos += 8; - int iVar1 = xPos + 8; - int iVar2 = width - 16; - xPos = 0; - do { - if (xPos == 0) { - iVar4 = 48; - } else { - iVar4 = (-(uint)(xPos != 56) & 0xfffffffa) + 60; - } - int iVar3 = 0; - if (0 < iVar2) { - do { - int _imageID = iVar4; - if ((iVar3 != 0) && (_imageID = iVar4 + 2, iVar3 != iVar2 - 8)) { - _imageID = iVar4 + 1; - } - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, _imageID, - iVar3 + iVar1, xPos + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, _imageID + 3, 0); - iVar3 += 8; - } while (iVar3 < iVar2); - } - xPos += 8; - } while (xPos < 64); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 91, iVar1 + 3, yPos + 9, - OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 92, 0); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 91, - (iVar1 - DAT_GMImageHeaders::instance.imh[GMFirstPictureIndex::instance[156] + 90].width) - 3 + iVar2, - yPos + 9, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 92, 0); - } - - } -} -} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp deleted file mode 100644 index ec62db845d..0000000000 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "../PencilRenderCore.func.hpp" - -#include "OpenSHC/Text/TextManager.func.hpp" -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" -#include "OpenSHC/IO/Graphics/GmID.hpp" -#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" -#include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -#include "OpenSHC/Globals/DAT_GMImageHeaders.hpp" -#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" -#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" -#include "OpenSHC/Globals/GMFirstPictureIndex.hpp" - -namespace OpenSHC { -namespace UI { - namespace Rendering { - - // FUNCTION: STRONGHOLDCRUSADER 0x00475CC0 - void PencilRenderCore::drawHeaderTextBanner( - int textGroupIndex, int textNumInGroup, int xPos, int yPos, int width, int param_6) - { - int _textY; - int _width; - int iVar2; - int iVar3; - int iVar4; - int _textX; - int iVar1 = xPos; - iVar2 = xPos + 8; - _width = width - 16; - for (int xPos = 0; xPos < 64; xPos = xPos + 8) { - if (xPos == 0) { - iVar4 = 48; - } else { - iVar4 = (-(uint)(xPos != 56) & 0xfffffffa) + 60; - } - iVar3 = 0; - if (0 < _width) { - do { - int imageID = iVar4; - if ((iVar3 != 0) && (imageID = iVar4 + 2, iVar3 != width - 24)) { - imageID = iVar4 + 1; - } - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, imageID, - iVar3 + iVar2, xPos + yPos + 8, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, imageID + 3, - 0); - iVar3 += 8; - } while (iVar3 < _width); - } - } - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 91, iVar1 + 11, - yPos + 17, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 92, 0); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 91, - (iVar2 - DAT_GMImageHeaders::instance.imh[GMFirstPictureIndex::instance[156] + 90].width) - 3 + _width, - yPos + 17, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 92, 0); - _textY = yPos + 22; - _textX = _width / 2 + iVar2; - 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::eTextSections)textGroupIndex, textNumInGroup), - _textX, _textY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 15, FALSE, 0); - } - - } -} -} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp deleted file mode 100644 index caed392dc6..0000000000 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "../PencilRenderCore.func.hpp" - -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" -#include "OpenSHC/DE/SHCDE/eGM.hpp" -#include "OpenSHC/IO/Graphics/GmID.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" - -namespace OpenSHC { -namespace UI { - namespace Rendering { - - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - // FUNCTION: STRONGHOLDCRUSADER 0x004690E0 - void PencilRenderCore::drawScrollbar( - uint xPos, int yPos, int height, int thumbYPos, BOOLEnum isDragged, int thumbHeight, int blendStrength) - { - int alphaImageID; - int _yPosEnd = height + yPos; - int _yPos = yPos; - if (yPos <= _yPosEnd - 20) { - do { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 79, (int)(xPos), - _yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 80, blendStrength); - _yPos += 20; - } while (_yPos <= _yPosEnd - 20); - } - for (; _yPos < _yPosEnd; ++_yPos) { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 95, (int)(xPos), - _yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 96, blendStrength); - } - if (isDragged) { - if (thumbHeight <= 20) { - MACRO_CALL_MEMBER( - OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( - OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 89, (int)(xPos), yPos + thumbYPos); - } - MACRO_CALL_MEMBER( - OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( - OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 100, (int)(xPos), thumbYPos + yPos); - _yPos = thumbYPos + 10; - if (10 < thumbHeight - 10) { - _yPosEnd = thumbHeight - 20; - do { - MACRO_CALL_MEMBER( - OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( - OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 101, (int)(xPos), _yPos + yPos); - ++_yPos; - --_yPosEnd; - } while (_yPosEnd != 0); - } - MACRO_CALL_MEMBER( - OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( - OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 102, (int)(xPos), yPos + _yPos); - } - if (thumbHeight <= 20) { - alphaImageID = 90; - _yPosEnd = 89; - _yPos = thumbYPos; - } else { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 100, (int)(xPos), - thumbYPos + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 103, blendStrength); - _yPos = thumbYPos + 10; - if (10 < thumbHeight - 10) { - thumbYPos = thumbHeight - 20; - do { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 101, - (int)(xPos), _yPos + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 104, - blendStrength); - ++_yPos; - --thumbYPos; - } while (thumbYPos != 0); - } - alphaImageID = 105; - _yPosEnd = 102; - } - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, _yPosEnd, (int)(xPos), - yPos + _yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, alphaImageID, blendStrength); - } - - } -} -} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 783b00e141..80d41c173a 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20111,9 +20111,9 @@ SHC_3BB0A8C1_0x00468F20 | 0.0% | Pending SHC_3BB0A8C1_0x00468F70 | 0.0% | Pending -SHC_3BB0A8C1_0x00468FE0 | 52.0% | Asm differs +SHC_3BB0A8C1_0x00468FE0 | 0.0% | Pending -SHC_3BB0A8C1_0x004690E0 | 60.1% | Asm differs +SHC_3BB0A8C1_0x004690E0 | 0.0% | Pending SHC_3BB0A8C1_0x00469290 | 0.0% | Pending @@ -21933,7 +21933,7 @@ SHC_3BB0A8C1_0x00475B90 | 0.0% | Pending SHC_3BB0A8C1_0x00475BE0 | 0.0% | Pending -SHC_3BB0A8C1_0x00475CC0 | 52.4% | Asm differs +SHC_3BB0A8C1_0x00475CC0 | 0.0% | Pending SHC_3BB0A8C1_0x00475E00 | 0.0% | Pending From be147cacff47e552756a6fe435552a2398180edc Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sun, 8 Nov 2026 00:44:42 +0100 Subject: [PATCH 21/29] reimplement: SHC_3BB0A8C1_0x004692E0 89.7% drawTableCellBackground PencilRenderCore::drawTableCellBackground, from gynt's draft (b1841933a, 26.83%; 7c68476b1, 26.8%, in his closed #255; the same body with his style passes at 63cc49fb3 on his fork's reimpl/UI-Rendering-development; our 4d8dc9310, 78.4%, before this). The two highlighted branches (selected, or the button being interacted with), their left end, middle pieces and right end with the middle's mask, the run of stripes otherwise, and the button width raised to 21 when it is narrower are his. New here: the width tests as > 20 and > 21, the binary's jle 0x14 / jle 0x15 with the draw first; x passed for the left end too; the pictures named; the stripe picture without the (char) cast, which made MSVC load the byte zero-extended and in eax before the pushes (quick_diff 0.8339 -> 0.9481, reccmp 78.4% -> 89.7%). Left: the original reads the index as a sign-extended byte (movsx edi, byte ptr [esp + 0x10]), which no form tried reproduces (a char parameter, a char local, casts, ternary and if forms all give movzx), and its second branch keeps ButtonY and the loop bound in other registers than its identical first branch. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../drawTableCellBackground.cpp | 79 +++++++++++-------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 47 insertions(+), 34 deletions(-) diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp index 72d955b564..de6c9462ed 100644 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp @@ -16,58 +16,71 @@ namespace UI { using OpenSHC::WindowsHelper::Enums::BOOLEnum; + // Pictures in GID_INTERFACE_ICONS_3, 20 pixels wide: a highlighted cell's ends and middles (the right end + // uses the middle's mask), or a run of stripe 69 or 71 by the row; each picture is followed by its mask. + enum { + TABLE_CELL_LEFT_PICTURE = 73, + TABLE_CELL_MIDDLE_PICTURE = 74, + TABLE_CELL_RIGHT_PICTURE = 75, + TABLE_CELL_LEFT_MASK = 76, + TABLE_CELL_MIDDLE_MASK = 77, + TABLE_CELL_STRIPE_PICTURES = 69, + TABLE_CELL_PIECE_WIDTH = 20 + }; + // FUNCTION: STRONGHOLDCRUSADER 0x004692E0 void PencilRenderCore::drawTableCellBackground(BOOLEnum isSelected, int indexToGetStripes, int blendStrength) { - int iVar1 = DAT_ButtonX::instance; - uint imageID = ((int)(char)indexToGetStripes & 1U) * 2 | 0x45; + int x = DAT_ButtonX::instance; + int const stripePicture = (indexToGetStripes & 1) * 2 | TABLE_CELL_STRIPE_PICTURES; if (isSelected) { - if (DAT_ButtonW::instance < 21) { - ++DAT_ButtonW::instance; - } else { + if (DAT_ButtonW::instance > TABLE_CELL_PIECE_WIDTH) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 73, - (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance), - OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 76, blendStrength); - iVar1 += 20; + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_LEFT_PICTURE, x, DAT_ButtonY::instance, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_LEFT_MASK, blendStrength); + x += TABLE_CELL_PIECE_WIDTH; + } else { + ++DAT_ButtonW::instance; } - while (iVar1 < DAT_ButtonW::instance - 20 + DAT_ButtonX::instance) { + for (; x < DAT_ButtonW::instance + DAT_ButtonX::instance - TABLE_CELL_PIECE_WIDTH; + x += TABLE_CELL_PIECE_WIDTH) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 74, iVar1, - (int)(DAT_ButtonY::instance), OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 77, blendStrength); - iVar1 += 20; + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_MIDDLE_PICTURE, x, DAT_ButtonY::instance, + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, TABLE_CELL_MIDDLE_MASK, blendStrength); } } else if (DAT_ButtonCurrentlyInteracting::instance) { - if (DAT_ButtonW::instance < 21) { - ++DAT_ButtonW::instance; - } else { + if (DAT_ButtonW::instance > TABLE_CELL_PIECE_WIDTH) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 73, - (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance), - OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 76, blendStrength); - iVar1 += 20; + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_LEFT_PICTURE, x, DAT_ButtonY::instance, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_LEFT_MASK, blendStrength); + x += TABLE_CELL_PIECE_WIDTH; + } else { + ++DAT_ButtonW::instance; } - while (iVar1 < DAT_ButtonW::instance - 20 + DAT_ButtonX::instance) { + for (; x < DAT_ButtonW::instance + DAT_ButtonX::instance - TABLE_CELL_PIECE_WIDTH; + x += TABLE_CELL_PIECE_WIDTH) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 74, iVar1, - (int)(DAT_ButtonY::instance), OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 77, blendStrength); - iVar1 += 20; + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_MIDDLE_PICTURE, x, DAT_ButtonY::instance, + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, TABLE_CELL_MIDDLE_MASK, blendStrength); } } else { - // The unselected, untouched cell is drawn as a run of stripes rather than end-cap plus middles - while (iVar1 < DAT_ButtonW::instance + DAT_ButtonX::instance) { + for (; x < DAT_ButtonW::instance + DAT_ButtonX::instance; x += TABLE_CELL_PIECE_WIDTH) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, (int)(imageID), - iVar1, (int)(DAT_ButtonY::instance), OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, - (int)(imageID + 1), blendStrength); - iVar1 += 20; + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, stripePicture, + x, DAT_ButtonY::instance, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, stripePicture + 1, + blendStrength); } return; } - if (21 < DAT_ButtonW::instance) { + if (DAT_ButtonW::instance > TABLE_CELL_PIECE_WIDTH + 1) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 75, iVar1, - (int)(DAT_ButtonY::instance), OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, 77, blendStrength); + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_RIGHT_PICTURE, x, DAT_ButtonY::instance, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_MIDDLE_MASK, blendStrength); } } diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 80d41c173a..3794ff977a 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20117,7 +20117,7 @@ SHC_3BB0A8C1_0x004690E0 | 0.0% | Pending SHC_3BB0A8C1_0x00469290 | 0.0% | Pending -SHC_3BB0A8C1_0x004692E0 | 78.4% | Asm differs: stripe row zero-extended, width test inverted +SHC_3BB0A8C1_0x004692E0 | 89.7% | Asm differs: the stripe index is read as a dword where the original sign-extends its low byte, and the second branch keeps other registers SHC_3BB0A8C1_0x004694A0 | 0.0% | Pending From a2044867434a60ec7b66ff7d1120518be36e8f03 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Thu, 19 Nov 2026 23:52:15 +0100 Subject: [PATCH 22/29] drafts: move the Roundtable render to the ready PR Roundtable::MenuModalRenderFunction_Roundtable (0x004B1AC0) reaches reccmp 100.0 (normalized 100.0) on main 3458fea34 and goes out with the ready branch reimpl/UI-B-round22-100 (9d405f21c), with a behaviour fix: this draft added the group counter to each shield's x where the original adds the x parameter. Its file leaves this draft and its status line goes back to main's. Co-Authored-By: Claude Opus 5.5 --- .../MenuModalRenderFunction_Roundtable.cpp | 83 ------------------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp diff --git a/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp b/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp deleted file mode 100644 index 45dd14b449..0000000000 --- a/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "../Roundtable.func.hpp" - -#include "OpenSHC/UI/BottomLeftTextDisplayState.func.hpp" -#include "OpenSHC/UI/MenuModalComposition.func.hpp" -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" -#include "OpenSHC/UI/Enums/MenuModalType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -#include "OpenSHC/Globals/DAT_00df4288.hpp" -#include "OpenSHC/Globals/DAT_BottomLeftTextDisplayState.hpp" -#include "OpenSHC/Globals/DAT_ButtonH.hpp" -#include "OpenSHC/Globals/DAT_ButtonW.hpp" -#include "OpenSHC/Globals/DAT_ButtonX.hpp" -#include "OpenSHC/Globals/DAT_ButtonY.hpp" -#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" -#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" -#include "OpenSHC/Globals/DAT_MouseState.hpp" -#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" - -namespace OpenSHC { -namespace UI { - namespace MenuModals { - - // FUNCTION: STRONGHOLDCRUSADER 0x004B1AC0 - void Roundtable::MenuModalRenderFunction_Roundtable(int x, int y, int width, int height) - { - if (DAT_MouseState::instance.rightClickStart != 0) { - MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, - DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); - } - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, - DAT_TextureRenderCoreObject::ptr)(2, x + 8, y + 8); - // Each seat's shield position at the table, clockwise from the top left - int seatPositions[8][2] = { - { 12, 12 }, - { 216, 12 }, - { 398, 12 }, - { 397, 103 }, - { 398, 193 }, - { 216, 192 }, - { 12, 193 }, - { 12, 103 }, - }; - // Players sit in their groups' order; each new group switches between the plain and the tinted shields - int tint = 1; - int group = 0; - for (int seat = 1; seat < countof(DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray); ++seat) { - int const player = DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[seat]; - if (player < 1 || DAT_GameSynchronyState::instance.DAT_PlayerGroupArray[player] < 1) { - break; - } - if (DAT_GameSynchronyState::instance.DAT_PlayerGroupArray[player] > group) { - ++group; - ++tint; - if (tint > 1) { - tint = 0; - } - } - if (tint == 0) { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, - DAT_TextureRenderCoreObject::ptr)( - seat + 2, seatPositions[seat - 1][0] + group, seatPositions[seat - 1][1] + y, 16); - } else { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, - DAT_TextureRenderCoreObject::ptr)( - seat + 2 + tint * 8, seatPositions[seat - 1][0] + group, seatPositions[seat - 1][1] + y, 20); - } - } - DAT_ButtonY::instance = y + 380; - DAT_ButtonX::instance = x + 24; - DAT_ButtonW::instance = 380; - DAT_ButtonH::instance = 40; - if (DAT_00df4288::instance != 0) { - MACRO_CALL_MEMBER( - OpenSHC::UI::BottomLeftTextDisplayState_Func::renderCurrentlyDisplayedTextConstructionCost, - DAT_BottomLeftTextDisplayState::ptr)(0); - DAT_00df4288::instance = 0; - } - } - - } -} -} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3794ff977a..01e77e735e 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25989,7 +25989,7 @@ SHC_3BB0A8C1_0x004B1990 | 0.0% | Pending SHC_3BB0A8C1_0x004B19E0 | 0.0% | Pending -SHC_3BB0A8C1_0x004B1AC0 | 76.1% | Register mismatch: the original keeps y in ebp and the group counter in y's home +SHC_3BB0A8C1_0x004B1AC0 | 0.0% | Pending SHC_3BB0A8C1_0x004B1C30 | 0.0% | Pending From 2b09210471da1a446e795ed59aa96502eedd60e8 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 20 Nov 2026 15:01:16 +0100 Subject: [PATCH 23/29] drafts: move MenuModalRenderFunction_CreditsScroll to the ready PR CreditsScroll::MenuModalRenderFunction_CreditsScroll (0x004AAB50) reaches reccmp 100.0 (normalized 100.0) on main 3458fea34 and goes out with the ready branch reimpl/UI-B-round26-100 (015b79f74). Its file leaves this draft and its status line goes back to main's. Co-Authored-By: Claude Fable 5.2 --- .../MenuModalRenderFunction_CreditsScroll.cpp | 207 ------------------ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 1 insertion(+), 208 deletions(-) delete mode 100644 src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp diff --git a/src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp b/src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp deleted file mode 100644 index 086c8edc79..0000000000 --- a/src/OpenSHC/UI/MenuModals/CreditsScroll/MenuModalRenderFunction_CreditsScroll.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include "../CreditsScroll.func.hpp" - -#include "OpenSHC/Text/TextEditorState.func.hpp" -#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" -#include "OpenSHC/Globals/DAT_TextEditorState.hpp" - -namespace OpenSHC { -namespace UI { - namespace MenuModals { - - // FUNCTION: STRONGHOLDCRUSADER 0x004AAB50 - void CreditsScroll::MenuModalRenderFunction_CreditsScroll(int x, int y, int width, int height) - { - int iVar1; - if (DAT_TextEditorState::instance.pendingCreditsFadeBorder) { - DAT_TextEditorState::instance.pendingCreditsFadeBorder = FALSE; - MACRO_CALL_MEMBER( - OpenSHC::Text::TextEditorState_Func::setTextRenderingLogic, DAT_TextEditorState::ptr)(); - int right = x - 1 + width; - int local_58 = 0; - int left = x + 1; - int local_10 = -600; - int local_14 = -570; - int local_18 = -540; - int local_1c = -0x1fe; - int local_20 = -0x1e0; - int local_24 = -450; - int local_28 = -420; - int local_2c = -390; - int local_30 = -360; - int local_34 = -330; - int local_38 = -300; - int local_3c = -270; - int local_40 = -0xf0; - int local_44 = -210; - int local_48 = -180; - int local_4c = -150; - int local_50 = -90; - int local_54 = -0x3c; - int local_c = 0x1e; - int fadeCol3 = -0x78; - int iVar2 = y; - do { - iVar1 = iVar2 + 3; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x, iVar2, x, iVar1, 32 - local_c / 20); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(left, iVar2, left, iVar1, local_54 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 2, iVar2, x + 2, iVar1, local_50 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 3, iVar2, x + 3, iVar1, fadeCol3 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 4, iVar2, x + 4, iVar1, local_4c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 5, iVar2, x + 5, iVar1, local_48 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 6, iVar2, x + 6, iVar1, local_44 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 7, iVar2, x + 7, iVar1, local_40 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 8, iVar2, x + 8, iVar1, local_3c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 9, iVar2, x + 9, iVar1, local_38 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 10, iVar2, x + 10, iVar1, local_34 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 11, iVar2, x + 11, iVar1, local_30 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 12, iVar2, x + 12, iVar1, local_2c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 13, iVar2, x + 13, iVar1, local_28 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 14, iVar2, x + 14, iVar1, local_24 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 0xf, iVar2, x + 0xf, iVar1, local_20 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 16, iVar2, x + 16, iVar1, local_1c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 17, iVar2, x + 17, iVar1, local_18 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 18, iVar2, x + 18, iVar1, local_14 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 19, iVar2, x + 19, iVar1, local_10 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 20, iVar2, right, iVar1, local_58 + 2); - local_50 += 3; - fadeCol3 += 4; - local_4c += 5; - local_48 += 6; - local_44 += 7; - local_40 += 8; - local_3c += 9; - local_38 += 10; - local_34 += 11; - local_30 += 12; - local_2c += 13; - local_28 += 14; - local_24 += 0xf; - local_20 += 16; - local_1c += 17; - local_18 += 18; - local_14 += 19; - local_10 += 20; - ++local_58; - --local_c; - local_54 += 2; - iVar2 += 4; - } while (local_54 < 0); - local_58 = 0; - local_50 = -600; - local_4c = -570; - local_48 = -540; - local_44 = -0x1fe; - local_40 = -0x1e0; - local_3c = -450; - local_38 = -420; - local_34 = -390; - local_30 = -360; - local_2c = -330; - local_28 = -300; - local_24 = -270; - local_20 = -0xf0; - local_1c = -210; - local_18 = -180; - local_14 = -150; - local_54 = -0x78; - local_10 = -90; - local_c = -0x3c; - int local_8 = 0x1e; - iVar2 = y + height; - do { - iVar1 = iVar2 + 3; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x, iVar2, x, iVar1, 32 - local_8 / 20); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(left, iVar2, left, iVar1, local_c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 2, iVar2, x + 2, iVar1, local_10 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 3, iVar2, x + 3, iVar1, local_54 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 4, iVar2, x + 4, iVar1, local_14 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 5, iVar2, x + 5, iVar1, local_18 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 6, iVar2, x + 6, iVar1, local_1c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 7, iVar2, x + 7, iVar1, local_20 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 8, iVar2, x + 8, iVar1, local_24 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 9, iVar2, x + 9, iVar1, local_28 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 10, iVar2, x + 10, iVar1, local_2c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 11, iVar2, x + 11, iVar1, local_30 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 12, iVar2, x + 12, iVar1, local_34 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 13, iVar2, x + 13, iVar1, local_38 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 14, iVar2, x + 14, iVar1, local_3c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 0xf, iVar2, x + 0xf, iVar1, local_40 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 16, iVar2, x + 16, iVar1, local_44 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 17, iVar2, x + 17, iVar1, local_48 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 18, iVar2, x + 18, iVar1, local_4c / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 19, iVar2, x + 19, iVar1, local_50 / 20 + 32); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x + 20, iVar2, right, iVar1, local_58 + 2); - local_10 += 3; - local_14 += 5; - local_18 += 6; - local_1c += 7; - local_20 += 8; - local_24 += 9; - local_28 += 10; - local_2c += 11; - local_30 += 12; - local_34 += 13; - local_38 += 14; - local_3c += 0xf; - local_40 += 16; - local_44 += 17; - local_48 += 18; - local_4c += 19; - local_50 += 20; - local_54 += 4; - ++local_58; - --local_8; - local_c += 2; - iVar2 -= 4; - } while (local_c < 0); - } - } - - } -} -} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 01e77e735e..57f26edffd 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25537,7 +25537,7 @@ SHC_3BB0A8C1_0x004AAB20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AAB40 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004AAB50 | 41.0% | Asm differs +SHC_3BB0A8C1_0x004AAB50 | 0.0% | Pending SHC_3BB0A8C1_0x004AB440 | 100.0% | Reimplemented From d3f9831c1ad4a4ce94f16b2f8dbbcb16a8d9b8dc Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 20 Nov 2026 15:01:16 +0100 Subject: [PATCH 24/29] drafts: move RenderInGameWinDefeatWindowDisplayElement to the ready PR DisplayElements::RenderInGameWinDefeatWindowDisplayElement (0x004AFB30) reaches reccmp 100.0 (normalized 100.0) on main 3458fea34 and goes out with the ready branch reimpl/UI-B-round26-100 (015b79f74). Its file leaves this draft and its status line goes back to main's. Co-Authored-By: Claude Fable 5.2 --- ...derInGameWinDefeatWindowDisplayElement.cpp | 137 ------------------ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 1 insertion(+), 138 deletions(-) delete mode 100644 src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp diff --git a/src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp b/src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp deleted file mode 100644 index 8e906862d2..0000000000 --- a/src/OpenSHC/UI/DisplayElements/RenderInGameWinDefeatWindowDisplayElement.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include "../DisplayElements.func.hpp" - -#include "OpenSHC/Game/GameCore.func.hpp" -#include "OpenSHC/Text/TextManager.func.hpp" -#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" -#include "OpenSHC/DE/SHCDE/eTextSections.hpp" -#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" -#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" -#include "OpenSHC/Text/GameLanguage.hpp" -#include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/UI/Enums/MenuViewType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" -#include "OpenSHC/Globals/DAT_GameCore.hpp" -#include "OpenSHC/Globals/DAT_GameState.hpp" -#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" -#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" -#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp" -#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" - -namespace OpenSHC { -namespace UI { - - // FUNCTION: STRONGHOLDCRUSADER 0x004AFB30 - void DisplayElements::RenderInGameWinDefeatWindowDisplayElement(int posX, int posY, DWORD elementState) - { - char (*textAddress)[250]; - int iVar4; - int* piVar5; - short* local_8; - // The original is built with /GS and sets up a security cookie here, so its source declared a local buffer - // larger than 4 bytes whose address escaped. Nothing in the original reads that buffer, so its element type - // and length cannot be recovered - this is the smallest declaration that reproduces the cookie and the - // original's 8-byte frame exactly. It is a reconstruction of the frame, not a recovered name. - short _securityCookieBuffer[3]; - local_8 = _securityCookieBuffer; - DWORD DVar1 = timeGetTime(); - if (8000 < DVar1 - DAT_GameState::instance.mapAndTime.gameOverTime) { - if (DAT_GameState::instance.mapAndTime.playerIsAlive[DAT_GameSynchronyState::instance.currentPlayerSlotID] - != 0) { - DAT_GameCore::instance.isVictoryOrDefeatUnk = 0; - MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( - OpenSHC::UI::Enums::MVT_MISSION_FINISHED_TRANSITION, 0); - } else { - MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( - OpenSHC::UI::Enums::MVT_GAME_LOSTUnk, 0); - } - } - int _alivePlayerCount = 0; - if (DAT_GameState::instance.mapAndTime.playerIsAlive[1] != 0) { - _alivePlayerCount = 1; - } - if (DAT_GameState::instance.mapAndTime.playerIsAlive[2] != 0) { - ++_alivePlayerCount; // written out as in the draft; not tried as a loop - } - if (DAT_GameState::instance.mapAndTime.playerIsAlive[3] != 0) { - ++_alivePlayerCount; - } - if (DAT_GameState::instance.mapAndTime.playerIsAlive[4] != 0) { - ++_alivePlayerCount; - } - if (DAT_GameState::instance.mapAndTime.playerIsAlive[5] != 0) { - ++_alivePlayerCount; - } - if (DAT_GameState::instance.mapAndTime.playerIsAlive[6] != 0) { - ++_alivePlayerCount; - } - if (DAT_GameState::instance.mapAndTime.playerIsAlive[7] != 0) { - ++_alivePlayerCount; - } - if (DAT_GameState::instance.mapAndTime.playerIsAlive[8] != 0) { - ++_alivePlayerCount; - } - DAT_PencilRenderCore::instance.surfaceTarget = OpenSHC::Rendering::Enums::RT_MAP_GAME; - int iVar3 = _alivePlayerCount * 0x1e - 6; - iVar3 += (29 - (iVar3 + 29) % 0x1e); - iVar4 = posY + (-28 - iVar3 / 2); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderedBoxWithBlendedBackground, - DAT_PencilRenderCore::ptr)(posX - 264, iVar4 - 19, 528, iVar3 + 96); - DAT_PencilRenderCore::instance.surfaceTarget = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; - // "Defeat" - if (DAT_GameState::instance.mapAndTime.playerIsAlive[DAT_GameSynchronyState::instance.currentPlayerSlotID] - != 0) { - 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_MAINOPTIONS, 16), - posX, iVar4, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 15, FALSE, 0); - } else { - 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_MAINOPTIONS, 17), - posX, iVar4, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 15, FALSE, 0); - } - iVar4 += 57; - piVar5 = DAT_BlendingDefinedData::instance.PlayerSlotUnitColor + 1; - textAddress = DAT_GameSynchronyState::instance.DAT_PlayerNames + 1; - local_8 = DAT_GameState::instance.mapAndTime.playerIsAlive + 1; - do { - if (*local_8 != 0) { - if ((DAT_TextManagerObject::instance.gameLanguage == OpenSHC::Text::GL_ENGLISH) - || (DAT_TextManagerObject::instance.gameLanguage == OpenSHC::Text::GL_AMERICAN)) { - MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, - DAT_TextManagerObject::ptr)(*textAddress, posX - 28, iVar4, OpenSHC::Text::TTA_CENTER, - DAT_RenderingDefinedData::instance.ColorArray[*piVar5], 0, 17, FALSE, 0); - // "Wins" - MACRO_CALL_MEMBER( - OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 64), - DAT_TextManagerObject::instance.currentXOffset_0x0 / 2 - 22 + posX, iVar4, - OpenSHC::Text::TTA_LEFT, DAT_RenderingDefinedData::instance.ColorArray[*piVar5], 0, 17, FALSE, - 0); - } else { - MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, - DAT_TextManagerObject::ptr)(*textAddress, posX - 78, iVar4, OpenSHC::Text::TTA_CENTER, - DAT_RenderingDefinedData::instance.ColorArray[*piVar5], 0, 18, FALSE, 0); - // "Wins" - MACRO_CALL_MEMBER( - OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 64), - DAT_TextManagerObject::instance.currentXOffset_0x0 / 2 - 72 + posX, iVar4, - OpenSHC::Text::TTA_LEFT, DAT_RenderingDefinedData::instance.ColorArray[*piVar5], 0, 18, FALSE, - 0); - } - iVar4 += 0x1e; - } - ++local_8; - ++piVar5; - ++textAddress; - } while ((int)local_8 < (int)&DAT_GameState::instance + 0x53e9a); - ; - } - -} -} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 57f26edffd..d0686666aa 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25929,7 +25929,7 @@ SHC_3BB0A8C1_0x004AFA80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AFB00 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004AFB30 | 82.0% | Asm differs +SHC_3BB0A8C1_0x004AFB30 | 0.0% | Pending SHC_3BB0A8C1_0x004AFDA0 | 0.0% | Pending From 54856921d612254bc1f1c8e38b84415217ff58bb Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 20 Nov 2026 15:01:17 +0100 Subject: [PATCH 25/29] reimplement: SHC_3BB0A8C1_0x0047C860 65.1% the modem box's top was 345 too low ChooseNetworkServiceProvider::MenuModalRenderFunction_ChooseNetworkServiceProvider: a behaviour fix in the draft. The second box, drawn on the modem tab, reaches from y + 265 to y + 345. The original takes the top first (lea ebx, [edi + 0x109] at 0x0047C9C5) and then moves y on to the bottom (add edi, 0x159). The draft moved y first and then wrote the top as y + 265, which made it y + 610, 345 pixels below where it belongs (265 below the box's bottom), and the frame's lines with it. The top is a local again, set in front of `y += 345`. Where it came from: gynt's 968b1ee68 ("65.32% esi/edi split, orig lea x3", on his fork's reimpl/UI-MenuModals-development) replaced the local of his 8f37773b4 (65.13%) by `(y + 0x109)` behind the move, and our c8ff9d9d9 took that file over as it was. So the 0.2 points between the two were a changed value, not a better match. sourcehold's reimpl/UI-MenuModals has the top right, and so has the newest commit on the file, af1d7904a on his fork's reimpl/UI-MenuItems-development (the older text, 35.3% there). Measured: reccmp 65.1% (normalized 65.1%) in a narrow build of the file on main 3458fea34, with TEXT_MULTIPLAYER_CONNECTION in place of 76 so that it compiles there, data resolvers and its own resolver on; 65.3% with the wrong top. Not run in game. What is left: x and y swap esi and edi, and x + 440 keeps a register where the original keeps y + 85 and works x + 440 out again at each use. Tried without a gain: both boxes written from x and y alone, with and without locals for their sides (0.56 to 0.61 in quick_diff against this form's 0.68), and the second box as `y += 180` in front of the first box's text. Co-authored-by: Gynt Co-Authored-By: Claude Fable 5.2 --- ...alRenderFunction_ChooseNetworkServiceProvider.cpp | 12 +++++++----- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp b/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp index fb33a6cc50..50afda7a48 100644 --- a/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp +++ b/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp @@ -54,23 +54,25 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( x + 440, listTop, x + 440, listBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); if (DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM) { + // the top first: y moves on to the box's bottom below + int modemTop = y + 265; y += 345; int modemRight = x + 440; int modemLeft = x + 40; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( - modemLeft, (y + 265), modemRight, y); + modemLeft, modemTop, modemRight, y); x += 461; --modemLeft; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - modemLeft, (y + 265) - 1, x, (y + 265) - 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + modemLeft, modemTop - 1, x, modemTop - 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( modemLeft, y + 1, x, y + 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - modemLeft, (y + 265), modemLeft, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + modemLeft, modemTop, modemLeft, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - x, (y + 265), x, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + x, modemTop, x, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - modemRight, (y + 265), modemRight, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + modemRight, modemTop, modemRight, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); } } } diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index d0686666aa..feac83a8c3 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22253,7 +22253,7 @@ SHC_3BB0A8C1_0x0047C5D0 | 0.0% | Pending SHC_3BB0A8C1_0x0047C670 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0047C860 | 65.3% | Asm differs +SHC_3BB0A8C1_0x0047C860 | 65.1% | x and y swap esi and edi; x + 440 keeps a register where the original keeps y + 85 SHC_3BB0A8C1_0x0047CA80 | 0.0% | Pending From 68b56e49535ffeb54dbfa6448dc198549ee57859 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Fri, 20 Nov 2026 21:27:55 +0100 Subject: [PATCH 26/29] reimplement: SHC_3BB0A8C1_0x004692E0 95.2% the right piece in the first arm; one byte read left PencilRenderCore::drawTableCellBackground, 89.7% to 95.2% (91.5% normalized), on top of be147cacf (our rewrite with gynt's draft). gynt's commits on it: 7c68476b1 at 26.8% on sourcehold's reimpl/UI-Rendering, b1841933a at 26.83% and 63cc49fb3, the newest, on his fork's reimpl/UI-Rendering-development, whose status line records 75.5%. The second arm's registers match now. The selected cell and the cell under the mouse draw the same pieces, and the original gives the second arm's three scratch registers in another order than the first's (the row's y in ecx at 0x004693AB against eax at 0x00469310, and so on round). Our two arms had the first arm's order twice. Written with the right piece inside the first arm, followed by a return, and once more behind the second arm, both arms come out as the original's; the compiler still emits the right piece once (0x00469426). The lever: a block that follows an if / else join, written out inside one arm, changes that arm's registers. Left is one instruction: the original reads the stripe index as a sign-extended byte (movsx edi, byte ptr [esp + 0x10] at 0x004692E8), ours as a dword. It is one byte longer, so reccmp also counts the four jumps across the loop's padding (jge 0x0046934E, jmp 0x0046938B, je 0x00469397 and jge 0x004693EA) and the padding itself, which is a jmp plus a lea in ours where the original has one lea (137 instructions against 136, 130 of them the same: 2 x 130 / 273 = 95.2). quick_diff shows only the byte read (0.9926, 135 instructions on both sides). Tried for the byte read, all without it: the parameter as a char (header and resolver changed locally, not committed) with the picture's expression in nine spellings, among them an int local set from it, step by step assignments, casts to int, uint and short, a shift, a conditional expression and an inline helper that takes an int: every one reads movzx into eax and copies it to edi later, which also turns the arms' registers back. The char parameter updated in place does byte arithmetic in al. A cast on the int parameter reads movzx as well. With % 2 in place of & 1 the char parameter is read with movsx, but into eax, and the remainder's code is longer. Measured in a narrow build of the file on main 3458fea34, data resolvers and its own resolver on. Not run in game. Co-authored-by: Gynt Co-Authored-By: Claude Fable 5.2 --- .../PencilRenderCore/drawTableCellBackground.cpp | 9 +++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp index de6c9462ed..bbb72a1557 100644 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawTableCellBackground.cpp @@ -50,6 +50,15 @@ namespace UI { TABLE_CELL_MIDDLE_PICTURE, x, DAT_ButtonY::instance, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, TABLE_CELL_MIDDLE_MASK, blendStrength); } + // the right piece is written in this arm and once more behind the other one (written once behind both, + // the second arm's three scratch registers come out rotated) + if (DAT_ButtonW::instance > TABLE_CELL_PIECE_WIDTH + 1) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + TABLE_CELL_RIGHT_PICTURE, x, DAT_ButtonY::instance, + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, TABLE_CELL_MIDDLE_MASK, blendStrength); + } + return; } else if (DAT_ButtonCurrentlyInteracting::instance) { if (DAT_ButtonW::instance > TABLE_CELL_PIECE_WIDTH) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index feac83a8c3..21d0744d68 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20117,7 +20117,7 @@ SHC_3BB0A8C1_0x004690E0 | 0.0% | Pending SHC_3BB0A8C1_0x00469290 | 0.0% | Pending -SHC_3BB0A8C1_0x004692E0 | 89.7% | Asm differs: the stripe index is read as a dword where the original sign-extends its low byte, and the second branch keeps other registers +SHC_3BB0A8C1_0x004692E0 | 95.2% | One instruction: the original reads the stripe index as a sign-extended byte (movsx edi, byte ptr [esp + 0x10]) SHC_3BB0A8C1_0x004694A0 | 0.0% | Pending From a8d6492603287a2924b8bc4fdee3972712f9b5e3 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sun, 22 Nov 2026 14:36:29 +0100 Subject: [PATCH 27/29] drafts: move the load and save progress bar's box to the ready PR ProgressBarBox::MenuModalRenderFunction_ProgressBarBox (0x00493560) reaches reccmp 100.0 (normalized 100.0) on main 3458fea34, off the /GL list and on it, and goes out with the ready branch reimpl/UI-A-progressbarbox-100 (bfac9fd223). Its file leaves this draft and its status line goes back to main's. Co-Authored-By: Claude Opus 5.5 --- ...MenuModalRenderFunction_ProgressBarBox.cpp | 66 ------------------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 src/OpenSHC/UI/MenuModals/ProgressBarBox/MenuModalRenderFunction_ProgressBarBox.cpp diff --git a/src/OpenSHC/UI/MenuModals/ProgressBarBox/MenuModalRenderFunction_ProgressBarBox.cpp b/src/OpenSHC/UI/MenuModals/ProgressBarBox/MenuModalRenderFunction_ProgressBarBox.cpp deleted file mode 100644 index f83f19281e..0000000000 --- a/src/OpenSHC/UI/MenuModals/ProgressBarBox/MenuModalRenderFunction_ProgressBarBox.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "../ProgressBarBox.func.hpp" - -#include "OpenSHC/Text/TextManager.func.hpp" -#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" -#include "OpenSHC/DE/SHCDE/eTextSections.hpp" -#include "OpenSHC/Game/GameMode.hpp" -#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" -#include "OpenSHC/Text/GameLanguage.hpp" -#include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" -#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" -#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" -#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" -#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" - -namespace OpenSHC { -namespace UI { - namespace MenuModals { - - // FUNCTION: STRONGHOLDCRUSADER 0x00493560 - void ProgressBarBox::MenuModalRenderFunction_ProgressBarBox(int x, int y, int width, int height) - { - if (DAT_TextManagerObject::instance.gameLanguage == OpenSHC::Text::GL_ENGLISH - || DAT_TextManagerObject::instance.gameLanguage == OpenSHC::Text::GL_AMERICAN) { - 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, - (int)(DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter)), - width / 2 + x, y + 25, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 16, FALSE, - 0); - } else { - 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, - (int)(DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter)), - width / 2 + x, y + 25, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 18, FALSE, - 0); - } - if (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY - && DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER - && DAT_GameSynchronyState::instance.saveRelated != 0) { - int barInset = (width - 300) / 2; - int barY = y + 65; - int barBottom = y + 80; - height = barInset + x; - MACRO_CALL_MEMBER( - OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)(height, - barY, (x - barInset) + width, barBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - DAT_MenuTextInputState::instance.progressBarY = barY; - DAT_MenuTextInputState::instance.progressBarX = height; - } else { - int barInset = (width - 300) / 2; - int barY = y + 65; - int barBottom = y + 80; - height = barInset + x; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( - height, barY, (x - barInset) + width, barBottom); - DAT_MenuTextInputState::instance.progressBarY = barY; - DAT_MenuTextInputState::instance.progressBarX = height; - } - } - } -} -} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 21d0744d68..8737cf9b59 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23623,7 +23623,7 @@ SHC_3BB0A8C1_0x004934E5 | 0.0% | Pending SHC_3BB0A8C1_0x004934F0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00493560 | 96.3% | Only the spill slot of the bar's x differs (the original uses y's home) +SHC_3BB0A8C1_0x00493560 | 0.0% | Pending SHC_3BB0A8C1_0x00493690 | 0.0% | Pending From cd54c52a9baf328daeb4a27d6d08d1ce9aef64aa Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 23 Nov 2026 00:53:44 +0100 Subject: [PATCH 28/29] drafts: move the network service provider modal to the ready PR ChooseNetworkServiceProvider::MenuModalRenderFunction_ChooseNetworkServiceProvider (0x0047C860) reaches reccmp 100.0 (normalized 100.0), off the /GL list and on it, and goes out with the ready branch reimpl/UI-A-netmodals-100 (5a9422dd69, on main 0e4a83b5d2). Its file leaves this draft and its status line goes back to main's. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...rFunction_ChooseNetworkServiceProvider.cpp | 80 ------------------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp diff --git a/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp b/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp deleted file mode 100644 index 50afda7a48..0000000000 --- a/src/OpenSHC/UI/MenuModals/ChooseNetworkServiceProvider/MenuModalRenderFunction_ChooseNetworkServiceProvider.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "../ChooseNetworkServiceProvider.func.hpp" - -#include "OpenSHC/Text/TextManager.func.hpp" -#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" -#include "OpenSHC/DE/SHCDE/eTextSections.hpp" -#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" -#include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - -#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" -#include "OpenSHC/Globals/DAT_GameCore.hpp" -#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" -#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" -#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" - -namespace OpenSHC { -namespace UI { - namespace MenuModals { - - // FUNCTION: STRONGHOLDCRUSADER 0x0047C860 - void ChooseNetworkServiceProvider::MenuModalRenderFunction_ChooseNetworkServiceProvider( - int x, int y, int width, int height) - { - // "Service Providers" - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(76, 6, x, y, width, height); - if (DAT_GameSynchronyState::instance.kickedAtTime != 0) { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, - DAT_PencilRenderCore::ptr)(x, y - 0x3c, x + width, y - 18, 16); - // "You Were Ejected!" - 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_XPLAY_WAITING_ROOM, 92), - width / 2 + x, y - 50, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_CCFAFF, 16, FALSE, - 0); - if (5000 < timeGetTime() - DAT_GameSynchronyState::instance.kickedAtTime) { - DAT_GameSynchronyState::instance.kickedAtTime = 0; - } - } - int listBottom = y + 165; - int listTop = y + 85; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( - x + 40, listTop, x + 440, listBottom); - int listLeft = x + 39; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - listLeft, listTop - 1, x + 461, listTop - 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - listLeft, listBottom + 1, x + 461, listBottom + 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - listLeft, listTop, listLeft, listBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - x + 461, listTop, x + 461, listBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - x + 440, listTop, x + 440, listBottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - if (DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM) { - // the top first: y moves on to the box's bottom below - int modemTop = y + 265; - y += 345; - int modemRight = x + 440; - int modemLeft = x + 40; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( - modemLeft, modemTop, modemRight, y); - x += 461; - --modemLeft; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - modemLeft, modemTop - 1, x, modemTop - 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - modemLeft, y + 1, x, y + 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - modemLeft, modemTop, modemLeft, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - x, modemTop, x, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - modemRight, modemTop, modemRight, y, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); - } - } - } -} -} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 8737cf9b59..848c6edcf8 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22253,7 +22253,7 @@ SHC_3BB0A8C1_0x0047C5D0 | 0.0% | Pending SHC_3BB0A8C1_0x0047C670 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0047C860 | 65.1% | x and y swap esi and edi; x + 440 keeps a register where the original keeps y + 85 +SHC_3BB0A8C1_0x0047C860 | 0.0% | Pending SHC_3BB0A8C1_0x0047CA80 | 0.0% | Pending From e58da0e66c2e973a265bcc56db87e546ccb3c4fd Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 23 Nov 2026 01:22:31 +0100 Subject: [PATCH 29/29] drafts: move the finding-sessions modal to the ready PR FindingNetworkSessions::MenuModalRenderFunction_FindingNetworkSessions (0x0047D190) reaches reccmp 100.0 (normalized 100.0), off the /GL list and on it, and goes out with the same ready branch, reimpl/UI-A-netmodals-100 (11d13f1041, on main 0e4a83b5d2). Its file leaves this draft and its status line goes back to main's. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...lRenderFunction_FindingNetworkSessions.cpp | 63 ------------------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 src/OpenSHC/UI/MenuModals/FindingNetworkSessions/MenuModalRenderFunction_FindingNetworkSessions.cpp diff --git a/src/OpenSHC/UI/MenuModals/FindingNetworkSessions/MenuModalRenderFunction_FindingNetworkSessions.cpp b/src/OpenSHC/UI/MenuModals/FindingNetworkSessions/MenuModalRenderFunction_FindingNetworkSessions.cpp deleted file mode 100644 index 8b4945263b..0000000000 --- a/src/OpenSHC/UI/MenuModals/FindingNetworkSessions/MenuModalRenderFunction_FindingNetworkSessions.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "../FindingNetworkSessions.func.hpp" - -#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" -#include "OpenSHC/DE/SHCDE/eGM.hpp" -#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" - -#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" -#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" -#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" -#include "OpenSHC/Globals/DAT_ProtocolDefinedData.hpp" -#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" -#include "OpenSHC/Globals/UI_NetworkSessionsShadeLogic.hpp" - -namespace OpenSHC { -namespace UI { - namespace MenuModals { - - // FUNCTION: STRONGHOLDCRUSADER 0x0047D190 - void FindingNetworkSessions::MenuModalRenderFunction_FindingNetworkSessions(int x, int y, int width, int height) - { - DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; - // "Finding Sessions" - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(76, 11, x, y, width, height); - int const top = y + 85; - int const bottom = y + 285; - int const right = x + 460; - // The session list: a dimmed box with a frame, a header row and a scrollbar column - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( - x + 40, top, right - 20, bottom); - int const outerRight = right + 1; - int const outerLeft = x + 39; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - outerLeft, top - 1, outerRight, top - 1, COL_VERY_SOFT_YELLOW::instance.shortValue); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - outerLeft, bottom + 1, outerRight, bottom + 1, COL_VERY_SOFT_YELLOW::instance.shortValue); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - right - 20, top + 20, outerRight, top + 20, COL_VERY_SOFT_YELLOW::instance.shortValue); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - outerLeft, top, outerLeft, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - outerRight, top, outerRight, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - right - 20, top, right - 20, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue); - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( - right - 19, bottom - 20, right, bottom - 20, COL_VERY_SOFT_YELLOW::instance.shortValue); - // The searching animation, a frame every second call - int const shadeTick = UI_NetworkSessionsShadeLogic::instance + 1; - UI_NetworkSessionsShadeLogic::instance = shadeTick; - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, - DAT_ProtocolDefinedData::instance.field_0x474[shadeTick / 2 % 32] + 398, width / 2 - 14 + x, y + 312); - DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; - if (DAT_GameSynchronyState::instance.scrollBarIndex == -1 - && DAT_GameSynchronyState::instance.DPLAY_SessionsCount != 0) { - DAT_GameSynchronyState::instance.scrollBarIndex = 0; - } - } - - } -} -} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 848c6edcf8..1ec40f00e9 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22311,7 +22311,7 @@ SHC_3BB0A8C1_0x0047D0E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D100 | 0.0% | Pending -SHC_3BB0A8C1_0x0047D190 | 66.9% | Register mismatch: the original keeps the right column in ebp and reloads x +SHC_3BB0A8C1_0x0047D190 | 0.0% | Pending SHC_3BB0A8C1_0x0047D330 | 100.0% | Reimplemented