diff --git a/Spore ModAPI/SourceCode/App/App.cpp b/Spore ModAPI/SourceCode/App/App.cpp index 6961fbc1..b0a51316 100644 --- a/Spore ModAPI/SourceCode/App/App.cpp +++ b/Spore ModAPI/SourceCode/App/App.cpp @@ -43,6 +43,10 @@ namespace App Args(const eastl::string16& path, eastl::hash_set& dstSkippedPaths, int& dstCount), Args(path, dstSkippedPaths, dstCount)); + auto_METHOD(PngEncoder, bool, EncodePNG, + Args(IO::IStream* stream, int mode), + Args(stream, mode)); + auto_STATIC_METHOD_(cIDGenerator, cIDGenerator*, Get); diff --git a/Spore ModAPI/SourceCode/DLL/AddressesApp.cpp b/Spore ModAPI/SourceCode/DLL/AddressesApp.cpp index efae6ef8..7fbc0490 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesApp.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesApp.cpp @@ -411,6 +411,11 @@ namespace App DefineAddress(ImportDirectoryPNGs, SelectAddress(0x5FC900, 0x5FCA80)); } + namespace Addresses(PngEncoder) + { + DefineAddress(EncodePNG, SelectAddress(0x68E660, 0x68e190)); + } + namespace Addresses(cLocaleManager) { DefineAddress(Get, SelectAddress(0x67DF60, 0x67DE00)); diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index 3875b3ad..5c571dd7 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1055,6 +1056,11 @@ namespace Simulator DefineAddress(GetRareHasBeenFound, SelectAddress(0x103BC30, 0x103AC50)); DefineAddress(SetRareAsFound, SelectAddress(0x1040820, 0x103FBB0)); DefineAddress(GenerateNPCStore, SelectAddress(0x103F560, 0x103E8F0)); + DefineAddress(CreateTradingObject, SelectAddress(0x103B470, 0x103A490)); + } + + namespace Addresses(cScenarioEditModeDisplayStrategy) { + DefineAddress(Load, SelectAddress(0xED6000, 0xED5C70)); } namespace Addresses(cGamePersistenceManager) diff --git a/Spore ModAPI/SourceCode/Graphics/Rendering.cpp b/Spore ModAPI/SourceCode/Graphics/Rendering.cpp index 438ad27e..a3a4d5a4 100644 --- a/Spore ModAPI/SourceCode/Graphics/Rendering.cpp +++ b/Spore ModAPI/SourceCode/Graphics/Rendering.cpp @@ -25,6 +25,7 @@ #include #include #include +#include namespace Graphics { @@ -196,5 +197,19 @@ namespace Graphics return *(D3DPRESENT_PARAMETERS*)(GetAddress(ActiveState, sPresentParams)); } } + + + int LayerSequence::AddRef() { + return RefCountTemplate::AddRef(); + } + int LayerSequence::Release() { + return RefCountTemplate::Release(); + } + LayerSequence::~LayerSequence() {} + void LayerSequence::DrawLayer(int flags, int layerIndex, App::cViewer** viewers, RenderStatistics& statistics) { + for (auto& layer : mLayers) { + layer.layer->DrawLayer(layer.flags, layer.layerIndex, viewers, statistics); + } + } } #endif diff --git a/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp b/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp index 818d452e..a21bb8af 100644 --- a/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp +++ b/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp @@ -21,9 +21,13 @@ #include #include #include +#include namespace Simulator { + auto_METHOD_(cScenarioEditModeDisplayStrategy, bool, Load); + + void cHerd::SetEnabled(bool enabled) { mbEnabled = enabled; diff --git a/Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp b/Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp index 5068107a..c2b7faba 100644 --- a/Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp +++ b/Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp @@ -58,5 +58,9 @@ namespace Simulator auto_METHOD_VOID(cSpaceTrading, GenerateNPCStore, Args(cPlanetRecord* planetRecord, LocalizedString& dstSpiceText), Args(planetRecord, dstSpiceText)); + + auto_METHOD_VOID(cSpaceTrading, CreateTradingObject, + Args(cSpaceInventoryItemPtr& dst, const ResourceKey& itemID, int itemCount, float itemCost), + Args(dst, itemID, itemCount, itemCost)); } #endif diff --git a/Spore ModAPI/SourceCode/Simulator/SpaceInventory.cpp b/Spore ModAPI/SourceCode/Simulator/SpaceInventory.cpp index acb8e4d7..654a6351 100644 --- a/Spore ModAPI/SourceCode/Simulator/SpaceInventory.cpp +++ b/Spore ModAPI/SourceCode/Simulator/SpaceInventory.cpp @@ -24,10 +24,6 @@ namespace Simulator auto_STATIC_METHOD_VOID(cSpaceInventoryItem, CreateMultiDeliveryObject, Args(cSpaceInventoryItemPtr& dst, const ResourceKey& itemID, uint32_t instanceID), Args(dst, itemID, instanceID)); - - auto_STATIC_METHOD_VOID(cSpaceInventoryItem, CreateTradingObject, - Args(cSpaceInventoryItemPtr& dst, const ResourceKey& itemID, int itemCount, float itemCost), - Args(dst, itemID, itemCount, itemCost)); } #endif diff --git a/Spore ModAPI/Spore ModAPI.vcxproj b/Spore ModAPI/Spore ModAPI.vcxproj index 29486064..4d748f64 100644 --- a/Spore ModAPI/Spore ModAPI.vcxproj +++ b/Spore ModAPI/Spore ModAPI.vcxproj @@ -327,9 +327,11 @@ + + @@ -866,6 +868,7 @@ + diff --git a/Spore ModAPI/Spore ModAPI.vcxproj.filters b/Spore ModAPI/Spore ModAPI.vcxproj.filters index 34c2ac02..bc3b5507 100644 --- a/Spore ModAPI/Spore ModAPI.vcxproj.filters +++ b/Spore ModAPI/Spore ModAPI.vcxproj.filters @@ -2238,6 +2238,15 @@ Header Files + + Header Files + + + Header Files + + + Header Files + diff --git a/Spore ModAPI/Spore/App/ScenarioMode.h b/Spore ModAPI/Spore/App/ScenarioMode.h index 1f25afef..f5d944d4 100644 --- a/Spore ModAPI/Spore/App/ScenarioMode.h +++ b/Spore ModAPI/Spore/App/ScenarioMode.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -65,7 +66,7 @@ namespace App public: /* 10h */ int mpEditModeInputStrategy; // cScenarioEditModeInputStrategy - /* 14h */ int mpEditModeDisplayStrategy; // cScenarioEditModeDisplayStrategy + /* 14h */ cScenarioEditModeDisplayStrategyPtr mpEditModeDisplayStrategy; /* 18h */ cScenarioTerraformModePtr mpTerraformMode; /* 1Ch */ int mpScenarioUI; // Simulator::ScenarioModeUI ? /* 20h */ GameInput mInput; diff --git a/Spore ModAPI/Spore/App/Thumbnail_cImportExport.h b/Spore ModAPI/Spore/App/Thumbnail_cImportExport.h index ece03c9c..038a5b6f 100644 --- a/Spore ModAPI/Spore/App/Thumbnail_cImportExport.h +++ b/Spore ModAPI/Spore/App/Thumbnail_cImportExport.h @@ -13,6 +13,35 @@ namespace App { + struct PngEncoder { + + bool EncodePNG(IO::IStream* outputStream, int mode); + + /* 00h */ eastl::vector field_0; + /* 14h */ int field_14; + /* 18h */ int field_18; + /* 1Ch */ int field_1C; // not initialized + /* 20h */ bool field_20; + /* 24h */ int field_24; + /* 28h */ int field_28; // -1 + /* 2Ch */ int field_2C; // -1 + /* 30h */ int field_30; + /* 34h */ int field_34; + /* 38h */ int field_38; + /* 3Ch */ int field_3C; + /* 40h */ int field_40; + /* 44h */ int field_44; + /* 48h */ int field_48; + /* 4Ch */ int field_4C; // 8 + /* 50h */ int field_50; + /* 54h */ bool field_54; // not initialized + /* 55h */ bool field_55; + /* 56h */ bool field_56; + /* 58h */ eastl::vector mData; + /* 6Ch */ int field_6C; + }; + ASSERT_SIZE(PngEncoder, 0x70); + struct ThumbnailDecodedMetadata { ThumbnailDecodedMetadata() = default; @@ -112,7 +141,7 @@ namespace App /* 44h */ uint32_t mMachineId; // not initialized /* 48h */ eastl::hash_map field_48; /* 68h */ eastl::hash_map field_68; - /* 88h */ char padding_88[0xF8 - 0x88]; + /* 88h */ PngEncoder mPngEncoder; /* F8h */ int field_F8; /* FCh */ int field_FC; /* 100h */ int field_100; @@ -139,4 +168,9 @@ namespace App DeclareAddress(SaveFilePaths); // 0x5F89C0 0x5F8B60 DeclareAddress(ImportDirectoryPNGs); // 0x5FC900 0x5FCA80 } + + namespace Addresses(PngEncoder) + { + DeclareAddress(EncodePNG); // 0x68E660 0x68e190 + } } \ No newline at end of file diff --git a/Spore ModAPI/Spore/CommonIDs.h b/Spore ModAPI/Spore/CommonIDs.h index 9aea4931..f9522b64 100644 --- a/Spore ModAPI/Spore/CommonIDs.h +++ b/Spore ModAPI/Spore/CommonIDs.h @@ -312,6 +312,8 @@ namespace GroupIDs ShaderFragments = 0x40212002, Shaders = 0x40212004, - Scripts1 = 0x24A4F5A + Scripts1 = 0x24A4F5A, + + SharedDialogs = 0x490F6945 }; } diff --git a/Spore ModAPI/Spore/Graphics/IRenderer.h b/Spore ModAPI/Spore/Graphics/IRenderer.h index 93419aa4..d817a42f 100644 --- a/Spore ModAPI/Spore/Graphics/IRenderer.h +++ b/Spore ModAPI/Spore/Graphics/IRenderer.h @@ -23,6 +23,7 @@ #include #include #include +#include #include diff --git a/Spore ModAPI/Spore/Graphics/LayerSequence.h b/Spore ModAPI/Spore/Graphics/LayerSequence.h new file mode 100644 index 00000000..4252472f --- /dev/null +++ b/Spore ModAPI/Spore/Graphics/LayerSequence.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include + +#define LayerSequencePtr eastl::intrusive_ptr + +namespace Graphics +{ + class LayerSequence + : public ILayer + , public RefCountTemplate + { + public: + virtual int AddRef() override; + virtual int Release() override; + virtual ~LayerSequence(); + virtual void DrawLayer(int flags, int layerIndex, App::cViewer** viewers, RenderStatistics& statistics) override; + + inline void AddLayer(ILayer* layer, int index, int flags) { + mLayers.push_back({layer, index, flags}); + } + + public: + struct SequenceLayer { + ILayerPtr layer; + int layerIndex; + int flags; + }; + + eastl::vector mLayers; + }; + ASSERT_SIZE(LayerSequence, 0x20); +} \ No newline at end of file diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/PlanetModel.h b/Spore ModAPI/Spore/Simulator/SubSystem/PlanetModel.h index 81ac3a4e..eb8fe064 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/PlanetModel.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/PlanetModel.h @@ -89,5 +89,6 @@ namespace Simulator DeclareAddress(GetGravity); DeclareAddress(GetHeightAt); DeclareAddress(GetOrientation); + DeclareAddress(GetRadius); // 0xB7DD80 TODO } } \ No newline at end of file diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h b/Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h index c0450d5a..33dcda1c 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h @@ -90,6 +90,13 @@ namespace Simulator /// @param[out] dstSpiceText void GenerateNPCStore(cPlanetRecord* planetRecord, LocalizedString& dstSpiceText); + /// Creates a trading object, which is an inventory item from GroupIDs::SpaceTrading_. + /// @param[out] dst Pointer where the new object will be written. + /// @param itemID Key to the item configuration in GroupIDs::SpaceTrading_ + /// @param itemCount Number of items to create + /// @param itemCost Cost of the object + void CreateTradingObject(cSpaceInventoryItemPtr& dst, const ResourceKey& itemID, int itemCount, float itemCost); + public: struct RareGroup { /* 00h */ uint32_t mGroupID; @@ -126,5 +133,6 @@ namespace Simulator DeclareAddress(GetRareHasBeenFound); // 0x103BC30 0x103AC50 DeclareAddress(SetRareAsFound); // 0x1040820 0x103FBB0 DeclareAddress(GenerateNPCStore); // 0x103F560 0x103E8F0 + DeclareAddress(CreateTradingObject); // 0x103B470 0x103A490 } } \ No newline at end of file diff --git a/Spore ModAPI/Spore/Simulator/cScenarioEditModeDisplayStrategy.h b/Spore ModAPI/Spore/Simulator/cScenarioEditModeDisplayStrategy.h new file mode 100644 index 00000000..9c818495 --- /dev/null +++ b/Spore ModAPI/Spore/Simulator/cScenarioEditModeDisplayStrategy.h @@ -0,0 +1,61 @@ +#pragma once + +#include +#include +#include +#include +#include + +#define cScenarioEditModeDisplayStrategyPtr eastl::intrusive_ptr + +namespace Simulator +{ + class cScenarioEditModeDisplayStrategy + /* 00h */ : public DefaultRefCounted + /* 08h */ , public UTFWin::IWinProc + /* 0Ch */ , public UTFWin::MessageBoxCallback + /* 10h */ , public App::IMessageListener + { + public: + static const uint32_t TYPE = 0x7103861; + + bool Load(); + + public: + /* 14h */ DefaultRefCountedPtr field_14; + /* 18h */ DefaultRefCountedPtr mEditModeScriptUI; // cScenarioEditModeScriptUIPtr + /* 1Ch */ int field_1C; // -1 + /* 20h */ int field_20; // -1 + /// 0x396F69F5.spui + /* 24h */ UILayoutPtr mMainUILayout; + /* 28h */ DefaultRefCountedPtr field_28; + /* 2Ch */ ObjectPtr mNamePanelUI; + /* 30h */ ObjectPtr mWorldComplexityMeter; // cScenarioComplexityMeterPtr + /* 34h */ ObjectPtr mTerraformComplexityMeter; // cScenarioComplexityMeterPtr + /* 38h */ ObjectPtr mTutorialsChecklistUI; // cScenarioTutorialsChecklistUIPtr + /* 3Ch */ ObjectPtr mTutorialsChecklistUI2; // cScenarioTutorialsChecklistUIPtr + /* 40h */ ObjectPtr mPosseUI; // UI::PossePtr + /* 44h */ ObjectPtr mSPUIGlobalOptions; // cSPUIGlobalOptionsPtr + /* 48h */ int field_48; + /* 4Ch */ int field_4C; + /* 50h */ int field_50; + /* 54h */ int field_54; + /* 58h */ int field_58; + /* 5Ch */ int field_5C; + /* 60h */ int field_60; + /* 64h */ int field_64; + /* 68h */ int field_68; + /* 6Ch */ int field_6C; + /* 70h */ App::MessageListenerData mMessageListenerData; + /* 84h */ int field_84; + /* 88h */ int field_88; + /* 8Ch */ int field_8C; + /* 90h */ int field_90; + /* 94h */ int field_94; + }; + ASSERT_SIZE(cScenarioEditModeDisplayStrategy, 0x98); + + namespace Addresses(cScenarioEditModeDisplayStrategy) { + DeclareAddress(Load); // 0xED6000 0xED5C70 + } +} \ No newline at end of file diff --git a/Spore ModAPI/Spore/Simulator/cSpaceInventoryItem.h b/Spore ModAPI/Spore/Simulator/cSpaceInventoryItem.h index 91486f6a..c7146ede 100644 --- a/Spore ModAPI/Spore/Simulator/cSpaceInventoryItem.h +++ b/Spore ModAPI/Spore/Simulator/cSpaceInventoryItem.h @@ -87,13 +87,6 @@ namespace Simulator /// @param instanceIDcddc static void CreateMultiDeliveryObject(cSpaceInventoryItemPtr& dst, const ResourceKey& itemID, uint32_t instanceID); - /// Creates a trading object, which is an inventory item from GroupIDs::SpaceTrading_. - /// @param[out] dst Pointer where the new object will be written. - /// @param itemID Key to the item configuration in GroupIDs::SpaceTrading_ - /// @param itemCount Number of items to create - /// @param itemCost Cost of the object - static void CreateTradingObject(cSpaceInventoryItemPtr& dst, const ResourceKey& itemID, int itemCount, float itemCost); - public: /* 10h */ size_t mItemCount; // 1 /* 14h */ SpaceInventoryItemType mItemType; // 2 diff --git a/Spore ModAPI/Spore/UTFWin/SporeStdDrawable.h b/Spore ModAPI/Spore/UTFWin/SporeStdDrawable.h index 9f3eb808..eba4aefd 100644 --- a/Spore ModAPI/Spore/UTFWin/SporeStdDrawable.h +++ b/Spore ModAPI/Spore/UTFWin/SporeStdDrawable.h @@ -30,6 +30,7 @@ namespace UTFWin { public: static const uint32_t TYPE = 0x53EB526; + static const int NUM_STATES = 8; SporeStdDrawable(); virtual ~SporeStdDrawable(); diff --git a/Spore ModAPI/Spore/UserInterface.h b/Spore ModAPI/Spore/UserInterface.h index ccae9d24..9ad4d192 100644 --- a/Spore ModAPI/Spore/UserInterface.h +++ b/Spore ModAPI/Spore/UserInterface.h @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include #include