Skip to content

Commit

Permalink
Add Simulator::GetSpecializedName() and cCreatureCitizen::GetSpeciali…
Browse files Browse the repository at this point in the history
…zedName()
  • Loading branch information
emd4600 committed Oct 16, 2024
1 parent 59b9d26 commit e08b988
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ namespace Addresses(Simulator)

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

DefineAddress(GetSpecializedName, SelectAddress(0xB6B7E0, 0xB6BBF0));


#ifndef SDK_TO_GHIDRA
DefineAddress(LightingWorld_ptr, SelectAddress(0x1682CD4, 0x167EA54));
Expand Down Expand Up @@ -221,6 +223,7 @@ namespace Simulator
DefineAddress(Update, SelectAddress(0xC24210, 0xC24A30));
DefineAddress(DoAction, SelectAddress(0xC26EF0, 0xC27710));
DefineAddress(GetHandheldItemForTool, SelectAddress(0xC22E70, 0xC23740));
DefineAddress(GetSpecializedName, SelectAddress(0xB6B500, 0xB6B910));
}

namespace Addresses(cCreatureBase)
Expand Down
7 changes: 7 additions & 0 deletions Spore ModAPI/SourceCode/Simulator/cCreatureAnimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,12 @@ namespace Simulator
auto_METHOD_VOID(cCreatureCitizen, DoAction, Args(int actionId, cGameData* actionObject, App::Property* prop), Args(actionId, actionObject, prop));

auto_METHOD(cCreatureCitizen, int, GetHandheldItemForTool, Args(int toolType), Args(toolType));

eastl::fixed_string<char16_t, 32> cCreatureCitizen::GetSpecializedName(cGameData* object) {
eastl::fixed_string<char16_t, 32> str;
CALL(GetAddress(cCreatureCitizen, GetSpecializedName), void,
Args(eastl::fixed_string<char16_t, 32>&, cGameData*), Args(str, object));
return str;
}
}
#endif
7 changes: 7 additions & 0 deletions Spore ModAPI/SourceCode/Simulator/cGameData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,12 @@ namespace Simulator
if (mScenarioClassIndex == -1) return nullptr;
else return ScenarioMode.GetData()->GetClass(mScenarioClassIndex);
}

eastl::fixed_string<char16_t, 32> GetSpecializedName(cGameData* object) {
eastl::fixed_string<char16_t, 32> str;
CALL(GetAddress(Simulator, GetSpecializedName), void,
Args(eastl::fixed_string<char16_t, 32>&, cGameData*), Args(str, object));
return str;
}
}
#endif
6 changes: 6 additions & 0 deletions Spore ModAPI/Spore/Simulator/cCreatureCitizen.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ namespace Simulator
/// @returns An integer identifying the kind of item to be held
int GetHandheldItemForTool(int toolType);

/// Returns the specialized name for a creature citizen, such as "Chieftain Whatever".
/// @param object
/// @returns
static eastl::fixed_string<char16_t, 32> GetSpecializedName(cGameData* object);

public:
/* FC0h */ int field_FC0; // 3
/* FC4h */ uint32_t mFavoredGrasperlikeAppendage; // -1
Expand All @@ -60,5 +65,6 @@ namespace Simulator
DeclareAddress(Update); // 0xC24210 0xC24A30
DeclareAddress(DoAction); // 0xC26EF0 0xC27710
DeclareAddress(GetHandheldItemForTool); // 0xC22E70 0xC23740
DeclareAddress(GetSpecializedName); // 0xB6B500 0xB6B910
}
}
11 changes: 11 additions & 0 deletions Spore ModAPI/Spore/Simulator/cGameData.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <Spore\Simulator\cScenarioMarker.h>
#include <Spore\Simulator\IGameDataView.h>
#include <EASTL\intrusive_list.h>
#include <EASTL\fixed_string.h>

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

Expand Down Expand Up @@ -113,4 +114,14 @@ namespace Simulator
DeclareAddress(func18h);
DeclareAddress(func3Ch);
}

static_assert(sizeof(eastl::fixed_string<char16_t, 32>) == 0x54, "");
/// Returns the specialized name for a game object, such as "Chieftain Whatever".
/// @param object
/// @returns
eastl::fixed_string<char16_t, 32> GetSpecializedName(cGameData* object);
}

namespace Addresses(Simulator) {
DeclareAddress(GetSpecializedName); // 0xB6B7E0 0xB6BBF0
}

0 comments on commit e08b988

Please sign in to comment.