Skip to content

Commit 867ed8d

Browse files
committed
qol changes
1 parent 52e8ab1 commit 867ed8d

7 files changed

Lines changed: 117 additions & 73 deletions

File tree

KBotExt/GameTab.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "HTTP.h"
88
#include "Auth.h"
99
#include "Utils.h"
10+
#include "Misc.h"
1011

1112
inline bool bAutoAccept = false;
1213
inline int instalockID;
@@ -191,15 +192,14 @@ class GameTab
191192

192193
ImGui::Columns(1);
193194

194-
ImGui::Separator();
195-
196-
static int inputGameID = 0;
197-
ImGui::InputInt("##inputGameID:", &inputGameID, 1, 100);
198-
ImGui::SameLine();
199-
if (ImGui::Button("Submit##gameID"))
200-
{
201-
gameID = inputGameID;
202-
}
195+
//ImGui::Separator();
196+
//static int inputGameID = 0;
197+
//ImGui::InputInt("##inputGameID:", &inputGameID, 1, 100);
198+
//ImGui::SameLine();
199+
//if (ImGui::Button("Submit##gameID"))
200+
//{
201+
// gameID = inputGameID;
202+
//}
203203

204204
// if pressed any button, gameID or custom changed
205205
if (gameID != 0 || !custom.empty())
@@ -237,12 +237,14 @@ class GameTab
237237
{
238238
result = http->Request("POST", "https://127.0.0.1/lol-lobby/v2/lobby/matchmaking/search", "", auth->leagueHeader, "", "", auth->leaguePort);
239239
}
240-
ImGui::SameLine();
240+
ImGui::NextColumn();
241241
if (ImGui::Button("Dodge"))
242242
{
243243
result = http->Request("POST", R"(https://127.0.0.1/lol-login/v1/session/invoke?destination=lcdsServiceProxy&method=call&args=["","teambuilder-draft","quitV2",""])", "", auth->leagueHeader, "", "", auth->leaguePort);
244244
}
245245
ImGui::SameLine();
246+
Misc::HelpMarker("Dodges lobby instantly, you still lose LP, but you don't have to restart the client");
247+
ImGui::NextColumn();
246248
if (ImGui::Button("Multi OP.GG"))
247249
{
248250
std::string names;

KBotExt/KBotExt.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ HWND hwnd;
2121

2222
//float processTimeMs = 0;
2323

24-
// Main code
2524
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
2625
{
2726
LPWSTR* szArgList;
@@ -186,20 +185,23 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
186185
if (RegSetValueExA(hkResult, "debugger", 0, REG_SZ, (const BYTE*)filePath, len) == ERROR_SUCCESS)
187186
{
188187
std::cout << "changed key " << std::endl;
188+
S.currentDebugger = filePath;
189189
}
190190
else
191191
std::cout << "failed change" << std::endl;
192192
}
193193
else
194194
{
195195
std::cout << "delete key" << RegDeleteValueA(hkResult, "debugger") << std::endl;
196+
S.currentDebugger = "Nothing";
196197
}
197198
}
198199
else if (regQuery == ERROR_FILE_NOT_FOUND && oldDebugger) // if key doesnt exist, create it
199200
{
200201
if (RegSetValueExA(hkResult, "debugger", 0, REG_SZ, (const BYTE*)filePath, len) == ERROR_SUCCESS)
201202
{
202203
std::cout << "created key " << std::endl;
204+
S.currentDebugger = filePath;
203205
}
204206
}
205207
RegCloseKey(hkResult);

KBotExt/KBotExt.vcxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,22 @@
9999
</ItemDefinitionGroup>
100100
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
101101
<ClCompile>
102-
<WarningLevel>Level3</WarningLevel>
102+
<WarningLevel>Level4</WarningLevel>
103103
<FunctionLevelLinking>true</FunctionLevelLinking>
104104
<IntrinsicFunctions>true</IntrinsicFunctions>
105105
<SDLCheck>true</SDLCheck>
106106
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107107
<ConformanceMode>true</ConformanceMode>
108108
<LanguageStandard>stdcpplatest</LanguageStandard>
109109
<AdditionalIncludeDirectories>$(SolutionDir)\KBotExt\imgui;$(SolutionDir)\KBotExt</AdditionalIncludeDirectories>
110+
<DebugInformationFormat>None</DebugInformationFormat>
111+
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
110112
</ClCompile>
111113
<Link>
112114
<SubSystem>Windows</SubSystem>
113115
<EnableCOMDATFolding>true</EnableCOMDATFolding>
114116
<OptimizeReferences>true</OptimizeReferences>
115-
<GenerateDebugInformation>true</GenerateDebugInformation>
117+
<GenerateDebugInformation>false</GenerateDebugInformation>
116118
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
117119
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
118120
</Link>

KBotExt/Misc.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,69 @@ class Misc
8686
return "0.0.0";
8787
}
8888

89+
static std::string ClearLogs()
90+
{
91+
std::string result = "";
92+
Misc::TerminateProcessByName("RiotClientServices.exe");
93+
Misc::TerminateProcessByName("RiotClientCrashHandler.exe");
94+
Misc::TerminateProcessByName("RiotClientUx.exe");
95+
Misc::TerminateProcessByName("RiotClientUxRender.exe");
96+
97+
Misc::TerminateProcessByName("LeagueClient.exe");
98+
Misc::TerminateProcessByName("LeagueCrashHandler.exe");
99+
Misc::TerminateProcessByName("LeagueClientUx.exe");
100+
Misc::TerminateProcessByName("LeagueClientUxRender.exe");
101+
102+
std::this_thread::sleep_for(std::chrono::seconds(2));
103+
104+
std::error_code errorCode;
105+
106+
std::string logsFolder = S.leaguePath + "Logs";
107+
if (std::filesystem::exists(logsFolder))
108+
{
109+
SetFileAttributesA(logsFolder.c_str(), GetFileAttributesA(logsFolder.c_str()) & ~FILE_ATTRIBUTE_READONLY & ~FILE_ATTRIBUTE_HIDDEN);
110+
std::filesystem::remove_all(logsFolder, errorCode);
111+
result += logsFolder + " - " + errorCode.message() + "\n";
112+
}
113+
114+
std::string configFolder = S.leaguePath + "Config";
115+
if (std::filesystem::exists(configFolder))
116+
{
117+
SetFileAttributesA(configFolder.c_str(), GetFileAttributesA(configFolder.c_str()) & ~FILE_ATTRIBUTE_READONLY & ~FILE_ATTRIBUTE_HIDDEN);
118+
std::filesystem::remove_all(configFolder, errorCode);
119+
result += configFolder + " - " + errorCode.message() + "\n";
120+
}
121+
122+
std::string programData = "C:/ProgramData/Riot Games";
123+
if (std::filesystem::exists(programData))
124+
{
125+
SetFileAttributesA(programData.c_str(), GetFileAttributesA(programData.c_str()) & ~FILE_ATTRIBUTE_READONLY & ~FILE_ATTRIBUTE_HIDDEN);
126+
std::filesystem::remove_all(programData, errorCode);
127+
result += programData + " - " + errorCode.message() + "\n";
128+
}
129+
130+
char* pLocal;
131+
size_t localLen;
132+
_dupenv_s(&pLocal, &localLen, "LOCALAPPDATA");
133+
std::string local = pLocal;
134+
local += "\\Riot Games";
135+
if (std::filesystem::exists(local))
136+
{
137+
SetFileAttributesA(local.c_str(), GetFileAttributesA(local.c_str()) & ~FILE_ATTRIBUTE_READONLY & ~FILE_ATTRIBUTE_HIDDEN);
138+
std::filesystem::remove_all(local, errorCode);
139+
result += local + " - " + errorCode.message() + "\n";
140+
}
141+
142+
int k = 0;
143+
for (const auto& file : std::filesystem::directory_iterator(std::filesystem::temp_directory_path()))
144+
{
145+
std::filesystem::remove_all(file, errorCode);
146+
k++;
147+
}
148+
result += "Deleted " + std::to_string(k) + " files in temp directory\n";
149+
return result;
150+
}
151+
89152
// Helper to display a little (?) mark which shows a tooltip when hovered.
90153
// In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md)
91154
static void HelpMarker(const char* desc)

KBotExt/MiscTab.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include <filesystem>
4-
#include <cstdio>
54

65
#include "Definitions.h"
76
#include "Includes.h"

KBotExt/Settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct Settings
2222
bool bAddFont = false;
2323
bool streamProof = false;
2424
bool debugger = false;
25+
std::string currentDebugger;
2526

2627
struct
2728
{

KBotExt/SettingsTab.h

Lines changed: 34 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -42,79 +42,52 @@ class SettingsTab
4242

4343
static void Render()
4444
{
45+
static bool once = true;
4546
if (ImGui::BeginTabItem("Settings"))
4647
{
48+
if (once)
49+
{
50+
once = false;
51+
HKEY hkResult;
52+
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LeagueClientUx.exe", 0, KEY_SET_VALUE | KEY_QUERY_VALUE, &hkResult) == ERROR_SUCCESS)
53+
{
54+
char buffer[MAX_PATH];
55+
DWORD dwLen;
56+
LSTATUS regQuery = RegGetValueA(hkResult, 0, "debugger", RRF_RT_REG_SZ, 0, (PVOID)&buffer, &dwLen);
57+
if (regQuery == ERROR_SUCCESS)
58+
{
59+
S.currentDebugger = buffer;
60+
}
61+
else if (regQuery == ERROR_FILE_NOT_FOUND)
62+
{
63+
S.currentDebugger = "Nothing";
64+
}
65+
else
66+
{
67+
S.currentDebugger = "Failed";
68+
}
69+
}
70+
}
4771
static std::string result;
4872

4973
ImGui::Checkbox("Auto-rename", &S.autoRename);
74+
ImGui::SameLine();
75+
Misc::HelpMarker("Automatically renames the program on launch");
5076

5177
ImGui::Checkbox("Stream Proof", &S.streamProof);
78+
ImGui::SameLine();
79+
Misc::HelpMarker("Hides the program in recordings and screenshots");
5280

5381
ImGui::Checkbox("Register debugger IFEO", &S.debugger);
82+
ImGui::SameLine();
83+
ImGui::Text(" | Hooked to: %s", S.currentDebugger.c_str());
5484

5585
// Terminate all league related processes,
5686
// remove read only and hidden property from files
5787
// and delete them
58-
if (ImGui::Button("Clear logs"))
88+
if (ImGui::Button("Clean logs"))
5989
{
60-
result = "";
61-
Misc::TerminateProcessByName("RiotClientServices.exe");
62-
Misc::TerminateProcessByName("RiotClientCrashHandler.exe");
63-
Misc::TerminateProcessByName("RiotClientUx.exe");
64-
Misc::TerminateProcessByName("RiotClientUxRender.exe");
65-
66-
Misc::TerminateProcessByName("LeagueClient.exe");
67-
Misc::TerminateProcessByName("LeagueCrashHandler.exe");
68-
Misc::TerminateProcessByName("LeagueClientUx.exe");
69-
Misc::TerminateProcessByName("LeagueClientUxRender.exe");
70-
71-
std::this_thread::sleep_for(std::chrono::seconds(2));
72-
73-
std::error_code errorCode;
74-
75-
std::string logsFolder = S.leaguePath + "Logs";
76-
if (std::filesystem::exists(logsFolder))
77-
{
78-
SetFileAttributesA(logsFolder.c_str(), GetFileAttributesA(logsFolder.c_str()) & ~FILE_ATTRIBUTE_READONLY & ~FILE_ATTRIBUTE_HIDDEN);
79-
std::filesystem::remove_all(logsFolder, errorCode);
80-
result += logsFolder + " - " + errorCode.message() + "\n";
81-
}
82-
83-
std::string configFolder = S.leaguePath + "Config";
84-
if (std::filesystem::exists(configFolder))
85-
{
86-
SetFileAttributesA(configFolder.c_str(), GetFileAttributesA(configFolder.c_str()) & ~FILE_ATTRIBUTE_READONLY & ~FILE_ATTRIBUTE_HIDDEN);
87-
std::filesystem::remove_all(configFolder, errorCode);
88-
result += configFolder + " - " + errorCode.message() + "\n";
89-
}
90-
91-
std::string programData = "C:/ProgramData/Riot Games";
92-
if (std::filesystem::exists(programData))
93-
{
94-
SetFileAttributesA(programData.c_str(), GetFileAttributesA(programData.c_str()) & ~FILE_ATTRIBUTE_READONLY & ~FILE_ATTRIBUTE_HIDDEN);
95-
std::filesystem::remove_all(programData, errorCode);
96-
result += programData + " - " + errorCode.message() + "\n";
97-
}
98-
99-
char* pLocal;
100-
size_t localLen;
101-
_dupenv_s(&pLocal, &localLen, "LOCALAPPDATA");
102-
std::string local = pLocal;
103-
local += "\\Riot Games";
104-
if (std::filesystem::exists(local))
105-
{
106-
SetFileAttributesA(local.c_str(), GetFileAttributesA(local.c_str()) & ~FILE_ATTRIBUTE_READONLY & ~FILE_ATTRIBUTE_HIDDEN);
107-
std::filesystem::remove_all(local, errorCode);
108-
result += local + " - " + errorCode.message() + "\n";
109-
}
110-
111-
int k = 0;
112-
for (const auto& file : std::filesystem::directory_iterator(std::filesystem::temp_directory_path()))
113-
{
114-
std::filesystem::remove_all(file, errorCode);
115-
k++;
116-
}
117-
result += "Deleted " + std::to_string(k) + " files in temp directory\n";
90+
result = Misc::ClearLogs();
11891
}
11992

12093
static char bufLeaguePath[MAX_PATH];
@@ -174,5 +147,7 @@ class SettingsTab
174147

175148
ImGui::EndTabItem();
176149
}
150+
else
151+
once = true;
177152
}
178153
};

0 commit comments

Comments
 (0)