Skip to content

Commit 1d803f7

Browse files
plenckaemd4600
andauthored
#23 - space tool icon override precedence fix (#24)
Possible fix to social palette precedence in Space Tool Icon overrider. Co-authored-by: LenP-dev <49527545+LenP-dev@users.noreply.github.com> Co-authored-by: Eric Mor <emd4600@gmail.com>
1 parent 0cc223c commit 1d803f7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
################################################################################
1+
################################################################################
22
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
33
################################################################################
44

@@ -10,4 +10,4 @@
1010
Debug
1111
Release
1212
Projects/*
13-
!Projects/Example Projects/
13+
!Projects/Example Projects/

Spore ModAPI/SourceCode/DLL/SpaceToolIconOverride.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,20 @@ void InjectIconWindows(UTFWin::IWindow* window)
8585
}
8686
}
8787

88-
member_detour(LoadSpaceGameUI_detour, UI::SpaceGameUI, void()) {
89-
void detoured() {
90-
original_function(this);
91-
InjectIconWindows(this->mInventoryItemIcons->FindWindowByID(0xC19CCD88)); // First icon from spui. Should be the fastest to access.
92-
// Icons should be destroyed with window hierarchy when they are no longer needed.
88+
member_detour(LoadIconSpui_detour, UTFWin::UILayout, bool(const ResourceKey&, bool, uint32_t)) {
89+
bool detoured(const ResourceKey & resourceKey, bool unkBool, uint32_t params) {
90+
bool result = original_function(this, resourceKey, unkBool, params);
91+
if (resourceKey.instanceID == 0x46fed9c8) { // SPU holding all space icons.
92+
InjectIconWindows(this->FindWindowByID(0xC19CCD88)); // First icon from spui. Should be the fastest to access.
93+
}
94+
95+
return result;
9396
}
9497
};
9598

9699
long SpaceToolIconOverride::AttachDetour() {
97100
long result = 0;
98-
result |= LoadSpaceGameUI_detour::attach(GetAddress(UI::SpaceGameUI, Load));
101+
result |= LoadIconSpui_detour::attach(GetAddress(UTFWin::UILayout, Load));
99102
return result;
100103
}
101104

0 commit comments

Comments
 (0)