diff --git a/DragonBurn/Config/ConfigMenu.cpp b/DragonBurn/Config/ConfigMenu.cpp index b0ea04d..c2544a7 100644 --- a/DragonBurn/Config/ConfigMenu.cpp +++ b/DragonBurn/Config/ConfigMenu.cpp @@ -7,6 +7,7 @@ #include #include "../Resources/Language.hpp" #include "../Features/RCS.h" +#include "../Helpers/KeyManager.h" namespace ConfigMenu { @@ -64,8 +65,8 @@ namespace ConfigMenu { ImGui::OpenPopup("##reallyDelete"); if (ImGui::BeginPopup("##reallyDelete")) { - ImGui::TextUnformatted(" Are you sure? "); - ImGui::TextUnformatted(" "); + ImGui::Text(" Are you sure? "); + ImGui::Text(" "); ImGui::SameLine(); if (ImGui::Button("No", { 40.0f, 0.0f })) ImGui::CloseCurrentPopup(); @@ -89,8 +90,8 @@ namespace ConfigMenu { ImGui::OpenPopup("##reallyReset"); if (ImGui::BeginPopup("##reallyReset")) { - ImGui::TextUnformatted(" Are you sure? "); - ImGui::TextUnformatted(" "); + ImGui::Text(" Are you sure? "); + ImGui::Text(" "); ImGui::SameLine(); if (ImGui::Button("No", { 40.0f, 0.0f })) ImGui::CloseCurrentPopup(); @@ -190,6 +191,8 @@ namespace ConfigMenu { LegitBotConfig::TriggerBot = true; LegitBotConfig::TriggerAlways = false; + TriggerBot::HotKey = 6; + Text::Trigger::HotKey = KeyMgr::GetKeyName(TriggerBot::HotKey); MenuConfig::TeamCheck = true; MenuConfig::BypassOBS = false; @@ -198,8 +201,8 @@ namespace ConfigMenu { MiscCFG::ShowHeadShootLine = false; MiscCFG::HeadShootLineColor = ImColor(131, 137, 150, 200); - LegitBotConfig::AimBotHotKey = 3; - AimControl::SetHotKey(LegitBotConfig::AimBotHotKey); + AimControl::HotKey = 1; + Text::Aimbot::HotKey = KeyMgr::GetKeyName(AimControl::HotKey); AimControl::AimFov = 10; AimControl::AimFovMin = 0.4f; AimControl::Smooth = 5.0f; @@ -210,8 +213,6 @@ namespace ConfigMenu { TriggerBot::ShotDuration = 400; RCS::RCSBullet = 1; - LegitBotConfig::TriggerHotKey = 4; - TriggerBot::SetHotKey(LegitBotConfig::TriggerHotKey); RCS::RCSScale = ImVec2(1.4f, 1.4f); AimControl::ScopeOnly = true; @@ -261,5 +262,7 @@ namespace ConfigMenu { MenuConfig::RadarWinChengePos = true; MenuConfig::SpecWinChengePos = true; + MenuConfig::HotKey = VK_END; + } } diff --git a/DragonBurn/Config/ConfigSaver.cpp b/DragonBurn/Config/ConfigSaver.cpp index 8bf1fbd..62d1d31 100644 --- a/DragonBurn/Config/ConfigSaver.cpp +++ b/DragonBurn/Config/ConfigSaver.cpp @@ -8,6 +8,7 @@ #include "../Features/TriggerBot.h" #include "../Features/Aimbot.h" #include "../Features/RCS.h" +#include "../Helpers/KeyManager.h" #include using json = nlohmann::json; @@ -148,7 +149,7 @@ namespace MyConfigSaver ConfigData["Aimbot"]["Enable"]= LegitBotConfig::AimBot; ConfigData["Aimbot"]["ToggleMode"]= LegitBotConfig::AimToggleMode; - ConfigData["Aimbot"]["Hotkey"]= LegitBotConfig::AimBotHotKey; + ConfigData["Aimbot"]["Hotkey"]= AimControl::HotKey; ConfigData["Aimbot"]["AimBullet"]= AimControl::AimBullet; ConfigData["Aimbot"]["Fov"]= AimControl::AimFov; ConfigData["Aimbot"]["FovMin"]= AimControl::AimFovMin; @@ -175,7 +176,7 @@ namespace MyConfigSaver ConfigData["Triggerbot"]["Enable"]= LegitBotConfig::TriggerBot; - ConfigData["Triggerbot"]["Hotkey"]= LegitBotConfig::TriggerHotKey; + ConfigData["Triggerbot"]["Hotkey"]= TriggerBot::HotKey; ConfigData["Triggerbot"]["Delay"]= TriggerBot::TriggerDelay; ConfigData["Triggerbot"]["FakeShot"]= TriggerBot::ShotDuration; ConfigData["Triggerbot"]["ScopeOnly"]= TriggerBot::ScopeOnly; @@ -213,6 +214,7 @@ namespace MyConfigSaver ConfigData["Misc"]["TeamCheck"]= MenuConfig::TeamCheck; ConfigData["Misc"]["AntiRecord"]= MenuConfig::BypassOBS; + ConfigData["Misc"]["MenuKey"] = MenuConfig::HotKey; ConfigData["MenuConfig"]["MarkWinPos"]["x"] = MenuConfig::MarkWinPos.x; ConfigData["MenuConfig"]["MarkWinPos"]["y"] = MenuConfig::MarkWinPos.y; @@ -371,7 +373,7 @@ namespace MyConfigSaver { LegitBotConfig::AimBot = ReadData(ConfigData["Aimbot"],{"Enable"}, false); LegitBotConfig::AimToggleMode = ReadData(ConfigData["Aimbot"],{"ToggleMode"}, false); - LegitBotConfig::AimBotHotKey = ReadData(ConfigData["Aimbot"],{"Hotkey"}, 0); + AimControl::HotKey = ReadData(ConfigData["Aimbot"],{"Hotkey"}, 0); AimControl::AimBullet = ReadData(ConfigData["Aimbot"],{"AimBullet"}, 0); AimControl::AimFov = ReadData(ConfigData["Aimbot"],{"Fov"}, 5.f); AimControl::AimFovMin = ReadData(ConfigData["Aimbot"],{"FovMin"}, .5f); @@ -385,7 +387,7 @@ namespace MyConfigSaver LegitBotConfig::VisibleCheck = ReadData(ConfigData["Aimbot"],{"VisibleCheck"}, true); AimControl::IgnoreFlash = ReadData(ConfigData["Aimbot"],{"IgnoreFlash"}, false); AimControl::ScopeOnly = ReadData(ConfigData["Aimbot"],{"ScopeOnly"}, false); - AimControl::SetHotKey(LegitBotConfig::AimBotHotKey); + Text::Aimbot::HotKey = KeyMgr::GetKeyName(AimControl::HotKey); LegitBotConfig::HitboxUpdated = false; } @@ -400,13 +402,13 @@ namespace MyConfigSaver if (ConfigData.contains("Triggerbot")) { LegitBotConfig::TriggerBot = ReadData(ConfigData["Triggerbot"],{"Enable"}, false); - LegitBotConfig::TriggerHotKey = ReadData(ConfigData["Triggerbot"],{"Hotkey"}, 0); + TriggerBot::HotKey = ReadData(ConfigData["Triggerbot"],{"Hotkey"}, 6); TriggerBot::TriggerDelay = ReadData(ConfigData["Triggerbot"],{"Delay"}, 20); TriggerBot::ShotDuration = ReadData(ConfigData["Triggerbot"],{"FakeShot"}, 200); TriggerBot::ScopeOnly = ReadData(ConfigData["Triggerbot"],{"ScopeOnly"}, false); TriggerBot::IgnoreFlash = ReadData(ConfigData["Triggerbot"],{"IgnoreFlash"}, false); LegitBotConfig::TriggerAlways = ReadData(ConfigData["Triggerbot"],{"AutoMode"}, false); - TriggerBot::SetHotKey(LegitBotConfig::TriggerHotKey); + Text::Trigger::HotKey = KeyMgr::GetKeyName(TriggerBot::HotKey); } if (ConfigData.contains("Misc")) @@ -435,6 +437,8 @@ namespace MyConfigSaver MiscCFG::SniperCrosshairColor.Value.w = ReadData(ConfigData["Misc"], { "SniperCrosshairColor","a" }, 255.f); MenuConfig::TeamCheck = ReadData(ConfigData["Misc"],{"TeamCheck"}, true); MenuConfig::BypassOBS = ReadData(ConfigData["Misc"],{"AntiRecord"}, false); + MenuConfig::HotKey = ReadData(ConfigData["Misc"], { "MenuKey" }, VK_END); + Text::Misc::HotKey = KeyMgr::GetKeyName(MenuConfig::HotKey); } if (ConfigData.contains("MenuConfig")) diff --git a/DragonBurn/Core/Cheats.cpp b/DragonBurn/Core/Cheats.cpp index d42723e..8033719 100644 --- a/DragonBurn/Core/Cheats.cpp +++ b/DragonBurn/Core/Cheats.cpp @@ -210,7 +210,7 @@ void Menu() { std::chrono::time_point now = std::chrono::system_clock::now(); std::chrono::duration difference = now - timepoint; - SHORT keyState = GetAsyncKeyState(VK_END); + SHORT keyState = GetAsyncKeyState(MenuConfig::HotKey); if (keyState & 0x8000) { keyWasPressed = true; } diff --git a/DragonBurn/Core/Config.h b/DragonBurn/Core/Config.h index e5e1377..a4131ba 100644 --- a/DragonBurn/Core/Config.h +++ b/DragonBurn/Core/Config.h @@ -44,6 +44,7 @@ namespace MenuConfig inline bool RadarWinChengePos = false; inline bool SpecWinChengePos = false; inline bool BombWinChengePos = false; + inline int HotKey = VK_END; } namespace LegitBotConfig @@ -51,7 +52,6 @@ namespace LegitBotConfig inline bool AimBot = true; inline bool AimAlways = false; inline bool AimToggleMode = false; - inline int AimBotHotKey = 3; // 0: head 1: neck 3: spine inline int AimPosition = 0; inline DWORD AimPositionIndex = BONEINDEX::head; @@ -64,7 +64,6 @@ namespace LegitBotConfig inline bool TriggerBot = true; inline bool TriggerAlways = false; - inline int TriggerHotKey = 4; inline bool RCS = false; diff --git a/DragonBurn/Core/GUI.h b/DragonBurn/Core/GUI.h index 56d2716..192dac0 100644 --- a/DragonBurn/Core/GUI.h +++ b/DragonBurn/Core/GUI.h @@ -10,6 +10,7 @@ #include "..\Resources\Language.hpp" #include "..\Resources\Images.hpp" +#include "../Helpers/KeyManager.h" ID3D11ShaderResourceView* Logo = NULL; ID3D11ShaderResourceView* MenuButton1 = NULL; @@ -426,11 +427,12 @@ namespace GUI ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 10.f); ImGui::TextDisabled(Text::Aimbot::HotKeyList.c_str()); ImGui::SameLine(); - AlignRight(160.f); - ImGui::SetNextItemWidth(160.f); - if (ImGui::Combo("###AimKey", &LegitBotConfig::AimBotHotKey, "LALT\0LBUTTON\0RBUTTON\0XBUTTON1\0XBUTTON2\0CAPITAL\0SHIFT\0CONTROL\0")) + AlignRight(70.f); + if (ImGui::Button(Text::Aimbot::HotKey.c_str(), { 70.f, 25.f })) { - AimControl::SetHotKey(LegitBotConfig::AimBotHotKey); + std::thread([&]() { + KeyMgr::GetPressedKey(AimControl::HotKey, Text::Aimbot::HotKey); + }).detach(); } PutSliderInt(Text::Aimbot::BulletSlider.c_str(), 10.f, &AimControl::AimBullet, &BulletMin, &BulletMax, "%d"); PutSwitch(Text::Aimbot::Toggle.c_str(), 10.f, ImGui::GetFrameHeight() * 1.7, &LegitBotConfig::AimToggleMode); @@ -561,6 +563,7 @@ namespace GUI ImGui::SeparatorText("Triggerbot"); int DelayMin = 0, DelayMax = 300; int DurationMin = 0, DurationMax = 1000; + PutSwitch(Text::Trigger::Enable.c_str(), 5.f, ImGui::GetFrameHeight() * 1.7, &LegitBotConfig::TriggerBot); if (LegitBotConfig::TriggerBot) { @@ -569,11 +572,12 @@ namespace GUI ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5.f); ImGui::TextDisabled(Text::Trigger::HotKeyList.c_str()); ImGui::SameLine(); - AlignRight(160.f); - ImGui::SetNextItemWidth(160.f); - if (ImGui::Combo("###TriggerbotKey", &LegitBotConfig::TriggerHotKey, "LALT\0RBUTTON\0XBUTTON1\0XBUTTON2\0CAPITAL\0SHIFT\0CONTROL\0")) + AlignRight(70.f); + if (ImGui::Button(Text::Trigger::HotKey.c_str(), {70.f, 25.f})) { - TriggerBot::SetHotKey(LegitBotConfig::TriggerHotKey); + std::thread([&]() { + KeyMgr::GetPressedKey(TriggerBot::HotKey, Text::Trigger::HotKey); + }).detach(); } } PutSwitch(Text::Trigger::Toggle.c_str(), 5.f, ImGui::GetFrameHeight() * 1.7, &LegitBotConfig::TriggerAlways); @@ -612,6 +616,15 @@ namespace GUI ImGui::NextColumn(); ImGui::SetCursorPosY(24.f); ImGui::SeparatorText("Global Settings"); + ImGui::TextDisabled(Text::Misc::MenuKey.c_str()); + ImGui::SameLine(); + AlignRight(70.f); + if (ImGui::Button(Text::Misc::HotKey.c_str(), { 70.f, 25.f })) + { + std::thread([&]() { + KeyMgr::GetPressedKey(MenuConfig::HotKey, Text::Misc::HotKey); + }).detach(); + } PutSwitch(Text::Misc::SpecCheck.c_str(), 5.f, ImGui::GetFrameHeight() * 1.7, &MenuConfig::WorkInSpec); PutSwitch(Text::Misc::TeamCheck.c_str(), 5.f, ImGui::GetFrameHeight() * 1.7, &MenuConfig::TeamCheck); PutSwitch(Text::Misc::AntiRecord.c_str(), 5.f, ImGui::GetFrameHeight() * 1.7, &MenuConfig::BypassOBS); diff --git a/DragonBurn/DragonBurn.vcxproj b/DragonBurn/DragonBurn.vcxproj index 7b04bd0..0629f8d 100644 --- a/DragonBurn/DragonBurn.vcxproj +++ b/DragonBurn/DragonBurn.vcxproj @@ -193,6 +193,7 @@ + diff --git a/DragonBurn/DragonBurn.vcxproj.filters b/DragonBurn/DragonBurn.vcxproj.filters index d0f2bcb..eeeef01 100644 --- a/DragonBurn/DragonBurn.vcxproj.filters +++ b/DragonBurn/DragonBurn.vcxproj.filters @@ -186,6 +186,7 @@ Core + diff --git a/DragonBurn/Features/Aimbot.cpp b/DragonBurn/Features/Aimbot.cpp index d3bb829..425c526 100644 --- a/DragonBurn/Features/Aimbot.cpp +++ b/DragonBurn/Features/Aimbot.cpp @@ -1,11 +1,5 @@ #include "Aimbot.h" - -void AimControl::SetHotKey(int Index) -{ - HotKey = HotKeyList.at(Index); -} - void AimControl::switchToggle() { LegitBotConfig::AimAlways = !LegitBotConfig::AimAlways; diff --git a/DragonBurn/Features/Aimbot.h b/DragonBurn/Features/Aimbot.h index 8a6ab3e..c5af747 100644 --- a/DragonBurn/Features/Aimbot.h +++ b/DragonBurn/Features/Aimbot.h @@ -20,7 +20,7 @@ extern "C" { namespace AimControl { - inline int HotKey = VK_XBUTTON1; + inline int HotKey = VK_LBUTTON; inline int AimBullet = 1; inline bool ScopeOnly = true; inline bool IgnoreFlash = false; @@ -28,11 +28,9 @@ namespace AimControl inline float AimFovMin = 0.4f; inline float Smooth = 5.0f; inline std::vector HitboxList{ BONEINDEX::head }; - inline std::vector HotKeyList{ VK_LMENU, VK_LBUTTON, VK_RBUTTON, VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_LSHIFT, VK_LCONTROL }; inline bool HasTarget = false; void AimBot(const CEntity& Local, Vec3 LocalPos, std::vector& AimPosList); void switchToggle(); - void SetHotKey(int Index); } diff --git a/DragonBurn/Features/TriggerBot.h b/DragonBurn/Features/TriggerBot.h index df47a3a..c72bf58 100644 --- a/DragonBurn/Features/TriggerBot.h +++ b/DragonBurn/Features/TriggerBot.h @@ -11,18 +11,12 @@ namespace TriggerBot inline int ShotDuration = 400; // ms inline bool ScopeOnly = true; inline bool IgnoreFlash = false; - inline int HotKey = VK_CAPITAL; - inline std::vector HotKeyList{VK_LMENU, VK_RBUTTON, VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_LSHIFT, VK_LCONTROL}; + inline int HotKey = VK_XBUTTON2; inline std::chrono::time_point timepoint = std::chrono::system_clock::now(); inline std::chrono::time_point startTime = std::chrono::system_clock::now(); inline bool recorded = false; inline bool VisibleCheck = true; - inline void SetHotKey(int Index) - { - HotKey = HotKeyList.at(Index); - } - // Triggerbot void Run(const CEntity& LocalEntity); //void TargetCheck(const CEntity& LocalEntity) noexcept; diff --git a/DragonBurn/Helpers/KeyManager.h b/DragonBurn/Helpers/KeyManager.h new file mode 100644 index 0000000..351c760 --- /dev/null +++ b/DragonBurn/Helpers/KeyManager.h @@ -0,0 +1,97 @@ +#pragma once +#include +#include + +namespace KeyMgr +{ + inline std::string GetKeyName(int vk_code) + { + switch (vk_code) + { + case VK_LBUTTON: return "LMB"; + case VK_RBUTTON: return "RMB"; + case VK_CANCEL: return "Cancel"; + case VK_MBUTTON: return "MMB"; + case VK_XBUTTON1: return "X1MB"; + case VK_XBUTTON2: return "X2MB"; + case VK_BACK: return "Return"; + case VK_TAB: return "Tab"; + case VK_RETURN: return "Enter"; + case VK_SHIFT: return "Shift"; + case VK_CONTROL: return "Control"; + case VK_MENU: return "Alt"; + case VK_PAUSE: return "Pause"; + case VK_CAPITAL: return "Caps"; + case VK_ESCAPE: return "Escape"; + case VK_SPACE: return "Space"; + case VK_LEFT: return "Left"; + case VK_UP: return "Up"; + case VK_RIGHT: return "Right"; + case VK_DOWN: return "Down"; + case VK_PRINT: return "Prt Scr"; + case VK_INSERT: return "Insert"; + case VK_DELETE: return "Delete"; + case VK_HOME: return "Home"; + case VK_END: return "End"; + case VK_PRIOR: return "Pg Up"; + case VK_NEXT: return "Pg Down"; + case VK_F1: return "F1"; + case VK_F2: return "F2"; + case VK_F3: return "F3"; + case VK_F4: return "F4"; + case VK_F5: return "F5"; + case VK_F6: return "F6"; + case VK_F7: return "F7"; + case VK_F8: return "F8"; + case VK_F9: return "F9"; + case VK_F10: return "F10"; + case VK_F11: return "F11"; + case VK_F12: return "F12"; + default: + { + char name[16]; + BYTE keyboardState[256]; + GetKeyboardState(keyboardState); + UINT scanCode = MapVirtualKey(vk_code, MAPVK_VK_TO_VSC); + int result = ToUnicode(vk_code, scanCode, keyboardState, reinterpret_cast(name), sizeof(name) / sizeof(name[0]), 0); + if (result > 0) + { + name[result] = '\0'; + return std::string(name); + } + return "N/A"; + } + } + } + + inline void GetPressedKey(int& vk_code, std::string& keyName) + { + int hotkey; + std::string buff = keyName; + keyName = "..."; + while (true) + { + + for (int key = 0; key < 256; key++) + { + if (GetAsyncKeyState(key) & 0x8000) + { + hotkey = key; + } + } + if (hotkey == MenuConfig::HotKey) + { + keyName = buff; + break; + } + + + if (hotkey > 0 && hotkey < 256 ) + { + vk_code = hotkey; + keyName = GetKeyName(hotkey); + break; + } + } + } +} \ No newline at end of file diff --git a/DragonBurn/Resources/Language.hpp b/DragonBurn/Resources/Language.hpp index 0d95a6e..7fe29c5 100644 --- a/DragonBurn/Resources/Language.hpp +++ b/DragonBurn/Resources/Language.hpp @@ -45,6 +45,7 @@ namespace Text { inline std::string Enable = "Enable Aimbot"; inline std::string FeatureName = "Aimbot"; inline std::string HotKeyList = "Hotkey"; + inline std::string HotKey = "LMB"; inline std::string Toggle = "Toggle Mode"; inline std::string DrawFov = "Show Fov"; inline std::string VisCheck = "Visible Check"; @@ -85,6 +86,7 @@ namespace Text { inline std::string Enable = "Enable Triggerbot"; inline std::string FeatureName = "Triggerbot"; inline std::string HotKeyList = "Hotkey"; + inline std::string HotKey = "X2MB"; inline std::string Toggle = "Always Active"; inline std::string ScopeOnly = "Scope Only"; inline std::string DelaySlider = "Shot Delay:"; @@ -95,6 +97,8 @@ namespace Text { namespace Misc { inline std::string FeatureName = "Misc"; + inline std::string MenuKey = " Menu Key"; + inline std::string HotKey = "End"; inline std::string StyleList = "Style"; inline std::string HeadshotLine = "Headshot Line"; inline std::string SpecCheck = "Work in Spec";