diff --git a/CMakeLists.txt b/CMakeLists.txt index f9e32ae6..ba8e3b47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ include(cmake/async-logger.cmake) include(cmake/imgui.cmake) include(cmake/json.cmake) include(cmake/minhook.cmake) +include(cmake/rdr-classes.cmake) # source set(SRC_DIR "${PROJECT_SOURCE_DIR}/src") @@ -25,7 +26,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE "${SRC_DIR}" "${imgui_SOURCE_DIR}" "${minhook_SOURCE_DIR}/include" - "${gtav_classes_SOURCE_DIR}" + "${rdr_classes_SOURCE_DIR}" ) message(STATUS "Setting up linked libraries") diff --git a/cmake/gtav-classes.cmake b/cmake/gtav-classes.cmake deleted file mode 100644 index c6dd5d4e..00000000 --- a/cmake/gtav-classes.cmake +++ /dev/null @@ -1,14 +0,0 @@ -include(FetchContent) - -FetchContent_Declare( - gtav_classes - GIT_REPOSITORY https://github.com/maybegreat48/GTAV-Classes.git - GIT_TAG fb7ec7fe0a8ac08823ab7a0a2e68c08b027fce2f - GIT_PROGRESS TRUE - CONFIGURE_COMMAND "" - BUILD_COMMAND "" -) -message("GTAV-Classes") -if(NOT gtav_classes_POPULATED) - FetchContent_Populate(gtav_classes) -endif() \ No newline at end of file diff --git a/cmake/rdr-classes.cmake b/cmake/rdr-classes.cmake new file mode 100644 index 00000000..7e8ba88e --- /dev/null +++ b/cmake/rdr-classes.cmake @@ -0,0 +1,14 @@ +include(FetchContent) + +FetchContent_Declare( + rdr_classes + GIT_REPOSITORY https://github.com/YimMenu/RDR-Classes.git + GIT_TAG a2a74e151a1ade7683be07e966b47aaa00a28848 + GIT_PROGRESS TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" +) +message("RDR-Classes") +if(NOT rdr_classes_POPULATED) + FetchContent_Populate(rdr_classes) +endif() \ No newline at end of file diff --git a/src/core/renderer/Renderer.cpp b/src/core/renderer/Renderer.cpp index b3cd2270..86f2b167 100644 --- a/src/core/renderer/Renderer.cpp +++ b/src/core/renderer/Renderer.cpp @@ -85,7 +85,7 @@ namespace YimMenu return false; } - m_FrameContext.reserve(m_SwapChainDesc.BufferCount); + m_FrameContext.resize(m_SwapChainDesc.BufferCount); D3D12_DESCRIPTOR_HEAP_DESC DescriptorDesc{ D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_SwapChainDesc.BufferCount, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE }; if (const auto result = m_Device->CreateDescriptorHeap(&DescriptorDesc, __uuidof(ID3D12DescriptorHeap), (void**)m_DescriptorHeap.GetAddressOf()); result < 0) @@ -102,7 +102,7 @@ namespace YimMenu return false; } - for (size_t i{}; i != m_SwapChainDesc.BufferCount; ++i) + for (size_t i{}; i < m_SwapChainDesc.BufferCount; ++i) { m_FrameContext[i].CommandAllocator = m_CommandAllocator.Get(); } diff --git a/src/game/frontend/menu/Menu.cpp b/src/game/frontend/menu/Menu.cpp index e4ea687b..1a3caa62 100644 --- a/src/game/frontend/menu/Menu.cpp +++ b/src/game/frontend/menu/Menu.cpp @@ -1,5 +1,11 @@ #include "Menu.hpp" +#include "core/memory/ModuleMgr.hpp" +#include "game/pointers/Pointers.hpp" +#include "util/Joaat.hpp" +#include "game/rdr/natives.hpp" +#include "core/filemgr/FileMgr.hpp" + namespace YimMenu { void Menu::Main() @@ -9,6 +15,36 @@ namespace YimMenu if (ImGui::Begin("Test")) { + if (ImGui::Button("Suicide")) + { + auto player_ped = PLAYER::PLAYER_PED_ID(); + ENTITY::SET_ENTITY_HEALTH(player_ped, 0, 0); + } + + if (ImGui::Button("Get Coords")) + { + auto coords = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), false, false); + + LOG(INFO) << coords.x << "x\t" << coords.y << "y\t" << coords.z << "z"; + } + + if (ImGui::Button("Dump Entrypoints")) + { + DWORD64 base_address = (DWORD64)GetModuleHandleA(0); + + const auto file_path = FileMgr::GetProjectFile("./entrypoints.txt"); + auto file = std::ofstream(file_path.Path(), std::ios::out | std::ios::trunc); + + for (auto& entry : g_Crossmap) + { + auto address = Pointers.GetNativeHandler(entry); + + file << std::hex << std::uppercase << "0x" << entry << " : RDR2.exe + 0x" << (DWORD64)address - base_address << std::endl; + } + + file.close(); + } + if (ImGui::Button("Unload")) g_Running = false; } diff --git a/src/game/pointers/Pointers.cpp b/src/game/pointers/Pointers.cpp index 2352e9c5..fc15e551 100644 --- a/src/game/pointers/Pointers.cpp +++ b/src/game/pointers/Pointers.cpp @@ -12,7 +12,7 @@ namespace YimMenu const auto rdr2 = ModuleMgr.Get("RDR2.exe"_J); if (!rdr2) { - LOG(FATAL) << "Could not find " << rdr2->Name() << ", is this RDR2?"; + LOG(FATAL) << "Could not find RDR2.exe, is this RDR2?"; return false; } @@ -39,6 +39,16 @@ namespace YimMenu WndProc = ptr.As(); }); + constexpr auto getNativeHandlerPtrn = Pattern<"E8 ? ? ? ? 42 8B 9C FE">("GetNativeHandler"); + scanner.Add(getNativeHandlerPtrn, [this](PointerCalculator ptr) { + GetNativeHandler = ptr.Add(1).Rip().As(); + }); + + constexpr auto fixVectorsPtrn = Pattern<"8B 41 18 4C 8B C1 85">("FixVectors"); + scanner.Add(fixVectorsPtrn, [this](PointerCalculator ptr) { + FixVectors = ptr.As(); + }); + if (!scanner.Scan()) { LOG(FATAL) << "Some patterns could not be found, unloading."; diff --git a/src/game/pointers/Pointers.hpp b/src/game/pointers/Pointers.hpp index ad6feb30..c6d1deea 100644 --- a/src/game/pointers/Pointers.hpp +++ b/src/game/pointers/Pointers.hpp @@ -3,12 +3,15 @@ #include #include #include "game/rdr/RenderingInfo.hpp" +#include