mirror of
https://github.com/EricPlayZ/EGameTools.git
synced 2025-07-18 17:37:53 +08:00
Add edDX12 support, added Save variables to file, added Load variables from file, added Restore variables to default, added a Restore button for each player variable, limited mod menu size, fixed menu crashing the game if in Fullscreen, fixed some Photo Mode issues
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
<ClCompile Include="source\dllmain.cpp" />
|
||||
<ClCompile Include="source\game_classes.cpp" />
|
||||
<ClCompile Include="source\hook.cpp" />
|
||||
<ClCompile Include="source\ImGuiFileDialog\ImGuiFileDialog.cpp" />
|
||||
<ClCompile Include="source\ImGui\backends\imgui_impl_dx11.cpp" />
|
||||
<ClCompile Include="source\ImGui\backends\imgui_impl_dx12.cpp" />
|
||||
<ClCompile Include="source\ImGui\backends\imgui_impl_win32.cpp" />
|
||||
@ -24,7 +25,7 @@
|
||||
<ClCompile Include="source\ImGui\imgui_tables.cpp" />
|
||||
<ClCompile Include="source\ImGui\imgui_widgets.cpp" />
|
||||
<ClCompile Include="source\ImGui\impl\d3d11_impl.cpp" />
|
||||
<ClCompile Include="source\ImGui\impl\shared.cpp" />
|
||||
<ClCompile Include="source\ImGui\impl\d3d12_impl.cpp" />
|
||||
<ClCompile Include="source\ImGui\impl\win32_impl.cpp" />
|
||||
<ClCompile Include="source\kiero.cpp" />
|
||||
<ClCompile Include="source\memory.cpp" />
|
||||
@ -40,6 +41,11 @@
|
||||
<ClInclude Include="source\core.h" />
|
||||
<ClInclude Include="source\game_classes.h" />
|
||||
<ClInclude Include="source\hook.h" />
|
||||
<ClInclude Include="source\ImGuiFileDialog\dirent\dirent.h" />
|
||||
<ClInclude Include="source\ImGuiFileDialog\ImGuiFileDialog.h" />
|
||||
<ClInclude Include="source\ImGuiFileDialog\ImGuiFileDialogConfig.h" />
|
||||
<ClInclude Include="source\ImGuiFileDialog\stb\stb_image.h" />
|
||||
<ClInclude Include="source\ImGuiFileDialog\stb\stb_image_resize.h" />
|
||||
<ClInclude Include="source\ImGui\backends\imgui_impl_dx11.h" />
|
||||
<ClInclude Include="source\ImGui\backends\imgui_impl_dx12.h" />
|
||||
<ClInclude Include="source\ImGui\backends\imgui_impl_win32.h" />
|
||||
@ -47,7 +53,7 @@
|
||||
<ClInclude Include="source\ImGui\imgui.h" />
|
||||
<ClInclude Include="source\ImGui\imgui_internal.h" />
|
||||
<ClInclude Include="source\ImGui\impl\d3d11_impl.h" />
|
||||
<ClInclude Include="source\ImGui\impl\shared.h" />
|
||||
<ClInclude Include="source\ImGui\impl\d3d12_impl.h" />
|
||||
<ClInclude Include="source\ImGui\impl\win32_impl.h" />
|
||||
<ClInclude Include="source\ImGui\imstb_rectpack.h" />
|
||||
<ClInclude Include="source\ImGui\imstb_textedit.h" />
|
||||
@ -65,7 +71,6 @@
|
||||
<ClInclude Include="source\sigscan\sigscan.h" />
|
||||
<ClInclude Include="source\time_tools.h" />
|
||||
<ClInclude Include="source\utils.h" />
|
||||
<ClInclude Include="source\vtablehook.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
@ -104,12 +109,13 @@
|
||||
<TargetExt>.asi</TargetExt>
|
||||
<TargetName>GameOverhaul</TargetName>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<LibraryPath>source\MinHook\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
|
||||
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TargetName>GameOverhaul</TargetName>
|
||||
<TargetExt>.asi</TargetExt>
|
||||
<LibraryPath>source\MinHook\lib;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
@ -136,8 +142,7 @@
|
||||
</Optimization>
|
||||
<IntrinsicFunctions>
|
||||
</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>source\ImGui;source\ImGuiFileDialog;source\MinHook\include;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -148,6 +153,7 @@
|
||||
</OptimizeReferences>
|
||||
<EnableCOMDATFolding>
|
||||
</EnableCOMDATFolding>
|
||||
<AdditionalLibraryDirectories>source\MinHook\lib;</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(SolutionDir)Extra Files\Default Config\FOVOverhaul.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\FOVOverhaul.ini"</Command>
|
||||
@ -165,7 +171,7 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>source\ImGui;source\ImGuiFileDialog;source\MinHook\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -174,7 +180,7 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>source\MinHook\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libMinHook-x64-v141-mtd.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
|
@ -33,9 +33,6 @@
|
||||
<ClCompile Include="source\ImGui\impl\d3d11_impl.cpp">
|
||||
<Filter>ImGui\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\ImGui\impl\shared.cpp">
|
||||
<Filter>ImGui\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\ImGui\impl\win32_impl.cpp">
|
||||
<Filter>ImGui\impl</Filter>
|
||||
</ClCompile>
|
||||
@ -53,6 +50,12 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\menu\player.cpp" />
|
||||
<ClCompile Include="source\menu\world.cpp" />
|
||||
<ClCompile Include="source\ImGuiFileDialog\ImGuiFileDialog.cpp">
|
||||
<Filter>ImGuiFileDialog</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\ImGui\impl\d3d12_impl.cpp">
|
||||
<Filter>ImGui\impl</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="source\memory.h" />
|
||||
@ -60,7 +63,6 @@
|
||||
<ClInclude Include="source\game_classes.h" />
|
||||
<ClInclude Include="source\print.h" />
|
||||
<ClInclude Include="source\time_tools.h" />
|
||||
<ClInclude Include="source\vtablehook.h" />
|
||||
<ClInclude Include="source\kiero.h" />
|
||||
<ClInclude Include="source\MinHook\include\MinHook.h">
|
||||
<Filter>MinHook\include</Filter>
|
||||
@ -95,9 +97,6 @@
|
||||
<ClInclude Include="source\ImGui\impl\d3d11_impl.h">
|
||||
<Filter>ImGui\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\ImGui\impl\shared.h">
|
||||
<Filter>ImGui\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\ImGui\impl\win32_impl.h">
|
||||
<Filter>ImGui\impl</Filter>
|
||||
</ClInclude>
|
||||
@ -118,6 +117,24 @@
|
||||
<ClInclude Include="source\core.h" />
|
||||
<ClInclude Include="source\menu\player.h" />
|
||||
<ClInclude Include="source\menu\world.h" />
|
||||
<ClInclude Include="source\ImGuiFileDialog\ImGuiFileDialog.h">
|
||||
<Filter>ImGuiFileDialog</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\ImGuiFileDialog\ImGuiFileDialogConfig.h">
|
||||
<Filter>ImGuiFileDialog</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\ImGuiFileDialog\dirent\dirent.h">
|
||||
<Filter>ImGuiFileDialog\dirent</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\ImGuiFileDialog\stb\stb_image.h">
|
||||
<Filter>ImGuiFileDialog\stb</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\ImGuiFileDialog\stb\stb_image_resize.h">
|
||||
<Filter>ImGuiFileDialog\stb</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\ImGui\impl\d3d12_impl.h">
|
||||
<Filter>ImGui\impl</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="MinHook">
|
||||
@ -141,5 +158,14 @@
|
||||
<Filter Include="sigscan">
|
||||
<UniqueIdentifier>{525740fe-17a7-431f-b020-720a1dc32e07}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ImGuiFileDialog">
|
||||
<UniqueIdentifier>{de465f41-9f72-477f-b27f-b2e79be85aee}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ImGuiFileDialog\dirent">
|
||||
<UniqueIdentifier>{3200ad89-3545-4059-8b77-8dde207ba3a4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ImGuiFileDialog\stb">
|
||||
<UniqueIdentifier>{fc7f7021-7f6b-46f0-af79-efe792ae05a8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -30,7 +30,7 @@
|
||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||
// 2016-05-07: DirectX11: Disabling depth-write.
|
||||
|
||||
#include "../imgui.h"
|
||||
#include <imgui.h>
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "imgui_impl_dx11.h"
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#pragma once
|
||||
#include "../imgui.h" // IMGUI_IMPL_API
|
||||
#include <imgui.h> // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
struct ID3D11Device;
|
||||
|
@ -38,7 +38,7 @@
|
||||
// 2018-06-08: DirectX12: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle (to ease support for future multi-viewport).
|
||||
// 2018-02-22: Merged into master with all Win32 code synchronized to other examples.
|
||||
|
||||
#include "../imgui.h"
|
||||
#include <imgui.h>
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "imgui_impl_dx12.h"
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#pragma once
|
||||
#include "../imgui.h" // IMGUI_IMPL_API
|
||||
#include <imgui.h> // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include <dxgiformat.h> // DXGI_FORMAT
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#include "../imgui.h"
|
||||
#include <imgui.h>
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "imgui_impl_win32.h"
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
|
@ -14,7 +14,7 @@
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#pragma once
|
||||
#include "../imgui.h" // IMGUI_IMPL_API
|
||||
#include <imgui.h> // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
|
||||
|
@ -1,17 +1,12 @@
|
||||
#include <d3d11.h>
|
||||
#include <assert.h>
|
||||
#include "../../kiero.h"
|
||||
#include "../imgui.h"
|
||||
#include "../backends/imgui_impl_win32.h"
|
||||
#include "../backends/imgui_impl_dx11.h"
|
||||
#include <imgui.h>
|
||||
#include <backends\imgui_impl_win32.h>
|
||||
#include <backends\imgui_impl_dx11.h>
|
||||
#include "..\..\menu\menu.h"
|
||||
#include "..\..\kiero.h"
|
||||
#include "d3d11_impl.h"
|
||||
#include "win32_impl.h"
|
||||
#include "../../menu/menu.h"
|
||||
|
||||
/*void SetStyle() {
|
||||
ImGuiStyle* style = &ImGui::GetStyle();
|
||||
style->Colors[ImGuiCol_WindowBg] = ImVec4(style->Colors[ImGuiCol_WindowBg].x, style->Colors[ImGuiCol_WindowBg].y, style->Colors[ImGuiCol_WindowBg].z, 0.98f);
|
||||
}*/
|
||||
|
||||
HRESULT(__stdcall* oPresent)(IDXGISwapChain*, UINT, UINT);
|
||||
HRESULT __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags) {
|
||||
@ -19,7 +14,7 @@ HRESULT __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UIN
|
||||
|
||||
if (!init)
|
||||
{
|
||||
DXGI_SWAP_CHAIN_DESC desc;
|
||||
DXGI_SWAP_CHAIN_DESC desc{};
|
||||
pSwapChain->GetDesc(&desc);
|
||||
|
||||
ID3D11Device* device = nullptr;
|
||||
@ -31,11 +26,11 @@ HRESULT __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UIN
|
||||
impl::win32::init(desc.OutputWindow);
|
||||
|
||||
ImGui::CreateContext();
|
||||
ImGui::GetIO().IniFilename = nullptr;
|
||||
|
||||
ImGui_ImplWin32_Init(desc.OutputWindow);
|
||||
ImGui_ImplDX11_Init(device, context);
|
||||
|
||||
//SetStyle();
|
||||
|
||||
init = true;
|
||||
}
|
||||
|
||||
@ -54,5 +49,5 @@ HRESULT __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UIN
|
||||
}
|
||||
|
||||
void impl::d3d11::init() {
|
||||
assert(kiero::bind(8, (void**)&oPresent, hkPresent11) == kiero::Status::Success);
|
||||
assert(kiero::bind(8, (LPVOID*)&oPresent, hkPresent11) == kiero::Status::Success);
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
#pragma once
|
||||
#include "shared.h"
|
||||
|
||||
namespace impl {
|
||||
namespace d3d11 {
|
||||
void init();
|
||||
|
193
DL2GameOverhaulScript/source/ImGui/impl/d3d12_impl.cpp
Normal file
193
DL2GameOverhaulScript/source/ImGui/impl/d3d12_impl.cpp
Normal file
@ -0,0 +1,193 @@
|
||||
#include <d3d12.h>
|
||||
#include <dxgi1_4.h>
|
||||
#include <assert.h>
|
||||
#include <imgui.h>
|
||||
#include <backends\imgui_impl_win32.h>
|
||||
#include <backends\imgui_impl_dx12.h>
|
||||
#include "..\..\menu\menu.h"
|
||||
#include "..\..\kiero.h"
|
||||
#include "d3d12_impl.h"
|
||||
#include "win32_impl.h"
|
||||
|
||||
struct FrameContext {
|
||||
ID3D12CommandAllocator* commandAllocator = nullptr;
|
||||
ID3D12Resource* main_render_target_resource = nullptr;
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE main_render_target_descriptor{};
|
||||
};
|
||||
|
||||
static UINT buffersCounts = -1;
|
||||
static FrameContext* frameContext = nullptr;
|
||||
|
||||
static ID3D12Device* device = nullptr;
|
||||
static ID3D12DescriptorHeap* d3d12DescriptorHeapBackBuffers = nullptr;
|
||||
static ID3D12DescriptorHeap* d3d12DescriptorHeapImGuiRender = nullptr;
|
||||
static ID3D12GraphicsCommandList* d3d12CommandList = nullptr;
|
||||
static ID3D12CommandQueue* d3d12CommandQueue = nullptr;
|
||||
|
||||
static void CreateRenderTarget(IDXGISwapChain* pSwapChain) {
|
||||
for (UINT i = 0; i < buffersCounts; i++) {
|
||||
ID3D12Resource* pBackBuffer = nullptr;
|
||||
pSwapChain->GetBuffer(i, IID_PPV_ARGS(&pBackBuffer));
|
||||
if (pBackBuffer) {
|
||||
D3D12_RENDER_TARGET_VIEW_DESC descTarget{};
|
||||
descTarget.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
descTarget.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D;
|
||||
|
||||
device->CreateRenderTargetView(pBackBuffer, &descTarget, frameContext[i].main_render_target_descriptor);
|
||||
frameContext[i].main_render_target_resource = pBackBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void RenderImGui_DX12(IDXGISwapChain3* pSwapChain) {
|
||||
static bool init = false;
|
||||
|
||||
if (!init) {
|
||||
DXGI_SWAP_CHAIN_DESC desc{};
|
||||
pSwapChain->GetDesc(&desc);
|
||||
pSwapChain->GetDevice(__uuidof(ID3D12Device), (void**)&device);
|
||||
|
||||
buffersCounts = desc.BufferCount;
|
||||
frameContext = new FrameContext[buffersCounts];
|
||||
|
||||
D3D12_DESCRIPTOR_HEAP_DESC descriptorBackBuffers{};
|
||||
descriptorBackBuffers.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
|
||||
descriptorBackBuffers.NumDescriptors = buffersCounts;
|
||||
descriptorBackBuffers.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
|
||||
descriptorBackBuffers.NodeMask = 1;
|
||||
if (device->CreateDescriptorHeap(&descriptorBackBuffers, IID_PPV_ARGS(&d3d12DescriptorHeapBackBuffers)) != S_OK)
|
||||
return;
|
||||
|
||||
SIZE_T rtvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = d3d12DescriptorHeapBackBuffers->GetCPUDescriptorHandleForHeapStart();
|
||||
for (UINT i = 0; i < buffersCounts; ++i) {
|
||||
frameContext[i].main_render_target_descriptor = rtvHandle;
|
||||
rtvHandle.ptr += rtvDescriptorSize;
|
||||
}
|
||||
|
||||
D3D12_DESCRIPTOR_HEAP_DESC descriptorImGuiRender{};
|
||||
descriptorImGuiRender.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
|
||||
descriptorImGuiRender.NumDescriptors = 1;
|
||||
descriptorImGuiRender.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
|
||||
if (device->CreateDescriptorHeap(&descriptorImGuiRender, IID_PPV_ARGS(&d3d12DescriptorHeapImGuiRender)) != S_OK)
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i < buffersCounts; i++) {
|
||||
ID3D12CommandAllocator* allocator = nullptr;
|
||||
if (device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator)) != S_OK)
|
||||
return;
|
||||
|
||||
frameContext[i].commandAllocator = allocator;
|
||||
}
|
||||
|
||||
if (device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, frameContext[0].commandAllocator, NULL, IID_PPV_ARGS(&d3d12CommandList)) != S_OK || d3d12CommandList->Close() != S_OK)
|
||||
return;
|
||||
|
||||
impl::win32::init(desc.OutputWindow);
|
||||
|
||||
ImGui::CreateContext();
|
||||
ImGui::GetIO().IniFilename = nullptr;
|
||||
|
||||
ImGui_ImplWin32_Init(desc.OutputWindow);
|
||||
ImGui_ImplDX12_Init(device, buffersCounts, DXGI_FORMAT_R8G8B8A8_UNORM, d3d12DescriptorHeapImGuiRender, d3d12DescriptorHeapImGuiRender->GetCPUDescriptorHandleForHeapStart(), d3d12DescriptorHeapImGuiRender->GetGPUDescriptorHandleForHeapStart());
|
||||
ImGui_ImplDX12_CreateDeviceObjects();
|
||||
|
||||
init = true;
|
||||
}
|
||||
|
||||
if (!frameContext[0].main_render_target_resource)
|
||||
CreateRenderTarget(pSwapChain);
|
||||
if (!d3d12CommandQueue || !frameContext[0].main_render_target_resource)
|
||||
return;
|
||||
|
||||
ImGui_ImplDX12_NewFrame();
|
||||
ImGui_ImplWin32_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
if (Menu::isOpen)
|
||||
Menu::Render();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
UINT backBufferIdx = pSwapChain->GetCurrentBackBufferIndex();
|
||||
ID3D12CommandAllocator* commandAllocator = frameContext[backBufferIdx].commandAllocator;
|
||||
commandAllocator->Reset();
|
||||
|
||||
D3D12_RESOURCE_BARRIER barrier{};
|
||||
barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
|
||||
barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
|
||||
barrier.Transition.pResource = frameContext[backBufferIdx].main_render_target_resource;
|
||||
barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
|
||||
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_PRESENT;
|
||||
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
d3d12CommandList->Reset(commandAllocator, NULL);
|
||||
d3d12CommandList->ResourceBarrier(1, &barrier);
|
||||
|
||||
d3d12CommandList->OMSetRenderTargets(1, &frameContext[backBufferIdx].main_render_target_descriptor, FALSE, NULL);
|
||||
d3d12CommandList->SetDescriptorHeaps(1, &d3d12DescriptorHeapImGuiRender);
|
||||
|
||||
ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData(), d3d12CommandList);
|
||||
|
||||
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_PRESENT;
|
||||
|
||||
d3d12CommandList->ResourceBarrier(1, &barrier);
|
||||
d3d12CommandList->Close();
|
||||
|
||||
d3d12CommandQueue->ExecuteCommandLists(1, reinterpret_cast<ID3D12CommandList* const*>(&d3d12CommandList));
|
||||
}
|
||||
|
||||
HRESULT(__stdcall* oPresent)(IDXGISwapChain3*, UINT, UINT);
|
||||
HRESULT __stdcall hkPresent12(IDXGISwapChain3* pSwapChain, UINT SyncInterval, UINT Flags) {
|
||||
RenderImGui_DX12(pSwapChain);
|
||||
|
||||
return oPresent(pSwapChain, SyncInterval, Flags);
|
||||
}
|
||||
|
||||
HRESULT(__stdcall* oPresent1)(IDXGISwapChain3*, UINT, UINT, const DXGI_PRESENT_PARAMETERS* pPresentParameters);
|
||||
HRESULT __stdcall hkPresent112(IDXGISwapChain3* pSwapChain, UINT SyncInterval, UINT PresentFlags, const DXGI_PRESENT_PARAMETERS* pPresentParameters) {
|
||||
RenderImGui_DX12(pSwapChain);
|
||||
|
||||
return oPresent1(pSwapChain, SyncInterval, PresentFlags, pPresentParameters);
|
||||
}
|
||||
|
||||
static void CleanupRenderTarget() {
|
||||
for (UINT i = 0; i < buffersCounts; ++i) {
|
||||
if (frameContext[i].main_render_target_resource) {
|
||||
frameContext[i].main_render_target_resource->Release();
|
||||
frameContext[i].main_render_target_resource = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT(__stdcall* oResizeBuffers)(IDXGISwapChain*, UINT, UINT, UINT, DXGI_FORMAT, UINT);
|
||||
HRESULT hookResizeBuffers12(IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags) {
|
||||
CleanupRenderTarget();
|
||||
|
||||
return oResizeBuffers(pSwapChain, BufferCount, Width, Height, NewFormat, SwapChainFlags);
|
||||
}
|
||||
|
||||
HRESULT(__stdcall* oResizeBuffers1)(IDXGISwapChain3*, UINT, UINT, UINT, DXGI_FORMAT, UINT, const UINT*, IUnknown* const*);
|
||||
HRESULT hookResizeBuffers112(IDXGISwapChain3* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags, const UINT* pCreationNodeMask, IUnknown* const* ppPresentQueue) {
|
||||
CleanupRenderTarget();
|
||||
|
||||
return oResizeBuffers1(pSwapChain, BufferCount, Width, Height, NewFormat, SwapChainFlags, pCreationNodeMask, ppPresentQueue);
|
||||
}
|
||||
|
||||
void(__stdcall* oExecuteCommandLists)(ID3D12CommandQueue*, UINT, ID3D12CommandList* const*);
|
||||
void hookExecuteCommandLists12(ID3D12CommandQueue* queue, UINT NumCommandLists, ID3D12CommandList* const *ppCommandLists) {
|
||||
if (!d3d12CommandQueue)
|
||||
d3d12CommandQueue = queue;
|
||||
|
||||
oExecuteCommandLists(queue, NumCommandLists, ppCommandLists);
|
||||
}
|
||||
|
||||
void impl::d3d12::init() {
|
||||
assert(kiero::bind(140, (LPVOID*)&oPresent, hkPresent12) == kiero::Status::Success);
|
||||
assert(kiero::bind(154, (LPVOID*)&oPresent1, hkPresent112) == kiero::Status::Success);
|
||||
|
||||
assert(kiero::bind(145, (LPVOID*)&oResizeBuffers, hookResizeBuffers12) == kiero::Status::Success);
|
||||
assert(kiero::bind(171, (LPVOID*)&oResizeBuffers1, hookResizeBuffers112) == kiero::Status::Success);
|
||||
|
||||
assert(kiero::bind(54, (LPVOID*)&oExecuteCommandLists, hookExecuteCommandLists12) == kiero::Status::Success);
|
||||
}
|
6
DL2GameOverhaulScript/source/ImGui/impl/d3d12_impl.h
Normal file
6
DL2GameOverhaulScript/source/ImGui/impl/d3d12_impl.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
namespace impl {
|
||||
namespace d3d12 {
|
||||
void init();
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <stdio.h>
|
||||
#include "shared.h"
|
||||
#include "../imgui.h"
|
||||
|
||||
void impl::showExampleWindow(const char* comment) {
|
||||
char buffer[128];
|
||||
memset(buffer, 0, 128);
|
||||
sprintf(buffer, "Kiero Dear ImGui Example (%s)", comment);
|
||||
|
||||
ImGui::Begin(buffer);
|
||||
|
||||
ImGui::Text("Hello");
|
||||
ImGui::Button("World!");
|
||||
|
||||
ImGui::End();
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
namespace impl {
|
||||
void showExampleWindow(const char* comment);
|
||||
}
|
@ -1,22 +1,17 @@
|
||||
#include <Windows.h>
|
||||
|
||||
#include "../../kiero.h"
|
||||
#include "../imgui.h"
|
||||
#include "../backends/imgui_impl_win32.h"
|
||||
|
||||
#include <imgui.h>
|
||||
#include <backends\imgui_impl_win32.h>
|
||||
#include "..\..\menu\menu.h"
|
||||
#include "..\..\sigscan\offsets.h"
|
||||
#include "..\..\kiero.h"
|
||||
#include "..\..\game_classes.h"
|
||||
#include "win32_impl.h"
|
||||
|
||||
#include "../../menu/menu.h"
|
||||
#include "../../sigscan/offsets.h"
|
||||
|
||||
static WNDPROC oWndProc = NULL;
|
||||
static bool toggledMenu = false;
|
||||
static bool menuMsgSent = false;
|
||||
static bool wasMenuKeyPressed = false;
|
||||
|
||||
static void(*DoGameWindowStuffOnGainFocus)(LPVOID gui__CActionNode) = nullptr;
|
||||
static void(*DoGameWindowStuffOnLostFocus)(LPVOID gui__CActionNode) = nullptr;
|
||||
static LPVOID* g_gui__CActionNode = nullptr;
|
||||
|
||||
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
LRESULT __stdcall hkWindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam) {
|
||||
@ -33,35 +28,22 @@ LRESULT __stdcall hkWindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wPara
|
||||
break;
|
||||
}
|
||||
|
||||
Engine::CInput* pCInput = Engine::CInput::Get();
|
||||
if (!pCInput)
|
||||
return CallWindowProc(oWndProc, hwnd, uMsg, wParam, lParam);
|
||||
|
||||
ImGui::GetIO().MouseDrawCursor = Menu::isOpen;
|
||||
ImGui_ImplWin32_WndProcHandler(hwnd, uMsg, wParam, lParam);
|
||||
|
||||
if (!DoGameWindowStuffOnGainFocus) {
|
||||
DoGameWindowStuffOnGainFocus = (decltype(DoGameWindowStuffOnGainFocus))Offsets::Get_DoGameWindowStuffOnGainFocusOffset();
|
||||
return CallWindowProc(oWndProc, hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
if (!DoGameWindowStuffOnLostFocus) {
|
||||
DoGameWindowStuffOnLostFocus = (decltype(DoGameWindowStuffOnLostFocus))Offsets::Get_DoGameWindowStuffOnLostFocusOffset();
|
||||
return CallWindowProc(oWndProc, hwnd, uMsg, wParam, lParam);
|
||||
|
||||
}
|
||||
if (!g_gui__CActionNode) {
|
||||
g_gui__CActionNode = Offsets::Get_g_gui__CActionNodeOffset();
|
||||
return CallWindowProc(oWndProc, hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
if (Menu::isOpen) {
|
||||
// Gain focus to ImGui
|
||||
if (!toggledMenu && DoGameWindowStuffOnLostFocus)
|
||||
DoGameWindowStuffOnLostFocus(g_gui__CActionNode);
|
||||
if (!toggledMenu)
|
||||
pCInput->BlockGameInput();
|
||||
|
||||
toggledMenu = true;
|
||||
return true;
|
||||
} else if (toggledMenu) {
|
||||
toggledMenu = false;
|
||||
|
||||
// Regain focus to game
|
||||
DoGameWindowStuffOnGainFocus(g_gui__CActionNode);
|
||||
pCInput->UnlockGameInput();
|
||||
}
|
||||
|
||||
return CallWindowProc(oWndProc, hwnd, uMsg, wParam, lParam);
|
||||
|
@ -1,6 +1,4 @@
|
||||
#pragma once
|
||||
#include "shared.h"
|
||||
|
||||
namespace impl {
|
||||
namespace win32 {
|
||||
void init(HWND hwnd);
|
||||
|
4946
DL2GameOverhaulScript/source/ImGuiFileDialog/ImGuiFileDialog.cpp
Normal file
4946
DL2GameOverhaulScript/source/ImGuiFileDialog/ImGuiFileDialog.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2280
DL2GameOverhaulScript/source/ImGuiFileDialog/ImGuiFileDialog.h
Normal file
2280
DL2GameOverhaulScript/source/ImGuiFileDialog/ImGuiFileDialog.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
||||
#pragma once
|
||||
|
||||
// uncomment and modify defines under for customize ImGuiFileDialog
|
||||
|
||||
//this options need c++17
|
||||
//#define USE_STD_FILESYSTEM
|
||||
|
||||
//#define MAX_FILE_DIALOG_NAME_BUFFER 1024
|
||||
//#define MAX_PATH_BUFFER_SIZE 1024
|
||||
|
||||
// the slash's buttons in path cna be used for quick select parallles directories
|
||||
//#define USE_QUICK_PATH_SELECT
|
||||
|
||||
// the spacing between button path's can be customized.
|
||||
// if disabled the spacing is defined by the imgui theme
|
||||
// define the space between path buttons
|
||||
//#define CUSTOM_PATH_SPACING 2
|
||||
|
||||
//#define USE_THUMBNAILS
|
||||
//the thumbnail generation use the stb_image and stb_resize lib who need to define the implementation
|
||||
//btw if you already use them in your app, you can have compiler error due to "implemntation found in double"
|
||||
//so uncomment these line for prevent the creation of implementation of these libs again
|
||||
//#define DONT_DEFINE_AGAIN__STB_IMAGE_IMPLEMENTATION
|
||||
//#define DONT_DEFINE_AGAIN__STB_IMAGE_RESIZE_IMPLEMENTATION
|
||||
//#define IMGUI_RADIO_BUTTON RadioButton
|
||||
//#define DisplayMode_ThumbailsList_ImageHeight 32.0f
|
||||
//#define tableHeaderFileThumbnailsString "Thumbnails"
|
||||
//#define DisplayMode_FilesList_ButtonString "FL"
|
||||
//#define DisplayMode_FilesList_ButtonHelp "File List"
|
||||
//#define DisplayMode_ThumbailsList_ButtonString "TL"
|
||||
//#define DisplayMode_ThumbailsList_ButtonHelp "Thumbnails List"
|
||||
// todo
|
||||
//#define DisplayMode_ThumbailsGrid_ButtonString "TG"
|
||||
//#define DisplayMode_ThumbailsGrid_ButtonHelp "Thumbnails Grid"
|
||||
|
||||
//#define USE_EXPLORATION_BY_KEYS
|
||||
// this mapping by default is for GLFW but you can use another
|
||||
//#include <GLFW/glfw3.h>
|
||||
// Up key for explore to the top
|
||||
//#define IGFD_KEY_UP ImGuiKey_UpArrow
|
||||
// Down key for explore to the bottom
|
||||
//#define IGFD_KEY_DOWN ImGuiKey_DownArrow
|
||||
// Enter key for open directory
|
||||
//#define IGFD_KEY_ENTER ImGuiKey_Enter
|
||||
// BackSpace for comming back to the last directory
|
||||
//#define IGFD_KEY_BACKSPACE ImGuiKey_Backspace
|
||||
|
||||
// by ex you can quit the dialog by pressing the key excape
|
||||
//#define USE_DIALOG_EXIT_WITH_KEY
|
||||
//#define IGFD_EXIT_KEY ImGuiKey_Escape
|
||||
|
||||
// widget
|
||||
// begin combo widget
|
||||
//#define IMGUI_BEGIN_COMBO ImGui::BeginCombo
|
||||
// when auto resized, FILTER_COMBO_MIN_WIDTH will be considered has minimum width
|
||||
// FILTER_COMBO_AUTO_SIZE is enabled by default now to 1
|
||||
// uncomment if you want disable
|
||||
//#define FILTER_COMBO_AUTO_SIZE 0
|
||||
// filter combobox width
|
||||
//#define FILTER_COMBO_MIN_WIDTH 120.0f
|
||||
// button widget use for compose path
|
||||
//#define IMGUI_PATH_BUTTON ImGui::Button
|
||||
// standard button
|
||||
//#define IMGUI_BUTTON ImGui::Button
|
||||
|
||||
// locales string
|
||||
//#define createDirButtonString "+"
|
||||
//#define resetButtonString "R"
|
||||
//#define drivesButtonString "Drives"
|
||||
//#define editPathButtonString "E"
|
||||
//#define searchString "Search"
|
||||
//#define dirEntryString "[DIR] "
|
||||
//#define linkEntryString "[LINK] "
|
||||
//#define fileEntryString "[FILE] "
|
||||
//#define fileNameString "File Name : "
|
||||
//#define dirNameString "Directory Path :"
|
||||
//#define buttonResetSearchString "Reset search"
|
||||
//#define buttonDriveString "Drives"
|
||||
//#define buttonEditPathString "Edit path\nYou can also right click on path buttons"
|
||||
//#define buttonResetPathString "Reset to current directory"
|
||||
//#define buttonCreateDirString "Create Directory"
|
||||
//#define OverWriteDialogTitleString "The file Already Exist !"
|
||||
//#define OverWriteDialogMessageString "Would you like to OverWrite it ?"
|
||||
//#define OverWriteDialogConfirmButtonString "Confirm"
|
||||
//#define OverWriteDialogCancelButtonString "Cancel"
|
||||
|
||||
//Validation buttons
|
||||
//#define okButtonString " OK"
|
||||
//#define okButtonWidth 0.0f
|
||||
//#define cancelButtonString " Cancel"
|
||||
//#define cancelButtonWidth 0.0f
|
||||
//alignement [0:1], 0.0 is left, 0.5 middle, 1.0 right, and other ratios
|
||||
//#define okCancelButtonAlignement 0.0f
|
||||
//#define invertOkAndCancelButtons 0
|
||||
|
||||
// DateTimeFormat
|
||||
// see strftime functionin <ctime> for customize
|
||||
// "%Y/%m/%d %H:%M" give 2021:01:22 11:47
|
||||
// "%Y/%m/%d %i:%M%p" give 2021:01:22 11:45PM
|
||||
//#define DateTimeFormat "%Y/%m/%d %i:%M%p"
|
||||
|
||||
// theses icons will appear in table headers
|
||||
//#define USE_CUSTOM_SORTING_ICON
|
||||
//#define tableHeaderAscendingIcon "A|"
|
||||
//#define tableHeaderDescendingIcon "D|"
|
||||
//#define tableHeaderFileNameString " File name"
|
||||
//#define tableHeaderFileTypeString " Type"
|
||||
//#define tableHeaderFileSizeString " Size"
|
||||
//#define tableHeaderFileDateTimeString " Date"
|
||||
//#define fileSizeBytes "o"
|
||||
//#define fileSizeKiloBytes "Ko"
|
||||
//#define fileSizeMegaBytes "Mo"
|
||||
//#define fileSizeGigaBytes "Go"
|
||||
|
||||
// default table sort field (must be FIELD_FILENAME, FIELD_TYPE, FIELD_SIZE, FIELD_DATE or FIELD_THUMBNAILS)
|
||||
//#define defaultSortField FIELD_FILENAME
|
||||
|
||||
// default table sort order for each field (true => Descending, false => Ascending)
|
||||
//#define defaultSortOrderFilename true
|
||||
//#define defaultSortOrderType true
|
||||
//#define defaultSortOrderSize true
|
||||
//#define defaultSortOrderDate true
|
||||
//#define defaultSortOrderThumbnails true
|
||||
|
||||
//#define USE_BOOKMARK
|
||||
//#define bookmarkPaneWith 150.0f
|
||||
//#define IMGUI_TOGGLE_BUTTON ToggleButton
|
||||
//#define bookmarksButtonString "Bookmark"
|
||||
//#define bookmarksButtonHelpString "Bookmark"
|
||||
//#define addBookmarkButtonString "+"
|
||||
//#define removeBookmarkButtonString "-"
|
21
DL2GameOverhaulScript/source/ImGuiFileDialog/LICENSE
Normal file
21
DL2GameOverhaulScript/source/ImGuiFileDialog/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2023 Stephane Cuillerdier (aka Aiekick)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
21
DL2GameOverhaulScript/source/ImGuiFileDialog/dirent/LICENSE
Normal file
21
DL2GameOverhaulScript/source/ImGuiFileDialog/dirent/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 1998-2019 Toni Ronkko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
1160
DL2GameOverhaulScript/source/ImGuiFileDialog/dirent/dirent.h
Normal file
1160
DL2GameOverhaulScript/source/ImGuiFileDialog/dirent/dirent.h
Normal file
File diff suppressed because it is too large
Load Diff
37
DL2GameOverhaulScript/source/ImGuiFileDialog/stb/LICENSE
Normal file
37
DL2GameOverhaulScript/source/ImGuiFileDialog/stb/LICENSE
Normal file
@ -0,0 +1,37 @@
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
7762
DL2GameOverhaulScript/source/ImGuiFileDialog/stb/stb_image.h
Normal file
7762
DL2GameOverhaulScript/source/ImGuiFileDialog/stb/stb_image.h
Normal file
File diff suppressed because it is too large
Load Diff
2631
DL2GameOverhaulScript/source/ImGuiFileDialog/stb/stb_image_resize.h
Normal file
2631
DL2GameOverhaulScript/source/ImGuiFileDialog/stb/stb_image_resize.h
Normal file
File diff suppressed because it is too large
Load Diff
81
DL2GameOverhaulScript/source/MinHook/LICENSE.txt
Normal file
81
DL2GameOverhaulScript/source/MinHook/LICENSE.txt
Normal file
@ -0,0 +1,81 @@
|
||||
MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
Copyright (C) 2009-2017 Tsuda Kageyu.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
================================================================================
|
||||
Portions of this software are Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
================================================================================
|
||||
Hacker Disassembler Engine 32 C
|
||||
Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Hacker Disassembler Engine 64 C
|
||||
Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,11 +1,12 @@
|
||||
#include <Windows.h>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <MinHook.h>
|
||||
#include "utils.h"
|
||||
#include "ini.h"
|
||||
#include "kiero.h"
|
||||
#include "ImGui\impl\d3d11_impl.h"
|
||||
#include "MinHook\include\MinHook.h"
|
||||
#include "ImGui\impl\d3d12_impl.h"
|
||||
#include "menu\menu.h"
|
||||
#include "menu\player.h"
|
||||
#include "menu\camera.h"
|
||||
@ -25,6 +26,7 @@ namespace Core {
|
||||
static FILE* f = nullptr;
|
||||
static void EnableConsole() {
|
||||
AllocConsole();
|
||||
SetConsoleTitle("Debug Tools");
|
||||
freopen_s(&f, "CONOUT$", "w", stdout);
|
||||
DisableConsoleQuickEdit();
|
||||
}
|
||||
@ -34,11 +36,15 @@ namespace Core {
|
||||
}
|
||||
|
||||
// Core
|
||||
static std::string_view rendererAPI{};
|
||||
static void HookRendererThread() {
|
||||
while (true) {
|
||||
Sleep(1000);
|
||||
|
||||
if (kiero::init(kiero::RenderType::Auto) != kiero::Status::Success)
|
||||
if (rendererAPI.empty())
|
||||
continue;
|
||||
|
||||
if (kiero::init(rendererAPI == "d3d11" ? kiero::RenderType::D3D11 : kiero::RenderType::D3D12) != kiero::Status::Success)
|
||||
continue;
|
||||
|
||||
switch (kiero::getRenderType()) {
|
||||
@ -46,6 +52,7 @@ namespace Core {
|
||||
impl::d3d11::init();
|
||||
break;
|
||||
case kiero::RenderType::D3D12:
|
||||
impl::d3d12::init();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -78,9 +85,31 @@ namespace Core {
|
||||
});
|
||||
}
|
||||
|
||||
static void OnUpdateFreeCam() {
|
||||
#pragma region GetRendererAPI
|
||||
static bool(*pReadVideoSettings)(LPVOID instance, LPVOID file, bool flag1) = nullptr;
|
||||
static bool(*oReadVideoSettings)(LPVOID instance, LPVOID file, bool flag1) = nullptr;
|
||||
bool detourReadVideoSettings(LPVOID instance, LPVOID file, bool flag1) {
|
||||
if (!rendererAPI.empty())
|
||||
return oReadVideoSettings(instance, file, flag1);
|
||||
|
||||
DWORD renderer = *reinterpret_cast<PDWORD>(reinterpret_cast<DWORD64>(instance) + 0x78);
|
||||
rendererAPI = !renderer ? "d3d11" : "d3d12";
|
||||
|
||||
return oReadVideoSettings(instance, file, flag1);
|
||||
}
|
||||
void LoopHookReadVideoSettings() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pReadVideoSettings)
|
||||
pReadVideoSettings = (decltype(pReadVideoSettings))Offsets::Get_ReadVideoSettingsOffset();
|
||||
else if (!oReadVideoSettings && MH_CreateHook(pReadVideoSettings, &detourReadVideoSettings, reinterpret_cast<LPVOID*>(&oReadVideoSettings)) == MH_OK) {
|
||||
MH_EnableHook(pReadVideoSettings);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
void OnPostUpdate() {
|
||||
if (!GamePH::PlayerVariables::gotPlayerVars)
|
||||
@ -101,10 +130,11 @@ namespace Core {
|
||||
|
||||
DWORD64 WINAPI MainThread(HMODULE hModule) {
|
||||
EnableConsole();
|
||||
|
||||
|
||||
HookLdrpInitRoutine();
|
||||
|
||||
MH_Initialize();
|
||||
LoopHookReadVideoSettings();
|
||||
|
||||
// Hook renderer for ImGui
|
||||
std::thread(HookRendererThread).detach();
|
||||
@ -113,6 +143,7 @@ namespace Core {
|
||||
GamePH::LoopHookOnUpdate();
|
||||
GamePH::LoopHookCalculateFreeCamCollision();
|
||||
GamePH::LoopHookLifeSetHealth();
|
||||
GamePH::LoopHookTogglePhotoMode();
|
||||
|
||||
const HANDLE proc = GetCurrentProcess();
|
||||
WaitForSingleObject(proc, INFINITE);
|
||||
|
@ -63,7 +63,7 @@ namespace GamePH {
|
||||
static DWORD64(*pCalculateFreeCamCollision)(LPVOID pFreeCamera, float* finalPos) = nullptr;
|
||||
static DWORD64(*oCalculateFreeCamCollision)(LPVOID pFreeCamera, float* finalPos) = nullptr;
|
||||
DWORD64 detourCalculateFreeCamCollision(LPVOID pFreeCamera, float* finalPos) {
|
||||
if (!Menu::Camera::freeCamEnabled && !Menu::Camera::disablePhotoModeLimitsEnabled.value)
|
||||
if (!Menu::Camera::freeCamEnabled.value && !Menu::Camera::disablePhotoModeLimitsEnabled.value)
|
||||
return oCalculateFreeCamCollision(pFreeCamera, finalPos);
|
||||
|
||||
return NULL;
|
||||
@ -106,14 +106,46 @@ namespace GamePH {
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region TogglePhotoMode
|
||||
static void(*pTogglePhotoMode)(LPVOID guiPhotoModeData, bool enabled) = nullptr;
|
||||
static void(*oTogglePhotoMode)(LPVOID guiPhotoModeData, bool enabled) = nullptr;
|
||||
void detourTogglePhotoMode(LPVOID guiPhotoModeData, bool enabled) {
|
||||
Menu::Camera::photoModeEnabled = enabled;
|
||||
if (Menu::Camera::freeCamEnabled.value) {
|
||||
GamePH::GameDI_PH* pGameDI_PH = GamePH::GameDI_PH::Get();
|
||||
if (pGameDI_PH) {
|
||||
GamePH::FreeCamera* pFreeCam = GamePH::FreeCamera::Get();
|
||||
if (pFreeCam) {
|
||||
pGameDI_PH->TogglePhotoMode();
|
||||
pFreeCam->AllowCameraMovement(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oTogglePhotoMode(guiPhotoModeData, enabled);
|
||||
}
|
||||
void LoopHookTogglePhotoMode() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pTogglePhotoMode)
|
||||
pTogglePhotoMode = (decltype(pTogglePhotoMode))Offsets::Get_TogglePhotoMode();
|
||||
else if (!oTogglePhotoMode && MH_CreateHook(pTogglePhotoMode, &detourTogglePhotoMode, reinterpret_cast<LPVOID*>(&oTogglePhotoMode)) == MH_OK) {
|
||||
MH_EnableHook(pTogglePhotoMode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
#pragma region PlayerVariables
|
||||
PDWORD64 PlayerVariables::FloatPlayerVariableVT;
|
||||
PDWORD64 PlayerVariables::BoolPlayerVariableVT;
|
||||
|
||||
std::vector <std::pair<std::string_view, std::pair<LPVOID, std::string_view>>> PlayerVariables::unorderedPlayerVars;
|
||||
std::vector <std::pair<std::string_view, std::pair<LPVOID, std::string_view>>> PlayerVariables::unorderedPlayerVarsDefault;
|
||||
std::vector <std::pair<std::string_view, std::pair<LPVOID, std::string_view>>> PlayerVariables::playerVars;
|
||||
std::vector <std::pair<std::string_view, std::pair<std::any, std::string_view>>> PlayerVariables::playerVarsDefault;
|
||||
bool PlayerVariables::gotPlayerVars = false;
|
||||
|
||||
std::unique_ptr<Hook::BreakpointHook> PlayerVariables::loadPlayerFloatVarBpHook = nullptr;
|
||||
@ -132,15 +164,15 @@ namespace GamePH {
|
||||
const char* tempName = reinterpret_cast<const char*>(info->ContextRecord->R8);
|
||||
const std::string_view name = tempName;
|
||||
|
||||
PlayerVariables::unorderedPlayerVars.emplace_back(name, std::make_pair(nullptr, "float"));
|
||||
PlayerVariables::unorderedPlayerVarsDefault.emplace_back(name, std::make_pair(nullptr, "float"));
|
||||
PlayerVariables::playerVars.emplace_back(name, std::make_pair(nullptr, "float"));
|
||||
PlayerVariables::playerVarsDefault.emplace_back(name, std::make_pair(0.0f, "float"));
|
||||
});
|
||||
loadPlayerBoolVarBpHook = std::make_unique<Hook::BreakpointHook>(Offsets::Get_LoadPlayerBoolVariableOffset(), [&](PEXCEPTION_POINTERS info) -> void {
|
||||
const char* tempName = reinterpret_cast<const char*>(info->ContextRecord->R8);
|
||||
const std::string_view name = tempName;
|
||||
|
||||
PlayerVariables::unorderedPlayerVars.emplace_back(name, std::make_pair(nullptr, "bool"));
|
||||
PlayerVariables::unorderedPlayerVarsDefault.emplace_back(name, std::make_pair(nullptr, "bool"));
|
||||
PlayerVariables::playerVars.emplace_back(name, std::make_pair(nullptr, "bool"));
|
||||
PlayerVariables::playerVarsDefault.emplace_back(name, std::make_pair(false, "bool"));
|
||||
});
|
||||
|
||||
hooked = true;
|
||||
@ -173,28 +205,40 @@ namespace GamePH {
|
||||
return;
|
||||
if (!Get())
|
||||
return;
|
||||
if (unorderedPlayerVars.empty())
|
||||
if (playerVars.empty())
|
||||
return;
|
||||
if (!GetFloatPlayerVariableVT())
|
||||
return;
|
||||
if (!GetBoolPlayerVariableVT())
|
||||
return;
|
||||
|
||||
PDWORD64* playerVars = reinterpret_cast<PDWORD64*>(Get());
|
||||
PDWORD64* playerVarsMem = reinterpret_cast<PDWORD64*>(Get());
|
||||
bool isFloatPlayerVar = false;
|
||||
bool isBoolPlayerVar = false;
|
||||
|
||||
for (auto it = unorderedPlayerVars.begin(); it != unorderedPlayerVars.end(); ++it) {
|
||||
for (auto it = playerVars.begin(); it != playerVars.end(); ++it) {
|
||||
while (true) {
|
||||
isFloatPlayerVar = *playerVars == GetFloatPlayerVariableVT();
|
||||
isBoolPlayerVar = *playerVars == GetBoolPlayerVariableVT();
|
||||
isFloatPlayerVar = *playerVarsMem == GetFloatPlayerVariableVT();
|
||||
isBoolPlayerVar = *playerVarsMem == GetBoolPlayerVariableVT();
|
||||
|
||||
if (isFloatPlayerVar || isBoolPlayerVar) {
|
||||
it->second.first = playerVars + 1;
|
||||
playerVars += isFloatPlayerVar ? 3 : 2;
|
||||
it->second.first = playerVarsMem + 1;
|
||||
const std::string_view varName = it->first;
|
||||
|
||||
auto itDef = std::find_if(GamePH::PlayerVariables::playerVarsDefault.begin(), GamePH::PlayerVariables::playerVarsDefault.end(), [&varName](const auto& pair) {
|
||||
return pair.first == varName;
|
||||
});
|
||||
if (itDef != GamePH::PlayerVariables::playerVarsDefault.end()) {
|
||||
if (isFloatPlayerVar)
|
||||
itDef->second.first = *reinterpret_cast<float*>(it->second.first);
|
||||
else
|
||||
itDef->second.first = *reinterpret_cast<bool*>(it->second.first);
|
||||
}
|
||||
|
||||
playerVarsMem += isFloatPlayerVar ? 3 : 2;
|
||||
break;
|
||||
} else
|
||||
playerVars += 1;
|
||||
playerVarsMem += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -538,6 +582,30 @@ namespace Engine {
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CInput
|
||||
DWORD64 CInput::BlockGameInput() {
|
||||
return Memory::CallVT<2, DWORD64>(this);
|
||||
}
|
||||
void CInput::UnlockGameInput() {
|
||||
Memory::CallVT<1>(this);
|
||||
}
|
||||
|
||||
CInput* CInput::Get() {
|
||||
__try {
|
||||
if (!Offsets::Get_g_CInput())
|
||||
return nullptr;
|
||||
|
||||
CInput* ptr = *reinterpret_cast<CInput**>(Offsets::Get_g_CInput());
|
||||
|
||||
if (!Memory::IsValidPtrMod(ptr, "engine_x64_rwdi.dll"))
|
||||
return nullptr;
|
||||
return ptr;
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CBulletPhysicsCharacter
|
||||
Vector3 CBulletPhysicsCharacter::posBeforeFreeze{};
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <vector>
|
||||
#include <string_view>
|
||||
#include <memory>
|
||||
#include <any>
|
||||
#include "hook.h"
|
||||
|
||||
#define STR_MERGE_IMPL(a, b) a##b
|
||||
@ -50,14 +51,15 @@ namespace GamePH {
|
||||
extern void LoopHookOnUpdate();
|
||||
extern void LoopHookCalculateFreeCamCollision();
|
||||
extern void LoopHookLifeSetHealth();
|
||||
extern void LoopHookTogglePhotoMode();
|
||||
|
||||
class PlayerVariables {
|
||||
private:
|
||||
static PDWORD64 FloatPlayerVariableVT;
|
||||
static PDWORD64 BoolPlayerVariableVT;
|
||||
public:
|
||||
static std::vector<std::pair<std::string_view, std::pair<LPVOID, std::string_view>>> unorderedPlayerVars;
|
||||
static std::vector<std::pair<std::string_view, std::pair<LPVOID, std::string_view>>> unorderedPlayerVarsDefault;
|
||||
static std::vector<std::pair<std::string_view, std::pair<LPVOID, std::string_view>>> playerVars;
|
||||
static std::vector<std::pair<std::string_view, std::pair<std::any, std::string_view>>> playerVarsDefault;
|
||||
static bool gotPlayerVars;
|
||||
|
||||
static std::unique_ptr<Hook::BreakpointHook> loadPlayerFloatVarBpHook;
|
||||
@ -200,6 +202,14 @@ namespace Engine {
|
||||
static CLobbySteam* Get();
|
||||
};
|
||||
|
||||
class CInput {
|
||||
public:
|
||||
DWORD64 BlockGameInput();
|
||||
void UnlockGameInput();
|
||||
|
||||
static CInput* Get();
|
||||
};
|
||||
|
||||
class CBulletPhysicsCharacter {
|
||||
public:
|
||||
union {
|
||||
|
@ -470,12 +470,12 @@ kiero::Status::Enum kiero::init(RenderType::Enum _renderType)
|
||||
return Status::UnknownError;
|
||||
}
|
||||
|
||||
g_methodsTable = (uint150_t*)::calloc(150, sizeof(uint150_t));
|
||||
g_methodsTable = (uint150_t*)::calloc(172, sizeof(uint150_t));
|
||||
::memcpy(g_methodsTable, *(uint150_t**)device, 44 * sizeof(uint150_t));
|
||||
::memcpy(g_methodsTable + 44, *(uint150_t**)commandQueue, 19 * sizeof(uint150_t));
|
||||
::memcpy(g_methodsTable + 44 + 19, *(uint150_t**)commandAllocator, 9 * sizeof(uint150_t));
|
||||
::memcpy(g_methodsTable + 44 + 19 + 9, *(uint150_t**)commandList, 60 * sizeof(uint150_t));
|
||||
::memcpy(g_methodsTable + 44 + 19 + 9 + 60, *(uint150_t**)swapChain, 18 * sizeof(uint150_t));
|
||||
::memcpy(g_methodsTable + 44 + 19 + 9 + 60, *(uint150_t**)swapChain, 40 * sizeof(uint150_t));
|
||||
|
||||
#if KIERO_USE_MINHOOK
|
||||
MH_Initialize();
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define KIERO_INCLUDE_D3D9 0 // 1 if you need D3D9 hook
|
||||
#define KIERO_INCLUDE_D3D10 0 // 1 if you need D3D10 hook
|
||||
#define KIERO_INCLUDE_D3D11 1 // 1 if you need D3D11 hook
|
||||
#define KIERO_INCLUDE_D3D12 0 // 1 if you need D3D12 hook
|
||||
#define KIERO_INCLUDE_D3D12 1 // 1 if you need D3D12 hook
|
||||
#define KIERO_INCLUDE_OPENGL 0 // 1 if you need OpenGL hook
|
||||
#define KIERO_INCLUDE_VULKAN 0 // 1 if you need Vulkan hook
|
||||
#define KIERO_USE_MINHOOK 1 // 1 if you will use kiero::bind function
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "..\ImGui\imgui.h"
|
||||
#include <imgui.h>
|
||||
#include "..\game_classes.h"
|
||||
#include "..\core.h"
|
||||
#include "menu.h"
|
||||
@ -8,7 +8,8 @@ namespace Menu {
|
||||
extern const int BaseFOV = 57;
|
||||
int FOV = 57;
|
||||
|
||||
bool freeCamEnabled = false;
|
||||
bool photoModeEnabled = false;
|
||||
SMART_BOOL freeCamEnabled{};
|
||||
SMART_BOOL disablePhotoModeLimitsEnabled{};
|
||||
bool teleportPlayerToCameraEnabled = false;
|
||||
|
||||
@ -23,6 +24,8 @@ namespace Menu {
|
||||
Menu::Camera::FOV = static_cast<int>(videoSettings->ExtraFOV) + Menu::Camera::BaseFOV;
|
||||
}
|
||||
static void FreeCamUpdate() {
|
||||
if (photoModeEnabled)
|
||||
return;
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
if (!iLevel)
|
||||
return;
|
||||
@ -36,33 +39,23 @@ namespace Menu {
|
||||
if (!pFreeCam)
|
||||
return;
|
||||
|
||||
if (freeCamEnabled) {
|
||||
if (freeCamEnabled.value) {
|
||||
if (viewCam == pFreeCam)
|
||||
return;
|
||||
|
||||
GamePH::GameDI_PH::Get()->TogglePhotoMode();
|
||||
GamePH::FreeCamera::Get()->AllowCameraMovement(2);
|
||||
pGameDI_PH->TogglePhotoMode();
|
||||
pFreeCam->AllowCameraMovement(2);
|
||||
} else {
|
||||
GamePH::CameraFPPDI* pPlayerCam = GamePH::CameraFPPDI::Get();
|
||||
if (!pPlayerCam || viewCam == pPlayerCam)
|
||||
return;
|
||||
|
||||
GamePH::GameDI_PH::Get()->TogglePhotoMode();
|
||||
GamePH::FreeCamera::Get()->AllowCameraMovement(0);
|
||||
pGameDI_PH->TogglePhotoMode();
|
||||
pFreeCam->AllowCameraMovement(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (freeCamEnabled)
|
||||
disablePhotoModeLimitsEnabled.Change(true);
|
||||
else
|
||||
disablePhotoModeLimitsEnabled.Restore();
|
||||
|
||||
UpdateFOVWhileMenuClosed();
|
||||
FreeCamUpdate();
|
||||
}
|
||||
|
||||
static bool GetFreeCamDisabledFlag() {
|
||||
static bool GetCamDisabledFlag() {
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
if (!iLevel)
|
||||
return true;
|
||||
@ -85,15 +78,37 @@ namespace Menu {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (photoModeEnabled)
|
||||
freeCamEnabled.Change(false);
|
||||
else
|
||||
freeCamEnabled.Restore();
|
||||
|
||||
if (freeCamEnabled.value)
|
||||
disablePhotoModeLimitsEnabled.Change(true);
|
||||
else
|
||||
disablePhotoModeLimitsEnabled.Restore();
|
||||
|
||||
UpdateFOVWhileMenuClosed();
|
||||
FreeCamUpdate();
|
||||
}
|
||||
|
||||
void Render() {
|
||||
ImGui::BeginDisabled(GetFreeCamDisabledFlag()); {
|
||||
ImGui::Checkbox("FreeCam", &freeCamEnabled);
|
||||
ImGui::BeginDisabled(GetCamDisabledFlag()); {
|
||||
ImGui::BeginDisabled(photoModeEnabled); {
|
||||
ImGui::Checkbox("FreeCam", &freeCamEnabled.value);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled(freeCamEnabled); {
|
||||
ImGui::BeginDisabled(freeCamEnabled.value); {
|
||||
ImGui::Checkbox("Disable PhotoMode Limits", &disablePhotoModeLimitsEnabled.value);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::Checkbox("Teleport Player to Camera", &teleportPlayerToCameraEnabled);
|
||||
ImGui::BeginDisabled(photoModeEnabled); {
|
||||
ImGui::Checkbox("Teleport Player to Camera", &teleportPlayerToCameraEnabled);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,9 @@ namespace Menu {
|
||||
namespace Camera {
|
||||
extern const int BaseFOV;
|
||||
extern int FOV;
|
||||
|
||||
extern bool freeCamEnabled;
|
||||
|
||||
extern bool photoModeEnabled;
|
||||
extern SMART_BOOL freeCamEnabled;
|
||||
extern SMART_BOOL disablePhotoModeLimitsEnabled;
|
||||
extern bool teleportPlayerToCameraEnabled;
|
||||
|
||||
|
@ -1,14 +1,17 @@
|
||||
#include "..\ImGui\imgui.h"
|
||||
#include <imgui.h>
|
||||
#include "camera.h"
|
||||
#include "player.h"
|
||||
#include "world.h"
|
||||
|
||||
namespace Menu {
|
||||
static const ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;
|
||||
static const ImVec2 minWndSize = ImVec2(0.0f, 0.0f);
|
||||
static const ImVec2 maxWndSize = ImVec2(700.0f, 675.0f);
|
||||
|
||||
bool isOpen = false;
|
||||
|
||||
void Render() {
|
||||
ImGui::SetNextWindowSizeConstraints(minWndSize, maxWndSize);
|
||||
ImGui::Begin("Game Overhaul", &Menu::isOpen, windowFlags); {
|
||||
if (ImGui::BeginTabBar("##MainTabBar")) {
|
||||
if (ImGui::BeginTabItem("Player")) {
|
||||
@ -25,7 +28,6 @@ namespace Menu {
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
ImGui::Separator();
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
#include "..\ImGui\imgui.h"
|
||||
#include <imgui.h>
|
||||
#include "..\game_classes.h"
|
||||
|
||||
namespace Menu {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "sigscan.h"
|
||||
#include "../memory.h"
|
||||
#include "..\memory.h"
|
||||
|
||||
// macro for lazily adding signatures to this sig list
|
||||
#define AddOffset(name, moduleName, pattern, type, retType) \
|
||||
@ -25,9 +25,7 @@ struct Offsets {
|
||||
AddOffset(LdrpRunInitializeRoutinesOffset, "ntdll.dll", "[48 89 4C 24 08 53 56 57 41 54 41 55 41 56 41 57 48 81 EC 90", PatternType::Address, PDWORD64) // for win7
|
||||
|
||||
// Input related
|
||||
AddOffset(g_gui__CActionNodeOffset, "engine_x64_rwdi.dll", "C3 48 8B 0D [?? ?? ?? ?? E8 ?? ?? ?? ?? 33 C0", PatternType::RelativePointer, LPVOID*)
|
||||
AddOffset(DoGameWindowStuffOnLostFocusOffset, "engine_x64_rwdi.dll", "C3 48 8B 0D ?? ?? ?? ?? E8 [?? ?? ?? ?? 33 C0", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(DoGameWindowStuffOnGainFocusOffset, "engine_x64_rwdi.dll", "48 8B 0D ?? ?? ?? ?? E8 [?? ?? ?? ?? BA ?? ?? ?? ?? 48 8B CE E8 ?? ?? ?? ??", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(g_CInput, "engine_x64_rwdi.dll", "48 89 05 [?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 86 ?? ?? ?? ??", PatternType::RelativePointer, PDWORD64*)
|
||||
|
||||
// Player vars related
|
||||
AddOffset(LoadPlayerFloatVariableOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8D 55 80 48 8B 08", PatternType::RelativePointer, PDWORD64);
|
||||
@ -46,11 +44,13 @@ struct Offsets {
|
||||
AddOffset(g_FreeCamera, "gamedll_ph_x64_rwdi.dll", "48 89 05 [?? ?? ?? ?? 48 89 4C 24 ??", PatternType::RelativePointer, PDWORD64)
|
||||
|
||||
// Functions
|
||||
AddOffset(ReadVideoSettingsOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8D 4C 24 ?? FF 15 ?? ?? ?? ?? 8B 54 24 78", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(CalculateFreeCamCollisionOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8B 06 4C 8D 4C 24 ??", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(GetViewCameraOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 85 C0 74 28 48 8B C8", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(MoveCharacterOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 80 BB ?? ?? ?? ?? ?? 74 4E", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(CreatePlayerHealthModuleOffset, "gamedll_ph_x64_rwdi.dll", "[48 89 5C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 4C 8B F1 E8 ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ??", PatternType::Address, LPVOID)
|
||||
AddOffset(LifeSetHealth, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 49 8D 4C 24 ?? 49 03 CE", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(TogglePhotoMode, "gamedll_ph_x64_rwdi.dll", "48 83 EC 48 38 91 ?? ?? ?? ??", PatternType::Address, LPVOID)
|
||||
AddOffset(GetTimeWeatherSystemOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 33 D2 48 8B C8 E8 ?? ?? ?? ?? 4C 8B C8", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(SetForcedWeatherOffset, "engine_x64_rwdi.dll", "89 51 68 C3 CC CC CC CC CC CC CC CC CC CC CC CC", PatternType::Address, LPVOID)
|
||||
AddOffset(GetCurrentWeatherOffset, "engine_x64_rwdi.dll", "48 8B 41 78 48 85 C0 75 0F", PatternType::Address, LPVOID)
|
||||
|
@ -1,17 +1,24 @@
|
||||
#include "utils.h"
|
||||
#include <Windows.h>
|
||||
#include "utils.h"
|
||||
|
||||
namespace Utils {
|
||||
bool str_replace(std::string& str, const std::string& from, const std::string& to) {
|
||||
const size_t start_pos = str.find(from);
|
||||
if (start_pos == std::string::npos)
|
||||
return false;
|
||||
|
||||
str.replace(start_pos, from.length(), to);
|
||||
return true;
|
||||
}
|
||||
|
||||
WindowsVersion GetWindowsVersion() {
|
||||
OSVERSIONINFOEX info{};
|
||||
DWORDLONG dwlConditionMask = 0;
|
||||
|
||||
// Initialize the OSVERSIONINFOEX structure.
|
||||
ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
|
||||
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
info.dwMajorVersion = 6;
|
||||
|
||||
// Initialize the condition mask.
|
||||
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_EQUAL);
|
||||
|
||||
if (VerifyVersionInfo(&info, VER_MAJORVERSION, dwlConditionMask)) {
|
||||
|
@ -1,4 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
enum class WindowsVersion {
|
||||
Unknown,
|
||||
Windows7,
|
||||
@ -6,5 +8,6 @@ enum class WindowsVersion {
|
||||
};
|
||||
|
||||
namespace Utils {
|
||||
extern bool str_replace(std::string& str, const std::string& from, const std::string& to);
|
||||
extern WindowsVersion GetWindowsVersion();
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Thordin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <Windows.h>
|
||||
|
||||
int vtablehook_unprotect(void* region) {
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
VirtualQuery((LPCVOID)region, &mbi, sizeof(mbi));
|
||||
VirtualProtect(mbi.BaseAddress, mbi.RegionSize, PAGE_READWRITE, &mbi.Protect);
|
||||
return mbi.Protect;
|
||||
}
|
||||
|
||||
void vtablehook_protect(void* region, int protection) {
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
VirtualQuery((LPCVOID)region, &mbi, sizeof(mbi));
|
||||
VirtualProtect(mbi.BaseAddress, mbi.RegionSize, protection, &mbi.Protect);
|
||||
}
|
||||
|
||||
/*
|
||||
* instance: pointer to an instance of a class
|
||||
* hook: function to overwrite with
|
||||
* offset: 0 = method 1, 1 = method 2 etc...
|
||||
* return: original function
|
||||
*/
|
||||
|
||||
void* vtablehook_hook(void* instance, void* hook, int offset) {
|
||||
intptr_t vtable = *((intptr_t*)instance);
|
||||
intptr_t entry = vtable + offset;
|
||||
intptr_t original = *((intptr_t*) entry);
|
||||
|
||||
int original_protection = vtablehook_unprotect((void*)entry);
|
||||
*((intptr_t*)entry) = (intptr_t)hook;
|
||||
vtablehook_protect((void*)entry, original_protection);
|
||||
|
||||
return (void*)original;
|
||||
}
|
Reference in New Issue
Block a user