Skip to content

Commit c70e26c

Browse files
committed
Remove kiero
Game does not support Windows 7 anymore, we don't have to also
1 parent 175dfa6 commit c70e26c

File tree

8 files changed

+14
-727
lines changed

8 files changed

+14
-727
lines changed

Diff for: ThirdParty_LICENSES

+7-31
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
============ imgui ============
1+
============ imgui ============
22

33
The MIT License (MIT)
44

@@ -22,11 +22,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2222
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
SOFTWARE.
2424

25-
============ spdlog ============
25+
============ spdlog ============
2626

2727
The MIT License (MIT)
2828

29-
Copyright (c) 2016 Gabi Melman.
29+
Copyright (c) 2016 Gabi Melman.
3030

3131
Permission is hereby granted, free of charge, to any person obtaining a copy
3232
of this software and associated documentation files (the "Software"), to deal
@@ -52,7 +52,7 @@ and users must comply to its license: https://github.com/fmtlib/fmt/blob/master/
5252

5353
============ nlohmann/json ============
5454

55-
MIT License
55+
MIT License
5656

5757
Copyright (c) 2013-2021 Niels Lohmann
5858

@@ -98,9 +98,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9898
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
9999
SOFTWARE.
100100

101-
============ MinHook ============
101+
============ MinHook ============
102102

103-
MinHook - The Minimalistic API Hooking Library for x64/x86
103+
MinHook - The Minimalistic API Hooking Library for x64/x86
104104
Copyright (C) 2009-2017 Tsuda Kageyu.
105105
All rights reserved.
106106

@@ -323,30 +323,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
323323
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
324324
SOFTWARE.
325325

326-
============ kiero ============
327-
328-
MIT License
329-
330-
Copyright (c) 2014-2020 Rebzzel
331-
332-
Permission is hereby granted, free of charge, to any person obtaining a copy
333-
of this software and associated documentation files (the "Software"), to deal
334-
in the Software without restriction, including without limitation the rights
335-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
336-
copies of the Software, and to permit persons to whom the Software is
337-
furnished to do so, subject to the following conditions:
338-
339-
The above copyright notice and this permission notice shall be included in all
340-
copies or substantial portions of the Software.
341-
342-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
343-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
344-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
345-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
346-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
347-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
348-
SOFTWARE.
349-
350326
============ lsqlite3 ============
351327

352328
* lsqlite3 *
@@ -491,7 +467,7 @@ with others.
491467

492468
The OFL allows the licensed fonts to be used, studied, modified and
493469
redistributed freely as long as they are not sold by themselves. The
494-
fonts, including any derivative works, can be bundled, embedded,
470+
fonts, including any derivative works, can be bundled, embedded,
495471
redistributed and/or sold with any software provided that any reserved
496472
names are not used by derivative works. The fonts and derivatives,
497473
however, cannot be released under any other type of license. The

Diff for: src/d3d12/D3D12.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ D3D12::D3D12(Window& aWindow, Paths& aPaths, Options& aOptions)
6565
, m_window(aWindow)
6666
, m_options(aOptions)
6767
{
68-
HookGame();
68+
Hook();
6969

7070
// add repeated task which prepares next ImGui frame for update
7171
GameMainThread::Get().AddGenericTask(

Diff for: src/d3d12/D3D12.h

+1-20
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
#include "common/D3D12Downlevel.h"
44
#include "window/Window.h"
55

6-
using TPresentD3D12Downlevel = HRESULT(ID3D12CommandQueueDownlevel*, ID3D12GraphicsCommandList*, ID3D12Resource*, HWND, D3D12_DOWNLEVEL_PRESENT_FLAGS);
7-
using TCreateCommittedResource =
8-
HRESULT(ID3D12Device*, const D3D12_HEAP_PROPERTIES*, D3D12_HEAP_FLAGS, const D3D12_RESOURCE_DESC*, D3D12_RESOURCE_STATES, const D3D12_CLEAR_VALUE*, const IID*, void**);
9-
using TExecuteCommandLists = void(ID3D12CommandQueue*, UINT, ID3D12CommandList* const*);
106
using TCRenderNode_Present_InternalPresent = void*(int32_t*, uint8_t, UINT);
117
using TCRenderGlobal_Resize = void*(uint32_t a1, uint32_t a2, uint32_t a3, uint8_t a4, int32_t* a5);
128
using TCRenderGlobal_Shutdown = void*(uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4);
@@ -35,7 +31,6 @@ struct D3D12
3531

3632
protected:
3733
void Hook();
38-
void HookGame();
3934

4035
struct FrameContext
4136
{
@@ -44,39 +39,25 @@ struct D3D12
4439
D3D12_CPU_DESCRIPTOR_HANDLE MainRenderTargetDescriptor{0};
4540
};
4641

47-
bool ResetState(const bool acClearDownlevelBackbuffers = true, const bool acDestroyContext = false);
42+
bool ResetState(const bool acDestroyContext = false);
4843
bool Initialize();
49-
bool InitializeDownlevel(ID3D12CommandQueue* apCommandQueue, ID3D12Resource* apSourceTex2D, HWND ahWindow);
5044
bool InitializeImGui(size_t aBuffersCounts);
5145

5246
void PrepareUpdate();
5347
void Update();
5448

55-
static HRESULT PresentDownlevel(
56-
ID3D12CommandQueueDownlevel* apCommandQueueDownlevel, ID3D12GraphicsCommandList* apOpenCommandList, ID3D12Resource* apSourceTex2D, HWND ahWindow,
57-
D3D12_DOWNLEVEL_PRESENT_FLAGS aFlags);
58-
static HRESULT CreateCommittedResource(
59-
ID3D12Device* apDevice, const D3D12_HEAP_PROPERTIES* acpHeapProperties, D3D12_HEAP_FLAGS aHeapFlags, const D3D12_RESOURCE_DESC* acpDesc,
60-
D3D12_RESOURCE_STATES aInitialResourceState, const D3D12_CLEAR_VALUE* acpOptimizedClearValue, const IID* acpRIID, void** appvResource);
61-
static void ExecuteCommandLists(ID3D12CommandQueue* apCommandQueue, UINT aNumCommandLists, ID3D12CommandList* const* apcpCommandLists);
62-
6349
static void* CRenderNode_Present_InternalPresent(int32_t* apSomeInt, uint8_t aSomeSync, UINT aSyncInterval);
6450
static void* CRenderGlobal_Resize(uint32_t a1, uint32_t a2, uint32_t a3, uint8_t a4, int32_t* a5);
6551
static void* CRenderGlobal_Shutdown(uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4);
6652

6753
private:
68-
TPresentD3D12Downlevel* m_realPresentD3D12Downlevel{nullptr};
69-
TCreateCommittedResource* m_realCreateCommittedResource{nullptr};
70-
TExecuteCommandLists* m_realExecuteCommandLists{nullptr};
7154
TCRenderNode_Present_InternalPresent* m_realInternalPresent{nullptr};
7255
TCRenderGlobal_Resize* m_realInternalResize{nullptr};
7356
TCRenderGlobal_Shutdown* m_realInternalShutdown{nullptr};
7457

7558
bool m_initialized{false};
7659

7760
TiltedPhoques::Vector<FrameContext> m_frameContexts;
78-
TiltedPhoques::Vector<Microsoft::WRL::ComPtr<ID3D12Resource>> m_downlevelBackbuffers;
79-
uint32_t m_downlevelBufferIndex{0};
8061

8162
Microsoft::WRL::ComPtr<ID3D12Device> m_pd3d12Device{};
8263
Microsoft::WRL::ComPtr<ID3D12DescriptorHeap> m_pd3dRtvDescHeap{};

Diff for: src/d3d12/D3D12_Functions.cpp

+3-138
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <imgui_impl/win32.h>
1010
#include <window/window.h>
1111

12-
bool D3D12::ResetState(const bool acClearDownlevelBackbuffers, const bool acDestroyContext)
12+
bool D3D12::ResetState(const bool acDestroyContext)
1313
{
1414
if (m_initialized)
1515
{
@@ -32,10 +32,6 @@ bool D3D12::ResetState(const bool acClearDownlevelBackbuffers, const bool acDest
3232
m_frameContexts.clear();
3333
m_outSize = {0, 0};
3434

35-
if (acClearDownlevelBackbuffers)
36-
m_downlevelBackbuffers.clear();
37-
m_downlevelBufferIndex = 0;
38-
3935
m_pd3d12Device.Reset();
4036
m_pd3dRtvDescHeap.Reset();
4137
m_pd3dSrvDescHeap.Reset();
@@ -144,137 +140,6 @@ bool D3D12::Initialize()
144140
return true;
145141
}
146142

147-
bool D3D12::InitializeDownlevel(ID3D12CommandQueue* apCommandQueue, ID3D12Resource* apSourceTex2D, HWND ahWindow)
148-
{
149-
if (!apCommandQueue || !apSourceTex2D)
150-
return false;
151-
152-
const HWND hWnd = m_window.GetWindow();
153-
if (!hWnd)
154-
{
155-
Log::Warn("D3D12::InitializeDownlevel() - window not yet hooked!");
156-
return false;
157-
}
158-
159-
if (m_initialized)
160-
{
161-
if (hWnd != ahWindow)
162-
Log::Warn(
163-
"D3D12::InitializeDownlevel() - current output window does not match hooked window! Currently hooked "
164-
"to {} while current output window is {}.",
165-
reinterpret_cast<void*>(hWnd), reinterpret_cast<void*>(ahWindow));
166-
167-
return true;
168-
}
169-
170-
const auto cmdQueueDesc = apCommandQueue->GetDesc();
171-
if (cmdQueueDesc.Type != D3D12_COMMAND_LIST_TYPE_DIRECT)
172-
{
173-
Log::Warn("D3D12::InitializeDownlevel() - ignoring command queue - invalid type of command list!");
174-
return false;
175-
}
176-
177-
m_pCommandQueue = apCommandQueue;
178-
179-
const auto st2DDesc = apSourceTex2D->GetDesc();
180-
m_outSize = {static_cast<LONG>(st2DDesc.Width), static_cast<LONG>(st2DDesc.Height)};
181-
182-
if (hWnd != ahWindow)
183-
Log::Warn(
184-
"D3D12::InitializeDownlevel() - current output window does not match hooked window! Currently hooked to {} "
185-
"while current output window is {}.",
186-
reinterpret_cast<void*>(hWnd), reinterpret_cast<void*>(ahWindow));
187-
188-
if (FAILED(apSourceTex2D->GetDevice(IID_PPV_ARGS(&m_pd3d12Device))))
189-
{
190-
Log::Error("D3D12::InitializeDownlevel() - failed to get device!");
191-
return ResetState();
192-
}
193-
194-
const size_t buffersCounts = m_downlevelBackbuffers.size();
195-
m_frameContexts.resize(buffersCounts);
196-
if (buffersCounts == 0)
197-
{
198-
Log::Error("D3D12::InitializeDownlevel() - no backbuffers were found!");
199-
return ResetState();
200-
}
201-
if (buffersCounts < g_numDownlevelBackbuffersRequired)
202-
{
203-
Log::Info("D3D12::InitializeDownlevel() - backbuffer list is not complete yet; assuming window was resized");
204-
return false;
205-
}
206-
207-
D3D12_DESCRIPTOR_HEAP_DESC rtvdesc;
208-
rtvdesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
209-
rtvdesc.NumDescriptors = static_cast<UINT>(buffersCounts);
210-
rtvdesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
211-
rtvdesc.NodeMask = 1;
212-
if (FAILED(m_pd3d12Device->CreateDescriptorHeap(&rtvdesc, IID_PPV_ARGS(&m_pd3dRtvDescHeap))))
213-
{
214-
Log::Error("D3D12::InitializeDownlevel() - failed to create RTV descriptor heap!");
215-
return ResetState();
216-
}
217-
218-
const SIZE_T rtvDescriptorSize = m_pd3d12Device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
219-
D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = m_pd3dRtvDescHeap->GetCPUDescriptorHandleForHeapStart();
220-
for (auto& context : m_frameContexts)
221-
{
222-
context.MainRenderTargetDescriptor = rtvHandle;
223-
rtvHandle.ptr += rtvDescriptorSize;
224-
}
225-
226-
D3D12_DESCRIPTOR_HEAP_DESC srvdesc = {};
227-
srvdesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
228-
srvdesc.NumDescriptors = 2;
229-
srvdesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
230-
if (FAILED(m_pd3d12Device->CreateDescriptorHeap(&srvdesc, IID_PPV_ARGS(&m_pd3dSrvDescHeap))))
231-
{
232-
Log::Error("D3D12::InitializeDownlevel() - failed to create SRV descriptor heap!");
233-
return ResetState();
234-
}
235-
236-
for (auto& context : m_frameContexts)
237-
{
238-
if (FAILED(m_pd3d12Device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&context.CommandAllocator))))
239-
{
240-
Log::Error("D3D12::InitializeDownlevel() - failed to create command allocator!");
241-
return ResetState();
242-
}
243-
}
244-
245-
if (FAILED(m_pd3d12Device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_frameContexts[0].CommandAllocator.Get(), nullptr, IID_PPV_ARGS(&m_pd3dCommandList))))
246-
{
247-
Log::Error("D3D12::InitializeDownlevel() - failed to create command list!");
248-
return ResetState();
249-
}
250-
251-
if (FAILED(m_pd3dCommandList->Close()))
252-
{
253-
Log::Error("D3D12::InitializeDownlevel() - failed to close command list!");
254-
return ResetState();
255-
}
256-
257-
for (size_t i = 0; i < buffersCounts; i++)
258-
{
259-
auto& context = m_frameContexts[i];
260-
context.BackBuffer = m_downlevelBackbuffers[i];
261-
m_pd3d12Device->CreateRenderTargetView(context.BackBuffer.Get(), nullptr, context.MainRenderTargetDescriptor);
262-
}
263-
264-
if (!InitializeImGui(buffersCounts))
265-
{
266-
Log::Error("D3D12::InitializeDownlevel() - failed to initialize ImGui!");
267-
return ResetState();
268-
}
269-
270-
Log::Info("D3D12::InitializeDownlevel() - initialization successful!");
271-
m_initialized = true;
272-
273-
OnInitialized.Emit();
274-
275-
return true;
276-
}
277-
278143
void D3D12::ReloadFonts()
279144
{
280145
std::lock_guard _(m_imguiLock);
@@ -525,8 +390,8 @@ void D3D12::Update()
525390
if (!m_imguiDrawDataBuffers[0].Valid)
526391
return;
527392

528-
const auto bufferIndex = m_pdxgiSwapChain != nullptr ? m_pdxgiSwapChain->GetCurrentBackBufferIndex() : m_downlevelBufferIndex;
529-
auto& frameContext = m_frameContexts[bufferIndex];
393+
assert(m_pdxgiSwapChain);
394+
auto& frameContext = m_frameContexts[m_pdxgiSwapChain->GetCurrentBackBufferIndex()];
530395
frameContext.CommandAllocator->Reset();
531396

532397
D3D12_RESOURCE_BARRIER barrier;

0 commit comments

Comments
 (0)