Skip to content

Commit e08b988

Browse files
committed
Add Simulator::GetSpecializedName() and cCreatureCitizen::GetSpecializedName()
1 parent 59b9d26 commit e08b988

5 files changed

Lines changed: 34 additions & 0 deletions

File tree

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ namespace Addresses(Simulator)
160160

161161
DefineAddress(GetPlayerHomePlanet, SelectAddress(0x10223F0, 0x1021220));
162162

163+
DefineAddress(GetSpecializedName, SelectAddress(0xB6B7E0, 0xB6BBF0));
164+
163165

164166
#ifndef SDK_TO_GHIDRA
165167
DefineAddress(LightingWorld_ptr, SelectAddress(0x1682CD4, 0x167EA54));
@@ -221,6 +223,7 @@ namespace Simulator
221223
DefineAddress(Update, SelectAddress(0xC24210, 0xC24A30));
222224
DefineAddress(DoAction, SelectAddress(0xC26EF0, 0xC27710));
223225
DefineAddress(GetHandheldItemForTool, SelectAddress(0xC22E70, 0xC23740));
226+
DefineAddress(GetSpecializedName, SelectAddress(0xB6B500, 0xB6B910));
224227
}
225228

226229
namespace Addresses(cCreatureBase)

Spore ModAPI/SourceCode/Simulator/cCreatureAnimal.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,12 @@ namespace Simulator
102102
auto_METHOD_VOID(cCreatureCitizen, DoAction, Args(int actionId, cGameData* actionObject, App::Property* prop), Args(actionId, actionObject, prop));
103103

104104
auto_METHOD(cCreatureCitizen, int, GetHandheldItemForTool, Args(int toolType), Args(toolType));
105+
106+
eastl::fixed_string<char16_t, 32> cCreatureCitizen::GetSpecializedName(cGameData* object) {
107+
eastl::fixed_string<char16_t, 32> str;
108+
CALL(GetAddress(cCreatureCitizen, GetSpecializedName), void,
109+
Args(eastl::fixed_string<char16_t, 32>&, cGameData*), Args(str, object));
110+
return str;
111+
}
105112
}
106113
#endif

Spore ModAPI/SourceCode/Simulator/cGameData.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,12 @@ namespace Simulator
7171
if (mScenarioClassIndex == -1) return nullptr;
7272
else return ScenarioMode.GetData()->GetClass(mScenarioClassIndex);
7373
}
74+
75+
eastl::fixed_string<char16_t, 32> GetSpecializedName(cGameData* object) {
76+
eastl::fixed_string<char16_t, 32> str;
77+
CALL(GetAddress(Simulator, GetSpecializedName), void,
78+
Args(eastl::fixed_string<char16_t, 32>&, cGameData*), Args(str, object));
79+
return str;
80+
}
7481
}
7582
#endif

Spore ModAPI/Spore/Simulator/cCreatureCitizen.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ namespace Simulator
3535
/// @returns An integer identifying the kind of item to be held
3636
int GetHandheldItemForTool(int toolType);
3737

38+
/// Returns the specialized name for a creature citizen, such as "Chieftain Whatever".
39+
/// @param object
40+
/// @returns
41+
static eastl::fixed_string<char16_t, 32> GetSpecializedName(cGameData* object);
42+
3843
public:
3944
/* FC0h */ int field_FC0; // 3
4045
/* FC4h */ uint32_t mFavoredGrasperlikeAppendage; // -1
@@ -60,5 +65,6 @@ namespace Simulator
6065
DeclareAddress(Update); // 0xC24210 0xC24A30
6166
DeclareAddress(DoAction); // 0xC26EF0 0xC27710
6267
DeclareAddress(GetHandheldItemForTool); // 0xC22E70 0xC23740
68+
DeclareAddress(GetSpecializedName); // 0xB6B500 0xB6B910
6369
}
6470
}

Spore ModAPI/Spore/Simulator/cGameData.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <Spore\Simulator\cScenarioMarker.h>
2626
#include <Spore\Simulator\IGameDataView.h>
2727
#include <EASTL\intrusive_list.h>
28+
#include <EASTL\fixed_string.h>
2829

2930
#define cGameDataPtr eastl::intrusive_ptr<Simulator::cGameData>
3031

@@ -113,4 +114,14 @@ namespace Simulator
113114
DeclareAddress(func18h);
114115
DeclareAddress(func3Ch);
115116
}
117+
118+
static_assert(sizeof(eastl::fixed_string<char16_t, 32>) == 0x54, "");
119+
/// Returns the specialized name for a game object, such as "Chieftain Whatever".
120+
/// @param object
121+
/// @returns
122+
eastl::fixed_string<char16_t, 32> GetSpecializedName(cGameData* object);
123+
}
124+
125+
namespace Addresses(Simulator) {
126+
DeclareAddress(GetSpecializedName); // 0xB6B7E0 0xB6BBF0
116127
}

0 commit comments

Comments
 (0)