From 6d38ff1590f91658d6db22035611a01a4677982b Mon Sep 17 00:00:00 2001 From: Sad Date: Tue, 2 Sep 2025 17:26:25 -0300 Subject: [PATCH 1/4] Add EmpireIsAwareOfPlayer method to cPlayer --- .../SourceCode/DLL/AddressesSimulator.cpp | 6 +++++ Spore ModAPI/SourceCode/Simulator/cPlayer.cpp | 26 +++++++++++++++++++ Spore ModAPI/Spore ModAPI.vcxproj | 5 ++-- Spore ModAPI/Spore ModAPI.vcxproj.filters | 3 +++ Spore ModAPI/Spore/Simulator/cPlayer.h | 12 +++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 Spore ModAPI/SourceCode/Simulator/cPlayer.cpp diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index 821a8e8d..cd9362cf 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -440,6 +441,11 @@ namespace Simulator DefineAddress(GetRingEffect, SelectAddress(0xC6FB50, 0xC70990)); } + namespace Addresses(cPlayer) + { + DefineAddress(EmpireIsAwareOfPlayer, SelectAddress(0xc79900, 0xc7a910)); + } + namespace Addresses(cPlayerInventory) { DefineAddress(GetUnlockableTool, SelectAddress(0xFF4640, 0xFF3BF0)); diff --git a/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp b/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp new file mode 100644 index 00000000..3b11c272 --- /dev/null +++ b/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp @@ -0,0 +1,26 @@ +#ifndef MODAPI_DLL_EXPORT +/**************************************************************************** +* Copyright (C) 2025 Sadicto +* +* This file is part of Spore ModAPI. +* +* Spore ModAPI is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +****************************************************************************/ +#include + +namespace Simulator +{ + auto_METHOD(cPlayer, bool, EmpireIsAwareOfPlayer, Args(uint32_t empireID), Args(empireID)); +} +#endif \ No newline at end of file diff --git a/Spore ModAPI/Spore ModAPI.vcxproj b/Spore ModAPI/Spore ModAPI.vcxproj index 6c361101..9fd1eab1 100644 --- a/Spore ModAPI/Spore ModAPI.vcxproj +++ b/Spore ModAPI/Spore ModAPI.vcxproj @@ -327,8 +327,8 @@ - - + + @@ -1012,6 +1012,7 @@ + diff --git a/Spore ModAPI/Spore ModAPI.vcxproj.filters b/Spore ModAPI/Spore ModAPI.vcxproj.filters index 1bfe6d18..2fc344b3 100644 --- a/Spore ModAPI/Spore ModAPI.vcxproj.filters +++ b/Spore ModAPI/Spore ModAPI.vcxproj.filters @@ -2738,6 +2738,9 @@ Source Files + + Source Files + diff --git a/Spore ModAPI/Spore/Simulator/cPlayer.h b/Spore ModAPI/Spore/Simulator/cPlayer.h index ba308f64..ae875544 100644 --- a/Spore ModAPI/Spore/Simulator/cPlayer.h +++ b/Spore ModAPI/Spore/Simulator/cPlayer.h @@ -87,6 +87,13 @@ namespace Simulator public: static const uint32_t TYPE = 0x3C609F8; + /// Determines whether the specified AI empire is aware of the player. + /// An empire is considered "aware" if the player has contacted it at least once, + /// or if the empire has ever sent a transmission to the player. + /// @param empireID The ID of the empire to check. + /// @returns True if the empire is aware of the player, false otherwise. + bool EmpireIsAwareOfPlayer(uint32_t empireID); + public: /* 38h */ eastl::sp_fixed_hash_set mOneTimeEventFlags; /* 68Ch */ int field_68C; @@ -135,4 +142,9 @@ namespace Simulator /* 129Ch */ eastl::fixed_vector mAdventuresCompleted; }; ASSERT_SIZE(cPlayer, 0x12D8); + + namespace Addresses(cPlayer) + { + DeclareAddress(EmpireIsAwareOfPlayer); // 0xc79900 0xc7a910 + } } \ No newline at end of file From a1b81a9fa979a0a529e2708b89bb05e3cb2b9094 Mon Sep 17 00:00:00 2001 From: Sad Date: Tue, 2 Sep 2025 17:50:48 -0300 Subject: [PATCH 2/4] Add PlayerContactedEmpire method to cPlayer --- Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp | 1 + Spore ModAPI/SourceCode/Simulator/cPlayer.cpp | 1 + Spore ModAPI/Spore/Simulator/cPlayer.h | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index cd9362cf..46e174c0 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -444,6 +444,7 @@ namespace Simulator namespace Addresses(cPlayer) { DefineAddress(EmpireIsAwareOfPlayer, SelectAddress(0xc79900, 0xc7a910)); + DefineAddress(PlayerContactedEmpire, SelectAddress(0xc798a0, 0xc7a8b0)); } namespace Addresses(cPlayerInventory) diff --git a/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp b/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp index 3b11c272..bf9e8f06 100644 --- a/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp +++ b/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp @@ -22,5 +22,6 @@ namespace Simulator { auto_METHOD(cPlayer, bool, EmpireIsAwareOfPlayer, Args(uint32_t empireID), Args(empireID)); + auto_METHOD(cPlayer, bool, PlayerContactedEmpire, Args(uint32_t empireID), Args(empireID)); } #endif \ No newline at end of file diff --git a/Spore ModAPI/Spore/Simulator/cPlayer.h b/Spore ModAPI/Spore/Simulator/cPlayer.h index ae875544..83ead489 100644 --- a/Spore ModAPI/Spore/Simulator/cPlayer.h +++ b/Spore ModAPI/Spore/Simulator/cPlayer.h @@ -87,13 +87,18 @@ namespace Simulator public: static const uint32_t TYPE = 0x3C609F8; - /// Determines whether the specified AI empire is aware of the player. + /// Checks whether the specified empire is aware of the player. /// An empire is considered "aware" if the player has contacted it at least once, /// or if the empire has ever sent a transmission to the player. /// @param empireID The ID of the empire to check. /// @returns True if the empire is aware of the player, false otherwise. bool EmpireIsAwareOfPlayer(uint32_t empireID); + /// Checks whether the player has ever contacted the specified empire. + /// @param empireID The ID of the empire to check. + /// @returns True if the player has contacted the empire at least once, false otherwise. + bool PlayerContactedEmpire(uint32_t empireID); + public: /* 38h */ eastl::sp_fixed_hash_set mOneTimeEventFlags; /* 68Ch */ int field_68C; @@ -146,5 +151,6 @@ namespace Simulator namespace Addresses(cPlayer) { DeclareAddress(EmpireIsAwareOfPlayer); // 0xc79900 0xc7a910 + DeclareAddress(PlayerContactedEmpire); // 0xc798a0 0xc7a8b0 } } \ No newline at end of file From 9cad749303152cc704e20ee733953aa89cbfa545 Mon Sep 17 00:00:00 2001 From: Sad Date: Tue, 2 Sep 2025 19:20:24 -0300 Subject: [PATCH 3/4] Delete player.cpp and move meths to SimulatorMisc.cpp --- .../SourceCode/Simulator/SimulatorMisc.cpp | 7 +++++ Spore ModAPI/SourceCode/Simulator/cPlayer.cpp | 27 ------------------- Spore ModAPI/Spore ModAPI.vcxproj | 1 - Spore ModAPI/Spore ModAPI.vcxproj.filters | 3 --- 4 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 Spore ModAPI/SourceCode/Simulator/cPlayer.cpp diff --git a/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp b/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp index a21bb8af..75af7f67 100644 --- a/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp +++ b/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace Simulator { @@ -243,6 +244,12 @@ namespace Simulator /// cNpcTribeController /// auto_STATIC_METHOD_(cNpcTribeController, cNpcTribeController*, Get); + + /// cPlayer /// + + auto_METHOD(cPlayer, bool, EmpireIsAwareOfPlayer, Args(uint32_t empireID), Args(empireID)); + auto_METHOD(cPlayer, bool, PlayerContactedEmpire, Args(uint32_t empireID), Args(empireID)); + } #endif \ No newline at end of file diff --git a/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp b/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp deleted file mode 100644 index bf9e8f06..00000000 --- a/Spore ModAPI/SourceCode/Simulator/cPlayer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef MODAPI_DLL_EXPORT -/**************************************************************************** -* Copyright (C) 2025 Sadicto -* -* This file is part of Spore ModAPI. -* -* Spore ModAPI is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -****************************************************************************/ -#include - -namespace Simulator -{ - auto_METHOD(cPlayer, bool, EmpireIsAwareOfPlayer, Args(uint32_t empireID), Args(empireID)); - auto_METHOD(cPlayer, bool, PlayerContactedEmpire, Args(uint32_t empireID), Args(empireID)); -} -#endif \ No newline at end of file diff --git a/Spore ModAPI/Spore ModAPI.vcxproj b/Spore ModAPI/Spore ModAPI.vcxproj index 9fd1eab1..ad242762 100644 --- a/Spore ModAPI/Spore ModAPI.vcxproj +++ b/Spore ModAPI/Spore ModAPI.vcxproj @@ -1012,7 +1012,6 @@ - diff --git a/Spore ModAPI/Spore ModAPI.vcxproj.filters b/Spore ModAPI/Spore ModAPI.vcxproj.filters index 2fc344b3..1bfe6d18 100644 --- a/Spore ModAPI/Spore ModAPI.vcxproj.filters +++ b/Spore ModAPI/Spore ModAPI.vcxproj.filters @@ -2738,9 +2738,6 @@ Source Files - - Source Files - From bc7847be34b8015985e86eec174529f9c94592e2 Mon Sep 17 00:00:00 2001 From: Sad Date: Tue, 2 Sep 2025 19:49:00 -0300 Subject: [PATCH 4/4] Delete unwanted changes to .vcxproj --- Spore ModAPI/Spore ModAPI.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Spore ModAPI/Spore ModAPI.vcxproj b/Spore ModAPI/Spore ModAPI.vcxproj index ad242762..6c361101 100644 --- a/Spore ModAPI/Spore ModAPI.vcxproj +++ b/Spore ModAPI/Spore ModAPI.vcxproj @@ -327,8 +327,8 @@ - - + +