Skip to content

Commit

Permalink
Switch to RED4ext::GpuApi where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
WSSDude committed Jan 12, 2025
1 parent 7a472f8 commit 0a95d1b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 41 deletions.
8 changes: 3 additions & 5 deletions src/d3d12/D3D12_Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "D3D12.h"
#include "reverse/Addresses.h"
#include "reverse/RenderContext.h"

#include <VersionHelpers.h>

Expand All @@ -23,8 +22,6 @@ void* D3D12::CRenderNode_Present_InternalPresent(int32_t* apDeviceIndex, uint8_t
{
auto& d3d12 = CET::Get().GetD3D12();

const auto* pContext = RenderContext::GetInstance();
auto* pSwapChain = pContext->devices[*apDeviceIndex - 1].pSwapChain;
if (d3d12.m_initialized)
d3d12.Update();
else
Expand All @@ -34,8 +31,9 @@ void* D3D12::CRenderNode_Present_InternalPresent(int32_t* apDeviceIndex, uint8_t
// DX12 does not work on Windows 8 and 8.1 so we should be safe with this check
if (IsWindows8OrGreater())
{
d3d12.m_pCommandQueue = pContext->pDirectQueue;
d3d12.m_pdxgiSwapChain = pSwapChain;
const auto& deviceData = RED4ext::GpuApi::GetDeviceData();
d3d12.m_pCommandQueue = deviceData.directCommandQueue;
d3d12.m_pdxgiSwapChain = deviceData.swapChains.GetData(*apDeviceIndex).swapChain;
d3d12.Initialize();
}
else
Expand Down
1 change: 0 additions & 1 deletion src/reverse/Addresses.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ constexpr uint32_t CPhotoMode_SetRecordID = 4241565651UL; // <UNKNOWN_SYMBOL>
#pragma endregion

#pragma region CRenderGlobal
constexpr uint32_t CRenderGlobal_InstanceOffset = 1239944840UL; // <UNKNOWN_SYMBOL>
constexpr uint32_t CRenderGlobal_Resize = 239671909UL; // GpuApi::ResizeBackbuffer
constexpr uint32_t CRenderGlobal_Shutdown = 3192982283UL; // <UNKNOWN_SYMBOL>
#pragma endregion
Expand Down
10 changes: 0 additions & 10 deletions src/reverse/RenderContext.cpp

This file was deleted.

24 changes: 0 additions & 24 deletions src/reverse/RenderContext.h

This file was deleted.

1 change: 1 addition & 0 deletions src/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <RED4ext/DynArray.hpp>
#include "RED4ext/GameApplication.hpp"
#include <RED4ext/GameEngine.hpp>
#include <RED4ext/GpuApi/DeviceData.hpp>
#include <RED4ext/Hashing/CRC.hpp>
#include <RED4ext/ISerializable.hpp>
#include <RED4ext/Relocation.hpp>
Expand Down
2 changes: 1 addition & 1 deletion vendor/RED4ext.SDK
Submodule RED4ext.SDK updated 34 files
+1 −1 .github/workflows/clang-format.yml
+10 −1 CMakeLists.txt
+16 −0 THIRD_PARTY_LICENSES.md
+2 −0 examples/CMakeLists.txt
+12 −2 include/RED4ext/Buffer-inl.hpp
+2 −1 include/RED4ext/Buffer.hpp
+17 −1 include/RED4ext/Detail/AddressHashes.hpp
+23 −0 include/RED4ext/GpuApi/Buffer.hpp
+41 −0 include/RED4ext/GpuApi/CommandListContext-inl.hpp
+55 −0 include/RED4ext/GpuApi/CommandListContext.hpp
+22 −0 include/RED4ext/GpuApi/D3D12MemAlloc-inl.hpp
+7 −0 include/RED4ext/GpuApi/D3D12MemAlloc.hpp
+57 −0 include/RED4ext/GpuApi/DeviceData-inl.hpp
+100 −0 include/RED4ext/GpuApi/DeviceData.hpp
+49 −0 include/RED4ext/GpuApi/SwapChain.hpp
+1 −2 include/RED4ext/HashMap.hpp
+11 −11 include/RED4ext/Memory/Allocators.hpp
+6 −3 include/RED4ext/NativeTypes-inl.hpp
+203 −40 include/RED4ext/Relocation-inl.hpp
+24 −1 include/RED4ext/Relocation.hpp
+16 −0 include/RED4ext/ResourceLoader-inl.hpp
+38 −3 include/RED4ext/ResourceLoader.hpp
+0 −3,104 include/RED4ext/Scripting/Natives.cpp
+16 −0 include/RED4ext/Scripting/Natives/EngineTime.hpp
+9 −0 include/RED4ext/Scripting/Natives/Generated/EngineTime.hpp
+10 −0 include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp
+24 −0 include/RED4ext/Scripting/Natives/questICharacterConditionType.hpp
+5 −0 src/GpuApi/CommandListContext.cpp
+5 −0 src/GpuApi/D3D12MemAlloc.cpp
+5 −0 src/GpuApi/DeviceData.cpp
+12 −0 src/Scripting/Natives.cpp
+0 −0 src/Scripting/Script.cpp
+1 −0 vendor/.clang-format
+2,025 −0 vendor/D3D12MemAlloc/D3D12MemAlloc.h
2 changes: 2 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ target("RED4ext.SDK")
set_group("vendor")
add_headerfiles("vendor/RED4ext.SDK/include/**.hpp")
add_includedirs("vendor/RED4ext.SDK/include/", { public = true })
add_headerfiles("vendor/RED4ext.SDK/vendor/D3D12MemAlloc/**.h")
add_includedirs("vendor/RED4ext.SDK/vendor/D3D12MemAlloc/", { public = true })
on_install(function() end)

target("cyber_engine_tweaks")
Expand Down

0 comments on commit 0a95d1b

Please sign in to comment.