Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
Fix #240 (#243)
Browse files Browse the repository at this point in the history
add dpi scaling
  • Loading branch information
R3nzTheCodeGOD authored Oct 31, 2022
2 parents feaa71e + 1cb75d6 commit 596985d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
1 change: 0 additions & 1 deletion R3nzSkin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions R3nzSkin/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions R3nzSkin/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion R3nzSkin/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:");

Expand Down Expand Up @@ -233,6 +233,11 @@ void GUI::render() noexcept
}
} ImGui::hoverInfo("Randomly changes the skin of all champions.");

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.");

if (ImGui::Button("Force Close"))
cheatManager.hooks->uninstall();
ImGui::hoverInfo("You will be returned to the reconnect screen.");
Expand Down
25 changes: 13 additions & 12 deletions R3nzSkin/R3nzSkin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

#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<FnSetInformationThread>(::GetProcAddress(::GetModuleHandle(L"ntdll.dll"), "NtSetInformationThread")) };

if (NtSetInformationThread == NULL)
if (!NtSetInformationThread)
return false;

if (const auto status{ NtSetInformationThread(hThread, 0x11u, NULL, 0ul) }; status == 0x00000000)
Expand Down Expand Up @@ -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, [[maybe_unused]] LPVOID reserved)
{
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;
}
8 changes: 4 additions & 4 deletions R3nzSkin_Injector/R3nzUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<System::Windows::Forms::MenuItem^>{ this->menuItem });
this->contextMenu->MenuItems->AddRange(gcnew array<System::Windows::Forms::MenuItem^>{ this->menuItem2 });
this->contextMenu->MenuItems->AddRange(gcnew array<System::Windows::Forms::MenuItem^>{ this->menuItem, this->menuItem2 });
//
// menuItem
//
this->menuItem2->Index = 0;
this->menuItem2->Text = L"Start";
this->menuItem2->Click += gcnew System::EventHandler(this, &R3nzUI::menuItem2_OnClick);
Expand Down
2 changes: 1 addition & 1 deletion R3nzSkin_Injector/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace System::Windows::Forms;
using namespace System::Threading;

[STAThread]
int main(array<String^>^ args)
int main([[maybe_unused]] array<String^>^ args)
{
std::srand(static_cast<unsigned int>(std::time(nullptr)));
Injector::renameExe();
Expand Down

0 comments on commit 596985d

Please sign in to comment.