Skip to content

Commit

Permalink
3rdParty: update Spore-ModAPI to v2.5.301
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Jan 8, 2024
1 parent 46786ad commit bb671fd
Show file tree
Hide file tree
Showing 17 changed files with 916 additions and 76 deletions.
2 changes: 1 addition & 1 deletion 3rdParty/BuildSporeModAPI.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set SPOREMODAPI_CUR_DIR=%~dp0

msbuild "%SPOREMODAPI_CUR_DIR%\Spore-ModAPI\Spore ModAPI" ^
/p:Configuration="Release DLL" ^
/p:SDK_BUILD_VER=300 ^
/p:SDK_BUILD_VER=301 ^
/p:EXECUTABLE_TYPE=10 ^
/p:Platform=Win32 ^
/m
4 changes: 2 additions & 2 deletions 3rdParty/Spore-ModAPI/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = [email protected]:emd4600/Spore-ModAPI.git
branch = master
commit = 42b62a380901f9c0e4ae14b120c4abeb55c54750
parent = ab127d265d02d9dca33d9bb9a4b04169c455ceec
commit = e7954a61f5c33f82eea47c047b2cda6c9d383c3d
parent = 46786ad51ae2936314c0a1cd80f579cd1e107c73
method = merge
cmdver = 0.4.6
348 changes: 319 additions & 29 deletions 3rdParty/Spore-ModAPI/SDKtoGhidra/SporeGhidra_disk.xml

Large diffs are not rendered by default.

345 changes: 319 additions & 26 deletions 3rdParty/Spore-ModAPI/SDKtoGhidra/SporeGhidra_march2017.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
#include <Spore\Simulator\cStar.h>
#include <Spore\Simulator\cMissionManager.h>
#include <Spore\Simulator\cSimulatorUniverse.h>
#include <Spore\Simulator\cIdentityColorable.h>
#include <Spore\Simulator\cSpeciesProfile.h>
#include <Spore\Simulator\Serialization.h>
#include <Spore\Simulator\SpaceConstants.h>
#include <Spore\Simulator\cArtilleryProjectile.h>
Expand All @@ -95,6 +97,7 @@
#include <Spore\Simulator\SubSystem\UIEventLog.h>
#include <Spore\Simulator\SubSystem\AnimalSpeciesManager.h>
#include <Spore\Simulator\SubSystem\PlantSpeciesManager.h>
#include <Spore\Simulator\SubSystem\GamePersistenceManager.h>
#include <Spore\Simulator\NounClassFactories.h>

namespace Addresses(Simulator)
Expand Down Expand Up @@ -499,6 +502,7 @@ namespace Simulator
DefineAddress(GetPlayerCivilization, SelectAddress(0xB25E30, 0xB25F90));
DefineAddress(CreateHerd, SelectAddress(0xB237C0, 0xB23920));
DefineAddress(CreateNest, SelectAddress(0xB20C70, 0xB20DD0));
DefineAddress(EnsurePlayer, SelectAddress(0xB20DE0, 0xB20F40));
}

namespace Addresses(cGameViewManager)
Expand Down Expand Up @@ -964,7 +968,22 @@ namespace Simulator
DefineAddress(GenerateNPCStore, SelectAddress(0x103F560, 0x103E8F0));
}

namespace Addresses(cCultureSet)
namespace Addresses(cGamePersistenceManager)
{
DefineAddress(Get, SelectAddress(0xB3D2A0, 0xB3D440));
}

namespace Addresses(cIdentityColorable)
{
DefineAddress(AssignNames, SelectAddress(0xB6F040, 0xB6F480));
}

namespace Addresses(cSpeciesProfile)
{
DefineAddress(GetSpeciesName, SelectAddress(0x4DA1C0, 0x4DA390));
}

namespace Addresses(cCultureSet)
{
DefineAddress(PickCreation, SelectAddress(0xBF8DF0, 0xBF9840));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ namespace Simulator
return mpPlayerTribe.get();
}

cPlayer* cGameNounManager::GetPlayer() {
return mpPlayer.get();
}

auto_METHOD_VOID_(cGameNounManager, EnsurePlayer);

auto_METHOD_(cGameNounManager, cCivilization*, GetPlayerCivilization);

auto_METHOD(cGameNounManager, cHerd*, CreateHerd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <Spore\Simulator\cBadgeManager.h>
#include <Spore\Simulator\cObjectPool.h>
#include <Spore\Simulator\cSimulatorUniverse.h>
#include <Spore\Simulator\cSpeciesProfile.h>
#include <Spore\Simulator\cIdentityColorable.h>
#include <Spore\Simulator\SubSystem\GamePersistenceManager.h>
#include <Spore\Simulator\cDefaultToolProjectile.h>
#include <Spore\Simulator\cArtilleryProjectile.h>
#include <Spore\Simulator\cCulturalProjectile.h>
Expand Down Expand Up @@ -71,6 +74,19 @@ namespace Simulator
return *(cSimulatorUniverse**)GetAddress(cSimulatorUniverse, _ptr);
}

//// GamePersistenceManager ////

auto_STATIC_METHOD_(cGamePersistenceManager, cGamePersistenceManager*, Get);


//// cSpeciesProfile ////

auto_METHOD_VOID(cSpeciesProfile, GetSpeciesName, Args(eastl::string16& dst), Args(dst));


//// cIdentityColorable ////

auto_METHOD_VOID(cIdentityColorable, AssignNames, Args(const eastl::string16& speciesName), Args(speciesName));

//// cDefaultToolProjectile ////

Expand Down
1 change: 1 addition & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@
<ClInclude Include="Spore\Simulator\SimulatorEnums.h" />
<ClInclude Include="Spore\Simulator\SpaceConstants.h" />
<ClInclude Include="Spore\Simulator\SubSystem\AnimalSpeciesManager.h" />
<ClInclude Include="Spore\Simulator\SubSystem\GamePersistenceManager.h" />
<ClInclude Include="Spore\Simulator\SubSystem\PlantSpeciesManager.h" />
<ClInclude Include="Spore\Simulator\SubSystem\SpaceGfx.h" />
<ClInclude Include="Spore\Simulator\SubSystem\SpaceTrading.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@
<ClInclude Include="Spore\Simulator\SubSystem\SpaceTrading.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\cCommunityLayout.h">
<ClInclude Include="Spore\Simulator\cCommunityLayout.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\cCulturalTarget.h">
Expand Down Expand Up @@ -2161,6 +2161,9 @@
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Editors\VerbIconData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\SubSystem\GamePersistenceManager.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ namespace Editors
class INameableEntity
{
public:
virtual void SetName(const char16_t* pString) = 0;
virtual const char16_t* GetName() = 0;
/* 00h */ virtual void SetName(const char16_t* pString) = 0;
/* 04h */ virtual const char16_t* GetName() = 0;

virtual void SetDescription(const char16_t* pString) = 0;
virtual const char16_t* GetDescription() = 0;
/* 08h */ virtual void SetDescription(const char16_t* pString) = 0;
/* 0Ch */ virtual const char16_t* GetDescription() = 0;

virtual void SetTags(const char16_t* pString) {};
virtual const char16_t* GetTags() {
/* 10h */ virtual void SetTags(const char16_t* pString) {};
/* 14h */ virtual const char16_t* GetTags() {
return nullptr;
};
};
Expand Down
1 change: 1 addition & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <Spore\Simulator\SubSystem\GameNounManager.h>
#include <Spore\Simulator\SubSystem\GameViewManager.h>
#include <Spore\Simulator\SubSystem\GameTimeManager.h>
#include <Spore\Simulator\SubSystem\GamePersistenceManager.h>
#include <Spore\Simulator\SubSystem\StarManager.h>
#include <Spore\Simulator\SubSystem\ToolManager.h>
#include <Spore\Simulator\SubSystem\SpacePlayerData.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <Spore\Simulator\cCreatureAnimal.h>
#include <Spore\Simulator\cTribe.h>
#include <Spore\Simulator\cHerd.h>
#include <Spore\Simulator\cPlayer.h>
#include <Spore\App\IMessageListener.h>
#include <EASTL\hash_map.h>
#include <EASTL\map.h>
Expand Down Expand Up @@ -86,6 +87,11 @@ namespace Simulator

void UpdateModels();

cPlayer* GetPlayer();

/// If there is no cPlayer instance created, it creates one.
void EnsurePlayer();


#ifndef SDK_TO_GHIDRA
/// Gets all the game data objects that use the given game noun ID. To be more specific, first a container is created
Expand Down Expand Up @@ -131,7 +137,7 @@ namespace Simulator
/* 58h */ cHerdPtr mpAvatarHerd;
/* 5Ch */ eastl::vector<cCreatureAnimalPtr> mPosseMembers;
/* 70h */ cTribePtr mpPlayerTribe;
/* 74h */ ObjectPtr mpPlayer; // cPlayer
/* 74h */ cPlayerPtr mpPlayer;
/* 78h */ eastl::intrusive_list<cGameData> mNouns;
/* 80h */ eastl::vector<ObjectPtr> field_80; // objects that haven't been updated since last call to UpdateModels?
/* 94h */ int field_94;
Expand Down Expand Up @@ -162,6 +168,7 @@ namespace Simulator
DeclareAddress(GetPlayerCivilization); // 0xB25E30 0xB25F90
DeclareAddress(CreateHerd);
DeclareAddress(CreateNest); // 0xB20C70 0xB20DD0
DeclareAddress(EnsurePlayer); // 0xB20DE0 0xB20F40
}

#ifndef SDK_TO_GHIDRA
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#pragma once

#include <Spore\App\IMessageListener.h>
#include <Spore\Simulator\SubSystem\cStrategy.h>
#include <Spore\Simulator\SubSystem\StarManager.h>
#include <EASTL\string.h>

#define GamePersistenceManager (*Simulator::cGamePersistenceManager::Get())

namespace Simulator
{
struct GameLoadParameters
{
/// This will be appended with `.spo` to create the game file name.
/* 00h */ eastl::string16 mGameName;
/* 10h */ eastl::string16 mStarName;
/* 20h */ eastl::string16 field_20;
/* 30h */ char padding_30[0x48 - 0x30];
/* 48h */ cSpeciesProfile* mpCreatureSpecies;
/* 4Ch */ ResourceKey mCreatureKey;
/* 58h */ ResourceKey field_58;
/* 5Ch */ char padding_64[0x7C - 0x64];
/* 7Ch */ StarID mStarID {0};
/* 80h */ char padding_80[0xA0 - 0x80];
/* A0h */ Difficulty mDifficulty;
/// Game mode to load
/* A4h */ TechLevel mGameMode;
/* A8h */ char padding_A8[0xB0 - 0xA8];
/* B0h */ int field_B0;
};
ASSERT_SIZE(GameLoadParameters, 0xB4); // I don't know if this is the real size

class cGamePersistenceManager
: public App::IMessageListener
, public cStrategy
{
public:
static cGamePersistenceManager* Get();

/// Call GameNounManager.EnsurePlayer() to avoid game crashes.
/* 10h */ virtual bool LoadGame(const GameLoadParameters& parameters);
//TODO more methods

/* 14h */ virtual void func14h(int);
/* 18h */ virtual void func18h(int, int);
/* 1Ch */ virtual bool func1Ch();
/* 20h */ virtual bool func1Ch(uint32_t);

public:
/* 20h */ int field_20;
/* 24h */ int field_24;
/* 28h */ int field_28;
/* 2Ch */ int field_2C;
/* 30h */ int field_30;
/* 34h */ eastl::string16 field_34;
/* 44h */ bool field_44;
/* 45h */ bool field_45;
/* 46h */ bool field_46;
/* 47h */ bool field_47;
/* 48h */ int field_48;
};
ASSERT_SIZE(cGamePersistenceManager, 0x4C);

namespace Addresses(cGamePersistenceManager) {
DeclareAddress(Get); // 0xB3D2A0 0xB3D440
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
namespace Simulator
{
class cCivilization
: public cGameData
, public Editors::INameableEntity
, public App::IMessageListener
, public cIdentityColorable
/* 00h */ : public cGameData
/* 34h */ , public Editors::INameableEntity
/* 38h */ , public App::IMessageListener
/* 3Ch */ , public cIdentityColorable
{
public:
static const uint32_t TYPE = 0x901F1362;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <Spore\MathUtils.h>
#include <EASTL\map.h>
#include <EASTL\string.h>

#define cIdentityColorablePtr eastl::intrusive_ptr<Simulator::cIdentityColorable>

Expand Down Expand Up @@ -47,10 +48,20 @@ namespace Simulator
/* 14h */ virtual void Write(void*);
/* 18h */ virtual void Read(void*);

/// Generates the identity name according to the color, and the names for all its entities.
/// @param speciesName
void AssignNames(const eastl::string16& speciesName);

public:
/* 04h */ uint32_t mIDColorID; // 0x53DBCF1
/* 08h */ eastl::map<int, int> field_8;
/// Names for different entities such as buildings, vehicles, etc. Check `Identity.locale`
/* 08h */ eastl::map<int, eastl::string16> mEntityNames;
/* 24h */ Math::ColorRGB mCachedColor;
};
ASSERT_SIZE(cIdentityColorable, 0x30);

namespace Addresses(cIdentityColorable)
{
DeclareAddress(AssignNames); // 0xB6F040 0xB6F480
}
}
Loading

0 comments on commit bb671fd

Please sign in to comment.