-
Notifications
You must be signed in to change notification settings - Fork 2
Improve safety and validation in gameplay and rendering processes #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
ce4be31
0dc73d7
ec08ff6
2740be5
6a8bf70
4e4a0ea
d7e6a74
5fbde6c
2a5705b
80751e3
bb46334
5bdc755
e6d26f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,7 +39,7 @@ void Cheats::Aimbot() | |||||||||||||||||||||||||||||||||||||
| GVars.PlayerController, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetCivilians, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetArrested, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetArrested, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetSurrendered, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetDead, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.MaxFOV, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.LOS, | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -57,7 +57,7 @@ void Cheats::Aimbot() | |||||||||||||||||||||||||||||||||||||
| GVars.PlayerController, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetCivilians, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetArrested, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetArrested, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetSurrendered, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.TargetDead, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.MaxFOV, | ||||||||||||||||||||||||||||||||||||||
| AimbotSettings.LOS, | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -66,18 +66,22 @@ void Cheats::Aimbot() | |||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if (!Target) return; | ||||||||||||||||||||||||||||||||||||||
| if (!Target || !Utils::IsValidActor(Target) || !Target->IsA(AReadyOrNotCharacter::StaticClass())) return; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| auto* TargetCharacter = reinterpret_cast<AReadyOrNotCharacter*>(Target); | ||||||||||||||||||||||||||||||||||||||
| if (!TargetCharacter->Mesh) return; | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+69
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Clear an invalid locked target before returning. At Line 69, validation returns without clearing Proposed fix-if (!Target || !Utils::IsValidActor(Target) || !Target->IsA(AReadyOrNotCharacter::StaticClass())) return;
+if (!Target || !Utils::IsValidActor(Target) || !Target->IsA(AReadyOrNotCharacter::StaticClass()))
+{
+ if (Target == LastTarget)
+ LastTarget = nullptr;
+ return;
+}
auto* TargetCharacter = reinterpret_cast<AReadyOrNotCharacter*>(Target);
-if (!TargetCharacter->Mesh) return;
+if (!TargetCharacter->Mesh)
+{
+ if (TargetCharacter == LastTarget)
+ LastTarget = nullptr;
+ return;
+}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| FVector CameraPos = GVars.POV->Location; | ||||||||||||||||||||||||||||||||||||||
| FVector TargetPos = ((AReadyOrNotCharacter*)Target)->Mesh->GetBoneTransform(BoneName, ERelativeTransformSpace::RTS_World).Translation; | ||||||||||||||||||||||||||||||||||||||
| FVector TargetPos = TargetCharacter->Mesh->GetBoneTransform(BoneName, ERelativeTransformSpace::RTS_World).Translation; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if (AimbotSettings.Prediction) | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| float ProjectileSpeed = 37000.0f; // Random default I made. | ||||||||||||||||||||||||||||||||||||||
| if (GVars.ReadyOrNotChar->GetEquippedWeapon()) | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| ProjectileSpeed = GVars.ReadyOrNotChar->GetEquippedWeapon()->ProjectileMovementSpeed; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| float WeaponProjectileSpeed = GVars.ReadyOrNotChar->GetEquippedWeapon()->ProjectileMovementSpeed; | ||||||||||||||||||||||||||||||||||||||
| if (WeaponProjectileSpeed > 0.0f) | ||||||||||||||||||||||||||||||||||||||
| ProjectileSpeed = WeaponProjectileSpeed; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| float Distance = TargetPos.GetDistanceTo(GVars.ReadyOrNotChar->K2_GetActorLocation()); | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -145,8 +149,8 @@ void Cheats::Aimbot() | |||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| // No smoothing � snap directly | ||||||||||||||||||||||||||||||||||||||
| // No smoothing - snap directly | ||||||||||||||||||||||||||||||||||||||
| GVars.PlayerController->ControlRotation.Yaw = DesiredYaw; | ||||||||||||||||||||||||||||||||||||||
| GVars.PlayerController->ControlRotation.Pitch = DesiredPitch; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,6 +73,7 @@ struct AimbotSettingsstruct { | |
| bool Prediction = false; | ||
| float PredictionMultiplier = 1.0f; | ||
| bool TargetLock = true; | ||
| bool TargetSurrendered = false; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Migrate existing
Add a settings version and migrate legacy records, or reject legacy 🤖 Prompt for AI Agents |
||
| } inline AimbotSettings; | ||
|
|
||
| struct SilentAimSettingsstruct { | ||
|
|
@@ -158,7 +159,7 @@ struct Cheats | |
| static void InstaKill(); | ||
| static void RenderESP(); | ||
| static void SetPlayerSpeed(); | ||
| static void SilentAim(Params::BaseMagazineWeapon_OnFire* FireParams); | ||
| static void SilentAim(Params::BaseMagazineWeapon_Server_OnFire* FireParams); | ||
| static void AddMag(); | ||
| static void ArrestAll(ETeam Team); // Arrest all of a specific team | ||
| static void ProcessArrestQueue(); | ||
|
|
@@ -176,4 +177,4 @@ struct Cheats | |
| static void SurrenderAll(ETeam Team); // Surrender all of a specific team | ||
| static void AntiSway(); | ||
| static void GiveAchievements(); | ||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| #include "pch.h" | ||
| #include "Engine.h" | ||
| #include <kiero/kiero.h> | ||
| #include <d3d12.h> | ||
| #include "ImGui/backends/imgui_impl_dx12.h" | ||
|
|
||
| #define MAJORVERSION 2 | ||
| #define MINORVERSION 5 | ||
|
|
@@ -115,8 +113,22 @@ static const std::pair<const char*, int> KeyNames[] = { | |
| {"OemClear", VK_OEM_CLEAR} | ||
| }; | ||
|
|
||
| static int FindKeyIndex(int VirtualKey) | ||
| { | ||
| for (int Index = 0; Index < IM_ARRAYSIZE(KeyNames); ++Index) | ||
| { | ||
| if (KeyNames[Index].second == VirtualKey) | ||
| return Index; | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| bool KeyGetter(void* Data, int Index, const char** OutText) | ||
| { | ||
| if (!Data || !OutText || Index < 0 || Index >= IM_ARRAYSIZE(KeyNames)) | ||
| return false; | ||
|
|
||
| auto* Items = static_cast<std::pair<const char*, int>*>(Data); | ||
| *OutText = Items[Index].first; | ||
| return true; | ||
|
|
@@ -262,7 +274,12 @@ HRESULT __stdcall Engine::hkPresent(IDXGISwapChain* SwapChain, UINT SyncInterval | |
| return Engine::oPresent(SwapChain, SyncInterval, Flags); | ||
| } | ||
|
|
||
| printf("[hkPresent] Initializing ImGui: %s\n", Engine::InitImGui() ? "Success" : "Failure"); | ||
| if (!Engine::InitImGui()) | ||
| { | ||
| printf("[hkPresent] Failed to initialize ImGui\n"); | ||
| return Engine::oPresent(SwapChain, SyncInterval, Flags); | ||
| } | ||
|
Comment on lines
+277
to
+281
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
ast-grep outline ReadyOrNot/Init.cpp --items all
rg -n -C 8 'InitImGui|pDevice|pContext|GetDevice|GetImmediateContext|Release|DestroyContext' \
ReadyOrNot/Init.cpp ReadyOrNot/DLLMain.cppRepository: peachmarrow13/ReadyOrNot Length of output: 11233 🏁 Script executed: #!/bin/bash
set -euo pipefail
cat -n ReadyOrNot/Init.cpp | sed -n '48,112p'
cat -n ReadyOrNot/DLLMain.cpp | sed -n '240,290p'
rg -n -C 5 'ImGui_Impl|InitImGui\(|`#if`|`#ifdef`|throw|return false|return true' ReadyOrNot/Init.cpp ReadyOrNot/DLLMain.cpp ReadyOrNot/*.h
python3 - <<'PY'
from pathlib import Path
text = Path("ReadyOrNot/Init.cpp").read_text()
start = text.index("bool Engine::InitImGui()")
end = text.index("\nvoid SetStyle()", start)
body = text[start:end]
print("InitImGui return, release, and context operations:")
for i, line in enumerate(body.splitlines(), 1):
if any(token in line for token in ("return", "Release", "CreateContext", "throw")):
print(f"{i:03}: {line}")
PYRepository: peachmarrow13/ReadyOrNot Length of output: 13217 Release COM interfaces on initialization failure.
🤖 Prompt for AI Agents |
||
| printf("[hkPresent] ImGui initialized successfully\n"); | ||
|
|
||
| if (hwnd) | ||
| oWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)WndProc); | ||
|
|
@@ -361,7 +378,11 @@ HRESULT __stdcall Engine::hkPresent(IDXGISwapChain* SwapChain, UINT SyncInterval | |
| CVars.QueuedAction = EQueuedAction::ToggleInfAmmo; | ||
| HostOnlyTooltip(); | ||
|
|
||
| ImGui::InputInt("Multi Fire", &CVars.MultiFire, 0, 50); | ||
| if (ImGui::InputInt("Multi Fire", &CVars.MultiFire, 0, 50)) | ||
| { | ||
| if (CVars.MultiFire < 0) CVars.MultiFire = 0; | ||
| if (CVars.MultiFire > 20) CVars.MultiFire = 20; | ||
| } | ||
|
|
||
| if (ImGui::Button("Remove Recoil")) | ||
| CVars.QueuedAction = EQueuedAction::RemoveRecoil; | ||
|
|
@@ -480,6 +501,8 @@ HRESULT __stdcall Engine::hkPresent(IDXGISwapChain* SwapChain, UINT SyncInterval | |
|
|
||
| ImGui::Checkbox("Target Arrested", &AimbotSettings.TargetArrested); | ||
|
|
||
| ImGui::Checkbox("Target Surrendered", &AimbotSettings.TargetSurrendered); | ||
|
|
||
| ImGui::Checkbox("Target All", &AimbotSettings.TargetAll); | ||
|
|
||
| ImGui::SliderFloat("Max Distance", &AimbotSettings.MaxDistance, 0.0f, 300.0f, "%.1f"); | ||
|
|
@@ -625,14 +648,14 @@ HRESULT __stdcall Engine::hkPresent(IDXGISwapChain* SwapChain, UINT SyncInterval | |
|
|
||
| if (ImGui::TreeNode("Misc Settings")) | ||
| { | ||
| static int MenuButtonCurrentIndex = KeyNames[MiscSettings.MenuButton].second; | ||
| static int MenuButtonCurrentIndex = FindKeyIndex(MiscSettings.MenuButton); | ||
|
|
||
| if (ImGui::Combo("Menu Toggle Key", &MenuButtonCurrentIndex, KeyGetter, (void*)KeyNames, IM_ARRAYSIZE(KeyNames))) | ||
| { | ||
| MiscSettings.MenuButton = KeyNames[MenuButtonCurrentIndex].second; | ||
| } | ||
|
|
||
| static int UninjectButtonCurrentIndex = KeyNames[MiscSettings.UninjectButton].second; | ||
| static int UninjectButtonCurrentIndex = FindKeyIndex(MiscSettings.UninjectButton); | ||
|
|
||
| if (ImGui::Combo("Uninject Key", &UninjectButtonCurrentIndex, KeyGetter, (void*)KeyNames, IM_ARRAYSIZE(KeyNames))) | ||
| { | ||
|
|
@@ -847,8 +870,9 @@ HRESULT __stdcall Engine::hkPresent(IDXGISwapChain* SwapChain, UINT SyncInterval | |
| return Engine::oPresent ? Engine::oPresent(SwapChain, SyncInterval, Flags) : S_OK; | ||
| } | ||
|
|
||
| static DWORD MainThread(HMODULE hModule) | ||
| static DWORD WINAPI MainThread(LPVOID Parameter) | ||
| { | ||
| HMODULE hModule = static_cast<HMODULE>(Parameter); | ||
| AllocConsole(); | ||
| FILE* Dummy; | ||
| freopen_s(&Dummy, "CONOUT$", "w", stdout); | ||
|
|
@@ -889,7 +913,13 @@ static DWORD MainThread(HMODULE hModule) | |
|
|
||
| LoadSettings(); | ||
|
|
||
| Hooks::HookProcessEvent(); | ||
| if (!Hooks::HookProcessEvent()) | ||
| { | ||
| printf("[ERROR] Failed to initialize ProcessEvent hook.\n"); | ||
| Cleaning.store(true); | ||
| Cleanup(hModule); | ||
| return 1; | ||
| } | ||
|
|
||
| while (!Cleaning.load()) | ||
| Sleep(100); | ||
|
|
@@ -904,7 +934,8 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) { | |
| switch (reason) { | ||
| case DLL_PROCESS_ATTACH: | ||
| DisableThreadLibraryCalls(hModule); | ||
| CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)MainThread, hModule, 0, nullptr); | ||
| if (HANDLE MainThreadHandle = CreateThread(nullptr, 0, MainThread, hModule, 0, nullptr)) | ||
| CloseHandle(MainThreadHandle); | ||
| break; | ||
| case DLL_PROCESS_DETACH: | ||
| Cleaning.store(true); | ||
|
|
@@ -1145,14 +1176,11 @@ void Cleanup(HMODULE hModule) | |
| } | ||
|
|
||
| if (Engine::pContext) { | ||
| Engine::pContext->OMSetRenderTargets(0, nullptr, nullptr); | ||
| Engine::pContext->ClearState(); | ||
| Engine::pContext->Flush(); | ||
| } | ||
|
|
||
| Engine::pContext->OMSetRenderTargets(0, nullptr, nullptr); | ||
| Engine::pContext->ClearState(); | ||
| Engine::pContext->Flush(); | ||
|
|
||
| if (Engine::pRenderTargetView) | ||
| { | ||
| Engine::pRenderTargetView->Release(); | ||
|
|
@@ -1179,4 +1207,4 @@ void Cleanup(HMODULE hModule) | |
| // Clean up console | ||
| FreeConsole(); | ||
| FreeLibraryAndExitThread(hModule, 0); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the required
Release|x64platform.OutDirandTargetNameare configured only forRelease|x64inReadyOrNot/ReadyOrNot.vcxproj, Lines 73-76. The README currently says onlyRelease, so aRelease|Win32build does not guaranteeBuild/ReadyOrNot.dll. Update the build step to specifyRelease|x64.Proposed documentation fix
📝 Committable suggestion
🤖 Prompt for AI Agents