From eeb3db72f9cabe77009481afa4ea7e2b437a1373 Mon Sep 17 00:00:00 2001 From: hotline1337 Date: Sun, 30 Oct 2022 20:52:38 +0100 Subject: [PATCH 1/4] minor optimizations and refactoring --- R3nzSkin/GUI.cpp | 2 +- R3nzSkin/R3nzSkin.cpp | 21 +++++++++++---------- R3nzSkin/R3nzSkin.vcxproj | 4 ++-- R3nzSkin_Injector/R3nzSkin_Injector.vcxproj | 4 ++-- R3nzSkin_Injector/R3nzUI.hpp | 8 ++++---- R3nzSkin_Injector/main.cpp | 2 +- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/R3nzSkin/GUI.cpp b/R3nzSkin/GUI.cpp index 1695c4d9..99308196 100644 --- a/R3nzSkin/GUI.cpp +++ b/R3nzSkin/GUI.cpp @@ -81,7 +81,7 @@ void GUI::render() noexcept ImGui::rainbowText(); if (ImGui::BeginTabBar("TabBar", ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_FittingPolicyScroll | ImGuiTabBarFlags_NoTooltip)) { if (player) { - if (ImGui::BeginTabItem("LocalPlayer")) { + if (ImGui::BeginTabItem("Local Player")) { auto& values{ cheatManager.database->champions_skins[fnv::hash_runtime(player->get_character_data_stack()->base_skin.model.str)] }; ImGui::Text("Player Skins Settings:"); diff --git a/R3nzSkin/R3nzSkin.cpp b/R3nzSkin/R3nzSkin.cpp index ebd50343..adeeab81 100644 --- a/R3nzSkin/R3nzSkin.cpp +++ b/R3nzSkin/R3nzSkin.cpp @@ -22,7 +22,7 @@ bool NTAPI HideThread(HANDLE hThread) noexcept using FnSetInformationThread = NTSTATUS(NTAPI*)(HANDLE, UINT, PVOID, ULONG); const auto NtSetInformationThread{ reinterpret_cast(::GetProcAddress(::GetModuleHandle(L"ntdll.dll"), "NtSetInformationThread")) }; - if (NtSetInformationThread == NULL) + if (!NtSetInformationThread) return false; if (const auto status{ NtSetInformationThread(hThread, 0x11u, NULL, 0ul) }; status == 0x00000000) @@ -62,16 +62,17 @@ static void WINAPI DllAttach([[maybe_unused]] LPVOID lp) noexcept ::ExitProcess(0u); } -BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID reserved) +__declspec(safebuffers) BOOL APIENTRY DllMain(const HMODULE hModule, const DWORD reason, LPVOID reserved [[maybe_unused]]) { - HideThread(hModule); + DisableThreadLibraryCalls(hModule); - if (reason == DLL_PROCESS_ATTACH) { - std::setlocale(LC_ALL, ".utf8"); - ::_beginthreadex(nullptr, 0u, reinterpret_cast<_beginthreadex_proc_type>(DllAttach), nullptr, 0u, nullptr); - ::CloseHandle(hModule); - return TRUE; - } + if (reason != DLL_PROCESS_ATTACH) + return FALSE; + + HideThread(hModule); + std::setlocale(LC_ALL, ".utf8"); - return FALSE; + ::_beginthreadex(nullptr, 0u, reinterpret_cast<_beginthreadex_proc_type>(DllAttach), nullptr, 0u, nullptr); + ::CloseHandle(hModule); + return TRUE; } diff --git a/R3nzSkin/R3nzSkin.vcxproj b/R3nzSkin/R3nzSkin.vcxproj index 6cad3b46..da6ec794 100644 --- a/R3nzSkin/R3nzSkin.vcxproj +++ b/R3nzSkin/R3nzSkin.vcxproj @@ -22,14 +22,14 @@ DynamicLibrary false - v142 + v143 true Unicode DynamicLibrary false - v142 + v143 true Unicode diff --git a/R3nzSkin_Injector/R3nzSkin_Injector.vcxproj b/R3nzSkin_Injector/R3nzSkin_Injector.vcxproj index 0c876c08..032e8480 100644 --- a/R3nzSkin_Injector/R3nzSkin_Injector.vcxproj +++ b/R3nzSkin_Injector/R3nzSkin_Injector.vcxproj @@ -23,13 +23,13 @@ Application false - v142 + v143 true Unicode true - v142 + v143 Unicode true true diff --git a/R3nzSkin_Injector/R3nzUI.hpp b/R3nzSkin_Injector/R3nzUI.hpp index 852ac2c0..6ef75698 100644 --- a/R3nzSkin_Injector/R3nzUI.hpp +++ b/R3nzSkin_Injector/R3nzUI.hpp @@ -226,21 +226,21 @@ namespace R3nzSkinInjector { this->linkLabel1->Cursor = System::Windows::Forms::Cursors::Hand; this->linkLabel1->LinkBehavior = System::Windows::Forms::LinkBehavior::NeverUnderline; this->linkLabel1->LinkColor = System::Drawing::Color::Silver; - this->linkLabel1->Location = System::Drawing::Point(34, 274); + this->linkLabel1->Location = System::Drawing::Point(20, 274); this->linkLabel1->Name = L"linkLabel1"; this->linkLabel1->Size = System::Drawing::Size(207, 14); this->linkLabel1->TabIndex = 11; this->linkLabel1->TabStop = true; - this->linkLabel1->Text = L"Copyright (c) 2021 R3nzTheCodeGOD"; + this->linkLabel1->Text = L"Copyright (c) 2021-2022 R3nzTheCodeGOD"; this->linkLabel1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter; this->linkLabel1->LinkClicked += gcnew System::Windows::Forms::LinkLabelLinkClickedEventHandler(this, &R3nzUI::linkLabel1_LinkClicked); // // contextMenu // - this->contextMenu->MenuItems->AddRange(gcnew array{ this->menuItem }); - this->contextMenu->MenuItems->AddRange(gcnew array{ this->menuItem2 }); + this->contextMenu->MenuItems->AddRange(gcnew array{ this->menuItem, this->menuItem2 }); // // menuItem + // this->menuItem2->Index = 0; this->menuItem2->Text = L"Start"; this->menuItem2->Click += gcnew System::EventHandler(this, &R3nzUI::menuItem2_OnClick); diff --git a/R3nzSkin_Injector/main.cpp b/R3nzSkin_Injector/main.cpp index cbe2b201..0c5e6380 100644 --- a/R3nzSkin_Injector/main.cpp +++ b/R3nzSkin_Injector/main.cpp @@ -11,7 +11,7 @@ using namespace System::Windows::Forms; using namespace System::Threading; [STAThread] -int main(array^ args) +int main(array^ args [[maybe_unused]]) { std::srand(static_cast(std::time(nullptr))); Injector::renameExe(); From f539d35ed6b072a1e4856b58da11be3900bc3771 Mon Sep 17 00:00:00 2001 From: hotline1337 Date: Sun, 30 Oct 2022 20:55:26 +0100 Subject: [PATCH 2/4] toolset --- R3nzSkin/R3nzSkin.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R3nzSkin/R3nzSkin.vcxproj b/R3nzSkin/R3nzSkin.vcxproj index da6ec794..6cad3b46 100644 --- a/R3nzSkin/R3nzSkin.vcxproj +++ b/R3nzSkin/R3nzSkin.vcxproj @@ -22,14 +22,14 @@ DynamicLibrary false - v143 + v142 true Unicode DynamicLibrary false - v143 + v142 true Unicode From 97e807e1f73e50e7396b77ad6c22b826f8642e43 Mon Sep 17 00:00:00 2001 From: hotline1337 Date: Sun, 30 Oct 2022 21:17:23 +0100 Subject: [PATCH 3/4] add dpi scaling --- R3nzSkin/Config.hpp | 1 + R3nzSkin/GUI.cpp | 6 ++++++ R3nzSkin_Injector/R3nzSkin_Injector.vcxproj | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/R3nzSkin/Config.hpp b/R3nzSkin/Config.hpp index fb42f34c..3737591a 100644 --- a/R3nzSkin/Config.hpp +++ b/R3nzSkin/Config.hpp @@ -21,6 +21,7 @@ class Config { KeyBind nextSkinKey{ KeyBind(KeyBind::PAGE_UP) }; KeyBind previousSkinKey{ KeyBind(KeyBind::PAGE_DOWN) }; bool rainbowText{ false }; + float fontScale{ 1.0f }; bool heroName{ true }; bool quickSkinChange{ false }; // player diff --git a/R3nzSkin/GUI.cpp b/R3nzSkin/GUI.cpp index 99308196..4b9e5220 100644 --- a/R3nzSkin/GUI.cpp +++ b/R3nzSkin/GUI.cpp @@ -233,6 +233,12 @@ void GUI::render() noexcept } } ImGui::hoverInfo("Randomly changes the skin of all champions."); + ImGui::Text("Font Scale"); + ImGui::SliderFloat("##fontScale", &cheatManager.config->fontScale, 1.0f, 3.0f, "%.3g:1", 1.f); + if (ImGui::GetIO().FontGlobalScale != cheatManager.config->fontScale) { + ImGui::GetIO().FontGlobalScale = cheatManager.config->fontScale; + } ImGui::hoverInfo("Changes the menu font scale."); + if (ImGui::Button("Force Close")) cheatManager.hooks->uninstall(); ImGui::hoverInfo("You will be returned to the reconnect screen."); diff --git a/R3nzSkin_Injector/R3nzSkin_Injector.vcxproj b/R3nzSkin_Injector/R3nzSkin_Injector.vcxproj index 032e8480..0c876c08 100644 --- a/R3nzSkin_Injector/R3nzSkin_Injector.vcxproj +++ b/R3nzSkin_Injector/R3nzSkin_Injector.vcxproj @@ -23,13 +23,13 @@ Application false - v143 + v142 true Unicode true - v143 + v142 Unicode true true From 1cb75d62fc19a95ca11d5c6dbe2f5ad589dd4ff4 Mon Sep 17 00:00:00 2001 From: R3nzTheCodeGOD Date: Mon, 31 Oct 2022 12:24:57 +0300 Subject: [PATCH 4/4] Save the fontScale variable in the cfg. --- R3nzSkin.sln | 1 - R3nzSkin/Config.cpp | 3 +++ R3nzSkin/GUI.cpp | 3 +-- R3nzSkin/R3nzSkin.cpp | 6 +++--- R3nzSkin_Injector/main.cpp | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/R3nzSkin.sln b/R3nzSkin.sln index 2314db2c..796ae8d2 100644 --- a/R3nzSkin.sln +++ b/R3nzSkin.sln @@ -17,7 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PythonScripts", "PythonScripts", "{D80EC08B-EC70-4DA6-8DE2-36EA4AC99769}" ProjectSection(SolutionItems) = preProject - PythonScripts\IDA_Dumper.py = PythonScripts\IDA_Dumper.py PythonScripts\lolskin_to_skin.py = PythonScripts\lolskin_to_skin.py EndProjectSection EndProject diff --git a/R3nzSkin/Config.cpp b/R3nzSkin/Config.cpp index 0acd4d8a..78847e2c 100644 --- a/R3nzSkin/Config.cpp +++ b/R3nzSkin/Config.cpp @@ -40,6 +40,7 @@ void Config::save() noexcept config_json["heroName"] = this->heroName; config_json["raibowText"] = this->rainbowText; config_json["quickSkinChange"] = this->quickSkinChange; + config_json["fontScale"] = this->fontScale; config_json["current_combo_ward_index"] = this->current_combo_ward_index; config_json["current_ward_skin_index"] = this->current_ward_skin_index; config_json["current_minion_skin_index"] = this->current_minion_skin_index; @@ -79,6 +80,7 @@ void Config::load() noexcept this->heroName = config_json.value("heroName", true); this->rainbowText = config_json.value("raibowText", false); this->quickSkinChange = config_json.value("quickSkinChange", false); + this->fontScale = config_json.value("fontScale", 1.0f); this->current_combo_ward_index = config_json.value("current_combo_ward_index", 0); this->current_ward_skin_index = config_json.value("current_ward_skin_index", -1); this->current_minion_skin_index = config_json.value("current_minion_skin_index", -1); @@ -109,6 +111,7 @@ void Config::reset() noexcept this->heroName = true; this->rainbowText = true; this->quickSkinChange = false; + this->fontScale = 1.0f; this->current_combo_skin_index = 0; this->current_combo_ward_index = 0; this->current_combo_minion_index = 0; diff --git a/R3nzSkin/GUI.cpp b/R3nzSkin/GUI.cpp index 4b9e5220..a7e71a27 100644 --- a/R3nzSkin/GUI.cpp +++ b/R3nzSkin/GUI.cpp @@ -233,8 +233,7 @@ void GUI::render() noexcept } } ImGui::hoverInfo("Randomly changes the skin of all champions."); - ImGui::Text("Font Scale"); - ImGui::SliderFloat("##fontScale", &cheatManager.config->fontScale, 1.0f, 3.0f, "%.3g:1", 1.f); + ImGui::SliderFloat("Font Scale", &cheatManager.config->fontScale, 1.0f, 2.0f, "%.3f"); if (ImGui::GetIO().FontGlobalScale != cheatManager.config->fontScale) { ImGui::GetIO().FontGlobalScale = cheatManager.config->fontScale; } ImGui::hoverInfo("Changes the menu font scale."); diff --git a/R3nzSkin/R3nzSkin.cpp b/R3nzSkin/R3nzSkin.cpp index adeeab81..0049c85b 100644 --- a/R3nzSkin/R3nzSkin.cpp +++ b/R3nzSkin/R3nzSkin.cpp @@ -16,10 +16,10 @@ #include "SDK/GameState.hpp" -bool NTAPI HideThread(HANDLE hThread) noexcept +bool WINAPI HideThread(const HANDLE hThread) noexcept { __try { - using FnSetInformationThread = NTSTATUS(NTAPI*)(HANDLE, UINT, PVOID, ULONG); + using FnSetInformationThread = NTSTATUS(NTAPI*)(HANDLE ThreadHandle, UINT ThreadInformationClass, PVOID ThreadInformation, ULONG ThreadInformationLength); const auto NtSetInformationThread{ reinterpret_cast(::GetProcAddress(::GetModuleHandle(L"ntdll.dll"), "NtSetInformationThread")) }; if (!NtSetInformationThread) @@ -62,7 +62,7 @@ static void WINAPI DllAttach([[maybe_unused]] LPVOID lp) noexcept ::ExitProcess(0u); } -__declspec(safebuffers) BOOL APIENTRY DllMain(const HMODULE hModule, const DWORD reason, LPVOID reserved [[maybe_unused]]) +__declspec(safebuffers) BOOL APIENTRY DllMain(const HMODULE hModule, const DWORD reason, [[maybe_unused]] LPVOID reserved) { DisableThreadLibraryCalls(hModule); diff --git a/R3nzSkin_Injector/main.cpp b/R3nzSkin_Injector/main.cpp index 0c5e6380..57f61f21 100644 --- a/R3nzSkin_Injector/main.cpp +++ b/R3nzSkin_Injector/main.cpp @@ -11,7 +11,7 @@ using namespace System::Windows::Forms; using namespace System::Threading; [STAThread] -int main(array^ args [[maybe_unused]]) +int main([[maybe_unused]] array^ args) { std::srand(static_cast(std::time(nullptr))); Injector::renameExe();