Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote v0 to v1, extend v1 and extend GpuApi #178

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ else()
RED4EXT_STATIC_LIB
PRIVATE
WIN32_LEAN_AND_MEAN
NOMINMAX
)

if(RED4EXT_USE_PCH)
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ foreach(EXAMPLE_PATH ${EXAMPLE_PATHS})
set_target_properties(${EXAMPLE_NAME} PROPERTIES FOLDER "Examples")
target_link_libraries(${EXAMPLE_NAME} PRIVATE RED4ext::SDK)

target_compile_definitions(${EXAMPLE_NAME} PRIVATE WIN32_LEAN_AND_MEAN)
target_compile_definitions(${EXAMPLE_NAME} PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
endif()
endforeach()
3 changes: 2 additions & 1 deletion include/RED4ext/Api/EMainReason.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace RED4ext
enum class EMainReason : uint8_t
{
Load = 0,
Unload
Unload,
Run
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the advantage of having this instead of just using GameStates?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psiberx wanted to include this for those that do not need to be hooking but only know that the game initialized and is running. He even suggested to call it from Running::OnEnter.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about calling it on Running::OnTick and change it to Tick?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess at that point, you may hook the game state. Believe psi wanted this as a one-off notification before first OnTick. Also am uncertain from this if you mean there would be some continuous notification, then I suppose it may as well truly be a game state hook 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only advantage is easier entry for beginners. I didn't suggest adding it though, just gave an example of how it could be handled. In Load you can't even do anything engine/game related. The game states are hard to understand and at least need a better description, explaining which systems exactly are initialized at what point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was unsure now if I should keep it or not, kept it for now.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with keeping it.

};
} // namespace RED4ext
4 changes: 2 additions & 2 deletions include/RED4ext/Api/FileVer.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <RED4ext/Api/v0/FileVer.hpp>
#include <RED4ext/Api/v1/FileVer.hpp>

/**
* @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)
4 changes: 1 addition & 3 deletions include/RED4ext/Api/PluginHandle.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#pragma once

#include <Windows.h>

namespace RED4ext
{
/**
* @brief The identifier of the plugin.
*/
using PluginHandle = HMODULE;
using PluginHandle = void*;
} // namespace RED4ext
50 changes: 25 additions & 25 deletions include/RED4ext/Api/Runtime.hpp
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
#pragma once

#include <RED4ext/Api/v0/Runtime.hpp>
#include <RED4ext/Api/v1/Runtime.hpp>

#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
47 changes: 31 additions & 16 deletions include/RED4ext/Api/Sdk.hpp
Original file line number Diff line number Diff line change
@@ -1,54 +1,69 @@
#pragma once

#include <RED4ext/Api/v0/PluginInfo.hpp>
#include <RED4ext/Api/v0/Sdk.hpp>
#include <RED4ext/Api/v1/PluginInfo.hpp>
#include <RED4ext/Api/v1/Sdk.hpp>

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.
* @brief The latest logger.
*/
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 handler.
*/
using GameStates = v1::GameStates;

/**
* @brief The latest game state for hooking.
*/
using GameState = v1::GameState;

/**
* @brief The latest scripts compiler interface.
*/
using Scripts = v1::Scripts;

/**
* @brief The latest game state type.
* @brief The latest rendering handler.
*/
using GameStates = v0::GameStates;
using Rendering = v1::Rendering;

/**
* @brief The latest game state type.
* @brief The latest render structure for hooking.
*/
using GameState = v0::GameState;
using Render = v1::Render;

/**
* @brief The latest game state type.
* @brief The latest game state hook result.
*/
using Scripts = v0::Scripts;
using EGameStateResult = v1::EGameStateResult;
} // namespace RED4ext

/*
Expand All @@ -60,5 +75,5 @@ using Scripts = v0::Scripts;
*/
#ifndef RED4EXT_OFFSET_TO_ADDR
#define RED4EXT_OFFSET_TO_ADDR(offset) \
reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(GetModuleHandle(nullptr)) + offset)
reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(GetModuleHandleW(nullptr)) + offset)
#endif
6 changes: 3 additions & 3 deletions include/RED4ext/Api/SemVer.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#pragma once

#include <RED4ext/Api/v0/SemVer.hpp>
#include <RED4ext/Api/v1/SemVer.hpp>

/**
* @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)
17 changes: 9 additions & 8 deletions include/RED4ext/Api/Version.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <RED4ext/Api/v0/Version.hpp>
#include <RED4ext/Api/v1/Version.hpp>

/*
* The SDK is using only one API version, the reason behind that is that multiple versions for every structure is
Expand All @@ -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
70 changes: 0 additions & 70 deletions include/RED4ext/Api/v0/FileVer.hpp

This file was deleted.

44 changes: 0 additions & 44 deletions include/RED4ext/Api/v0/GameState.hpp

This file was deleted.

26 changes: 0 additions & 26 deletions include/RED4ext/Api/v0/GameStates.hpp

This file was deleted.

Loading