Skip to content

Commit

Permalink
3rdParty: update Spore-ModAPI to v2.5.311
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Feb 22, 2024
1 parent 6adf7e1 commit 95c732f
Show file tree
Hide file tree
Showing 15 changed files with 186 additions and 4 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=309 ^
/p:SDK_BUILD_VER=311 ^
/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 = 5a79029bf07cb031e68f8936b5e31ac5b2b1c52b
parent = 8f960ee9ce3d3977f112f90b603613c27f471059
commit = 69de07644fb97c1cbf433db2130b0cea0c168798
parent = 6adf7e1834bc2eb324f5c879bf50661c1650dc45
method = merge
cmdver = 0.4.6
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include <Spore\Simulator\cCollectableItems.h>
#include <Spore\Simulator\cSpaceDefenseMissile.h>
#include <Spore\Simulator\cDefaultToolProjectile.h>
#include <Spore\Simulator\cPlanetaryArtifact.h>
#include <Spore\Simulator\SubSystem\cRelationshipManager.h>
#include <Spore\Simulator\SubSystem\GameBehaviorManager.h>
#include <Spore\Simulator\SubSystem\GameInputManager.h>
Expand Down Expand Up @@ -134,6 +135,8 @@ namespace Addresses(Simulator)
DefineAddress(LaunchDefaultToolProjectile, SelectAddress(0x1054F40, 0x1054390));

DefineAddress(sCreatureGameUnlockCategoriesCount, SelectAddress(0x1587278, 0x1583298));

DefineAddress(CreateUFO, SelectAddress(0x102BB50, 0x102AC60));

#ifndef SDK_TO_GHIDRA
DefineAddress(LightingWorld_ptr, SelectAddress(0x1682CD4, 0x167EA54));
Expand Down Expand Up @@ -309,6 +312,7 @@ namespace Simulator
namespace Addresses(cGameDataUFO)
{
DefineAddress(ChangeEnergy, SelectAddress(0xC382C0, 0xC38B50));
DefineAddress(Initialize, SelectAddress(0xC3D8D0, 0xC3E210));
}
namespace Addresses(cGameTerrainCursor)
{
Expand Down Expand Up @@ -1039,6 +1043,12 @@ namespace Simulator
{
DefineAddress(sub_D3B460, SelectAddress(0xD3B460, 0xD3BF50));
}

namespace Addresses(cPlanetaryArtifact)
{
DefineAddress(SetLocomotion, SelectAddress(0xC687D0, 0xC69230));
DefineAddress(LoadFromItem, SelectAddress(0xC73F90, 0xC74ED0));
}
}

#ifdef SDK_TO_GHIDRA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <Spore\Simulator\cResourceProjectile.h>
#include <Spore\Simulator\cSpaceDefenseMissile.h>
#include <Spore\Simulator\cCollectableItems.h>
#include <Spore\Simulator\cPlanetaryArtifact.h>

namespace Simulator
{
Expand Down Expand Up @@ -146,5 +147,14 @@ namespace Simulator
eastl::fixed_vector<eastl::pair<uint32_t, int>, 16>& GetCreatureGameUnlockCategoriesCount() {
return *(eastl::fixed_vector<eastl::pair<uint32_t, int>, 16>*)(GetAddress(Simulator, sCreatureGameUnlockCategoriesCount));
}


//// cPlanetaryArtifact ////

auto_METHOD_VOID_(cPlanetaryArtifact, SetLocomotion);

auto_METHOD_VOID(cPlanetaryArtifact, LoadFromItem,
Args(SpaceInventoryItemType itemType, const ResourceKey& itemKey, int count, bool arg),
Args(itemType, itemKey, count, arg));
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
namespace Simulator
{
auto_METHOD(cGameDataUFO, float, ChangeEnergy, Args(float delta), Args(delta));

auto_METHOD_VOID(cGameDataUFO, Initialize, Args(UfoType type, cEmpire* empire), Args(type, empire));

auto_STATIC_METHOD(Simulator, cGameDataUFO*, CreateUFO, Args(UfoType type, cEmpire* empire), Args(type, empire));
}
#endif
3 changes: 3 additions & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,11 @@
<ClInclude Include="Spore\Simulator\cICBM.h" />
<ClInclude Include="Spore\Simulator\cInterCityRoad.h" />
<ClInclude Include="Spore\Simulator\cMission.h" />
<ClInclude Include="Spore\Simulator\cMovableDestructibleOrnament.h" />
<ClInclude Include="Spore\Simulator\cNest.h" />
<ClInclude Include="Spore\Simulator\cObjectInstanceInventoryItem.h" />
<ClInclude Include="Spore\Simulator\cObjectPool.h" />
<ClInclude Include="Spore\Simulator\cPlanetaryArtifact.h" />
<ClInclude Include="Spore\Simulator\cPlantCargoInfo.h" />
<ClInclude Include="Spore\Simulator\cResourceProjectile.h" />
<ClInclude Include="Spore\Simulator\cScenarioEditHistory.h" />
Expand All @@ -449,6 +451,7 @@
<ClInclude Include="Spore\Simulator\cSpaceNames.h" />
<ClInclude Include="Spore\Simulator\cSpear.h" />
<ClInclude Include="Spore\Simulator\cTimeOfDay.h" />
<ClInclude Include="Spore\Simulator\cToolObject.h" />
<ClInclude Include="Spore\Simulator\cTotemPole.h" />
<ClInclude Include="Spore\Simulator\cTribe.h" />
<ClInclude Include="Spore\Simulator\cTribeArchetype.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,15 @@
<ClInclude Include="Spore\Palettes\PaletteIterator.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\cMovableDestructibleOrnament.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\cToolObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\cPlanetaryArtifact.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="SourceCode\Allocator.cpp">
Expand Down
3 changes: 3 additions & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
#include <Spore\Simulator\cDefaultAoEArea.h>
#include <Spore\Simulator\cSpear.h>
#include <Spore\Simulator\cCollectableItems.h>
#include <Spore\Simulator\cMovableDestructibleOrnament.h>
#include <Spore\Simulator\cToolObject.h>
#include <Spore\Simulator\cPlanetaryArtifact.h>

#include <Spore\Simulator\SimulatorMessages.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,4 +674,21 @@ namespace Simulator
/// Cold orbit, far from the sun
Cold = 2,
};

enum class UfoType
{
Player = 0,
UberTurret = 1,
Raider = 2,
Unk3 = 3,
Bomber = 4,
/// Only has weapon 'abduct'
Unk5 = 5,
Defender = 6,
Unk7 = 7,
Unk8 = 8,
Unk9 = 9,
Unk10 = 10,
Unk11 = 10,
};
}
18 changes: 18 additions & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cGameDataUFO.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

namespace Simulator
{
class cEmpire;

class cGameDataUFO
/* 00h */ : public cGameData
/* 34h */ , public cLocomotiveObject
Expand All @@ -48,6 +50,8 @@ namespace Simulator

float ChangeEnergy(float delta);

void Initialize(UfoType type, cEmpire* empire);

public:
/* 5ECh */ float field_5EC;
/* 5F0h */ float field_5F0;
Expand Down Expand Up @@ -77,6 +81,7 @@ namespace Simulator
/* 6D0h */ cGonzagoTimer field_6D0;
/* 6F0h */ cGonzagoTimer field_6F0;
/* 710h */ int field_710;
/// 0 is player UFO
/* 714h */ int mUFOType; // -1
/* 718h */ Vector3 mNextPosition;
/* 724h */ Vector3 mNextVelocity;
Expand Down Expand Up @@ -125,5 +130,18 @@ namespace Simulator
namespace Addresses(cGameDataUFO)
{
DeclareAddress(ChangeEnergy);
DeclareAddress(Initialize); // 0xC3D8D0 0xC3E210
}

/// Creates a new UFO instance of the given type and assigned to the specified empire.
/// It will call cGameDataUFO::Initialize(), which sets up the necessary tools and AI.
/// @param type
/// @param empire
/// @returns
cGameDataUFO* CreateUFO(UfoType type, cEmpire* empire);
}

namespace Addresses(Simulator)
{
DeclareAddress(CreateUFO); // 0x102BB50 0x102AC60
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ namespace Simulator
/* 270h */ int field_270;
/* 274h */ bool field_274;
/* 278h */ eastl::fixed_vector<cSpatialObjectPtr, 128> mNeighbors;
// vector of functions such as sub_B4C6E0
/* 490h */ eastl::fixed_vector<int, 4> field_490;
/* 4B8h */ eastl::vector<int> field_4B8;
/* 4CCh */ int field_4CC; //PLACEHOLDER important cLomotionStrategy
/* 4CCh */ int field_4CC; //TODO important cLomotionStrategy
};
ASSERT_SIZE(cLocomotiveObject, 0x4D0);
}
3 changes: 3 additions & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cMission.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ namespace Simulator
/// @param pEmpire
void SetTargetEmpire(cEmpire* pEmpire);

/* 54h */ virtual int func54h();
/* 58h */ virtual int func58h();
/* 5Ch */ virtual int func5Ch();
/* 60h */ virtual int GetState();
/* 64h */ virtual bool func64h(); // field_38.IsRunning()
// Called by sub_E13A70
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include <Spore\Simulator\cGameData.h>
#include <Spore\Simulator\cLocomotiveObject.h>
#include <Spore\Simulator\cCombatant.h>
#include <Spore\Simulator\cBehaviorAgent.h>

#define cMovableDestructibleOrnamentPtr eastl::intrusive_ptr<Simulator::cMovableDestructibleOrnament>

namespace Simulator
{
class cMovableDestructibleOrnament
/* 00h */ : public cGameData
/* 34h */ , public cLocomotiveObject
/* 508h */ , public cCombatant
/* 5D0h */ , public cBehaviorAgent
{
public:
static const uint32_t TYPE = 0x283D961;
static const uint32_t NOUN_ID = 0x283DDB1;

using Object::AddRef;
using Object::Release;
using Object::Cast;
};
ASSERT_SIZE(cMovableDestructibleOrnament, 0x638);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#pragma once

#include <Spore\Simulator\cMovableDestructibleOrnament.h>
#include <Spore\Simulator\SimulatorEnums.h>

#define cPlanetaryArtifactPtr eastl::intrusive_ptr<Simulator::cPlanetaryArtifact>

namespace Simulator
{
class cPlanetaryArtifact
: public cMovableDestructibleOrnament
{
public:
static const uint32_t TYPE = 0x2DD8C33;
static const uint32_t NOUN_ID = 0x2DD8C42;

using Object::AddRef;
using Object::Release;
using Object::Cast;

/// Creates a `cGroundLocomotion` locomotion strategy, and adds this object to the behavior manager.
void SetLocomotion();

void LoadFromItem(SpaceInventoryItemType itemType, const ResourceKey& itemKey, int count, bool);

public:
/* 638h */ int mItemCount;
/* 63Ch */ PropertyListPtr mItemPropList;
/* 640h */ int field_640;
/* 644h */ float mInventoryItemArtifactPlumpScale; // not initialized
/* 648h */ float mInventoryItemArtifactNormalScale; // not initialized
/* 64Ch */ ResourceKey mInventoryItemKey;
/* 658h */ SpaceInventoryItemType mItemType; // -1
/* 65Ch */ bool field_65C;
/* 65Dh */ bool field_65D;
/* 65Eh */ bool field_65E; // true
/* 660h */ float field_660; // -1
};
ASSERT_SIZE(cPlanetaryArtifact, 0x668);

namespace Addresses(cPlanetaryArtifact)
{
DeclareAddress(SetLocomotion); // 0xC687D0 0xC69230
DeclareAddress(LoadFromItem); // 0xC73F90 0xC74ED0
}
}
31 changes: 31 additions & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cToolObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include <Spore\Simulator\cMovableDestructibleOrnament.h>

#define cToolObjectPtr eastl::intrusive_ptr<Simulator::cToolObject>

namespace Simulator
{
class cToolObject
: public cMovableDestructibleOrnament
{
public:
static const uint32_t TYPE = 0x4E3FAAF;
static const uint32_t NOUN_ID = 0x4E3FAB5;

using Object::AddRef;
using Object::Release;
using Object::Cast;

public:
/* 638h */ int field_638;
/* 63Ch */ int field_63C;
/* 640h */ int field_640;
/* 644h */ int field_644;
/* 648h */ int field_648;
/* 64Ch */ int field_64C;
/* 650h */ int field_650;
/* 654h */ int field_654;
};
ASSERT_SIZE(cToolObject, 0x658);
}

0 comments on commit 95c732f

Please sign in to comment.