diff --git a/include/RED4ext/Api/FileVer.hpp b/include/RED4ext/Api/FileVer.hpp index 33a459bea..67cca7d9e 100644 --- a/include/RED4ext/Api/FileVer.hpp +++ b/include/RED4ext/Api/FileVer.hpp @@ -1,8 +1,8 @@ #pragma once -#include +#include /** * @brief Creates a file version using the latest version info type. */ -#define RED4EXT_FILEVER(major, minor, build, revision) RED4EXT_V0_FILEVER(major, minor, build, revision) +#define RED4EXT_FILEVER(major, minor, build, revision) RED4EXT_V1_FILEVER(major, minor, build, revision) diff --git a/include/RED4ext/Api/Runtime.hpp b/include/RED4ext/Api/Runtime.hpp index a925bb08c..b3746eee8 100644 --- a/include/RED4ext/Api/Runtime.hpp +++ b/include/RED4ext/Api/Runtime.hpp @@ -1,37 +1,37 @@ #pragma once -#include +#include -#define RED4EXT_RUNTIME_1_50 RED4EXT_V0_RUNTIME_1_50 -#define RED4EXT_RUNTIME_1_50_HOTFIX_1 RED4EXT_V0_RUNTIME_1_50_HOTFIX_1 -#define RED4EXT_RUNTIME_1_50_HOTFIX_2 RED4EXT_V0_RUNTIME_1_50_HOTFIX_2 -#define RED4EXT_RUNTIME_1_52 RED4EXT_V0_RUNTIME_1_52 -#define RED4EXT_RUNTIME_1_52_HOTFIX_1 RED4EXT_V0_RUNTIME_1_52_HOTFIX_1 -#define RED4EXT_RUNTIME_1_60 RED4EXT_V0_RUNTIME_1_60 -#define RED4EXT_RUNTIME_1_61 RED4EXT_V0_RUNTIME_1_61 -#define RED4EXT_RUNTIME_1_61_HOTFIX_1 RED4EXT_V0_RUNTIME_1_61_HOTFIX_1 -#define RED4EXT_RUNTIME_1_62 RED4EXT_V0_RUNTIME_1_62 -#define RED4EXT_RUNTIME_1_62_HOTFIX_1 RED4EXT_V0_RUNTIME_1_62_HOTFIX_1 -#define RED4EXT_RUNTIME_1_63 RED4EXT_V0_RUNTIME_1_63 -#define RED4EXT_RUNTIME_1_63_HOTFIX_1 RED4EXT_V0_RUNTIME_1_63_HOTFIX_1 -#define RED4EXT_RUNTIME_2_00 RED4EXT_V0_RUNTIME_2_00 -#define RED4EXT_RUNTIME_2_01 RED4EXT_V0_RUNTIME_2_01 -#define RED4EXT_RUNTIME_2_02 RED4EXT_V0_RUNTIME_2_02 -#define RED4EXT_RUNTIME_2_10 RED4EXT_V0_RUNTIME_2_10 -#define RED4EXT_RUNTIME_2_11 RED4EXT_V0_RUNTIME_2_11 -#define RED4EXT_RUNTIME_2_12 RED4EXT_V0_RUNTIME_2_12 -#define RED4EXT_RUNTIME_2_12_HOTFIX_1 RED4EXT_V0_RUNTIME_2_12_HOTFIX_1 -#define RED4EXT_RUNTIME_2_13 RED4EXT_V0_RUNTIME_2_13 -#define RED4EXT_RUNTIME_2_20 RED4EXT_V0_RUNTIME_2_20 -#define RED4EXT_RUNTIME_2_21 RED4EXT_V0_RUNTIME_2_21 +#define RED4EXT_RUNTIME_1_50 RED4EXT_V1_RUNTIME_1_50 +#define RED4EXT_RUNTIME_1_50_HOTFIX_1 RED4EXT_V1_RUNTIME_1_50_HOTFIX_1 +#define RED4EXT_RUNTIME_1_50_HOTFIX_2 RED4EXT_V1_RUNTIME_1_50_HOTFIX_2 +#define RED4EXT_RUNTIME_1_52 RED4EXT_V1_RUNTIME_1_52 +#define RED4EXT_RUNTIME_1_52_HOTFIX_1 RED4EXT_V1_RUNTIME_1_52_HOTFIX_1 +#define RED4EXT_RUNTIME_1_60 RED4EXT_V1_RUNTIME_1_60 +#define RED4EXT_RUNTIME_1_61 RED4EXT_V1_RUNTIME_1_61 +#define RED4EXT_RUNTIME_1_61_HOTFIX_1 RED4EXT_V1_RUNTIME_1_61_HOTFIX_1 +#define RED4EXT_RUNTIME_1_62 RED4EXT_V1_RUNTIME_1_62 +#define RED4EXT_RUNTIME_1_62_HOTFIX_1 RED4EXT_V1_RUNTIME_1_62_HOTFIX_1 +#define RED4EXT_RUNTIME_1_63 RED4EXT_V1_RUNTIME_1_63 +#define RED4EXT_RUNTIME_1_63_HOTFIX_1 RED4EXT_V1_RUNTIME_1_63_HOTFIX_1 +#define RED4EXT_RUNTIME_2_00 RED4EXT_V1_RUNTIME_2_00 +#define RED4EXT_RUNTIME_2_01 RED4EXT_V1_RUNTIME_2_01 +#define RED4EXT_RUNTIME_2_02 RED4EXT_V1_RUNTIME_2_02 +#define RED4EXT_RUNTIME_2_10 RED4EXT_V1_RUNTIME_2_10 +#define RED4EXT_RUNTIME_2_11 RED4EXT_V1_RUNTIME_2_11 +#define RED4EXT_RUNTIME_2_12 RED4EXT_V1_RUNTIME_2_12 +#define RED4EXT_RUNTIME_2_12_HOTFIX_1 RED4EXT_V1_RUNTIME_2_12_HOTFIX_1 +#define RED4EXT_RUNTIME_2_13 RED4EXT_V1_RUNTIME_2_13 +#define RED4EXT_RUNTIME_2_20 RED4EXT_V1_RUNTIME_2_20 +#define RED4EXT_RUNTIME_2_21 RED4EXT_V1_RUNTIME_2_21 /** * @brief Supports all game versions. * @note Only use this if you do not use RED4ext.SDK library, but you want to use RED4ext as a loader only. */ -#define RED4EXT_RUNTIME_INDEPENDENT RED4EXT_V0_RUNTIME_INDEPENDENT +#define RED4EXT_RUNTIME_INDEPENDENT RED4EXT_V1_RUNTIME_INDEPENDENT /* * @brief The latest game version. */ -#define RED4EXT_RUNTIME_LATEST RED4EXT_V0_RUNTIME_LATEST +#define RED4EXT_RUNTIME_LATEST RED4EXT_V1_RUNTIME_LATEST diff --git a/include/RED4ext/Api/Sdk.hpp b/include/RED4ext/Api/Sdk.hpp index ec44c52e1..5588a0dbd 100644 --- a/include/RED4ext/Api/Sdk.hpp +++ b/include/RED4ext/Api/Sdk.hpp @@ -1,54 +1,54 @@ #pragma once -#include -#include +#include +#include namespace RED4ext { /** * @brief The latest plugin info type. */ -using PluginInfo = v0::PluginInfo; +using PluginInfo = v1::PluginInfo; /** * @brief The latest version info type. */ -using SemVer = v0::SemVer; +using SemVer = v1::SemVer; /** * @brief The latest version info type. */ -using FileVer = v0::FileVer; +using FileVer = v1::FileVer; /** * @brief The latest RED4ext. */ -using Sdk = v0::Sdk; +using Sdk = v1::Sdk; /** * @brief The latest hooking. */ -using Logger = v0::Logger; +using Logger = v1::Logger; /** * @brief The latest hooking. */ -using Hooking = v0::Hooking; +using Hooking = v1::Hooking; /** * @brief The latest game state type. */ -using GameStates = v0::GameStates; +using GameStates = v1::GameStates; /** * @brief The latest game state type. */ -using GameState = v0::GameState; +using GameState = v1::GameState; /** * @brief The latest game state type. */ -using Scripts = v0::Scripts; +using Scripts = v1::Scripts; } // namespace RED4ext /* diff --git a/include/RED4ext/Api/SemVer.hpp b/include/RED4ext/Api/SemVer.hpp index 515b90813..1131e5ba7 100644 --- a/include/RED4ext/Api/SemVer.hpp +++ b/include/RED4ext/Api/SemVer.hpp @@ -1,14 +1,14 @@ #pragma once -#include +#include /** * @brief Creates a semantic version using the latest version info type. */ #define RED4EXT_SEMVER_EX(major, minor, patch, prereleaseType, prereleaseNumber) \ - RED4EXT_V0_SEMVER_EX(major, minor, patch, prereleaseType, prereleaseNumber) + RED4EXT_V1_SEMVER_EX(major, minor, patch, prereleaseType, prereleaseNumber) /** * @brief Creates a semantic version using the latest version info type. */ -#define RED4EXT_SEMVER(major, minor, patch) RED4EXT_V0_SEMVER(major, minor, patch) +#define RED4EXT_SEMVER(major, minor, patch) RED4EXT_V1_SEMVER(major, minor, patch) diff --git a/include/RED4ext/Api/Version.hpp b/include/RED4ext/Api/Version.hpp index d1ff09c5d..63ad53b1e 100644 --- a/include/RED4ext/Api/Version.hpp +++ b/include/RED4ext/Api/Version.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include /* * The SDK is using only one API version, the reason behind that is that multiple versions for every structure is @@ -15,17 +15,18 @@ */ #define RED4EXT_API_VERSION_0 0 -#define RED4EXT_API_VERSION_LATEST RED4EXT_API_VERSION_0 +#define RED4EXT_API_VERSION_1 1 +#define RED4EXT_API_VERSION_LATEST RED4EXT_API_VERSION_1 /* * The SDK version, it is maninly used to reject loading plugin that are using a broken SDK version, while API version * is 0, it is used to load only plugins using the latest SDK version. */ -#define RED4EXT_SDK_0_1_0 RED4EXT_V0_SDK_0_1_0 -#define RED4EXT_SDK_0_2_0 RED4EXT_V0_SDK_0_2_0 -#define RED4EXT_SDK_0_3_0 RED4EXT_V0_SDK_0_3_0 -#define RED4EXT_SDK_0_4_0 RED4EXT_V0_SDK_0_4_0 -#define RED4EXT_SDK_0_5_0 RED4EXT_V0_SDK_0_5_0 +#define RED4EXT_SDK_0_1_0 RED4EXT_V1_SDK_0_1_0 +#define RED4EXT_SDK_0_2_0 RED4EXT_V1_SDK_0_2_0 +#define RED4EXT_SDK_0_3_0 RED4EXT_V1_SDK_0_3_0 +#define RED4EXT_SDK_0_4_0 RED4EXT_V1_SDK_0_4_0 +#define RED4EXT_SDK_0_5_0 RED4EXT_V1_SDK_0_5_0 -#define RED4EXT_SDK_LATEST RED4EXT_V0_SDK_LATEST +#define RED4EXT_SDK_LATEST RED4EXT_V1_SDK_LATEST diff --git a/include/RED4ext/Api/v0/FileVer.hpp b/include/RED4ext/Api/v0/FileVer.hpp deleted file mode 100644 index a3857fddd..000000000 --- a/include/RED4ext/Api/v0/FileVer.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include -#include - -namespace RED4ext::v0 -{ -struct FileVer -{ - uint16_t major; - uint16_t minor; - uint16_t build; - uint16_t revision; -}; - -FileVer CreateFileVer(uint16_t aMajor, uint16_t aMinor, uint16_t aBuild, uint16_t aRevision); - -/** - * @brief Compare two file versions. - * @param aLhs The lhs version. - * @param aRhs The rhs version. - * @return < 0 if lhs is lower than rhs, 0 if they are equal, > 0 if lhs is greater than lhs. - */ -int32_t CompareFileVer(const RED4ext::v0::FileVer& aLhs, const RED4ext::v0::FileVer& aRhs); -} // namespace RED4ext::v0 - -#define RED4EXT_V0_FILEVER(major, minor, build, revision) RED4ext::v0::CreateFileVer(major, minor, build, revision) - -#ifdef __cplusplus -namespace std -{ -std::wstring to_wstring(const RED4ext::v0::FileVer& aVersion); -} // namespace std -#endif - -#ifdef RED4EXT_HEADER_ONLY -#include -#endif - -#ifdef __cplusplus -inline bool operator<(const RED4ext::v0::FileVer& aLhs, const RED4ext::v0::FileVer& aRhs) -{ - return RED4ext::v0::CompareFileVer(aLhs, aRhs) < 0; -} - -inline bool operator<=(const RED4ext::v0::FileVer& aLhs, const RED4ext::v0::FileVer& aRhs) -{ - return RED4ext::v0::CompareFileVer(aLhs, aRhs) <= 0; -} - -inline bool operator>(const RED4ext::v0::FileVer& aLhs, const RED4ext::v0::FileVer& aRhs) -{ - return RED4ext::v0::CompareFileVer(aLhs, aRhs) > 0; -} - -inline bool operator>=(const RED4ext::v0::FileVer& aLhs, const RED4ext::v0::FileVer& aRhs) -{ - return RED4ext::v0::CompareFileVer(aLhs, aRhs) >= 0; -} - -inline bool operator==(const RED4ext::v0::FileVer& aLhs, const RED4ext::v0::FileVer& aRhs) -{ - return RED4ext::v0::CompareFileVer(aLhs, aRhs) == 0; -} - -inline bool operator!=(const RED4ext::v0::FileVer& aLhs, const RED4ext::v0::FileVer& aRhs) -{ - return RED4ext::v0::CompareFileVer(aLhs, aRhs) != 0; -} -#endif diff --git a/include/RED4ext/Api/v0/GameState.hpp b/include/RED4ext/Api/v0/GameState.hpp deleted file mode 100644 index bf3b0fe75..000000000 --- a/include/RED4ext/Api/v0/GameState.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -namespace RED4ext -{ -struct CGameApplication; - -namespace v0 -{ -struct GameState -{ - /** - * @brief The function that is called when the state is actived. - * - * @param[in] aApp The game application. - * - * @return Always return true. - * @note The return result do not matter for this event, always return "true" here. - */ - bool (*OnEnter)(CGameApplication* aApp); - - /** - * @brief The function that is called when the state is updated. - * - * @param[in] aApp The game application. - * - * @return true if the state is done updating, false otherwise. - * @note Returning true will prevent the update function from being called, returning false will keep calling the - * function until it returns true. When this function is called from "Running" the return result will not - * matter. - */ - bool (*OnUpdate)(CGameApplication* aApp); - - /** - * @brief The function that is called when the state is done. - * - * @param[in] aApp The game application. - * - * @return Always return true. - * @note The return result do not matter for this event, always return "true" here. - */ - bool (*OnExit)(CGameApplication* aApp); -}; -} // namespace v0 -} // namespace RED4ext diff --git a/include/RED4ext/Api/v0/GameStates.hpp b/include/RED4ext/Api/v0/GameStates.hpp deleted file mode 100644 index 1f41d68e9..000000000 --- a/include/RED4ext/Api/v0/GameStates.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include - -namespace RED4ext -{ -enum class EGameStateType : uint32_t; - -namespace v0 -{ -struct GameStates -{ - /** - * @brief Add a custom game state. - * - * @param[in] aHandle The plugin's handle. - * @param[in] aType The type of the state. - * @param[in] aState The state. Can be allocated on stack. - * - * @return true if the state is added successfully, false otherwise. - */ - bool (*Add)(PluginHandle aHandle, EGameStateType aType, GameState* aState); -}; -} // namespace v0 -} // namespace RED4ext diff --git a/include/RED4ext/Api/v0/Runtime.hpp b/include/RED4ext/Api/v0/Runtime.hpp deleted file mode 100644 index 35533d6bb..000000000 --- a/include/RED4ext/Api/v0/Runtime.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include - -/* - * CD Projekt RED does use semantic versioning in their game for "PRODUCTVERSION", but the string one and patch notes do - * not respect the semantic version. It is interpreted as semantic versioning as following: - * 1.03 -> major: 1, minor: 0, patch: 3. - * 1.10 -> major: 1, minor: 1, patch: 0. - * 1.11 -> major: 1, minor: 1, patch: 1. - * - * To keep things consinstently we are going to use their own versioning for runtime defines. - */ - -#define RED4EXT_V0_RUNTIME_1_50 RED4EXT_V0_FILEVER(3, 0, 58, 35694) -#define RED4EXT_V0_RUNTIME_1_50_HOTFIX_1 RED4EXT_V0_FILEVER(3, 0, 58, 60196) -#define RED4EXT_V0_RUNTIME_1_50_HOTFIX_2 RED4EXT_V0_FILEVER(3, 0, 58, 63411) -#define RED4EXT_V0_RUNTIME_1_52 RED4EXT_V0_FILEVER(3, 0, 59, 40169) -#define RED4EXT_V0_RUNTIME_1_52_HOTFIX_1 RED4EXT_V0_FILEVER(3, 0, 60, 1056) -#define RED4EXT_V0_RUNTIME_1_60 RED4EXT_V0_FILEVER(3, 0, 64, 38113) -#define RED4EXT_V0_RUNTIME_1_61 RED4EXT_V0_FILEVER(3, 0, 66, 28510) -#define RED4EXT_V0_RUNTIME_1_61_HOTFIX_1 RED4EXT_V0_FILEVER(3, 0, 68, 49653) -#define RED4EXT_V0_RUNTIME_1_62 RED4EXT_V0_FILEVER(3, 0, 70, 58535) -#define RED4EXT_V0_RUNTIME_1_62_HOTFIX_1 RED4EXT_V0_FILEVER(3, 0, 71, 13361) -#define RED4EXT_V0_RUNTIME_1_63 RED4EXT_V0_FILEVER(3, 0, 72, 45053) -#define RED4EXT_V0_RUNTIME_1_63_HOTFIX_1 RED4EXT_V0_FILEVER(3, 0, 72, 54038) -#define RED4EXT_V0_RUNTIME_2_00 RED4EXT_V0_FILEVER(3, 0, 74, 53121) -#define RED4EXT_V0_RUNTIME_2_01 RED4EXT_V0_FILEVER(3, 0, 74, 63017) -#define RED4EXT_V0_RUNTIME_2_02 RED4EXT_V0_FILEVER(3, 0, 75, 25522) -#define RED4EXT_V0_RUNTIME_2_10 RED4EXT_V0_FILEVER(3, 0, 76, 4238) -#define RED4EXT_V0_RUNTIME_2_11 RED4EXT_V0_FILEVER(3, 0, 76, 41558) -#define RED4EXT_V0_RUNTIME_2_12 RED4EXT_V0_FILEVER(3, 0, 76, 55031) -#define RED4EXT_V0_RUNTIME_2_12_HOTFIX_1 RED4EXT_V0_FILEVER(3, 0, 76, 64179) -#define RED4EXT_V0_RUNTIME_2_13 RED4EXT_V0_FILEVER(3, 0, 77, 64623) -#define RED4EXT_V0_RUNTIME_2_20 RED4EXT_V0_FILEVER(3, 0, 78, 41888) -#define RED4EXT_V0_RUNTIME_2_21 RED4EXT_V0_FILEVER(3, 0, 78, 57301) - -/** - * @brief Supports all game versions. - * @note Only use this if you do not use RED4ext.SDK library, but you want to use RED4ext as a loader only. - */ -#define RED4EXT_V0_RUNTIME_INDEPENDENT \ - RED4EXT_V0_FILEVER(static_cast(-1), static_cast(-1), static_cast(-1), \ - static_cast(-1)) - -/* - * @brief The latest game version. - */ -#define RED4EXT_V0_RUNTIME_LATEST RED4EXT_V0_RUNTIME_2_21 diff --git a/include/RED4ext/Api/v0/SemVer.hpp b/include/RED4ext/Api/v0/SemVer.hpp deleted file mode 100644 index 241004c6a..000000000 --- a/include/RED4ext/Api/v0/SemVer.hpp +++ /dev/null @@ -1,133 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace RED4ext::v0 -{ -struct SemVer -{ - struct PrereleaseInfo - { - uint32_t type; - uint32_t number; - }; - - uint8_t major; - uint16_t minor; - uint32_t patch; - PrereleaseInfo prerelease; -}; - -SemVer CreateSemVer(uint8_t aMajor, uint16_t aMinor, uint32_t aPatch, uint32_t prereleaseType, - uint32_t prereleaseNumber); - -/** - * @brief Compare two semantic versions. - * @param aLhs The lhs version. - * @param aRhs The rhs version. - * @return < 0 if lhs is lower than rhs, 0 if they are equal, > 0 if lhs is greater than lhs. - */ -int32_t CompareSemVer(const RED4ext::v0::SemVer& aLhs, const RED4ext::v0::SemVer& aRhs); - -/** - * @brief Compare two pre-release semantic versions. - * @param aLhs The lhs pre-release. - * @param aRhs The rhs pre-release. - * @return < 0 if lhs is lower than rhs, 0 if they are equal, > 0 if lhs is greater than lhs. - */ -int32_t CompareSemVerPrerelease(const RED4ext::v0::SemVer::PrereleaseInfo& aLhs, - const RED4ext::v0::SemVer::PrereleaseInfo& aRhs); -} // namespace RED4ext::v0 - -// clang-format off -#define RED4EXT_V0_SEMVER_PRERELEASE_TYPE_NONE 0ul -#define RED4EXT_V0_SEMVER_PRERELEASE_TYPE_ALPHA 1ul -#define RED4EXT_V0_SEMVER_PRERELEASE_TYPE_BETA 2ul -#define RED4EXT_V0_SEMVER_PRERELEASE_TYPE_RC 3ul -// clang-format on - -#define RED4EXT_V0_SEMVER_EX(major, minor, patch, prereleaseType, prereleaseNumber) \ - RED4ext::v0::CreateSemVer(major, minor, patch, prereleaseType, prereleaseNumber) - -#define RED4EXT_V0_SEMVER(major, minor, patch) \ - RED4EXT_V0_SEMVER_EX(major, minor, patch, RED4EXT_V0_SEMVER_PRERELEASE_TYPE_NONE, 0) - -#ifdef __cplusplus -namespace std -{ -std::wstring to_wstring(const RED4ext::v0::SemVer& aVersion); -} // namespace std -#endif - -#ifdef RED4EXT_HEADER_ONLY -#include -#endif - -#ifdef __cplusplus -#pragma region PrereleaseInfo operators -inline bool operator<(const RED4ext::v0::SemVer::PrereleaseInfo& aLhs, const RED4ext::v0::SemVer::PrereleaseInfo& aRhs) -{ - return RED4ext::v0::CompareSemVerPrerelease(aLhs, aRhs) < 0; -} - -inline bool operator<=(const RED4ext::v0::SemVer::PrereleaseInfo& aLhs, const RED4ext::v0::SemVer::PrereleaseInfo& aRhs) -{ - return RED4ext::v0::CompareSemVerPrerelease(aLhs, aRhs) <= 0; -} - -inline bool operator>(const RED4ext::v0::SemVer::PrereleaseInfo& aLhs, const RED4ext::v0::SemVer::PrereleaseInfo& aRhs) -{ - return RED4ext::v0::CompareSemVerPrerelease(aLhs, aRhs) > 0; -} - -inline bool operator>=(const RED4ext::v0::SemVer::PrereleaseInfo& aLhs, const RED4ext::v0::SemVer::PrereleaseInfo& aRhs) -{ - return RED4ext::v0::CompareSemVerPrerelease(aLhs, aRhs) >= 0; -} - -inline bool operator==(const RED4ext::v0::SemVer::PrereleaseInfo& aLhs, const RED4ext::v0::SemVer::PrereleaseInfo& aRhs) -{ - return RED4ext::v0::CompareSemVerPrerelease(aLhs, aRhs) == 0; -} - -inline bool operator!=(const RED4ext::v0::SemVer::PrereleaseInfo& aLhs, const RED4ext::v0::SemVer::PrereleaseInfo& aRhs) -{ - return RED4ext::v0::CompareSemVerPrerelease(aLhs, aRhs) != 0; -} -#pragma endregion - -#pragma region VersionInfo operators -inline bool operator<(const RED4ext::v0::SemVer& aLhs, const RED4ext::v0::SemVer& aRhs) -{ - return RED4ext::v0::CompareSemVer(aLhs, aRhs) < 0; -} - -inline bool operator<=(const RED4ext::v0::SemVer& aLhs, const RED4ext::v0::SemVer& aRhs) -{ - return RED4ext::v0::CompareSemVer(aLhs, aRhs) <= 0; -} - -inline bool operator>(const RED4ext::v0::SemVer& aLhs, const RED4ext::v0::SemVer& aRhs) -{ - return RED4ext::v0::CompareSemVer(aLhs, aRhs) > 0; -} - -inline bool operator>=(const RED4ext::v0::SemVer& aLhs, const RED4ext::v0::SemVer& aRhs) -{ - return RED4ext::v0::CompareSemVer(aLhs, aRhs) >= 0; -} - -inline bool operator==(const RED4ext::v0::SemVer& aLhs, const RED4ext::v0::SemVer& aRhs) -{ - return RED4ext::v0::CompareSemVer(aLhs, aRhs) == 0; -} - -inline bool operator!=(const RED4ext::v0::SemVer& aLhs, const RED4ext::v0::SemVer& aRhs) -{ - return RED4ext::v0::CompareSemVer(aLhs, aRhs) != 0; -} -#pragma endregion -#endif diff --git a/include/RED4ext/Api/v0/Version.hpp b/include/RED4ext/Api/v0/Version.hpp deleted file mode 100644 index de65c14ef..000000000 --- a/include/RED4ext/Api/v0/Version.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -#define RED4EXT_V0_SDK_0_1_0 RED4EXT_V0_SEMVER(0, 1, 0) -#define RED4EXT_V0_SDK_0_2_0 RED4EXT_V0_SEMVER(0, 2, 0) -#define RED4EXT_V0_SDK_0_3_0 RED4EXT_V0_SEMVER(0, 3, 0) -#define RED4EXT_V0_SDK_0_4_0 RED4EXT_V0_SEMVER(0, 4, 0) -#define RED4EXT_V0_SDK_0_5_0 RED4EXT_V0_SEMVER(0, 5, 0) - -#define RED4EXT_V0_SDK_LATEST RED4EXT_V0_SEMVER(RED4EXT_VER_MAJOR, RED4EXT_VER_MINOR, RED4EXT_VER_PATCH) diff --git a/include/RED4ext/Api/v0/FileVer-inl.hpp b/include/RED4ext/Api/v1/FileVer-inl.hpp similarity index 52% rename from include/RED4ext/Api/v0/FileVer-inl.hpp rename to include/RED4ext/Api/v1/FileVer-inl.hpp index aac2de020..c7ab13cd5 100644 --- a/include/RED4ext/Api/v0/FileVer-inl.hpp +++ b/include/RED4ext/Api/v1/FileVer-inl.hpp @@ -1,25 +1,20 @@ #pragma once #ifdef RED4EXT_STATIC_LIB -#include +#include #endif #include #include -RED4EXT_INLINE RED4ext::v0::FileVer RED4ext::v0::CreateFileVer(uint16_t aMajor, uint16_t aMinor, uint16_t aBuild, - uint16_t aRevision) +namespace RED4ext::v1 { - FileVer version{}; - version.major = aMajor; - version.minor = aMinor; - version.build = aBuild; - version.revision = aRevision; - - return version; +RED4EXT_INLINE FileVer CreateFileVer(uint16_t aMajor, uint16_t aMinor, uint16_t aBuild, uint16_t aRevision) +{ + return {.major = aMajor, .minor = aMinor, .build = aBuild, .revision = aRevision}; } -RED4EXT_INLINE int32_t RED4ext::v0::CompareFileVer(const RED4ext::v0::FileVer& aLhs, const RED4ext::v0::FileVer& aRhs) +RED4EXT_INLINE int32_t CompareFileVer(const FileVer& aLhs, const FileVer& aRhs) { if (aLhs.major != aRhs.major) { @@ -40,11 +35,15 @@ RED4EXT_INLINE int32_t RED4ext::v0::CompareFileVer(const RED4ext::v0::FileVer& a return 0; } +} // namespace RED4ext::v1 -RED4EXT_INLINE std::wstring std::to_wstring(const RED4ext::v0::FileVer& aVersion) +namespace std +{ +RED4EXT_INLINE std::wstring to_wstring(const RED4ext::v1::FileVer& aVersion) { std::wstringstream stream; stream << aVersion.major << L"." << aVersion.minor << L"." << aVersion.build << L"." << aVersion.revision; return stream.str(); } +} // namespace std diff --git a/include/RED4ext/Api/v1/FileVer.hpp b/include/RED4ext/Api/v1/FileVer.hpp new file mode 100644 index 000000000..134638268 --- /dev/null +++ b/include/RED4ext/Api/v1/FileVer.hpp @@ -0,0 +1,66 @@ +#pragma once + +#include +#include + +namespace RED4ext::v1 +{ +struct FileVer +{ + uint16_t major; + uint16_t minor; + uint16_t build; + uint16_t revision; +}; + +FileVer CreateFileVer(uint16_t aMajor, uint16_t aMinor, uint16_t aBuild, uint16_t aRevision); + +/** + * @brief Compare two file versions. + * @param aLhs The lhs version. + * @param aRhs The rhs version. + * @return < 0 if lhs is lower than rhs, 0 if they are equal, > 0 if lhs is greater than lhs. + */ +int32_t CompareFileVer(const FileVer& aLhs, const FileVer& aRhs); +} // namespace RED4ext::v1 + +#define RED4EXT_V1_FILEVER(major, minor, build, revision) RED4ext::v1::CreateFileVer(major, minor, build, revision) + +namespace std +{ +std::wstring to_wstring(const RED4ext::v1::FileVer& aVersion); +} // namespace std + +#ifdef RED4EXT_HEADER_ONLY +#include +#endif + +inline bool operator<(const RED4ext::v1::FileVer& aLhs, const RED4ext::v1::FileVer& aRhs) +{ + return RED4ext::v1::CompareFileVer(aLhs, aRhs) < 0; +} + +inline bool operator<=(const RED4ext::v1::FileVer& aLhs, const RED4ext::v1::FileVer& aRhs) +{ + return RED4ext::v1::CompareFileVer(aLhs, aRhs) <= 0; +} + +inline bool operator>(const RED4ext::v1::FileVer& aLhs, const RED4ext::v1::FileVer& aRhs) +{ + return RED4ext::v1::CompareFileVer(aLhs, aRhs) > 0; +} + +inline bool operator>=(const RED4ext::v1::FileVer& aLhs, const RED4ext::v1::FileVer& aRhs) +{ + return RED4ext::v1::CompareFileVer(aLhs, aRhs) >= 0; +} + +inline bool operator==(const RED4ext::v1::FileVer& aLhs, const RED4ext::v1::FileVer& aRhs) +{ + return RED4ext::v1::CompareFileVer(aLhs, aRhs) == 0; +} + +inline bool operator!=(const RED4ext::v1::FileVer& aLhs, const RED4ext::v1::FileVer& aRhs) +{ + return RED4ext::v1::CompareFileVer(aLhs, aRhs) != 0; +} diff --git a/include/RED4ext/Api/v1/GameState.hpp b/include/RED4ext/Api/v1/GameState.hpp new file mode 100644 index 000000000..4e2505b3a --- /dev/null +++ b/include/RED4ext/Api/v1/GameState.hpp @@ -0,0 +1,76 @@ +#pragma once + +namespace RED4ext +{ +struct CGameApplication; + +namespace v1 +{ +struct GameState +{ + /** + * @brief The function that is called when the state is actived, before original function call. + * + * @param[in] aApp The game application. + * + * @return Always return true. + * @note The return result do not matter for this event, always return "true" here. + */ + bool (*OnBeforeEnter)(CGameApplication* aApp); + + /** + * @brief The function that is called when the state is actived, after original function call. + * + * @param[in] aApp The game application. + * + * @return Always return true. + * @note The return result do not matter for this event, always return "true" here. + */ + bool (*OnAfterEnter)(CGameApplication* aApp); + + /** + * @brief The function that is called when the state is updated, before original function call. + * + * @param[in] aApp The game application. + * + * @return true if the state is done updating, false otherwise. + * @note Returning true will prevent the update function from being called, returning false will keep calling the + * function until it returns true. When this function is not called from "Running" the return result will not + * matter as the function will get called only once either way. + */ + bool (*OnBeforeTick)(CGameApplication* aApp); + + /** + * @brief The function that is called when the state is updated, after original function call. + * + * @param[in] aApp The game application. + * + * @return true if the state is done updating, false otherwise. + * @note Returning true will prevent the update function from being called, returning false will keep calling the + * function until it returns true. When this function is not called from "Running" the return result will not + * matter as the function will get called only once either way. + */ + bool (*OnAfterTick)(CGameApplication* aApp); + + /** + * @brief The function that is called when the state is done, before original function call. + * + * @param[in] aApp The game application. + * + * @return Always return true. + * @note The return result do not matter for this event, always return "true" here. + */ + bool (*OnBeforeExit)(CGameApplication* aApp); + + /** + * @brief The function that is called when the state is done, after original function call. + * + * @param[in] aApp The game application. + * + * @return Always return true. + * @note The return result do not matter for this event, always return "true" here. + */ + bool (*OnAfterExit)(CGameApplication* aApp); +}; +} // namespace v1 +} // namespace RED4ext diff --git a/include/RED4ext/Api/v1/GameStates.hpp b/include/RED4ext/Api/v1/GameStates.hpp new file mode 100644 index 000000000..deeb57160 --- /dev/null +++ b/include/RED4ext/Api/v1/GameStates.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include +#include + +namespace RED4ext +{ +enum class EGameStateType : uint32_t; + +namespace v1 +{ +struct GameStates +{ + /** + * @brief Add a custom game state hook. + * + * @param[in] aHandle The plugin's handle. + * @param[in] aType The type of the state to hook. + * @param[in] aState Hooks for the state. Can be allocated on stack. + * + * @return true if the state hook is added successfully, false otherwise. + */ + bool (*AddHook)(PluginHandle aHandle, EGameStateType aType, GameState* aState); +}; +} // namespace v1 +} // namespace RED4ext diff --git a/include/RED4ext/Api/v0/Hooking.hpp b/include/RED4ext/Api/v1/Hooking.hpp similarity index 98% rename from include/RED4ext/Api/v0/Hooking.hpp rename to include/RED4ext/Api/v1/Hooking.hpp index 89a6995da..aaa19083d 100644 --- a/include/RED4ext/Api/v0/Hooking.hpp +++ b/include/RED4ext/Api/v1/Hooking.hpp @@ -2,7 +2,7 @@ #include -namespace RED4ext::v0 +namespace RED4ext::v1 { struct Hooking { @@ -88,4 +88,4 @@ struct Hooking */ bool (*Detach)(PluginHandle aHandle, void* aTarget); }; -} // namespace RED4ext::v0 +} // namespace RED4ext::v1 diff --git a/include/RED4ext/Api/v0/Logger.hpp b/include/RED4ext/Api/v1/Logger.hpp similarity index 97% rename from include/RED4ext/Api/v0/Logger.hpp rename to include/RED4ext/Api/v1/Logger.hpp index a1c2df0ec..1109b0025 100644 --- a/include/RED4ext/Api/v0/Logger.hpp +++ b/include/RED4ext/Api/v1/Logger.hpp @@ -2,7 +2,7 @@ #include -namespace RED4ext::v0 +namespace RED4ext::v1 { struct Logger { @@ -42,4 +42,4 @@ struct Logger void (*CriticalW)(PluginHandle aHandle, const wchar_t* aMessage); void (*CriticalWF)(PluginHandle aHandle, const wchar_t* aFormat, ...); }; -} // namespace RED4ext::v0 +} // namespace RED4ext::v1 diff --git a/include/RED4ext/Api/v0/PluginInfo.hpp b/include/RED4ext/Api/v1/PluginInfo.hpp similarity index 76% rename from include/RED4ext/Api/v0/PluginInfo.hpp rename to include/RED4ext/Api/v1/PluginInfo.hpp index 6ec73fe1e..a3086ef61 100644 --- a/include/RED4ext/Api/v0/PluginInfo.hpp +++ b/include/RED4ext/Api/v1/PluginInfo.hpp @@ -1,9 +1,9 @@ #pragma once -#include -#include +#include +#include -namespace RED4ext::v0 +namespace RED4ext::v1 { struct PluginInfo { @@ -29,8 +29,8 @@ struct PluginInfo /** * @brief The supported game's version of the plugin. - * @note If you are using RED4ext only as a loader, use 'RED4EXT_V0_RUNTIME_INDEPENDENT'. + * @note If you are using RED4ext only as a loader, use 'RED4EXT_V1_RUNTIME_INDEPENDENT'. */ FileVer runtime; }; -} // namespace RED4ext::v0 +} // namespace RED4ext::v1 diff --git a/include/RED4ext/Api/v1/Runtime.hpp b/include/RED4ext/Api/v1/Runtime.hpp new file mode 100644 index 000000000..77e15ce0d --- /dev/null +++ b/include/RED4ext/Api/v1/Runtime.hpp @@ -0,0 +1,49 @@ +#pragma once + +#include + +/* + * CD Projekt RED does use semantic versioning in their game for "PRODUCTVERSION", but the string one and patch notes do + * not respect the semantic version. It is interpreted as semantic versioning as following: + * 1.03 -> major: 1, minor: 0, patch: 3. + * 1.10 -> major: 1, minor: 1, patch: 0. + * 1.11 -> major: 1, minor: 1, patch: 1. + * + * To keep things consinstently we are going to use their own versioning for runtime defines. + */ + +#define RED4EXT_V1_RUNTIME_1_50 RED4EXT_V1_FILEVER(3, 0, 58, 35694) +#define RED4EXT_V1_RUNTIME_1_50_HOTFIX_1 RED4EXT_V1_FILEVER(3, 0, 58, 60196) +#define RED4EXT_V1_RUNTIME_1_50_HOTFIX_2 RED4EXT_V1_FILEVER(3, 0, 58, 63411) +#define RED4EXT_V1_RUNTIME_1_52 RED4EXT_V1_FILEVER(3, 0, 59, 40169) +#define RED4EXT_V1_RUNTIME_1_52_HOTFIX_1 RED4EXT_V1_FILEVER(3, 0, 60, 1056) +#define RED4EXT_V1_RUNTIME_1_60 RED4EXT_V1_FILEVER(3, 0, 64, 38113) +#define RED4EXT_V1_RUNTIME_1_61 RED4EXT_V1_FILEVER(3, 0, 66, 28510) +#define RED4EXT_V1_RUNTIME_1_61_HOTFIX_1 RED4EXT_V1_FILEVER(3, 0, 68, 49653) +#define RED4EXT_V1_RUNTIME_1_62 RED4EXT_V1_FILEVER(3, 0, 70, 58535) +#define RED4EXT_V1_RUNTIME_1_62_HOTFIX_1 RED4EXT_V1_FILEVER(3, 0, 71, 13361) +#define RED4EXT_V1_RUNTIME_1_63 RED4EXT_V1_FILEVER(3, 0, 72, 45053) +#define RED4EXT_V1_RUNTIME_1_63_HOTFIX_1 RED4EXT_V1_FILEVER(3, 0, 72, 54038) +#define RED4EXT_V1_RUNTIME_2_00 RED4EXT_V1_FILEVER(3, 0, 74, 53121) +#define RED4EXT_V1_RUNTIME_2_01 RED4EXT_V1_FILEVER(3, 0, 74, 63017) +#define RED4EXT_V1_RUNTIME_2_02 RED4EXT_V1_FILEVER(3, 0, 75, 25522) +#define RED4EXT_V1_RUNTIME_2_10 RED4EXT_V1_FILEVER(3, 0, 76, 4238) +#define RED4EXT_V1_RUNTIME_2_11 RED4EXT_V1_FILEVER(3, 0, 76, 41558) +#define RED4EXT_V1_RUNTIME_2_12 RED4EXT_V1_FILEVER(3, 0, 76, 55031) +#define RED4EXT_V1_RUNTIME_2_12_HOTFIX_1 RED4EXT_V1_FILEVER(3, 0, 76, 64179) +#define RED4EXT_V1_RUNTIME_2_13 RED4EXT_V1_FILEVER(3, 0, 77, 64623) +#define RED4EXT_V1_RUNTIME_2_20 RED4EXT_V1_FILEVER(3, 0, 78, 41888) +#define RED4EXT_V1_RUNTIME_2_21 RED4EXT_V1_FILEVER(3, 0, 78, 57301) + +/** + * @brief Supports all game versions. + * @note Only use this if you do not use RED4ext.SDK library, but you want to use RED4ext as a loader only. + */ +#define RED4EXT_V1_RUNTIME_INDEPENDENT \ + RED4EXT_V1_FILEVER(static_cast(-1), static_cast(-1), static_cast(-1), \ + static_cast(-1)) + +/* + * @brief The latest game version. + */ +#define RED4EXT_V1_RUNTIME_LATEST RED4EXT_V1_RUNTIME_2_21 diff --git a/include/RED4ext/Api/v0/Scripts.hpp b/include/RED4ext/Api/v1/Scripts.hpp similarity index 94% rename from include/RED4ext/Api/v0/Scripts.hpp rename to include/RED4ext/Api/v1/Scripts.hpp index f9d5696c7..32cecd126 100644 --- a/include/RED4ext/Api/v0/Scripts.hpp +++ b/include/RED4ext/Api/v1/Scripts.hpp @@ -3,7 +3,7 @@ #include #include -namespace RED4ext::v0 +namespace RED4ext::v1 { struct Scripts { @@ -34,4 +34,4 @@ struct Scripts */ bool (*Add)(PluginHandle aHandle, const wchar_t* aPath); }; -} // namespace RED4ext::v0 +} // namespace RED4ext::v1 diff --git a/include/RED4ext/Api/v0/Sdk.hpp b/include/RED4ext/Api/v1/Sdk.hpp similarity index 66% rename from include/RED4ext/Api/v0/Sdk.hpp rename to include/RED4ext/Api/v1/Sdk.hpp index b2d8d1ada..2d3ea6d79 100644 --- a/include/RED4ext/Api/v0/Sdk.hpp +++ b/include/RED4ext/Api/v1/Sdk.hpp @@ -1,12 +1,12 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -namespace RED4ext::v0 +namespace RED4ext::v1 { struct Sdk { @@ -24,4 +24,4 @@ struct Sdk GameStates* gameStates; Scripts* scripts; }; -} // namespace RED4ext::v0 +} // namespace RED4ext::v1 diff --git a/include/RED4ext/Api/v0/SemVer-inl.hpp b/include/RED4ext/Api/v1/SemVer-inl.hpp similarity index 51% rename from include/RED4ext/Api/v0/SemVer-inl.hpp rename to include/RED4ext/Api/v1/SemVer-inl.hpp index 15a10ea06..c5a3f4ae8 100644 --- a/include/RED4ext/Api/v0/SemVer-inl.hpp +++ b/include/RED4ext/Api/v1/SemVer-inl.hpp @@ -1,26 +1,25 @@ #pragma once #ifdef RED4EXT_STATIC_LIB -#include +#include #endif #include + #include -RED4EXT_INLINE RED4ext::v0::SemVer RED4ext::v0::CreateSemVer(uint8_t aMajor, uint16_t aMinor, uint32_t aPatch, - uint32_t aPrereleaseType, uint32_t aPrereleaseNumber) +namespace RED4ext::v1 { - SemVer version{}; - version.major = aMajor; - version.minor = aMinor; - version.patch = aPatch; - version.prerelease.type = aPrereleaseType; - version.prerelease.number = aPrereleaseNumber; - - return version; +RED4EXT_INLINE SemVer CreateSemVer(uint8_t aMajor, uint16_t aMinor, uint32_t aPatch, uint32_t aPrereleaseType, + uint32_t aPrereleaseNumber) +{ + return {.major = aMajor, + .minor = aMinor, + .patch = aPatch, + .prerelease = {.type = aPrereleaseType, .number = aPrereleaseNumber}}; } -RED4EXT_INLINE int32_t RED4ext::v0::CompareSemVer(const RED4ext::v0::SemVer& aLhs, const RED4ext::v0::SemVer& aRhs) +RED4EXT_INLINE int32_t CompareSemVer(const SemVer& aLhs, const SemVer& aRhs) { if (aLhs.major != aRhs.major) { @@ -38,8 +37,7 @@ RED4EXT_INLINE int32_t RED4ext::v0::CompareSemVer(const RED4ext::v0::SemVer& aLh return CompareSemVerPrerelease(aLhs.prerelease, aRhs.prerelease); } -RED4EXT_INLINE int32_t RED4ext::v0::CompareSemVerPrerelease(const RED4ext::v0::SemVer::PrereleaseInfo& aLhs, - const RED4ext::v0::SemVer::PrereleaseInfo& aRhs) +RED4EXT_INLINE int32_t CompareSemVerPrerelease(const SemVer::PrereleaseInfo& aLhs, const SemVer::PrereleaseInfo& aRhs) { if (aLhs.type != aRhs.type) { @@ -52,28 +50,31 @@ RED4EXT_INLINE int32_t RED4ext::v0::CompareSemVerPrerelease(const RED4ext::v0::S return 0; } +} // namespace RED4ext::v1 -RED4EXT_INLINE std::wstring std::to_wstring(const RED4ext::v0::SemVer& aVersion) +namespace std +{ +RED4EXT_INLINE wstring to_wstring(const RED4ext::v1::SemVer& aVersion) { - std::wstringstream stream; + wstringstream stream; stream << aVersion.major << L"." << aVersion.minor << L"." << aVersion.patch; - if (aVersion.prerelease.type != RED4EXT_V0_SEMVER_PRERELEASE_TYPE_NONE) + if (aVersion.prerelease.type != RED4EXT_V1_SEMVER_PRERELEASE_TYPE_NONE) { stream << L"-"; switch (aVersion.prerelease.type) { - case RED4EXT_V0_SEMVER_PRERELEASE_TYPE_ALPHA: + case RED4EXT_V1_SEMVER_PRERELEASE_TYPE_ALPHA: { stream << L"alpha"; break; } - case RED4EXT_V0_SEMVER_PRERELEASE_TYPE_BETA: + case RED4EXT_V1_SEMVER_PRERELEASE_TYPE_BETA: { stream << L"beta"; break; } - case RED4EXT_V0_SEMVER_PRERELEASE_TYPE_RC: + case RED4EXT_V1_SEMVER_PRERELEASE_TYPE_RC: { stream << L"rc"; break; @@ -90,3 +91,4 @@ RED4EXT_INLINE std::wstring std::to_wstring(const RED4ext::v0::SemVer& aVersion) return stream.str(); } +} // namespace std diff --git a/include/RED4ext/Api/v1/SemVer.hpp b/include/RED4ext/Api/v1/SemVer.hpp new file mode 100644 index 000000000..d60bf4e23 --- /dev/null +++ b/include/RED4ext/Api/v1/SemVer.hpp @@ -0,0 +1,129 @@ +#pragma once + +#include +#include + +#include + +namespace RED4ext::v1 +{ +struct SemVer +{ + struct PrereleaseInfo + { + uint32_t type; + uint32_t number; + }; + + uint8_t major; + uint16_t minor; + uint32_t patch; + PrereleaseInfo prerelease; +}; + +SemVer CreateSemVer(uint8_t aMajor, uint16_t aMinor, uint32_t aPatch, uint32_t prereleaseType, + uint32_t prereleaseNumber); + +/** + * @brief Compare two semantic versions. + * @param aLhs The lhs version. + * @param aRhs The rhs version. + * @return < 0 if lhs is lower than rhs, 0 if they are equal, > 0 if lhs is greater than lhs. + */ +int32_t CompareSemVer(const RED4ext::v1::SemVer& aLhs, const RED4ext::v1::SemVer& aRhs); + +/** + * @brief Compare two pre-release semantic versions. + * @param aLhs The lhs pre-release. + * @param aRhs The rhs pre-release. + * @return < 0 if lhs is lower than rhs, 0 if they are equal, > 0 if lhs is greater than lhs. + */ +int32_t CompareSemVerPrerelease(const RED4ext::v1::SemVer::PrereleaseInfo& aLhs, + const RED4ext::v1::SemVer::PrereleaseInfo& aRhs); +} // namespace RED4ext::v1 + +// clang-format off +#define RED4EXT_V1_SEMVER_PRERELEASE_TYPE_NONE 0ul +#define RED4EXT_V1_SEMVER_PRERELEASE_TYPE_ALPHA 1ul +#define RED4EXT_V1_SEMVER_PRERELEASE_TYPE_BETA 2ul +#define RED4EXT_V1_SEMVER_PRERELEASE_TYPE_RC 3ul +// clang-format on + +#define RED4EXT_V1_SEMVER_EX(major, minor, patch, prereleaseType, prereleaseNumber) \ + RED4ext::v1::CreateSemVer(major, minor, patch, prereleaseType, prereleaseNumber) + +#define RED4EXT_V1_SEMVER(major, minor, patch) \ + RED4EXT_V1_SEMVER_EX(major, minor, patch, RED4EXT_V1_SEMVER_PRERELEASE_TYPE_NONE, 0) + +namespace std +{ +std::wstring to_wstring(const RED4ext::v1::SemVer& aVersion); +} // namespace std + +#ifdef RED4EXT_HEADER_ONLY +#include +#endif + +#pragma region PrereleaseInfo operators +inline bool operator<(const RED4ext::v1::SemVer::PrereleaseInfo& aLhs, const RED4ext::v1::SemVer::PrereleaseInfo& aRhs) +{ + return RED4ext::v1::CompareSemVerPrerelease(aLhs, aRhs) < 0; +} + +inline bool operator<=(const RED4ext::v1::SemVer::PrereleaseInfo& aLhs, const RED4ext::v1::SemVer::PrereleaseInfo& aRhs) +{ + return RED4ext::v1::CompareSemVerPrerelease(aLhs, aRhs) <= 0; +} + +inline bool operator>(const RED4ext::v1::SemVer::PrereleaseInfo& aLhs, const RED4ext::v1::SemVer::PrereleaseInfo& aRhs) +{ + return RED4ext::v1::CompareSemVerPrerelease(aLhs, aRhs) > 0; +} + +inline bool operator>=(const RED4ext::v1::SemVer::PrereleaseInfo& aLhs, const RED4ext::v1::SemVer::PrereleaseInfo& aRhs) +{ + return RED4ext::v1::CompareSemVerPrerelease(aLhs, aRhs) >= 0; +} + +inline bool operator==(const RED4ext::v1::SemVer::PrereleaseInfo& aLhs, const RED4ext::v1::SemVer::PrereleaseInfo& aRhs) +{ + return RED4ext::v1::CompareSemVerPrerelease(aLhs, aRhs) == 0; +} + +inline bool operator!=(const RED4ext::v1::SemVer::PrereleaseInfo& aLhs, const RED4ext::v1::SemVer::PrereleaseInfo& aRhs) +{ + return RED4ext::v1::CompareSemVerPrerelease(aLhs, aRhs) != 0; +} +#pragma endregion + +#pragma region VersionInfo operators +inline bool operator<(const RED4ext::v1::SemVer& aLhs, const RED4ext::v1::SemVer& aRhs) +{ + return RED4ext::v1::CompareSemVer(aLhs, aRhs) < 0; +} + +inline bool operator<=(const RED4ext::v1::SemVer& aLhs, const RED4ext::v1::SemVer& aRhs) +{ + return RED4ext::v1::CompareSemVer(aLhs, aRhs) <= 0; +} + +inline bool operator>(const RED4ext::v1::SemVer& aLhs, const RED4ext::v1::SemVer& aRhs) +{ + return RED4ext::v1::CompareSemVer(aLhs, aRhs) > 0; +} + +inline bool operator>=(const RED4ext::v1::SemVer& aLhs, const RED4ext::v1::SemVer& aRhs) +{ + return RED4ext::v1::CompareSemVer(aLhs, aRhs) >= 0; +} + +inline bool operator==(const RED4ext::v1::SemVer& aLhs, const RED4ext::v1::SemVer& aRhs) +{ + return RED4ext::v1::CompareSemVer(aLhs, aRhs) == 0; +} + +inline bool operator!=(const RED4ext::v1::SemVer& aLhs, const RED4ext::v1::SemVer& aRhs) +{ + return RED4ext::v1::CompareSemVer(aLhs, aRhs) != 0; +} +#pragma endregion diff --git a/include/RED4ext/Api/v1/Version.hpp b/include/RED4ext/Api/v1/Version.hpp new file mode 100644 index 000000000..77e653b72 --- /dev/null +++ b/include/RED4ext/Api/v1/Version.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +#define RED4EXT_V1_SDK_0_1_0 RED4EXT_V1_SEMVER(0, 1, 0) +#define RED4EXT_V1_SDK_0_2_0 RED4EXT_V1_SEMVER(0, 2, 0) +#define RED4EXT_V1_SDK_0_3_0 RED4EXT_V1_SEMVER(0, 3, 0) +#define RED4EXT_V1_SDK_0_4_0 RED4EXT_V1_SEMVER(0, 4, 0) +#define RED4EXT_V1_SDK_0_5_0 RED4EXT_V1_SEMVER(0, 5, 0) + +#define RED4EXT_V1_SDK_LATEST RED4EXT_V1_SEMVER(RED4EXT_VER_MAJOR, RED4EXT_VER_MINOR, RED4EXT_VER_PATCH) diff --git a/include/RED4ext/GameStates.hpp b/include/RED4ext/GameStates.hpp index 9cb859d82..67a604dd9 100644 --- a/include/RED4ext/GameStates.hpp +++ b/include/RED4ext/GameStates.hpp @@ -20,11 +20,11 @@ struct IGameState { virtual ~IGameState() = 0; // 00 - virtual const char* GetName() = 0; // 08 - virtual EGameStateType GetType() = 0; // 10 - virtual bool OnEnter(CGameApplication* aApp) = 0; // 18 - virtual bool OnUpdate(CGameApplication* aApp) = 0; // 20 - virtual bool OnExit(CGameApplication* aApp) = 0; // 28 + virtual const char* GetName() = 0; // 08 + virtual EGameStateType GetType() = 0; // 10 + virtual bool OnEnter(CGameApplication* aApp) = 0; // 18 + virtual bool OnTick(CGameApplication* aApp) = 0; // 20 + virtual bool OnExit(CGameApplication* aApp) = 0; // 28 }; struct CBaseInitializationState : IGameState diff --git a/src/Api/v0/FileVer.cpp b/src/Api/v1/FileVer.cpp similarity index 70% rename from src/Api/v0/FileVer.cpp rename to src/Api/v1/FileVer.cpp index c9b2f6a3c..18c9a1813 100644 --- a/src/Api/v0/FileVer.cpp +++ b/src/Api/v1/FileVer.cpp @@ -2,4 +2,4 @@ #error Please define 'RED4EXT_STATIC_LIB' to compile this file. #endif -#include +#include diff --git a/src/Api/v0/SemVer.cpp b/src/Api/v1/SemVer.cpp similarity index 70% rename from src/Api/v0/SemVer.cpp rename to src/Api/v1/SemVer.cpp index 255eff918..4848f4cba 100644 --- a/src/Api/v0/SemVer.cpp +++ b/src/Api/v1/SemVer.cpp @@ -2,4 +2,4 @@ #error Please define 'RED4EXT_STATIC_LIB' to compile this file. #endif -#include +#include