Skip to content

Commit

Permalink
Merge pull request #148 from ByteCorum/WIP
Browse files Browse the repository at this point in the history
New hotkey system; Fixes
  • Loading branch information
ByteCorum authored Sep 24, 2024
2 parents f3cfcbc + f8e6a7a commit 4926e97
Show file tree
Hide file tree
Showing 17 changed files with 210 additions and 122 deletions.
25 changes: 14 additions & 11 deletions DragonBurn/Config/ConfigMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <string>
#include "../Resources/Language.hpp"
#include "../Features/RCS.h"
#include "../Helpers/KeyManager.h"

namespace ConfigMenu {

Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -180,16 +181,18 @@ namespace ConfigMenu {
MenuConfig::WorkInSpec = true;

RadarCFG::ShowRadar = false;
RadarCFG::RadarRange = 150;
RadarCFG::RadarRange = 125;
RadarCFG::ShowRadarCrossLine = false;
RadarCFG::RadarCrossLineColor = ImColor(131, 137, 150, 180);
RadarCFG::RadarType = 2;
RadarCFG::RadarPointSizeProportion = 1.f;
RadarCFG::RadarBgAlpha = 0.1f;
RadarCFG::Proportion = 3300;
RadarCFG::Proportion = 2700.f;

LegitBotConfig::TriggerBot = true;
LegitBotConfig::TriggerAlways = false;
TriggerBot::HotKey = 6;
Text::Trigger::HotKey = KeyMgr::GetKeyName(TriggerBot::HotKey);

MenuConfig::TeamCheck = true;
MenuConfig::BypassOBS = false;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -252,7 +253,7 @@ namespace ConfigMenu {
LegitBotConfig::FovCircleColor = ImColor(131, 137, 150, 180);

MenuConfig::MarkWinPos = ImVec2(ImGui::GetIO().DisplaySize.x - 300.0f, 100.f);
MenuConfig::RadarWinPos = ImVec2(0.f, 0.f);
MenuConfig::RadarWinPos = ImVec2(25.f, 25.f);
MenuConfig::SpecWinPos = ImVec2(10.0f, ImGui::GetIO().DisplaySize.y / 2 - 200);
MenuConfig::BombWinPos = ImVec2((ImGui::GetIO().DisplaySize.x - 200.0f) / 2.0f, 80.0f);

Expand All @@ -261,5 +262,7 @@ namespace ConfigMenu {
MenuConfig::RadarWinChengePos = true;
MenuConfig::SpecWinChengePos = true;

MenuConfig::HotKey = VK_END;

}
}
18 changes: 12 additions & 6 deletions DragonBurn/Config/ConfigSaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "../Features/TriggerBot.h"
#include "../Features/Aimbot.h"
#include "../Features/RCS.h"
#include "../Helpers/KeyManager.h"
#include <json.hpp>

using json = nlohmann::json;
Expand Down Expand Up @@ -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;
Expand All @@ -168,13 +169,14 @@ namespace MyConfigSaver


ConfigData["RCS"]["Enable"]= LegitBotConfig::RCS;
ConfigData["RCS"]["RCSBullet"]= RCS::RCSBullet;
ConfigData["RCS"]["Yaw"]= RCS::RCSScale.x;
ConfigData["RCS"]["Pitch"]= RCS::RCSScale.y;



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;
Expand Down Expand Up @@ -212,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;
Expand Down Expand Up @@ -370,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);
Expand All @@ -384,27 +387,28 @@ 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;
}

if (ConfigData.contains("RCS"))
{
LegitBotConfig::RCS = ReadData(ConfigData["RCS"],{"Enable"}, false);
RCS::RCSBullet = ReadData(ConfigData["RCS"], { "RCSBullet" }, 1);
RCS::RCSScale.x = ReadData(ConfigData["RCS"],{"Yaw"}, 1.f);
RCS::RCSScale.y = ReadData(ConfigData["RCS"],{"Pitch"}, 1.f);
}

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"))
Expand Down Expand Up @@ -433,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"))
Expand Down
14 changes: 8 additions & 6 deletions DragonBurn/Core/Cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void Menu()
{
std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
std::chrono::duration<double, std::milli> difference = now - timepoint;
SHORT keyState = GetAsyncKeyState(VK_END);
SHORT keyState = GetAsyncKeyState(MenuConfig::HotKey);
if (keyState & 0x8000) {
keyWasPressed = true;
}
Expand Down Expand Up @@ -266,7 +266,8 @@ void AIM(const CEntity& LocalEntity, std::vector<Vec3> AimPosList)
// Aimbot
DWORD lastTick = 0;
DWORD currentTick = GetTickCount64();
if (LegitBotConfig::AimBot) {
if (LegitBotConfig::AimBot)
{
Render::DrawFovCircle(LocalEntity);

if (LegitBotConfig::AimAlways || GetAsyncKeyState(AimControl::HotKey)) {
Expand All @@ -281,8 +282,9 @@ void AIM(const CEntity& LocalEntity, std::vector<Vec3> AimPosList)
}
}

if (!AimControl::AimBot || !AimControl::HasTarget)
if (!LegitBotConfig::AimBot)
RCS::RecoilControl(LocalEntity);

}

void MiscFuncs(CEntity& LocalEntity)
Expand All @@ -299,7 +301,7 @@ void RadarSetting(Base_Radar& Radar)
{
// Radar window
ImGui::SetNextWindowBgAlpha(RadarCFG::RadarBgAlpha);
ImGui::Begin("Radar", 0, ImGuiWindowFlags_NoResize);
ImGui::Begin("Radar", 0, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar);
ImGui::SetWindowSize({ RadarCFG::RadarRange * 2,RadarCFG::RadarRange * 2 });
ImGui::SetWindowPos(MenuConfig::RadarWinPos, ImGuiCond_Once);

Expand All @@ -312,9 +314,9 @@ void RadarSetting(Base_Radar& Radar)
if (!RadarCFG::customRadar)
{
RadarCFG::ShowRadarCrossLine = false;
RadarCFG::Proportion = 3300.f;
RadarCFG::Proportion = 2700.f;
RadarCFG::RadarPointSizeProportion = 1.f;
RadarCFG::RadarRange = 150.f;
RadarCFG::RadarRange = 125.f;
RadarCFG::RadarBgAlpha = 0.1f;
}

Expand Down
9 changes: 4 additions & 5 deletions DragonBurn/Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace MenuConfig
{
inline std::string name = "DragonBurn";
inline std::string version = "2.0.3.0";
inline std::string version = "2.0.4.0";
inline std::string author = "ByteCorum";

inline std::string path = "";
Expand Down Expand Up @@ -44,14 +44,14 @@ namespace MenuConfig
inline bool RadarWinChengePos = false;
inline bool SpecWinChengePos = false;
inline bool BombWinChengePos = false;
inline int HotKey = VK_END;
}

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;
Expand All @@ -64,7 +64,6 @@ namespace LegitBotConfig

inline bool TriggerBot = true;
inline bool TriggerAlways = false;
inline int TriggerHotKey = 4;

inline bool RCS = false;

Expand Down Expand Up @@ -146,13 +145,13 @@ namespace ESPConfig
namespace RadarCFG
{
inline bool ShowRadar = false;
inline float RadarRange = 150;
inline float RadarRange = 125;
inline float RadarPointSizeProportion = 1.f;
inline bool ShowRadarCrossLine = false;
inline ImColor RadarCrossLineColor = ImColor(131, 137, 150, 180);
// 0: circle 1: arrow 2: circle with arrow
inline int RadarType = 2;
inline float Proportion = 3300.f;
inline float Proportion = 2700.f;
inline bool customRadar = false;
inline float RadarBgAlpha = 0.1f;
}
Expand Down
36 changes: 26 additions & 10 deletions DragonBurn/Core/GUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "..\Resources\Language.hpp"
#include "..\Resources\Images.hpp"
#include "../Helpers/KeyManager.h"

ID3D11ShaderResourceView* Logo = NULL;
ID3D11ShaderResourceView* MenuButton1 = NULL;
Expand Down Expand Up @@ -110,7 +111,7 @@ namespace GUI
Gui.LoadTextureFromMemory(Images::ConfigButtonPressed, sizeof Images::ConfigButtonPressed, &MenuButton4Pressed, &buttonW, &buttonH);

MenuConfig::MarkWinPos = ImVec2(ImGui::GetIO().DisplaySize.x - 300.0f, 100.f);
MenuConfig::RadarWinPos = ImVec2(0.f, 0.f);
MenuConfig::RadarWinPos = ImVec2(25.f, 25.f);
MenuConfig::SpecWinPos = ImVec2(10.0f, ImGui::GetIO().DisplaySize.y / 2 - 200);
MenuConfig::BombWinPos = ImVec2((ImGui::GetIO().DisplaySize.x - 200.0f) / 2.0f, 80.0f);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -508,8 +510,11 @@ namespace GUI
ImGui::SetCursorPosY(24.f);
ImGui::SeparatorText("RCS");
float recoilMin = 0.f, recoilMax = 2.f;
int RCSBulletMin = 0, RCSBulletMax = 5;
PutSwitch(Text::RCS::Toggle.c_str(), 5.f, ImGui::GetFrameHeight() * 1.7, &LegitBotConfig::RCS);
if (LegitBotConfig::RCS) {
if (LegitBotConfig::RCS)
{
PutSliderInt(Text::RCS::BulletSlider.c_str(), 5.f, &RCS::RCSBullet, &RCSBulletMin, &RCSBulletMax, "%d");
PutSliderFloat(Text::RCS::Yaw.c_str(), 5.f, &RCS::RCSScale.x, &recoilMin, &recoilMax, "%.2f");
PutSliderFloat(Text::RCS::Pitch.c_str(), 5.f, &RCS::RCSScale.y, &recoilMin, &recoilMax, "%.2f");
float scalex = (2.22 - RCS::RCSScale.x) *.5f;
Expand Down Expand Up @@ -558,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)
{
Expand All @@ -566,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);
Expand Down Expand Up @@ -609,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);
Expand Down
1 change: 1 addition & 0 deletions DragonBurn/DragonBurn.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
<ClInclude Include="Game\View.h" />
<ClInclude Include="Helpers\Format.h" />
<ClInclude Include="Helpers\GetWeaponIcon.h" />
<ClInclude Include="Helpers\KeyManager.h" />
<ClInclude Include="Helpers\Logger.h" />
<ClInclude Include="Helpers\Mouse.h" />
<ClInclude Include="Helpers\WebApi.h" />
Expand Down
1 change: 1 addition & 0 deletions DragonBurn/DragonBurn.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
<ClInclude Include="Core\Config.h">
<Filter>Core</Filter>
</ClInclude>
<ClInclude Include="Helpers\KeyManager.h" />
</ItemGroup>
<ItemGroup>
<Image Include="icon.ico">
Expand Down
6 changes: 0 additions & 6 deletions DragonBurn/Features/Aimbot.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#include "Aimbot.h"


void AimControl::SetHotKey(int Index)
{
HotKey = HotKeyList.at(Index);
}

void AimControl::switchToggle()
{
LegitBotConfig::AimAlways = !LegitBotConfig::AimAlways;
Expand Down
Loading

0 comments on commit 4926e97

Please sign in to comment.