Skip to content

Commit 2015562

Browse files
13.1 patch update.
- new little legends added. - x86RetSpoof added. - Localization done for little legend names.
1 parent ef90524 commit 2015562

17 files changed

+497
-116
lines changed

R3nzSkinTFT/Config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void Config::load() noexcept
5454
this->currentComboSkinIndex = config_json.value("currentComboSkinIndex", 0);
5555
this->curretSkinId = config_json.value("curretSkinId", 1);
5656

57-
if (this->curretSkinId <= 0)
57+
if (this->curretSkinId < 1)
5858
this->curretSkinId = 1;
5959

6060
in.close();

R3nzSkinTFT/GUI.cpp

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include <string>
33
#include <mutex>
44
#include <vector>
5+
#include <variant>
6+
#include <tuple>
57

68
#include "imgui/imgui.h"
79
#include "imgui/imgui_stdlib.h"
@@ -16,7 +18,7 @@ inline void footer() noexcept
1618
{
1719
ImGui::Separator();
1820
ImGui::textUnformattedCentered((std::string("Last Build: ") + __DATE__ + " - " + __TIME__).c_str());
19-
ImGui::textUnformattedCentered("Copyright (C) 2022 R3nzTheCodeGOD");
21+
ImGui::textUnformattedCentered("Copyright (C) 2022-2023 R3nzTheCodeGOD");
2022
}
2123

2224
void GUI::render() noexcept
@@ -32,7 +34,14 @@ void GUI::render() noexcept
3234
};
3335

3436
std::call_once(this->changeSkin, [&]() noexcept -> void {
35-
if (cheatManager.config->currentComboSkinIndex > 0 && cheatManager.config->curretSkinId > cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].skinCount)
37+
const auto& pet{ cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1] };
38+
std::int32_t count{ 0 };
39+
if (std::holds_alternative<std::int32_t>(pet.skinIds))
40+
count = std::get<std::int32_t>(pet.skinIds);
41+
else if (std::holds_alternative<std::pair<std::int32_t, std::int32_t>>(pet.skinIds))
42+
count = std::get<std::pair<std::int32_t, std::int32_t>>(pet.skinIds).second;
43+
44+
if (cheatManager.config->currentComboSkinIndex > 0 && cheatManager.config->curretSkinId > count)
3645
cheatManager.config->curretSkinId = 1;
3746

3847
if (cheatManager.config->currentComboSkinIndex > 0)
@@ -42,10 +51,22 @@ void GUI::render() noexcept
4251
ImGui::Begin("R3nzSkin TFT", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_AlwaysAutoResize);
4352
if (ImGui::BeginTabBar("TabBar", ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_FittingPolicyScroll | ImGuiTabBarFlags_NoTooltip)) {
4453
if (ImGui::BeginTabItem("Skin Changer")) {
45-
if (ImGui::Combo("Current Pet", &cheatManager.config->currentComboSkinIndex, vectorGetter, static_cast<void*>(&cheatManager.database->pets), cheatManager.database->pets.size() + 1))
46-
cheatManager.config->curretSkinId = 1;
47-
48-
ImGui::SliderInt("Current Pet SkinId", &cheatManager.config->curretSkinId, 1, cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].skinCount);
54+
if (ImGui::Combo("Current Pet", &cheatManager.config->currentComboSkinIndex, vectorGetter, static_cast<void*>(&cheatManager.database->pets), cheatManager.database->pets.size() + 1)) {
55+
const auto& pet{ cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1] };
56+
if (std::holds_alternative<std::int32_t>(pet.skinIds))
57+
cheatManager.config->curretSkinId = 1;
58+
else if (std::holds_alternative<std::pair<std::int32_t, std::int32_t>>(pet.skinIds))
59+
cheatManager.config->curretSkinId = std::get<std::pair<std::int32_t, std::int32_t>>(pet.skinIds).first;
60+
}
61+
62+
const auto& pet{ cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1] };
63+
if (std::holds_alternative<std::int32_t>(pet.skinIds)) {
64+
ImGui::SliderInt("Current Pet SkinId", &cheatManager.config->curretSkinId, 1, std::get<std::int32_t>(pet.skinIds));
65+
} else if (std::holds_alternative<std::pair<std::int32_t, std::int32_t>>(pet.skinIds)) {
66+
const auto pair{ std::get<std::pair<std::int32_t, std::int32_t>>(pet.skinIds) };
67+
ImGui::SliderInt("Current Pet SkinId", &cheatManager.config->curretSkinId, pair.first, pair.second);
68+
}
69+
4970
if (ImGui::Button("Change Pet Skin"))
5071
player->changeSkin(cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].modelName, cheatManager.config->curretSkinId);
5172
footer();
@@ -58,10 +79,10 @@ void GUI::render() noexcept
5879
}
5980

6081
if (ImGui::BeginTabItem("Extra")) {
61-
ImGui::InputText("##pushmanualmodel", &this->manualModel);
82+
ImGui::InputText("##push_model", &this->model);
6283
ImGui::SameLine();
63-
if (ImGui::Button("Push Manual Model"))
64-
player->changeSkin(this->manualModel.c_str(), 1);
84+
if (ImGui::Button("Push Model"))
85+
player->changeSkin(this->model.c_str(), 1);
6586
ImGui::Separator();
6687
ImGui::InputText("Change Nick", player->getNamePtr());
6788
ImGui::Separator();

R3nzSkinTFT/GUI.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ class GUI {
1010
void render() noexcept;
1111
private:
1212
std::once_flag changeSkin;
13-
std::string manualModel{ "TFTDebug_DummyMelee" };
13+
std::string model{ "TFTDebug_DummyMelee" };
1414
};

R3nzSkinTFT/Hooks.cpp

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,20 @@ std::once_flag init_device;
3737
std::unique_ptr<::vmt_smart_hook> d3d_device_vmt{ nullptr };
3838
std::unique_ptr<::vmt_smart_hook> swap_chain_vmt{ nullptr };
3939

40-
static const ImWchar ranges[] = {
40+
static const ImWchar tahomaRanges[] = {
4141
0x0020, 0x00FF, // Basic Latin + Latin Supplement
4242
0x0100, 0x024F, // Latin Extended-A + Latin Extended-B
43+
0x0250, 0x02FF, // IPA Extensions + Spacing Modifier Letters
4344
0x0300, 0x03FF, // Combining Diacritical Marks + Greek/Coptic
44-
0x0400, 0x044F, // Cyrillic
45-
0x0600, 0x06FF, // Arabic
45+
0x0400, 0x052F, // Cyrillic + Cyrillic Supplement
46+
0x0530, 0x06FF, // Armenian + Hebrew + Arabic
4647
0x0E00, 0x0E7F, // Thai
48+
0x1E00, 0x1FFF, // Latin Extended Additional + Greek Extended
49+
0x2000, 0x20CF, // General Punctuation + Superscripts and Subscripts + Currency Symbols
50+
0x2100, 0x218F, // Letterlike Symbols + Number Forms
4751
0,
4852
};
4953

50-
static ImWchar* getFontGlyphRangesKr() noexcept
51-
{
52-
static ImVector<ImWchar> rangesKR;
53-
if (rangesKR.empty()) {
54-
ImFontGlyphRangesBuilder builder;
55-
auto& io{ ImGui::GetIO() };
56-
builder.AddRanges(io.Fonts->GetGlyphRangesChineseSimplifiedCommon());
57-
builder.AddRanges(io.Fonts->GetGlyphRangesChineseFull());
58-
builder.AddRanges(io.Fonts->GetGlyphRangesKorean());
59-
builder.AddRanges(io.Fonts->GetGlyphRangesJapanese());
60-
builder.BuildRanges(&rangesKR);
61-
}
62-
return rangesKR.Data;
63-
}
64-
6554
namespace d3d_vtable {
6655
ID3D11Device* d3d11_device{ nullptr };
6756
ID3D11DeviceContext* d3d11_device_context{ nullptr };
@@ -166,10 +155,10 @@ namespace d3d_vtable {
166155
::CoTaskMemFree(pathToFonts);
167156
ImFontConfig cfg;
168157
cfg.SizePixels = 15.0f;
169-
io.Fonts->AddFontFromFileTTF((path / "tahoma.ttf").string().c_str(), 15.0f, &cfg, ranges);
158+
io.Fonts->AddFontFromFileTTF((path / "tahoma.ttf").string().c_str(), 15.0f, &cfg, tahomaRanges);
170159
}
171160

172-
ImGui_ImplWin32_Init(cheatManager.memory->getRiotWindow());
161+
ImGui_ImplWin32_Init(cheatManager.memory->riotWindow);
173162

174163
if (is_d3d11) {
175164
p_swap_chain = reinterpret_cast<IDXGISwapChain*>(device);
@@ -181,7 +170,7 @@ namespace d3d_vtable {
181170
} else
182171
::ImGui_ImplDX9_Init(reinterpret_cast<IDirect3DDevice9*>(device));
183172

184-
originalWndProc = WNDPROC(::SetWindowLongW(cheatManager.memory->getRiotWindow(), GWLP_WNDPROC, LONG_PTR(&wndProc)));
173+
originalWndProc = WNDPROC(::SetWindowLongW(cheatManager.memory->riotWindow, GWLP_WNDPROC, LONG_PTR(&wndProc)));
185174
}
186175

187176
static void render(void* device, bool is_d3d11 = false) noexcept
@@ -278,7 +267,7 @@ void Hooks::install() const noexcept
278267

279268
void Hooks::uninstall() const noexcept
280269
{
281-
::SetWindowLongW(cheatManager.memory->getRiotWindow(), GWLP_WNDPROC, LONG_PTR(originalWndProc));
270+
::SetWindowLongW(cheatManager.memory->riotWindow, GWLP_WNDPROC, LONG_PTR(originalWndProc));
282271

283272
if (d3d_device_vmt)
284273
d3d_device_vmt->unhook();

R3nzSkinTFT/R3nzSkinTFT.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma warning(disable : 6387 4715)
22

33
#include <Windows.h>
4+
#include <array>
45
#include <clocale>
56
#include <chrono>
67
#include <cstdint>
@@ -12,6 +13,7 @@
1213
#include "GUI.hpp"
1314
#include "Hooks.hpp"
1415
#include "Memory.hpp"
16+
#include "RetSpoofInvoker.hpp"
1517

1618
#include "SDK/GameState.hpp"
1719

@@ -47,6 +49,10 @@ static void WINAPI DllAttach([[maybe_unused]] LPVOID lp) noexcept
4749
break;
4850
}
4951

52+
const auto gadget{ *reinterpret_cast<std::array<std::uint8_t, 2>*>(cheatManager.memory->moduleBase + offsets::global::retSpoofGadget)};
53+
cheatManager.logger->addLog("[+] Gadget: 0x%X 0x%X\n", gadget.at(0), gadget.at(1));
54+
invoker.init(cheatManager.memory->moduleBase + offsets::global::retSpoofGadget);
55+
5056
std::this_thread::sleep_for(500ms);
5157
cheatManager.memory->Search(false);
5258
std::this_thread::sleep_for(500ms);
@@ -62,7 +68,7 @@ static void WINAPI DllAttach([[maybe_unused]] LPVOID lp) noexcept
6268
::ExitProcess(0u);
6369
}
6470

65-
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID reserved)
71+
__declspec(safebuffers) BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID reserved)
6672
{
6773
if (reason == DLL_PROCESS_ATTACH) {
6874
HideThread(hModule);

R3nzSkinTFT/R3nzSkinTFT.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
<ClInclude Include="GUI.hpp" />
104104
<ClInclude Include="Offsets.hpp" />
105105
<ClInclude Include="resource.h" />
106+
<ClInclude Include="RetSpoofInvoker.hpp" />
106107
<ClInclude Include="SDK\AIBaseCommon.hpp" />
107108
<ClInclude Include="SDK\AString.hpp" />
108109
<ClInclude Include="SDK\CharacterDataStack.hpp" />
@@ -114,6 +115,7 @@
114115
<ClInclude Include="SkinDatabase.hpp" />
115116
<ClInclude Include="Utils.hpp" />
116117
<ClInclude Include="vmt_smart_hook.hpp" />
118+
<ClInclude Include="x86RetSpoof.hpp" />
117119
</ItemGroup>
118120
<ItemGroup>
119121
<ResourceCompile Include="R3nzSkinTFT.rc" />

R3nzSkinTFT/R3nzSkinTFT.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@
189189
<ClInclude Include="Logger.hpp">
190190
<Filter>Source Files\Logger</Filter>
191191
</ClInclude>
192+
<ClInclude Include="x86RetSpoof.hpp">
193+
<Filter>Source Files\Utils</Filter>
194+
</ClInclude>
195+
<ClInclude Include="RetSpoofInvoker.hpp">
196+
<Filter>Source Files\Utils</Filter>
197+
</ClInclude>
192198
</ItemGroup>
193199
<ItemGroup>
194200
<ResourceCompile Include="R3nzSkinTFT.rc" />

R3nzSkinTFT/RetSpoofInvoker.hpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#pragma once
2+
3+
#include <cstdint>
4+
5+
#include "x86RetSpoof.hpp"
6+
7+
class RetSpoofInvoker {
8+
private:
9+
std::uintptr_t gadgetAddress{ 0 };
10+
public:
11+
void init(std::uintptr_t gadgetAddress) noexcept
12+
{
13+
this->gadgetAddress = gadgetAddress;
14+
}
15+
16+
template <typename ReturnType, typename... Args>
17+
ReturnType invokeFastcall(std::uintptr_t ecx, std::uintptr_t edx, std::uintptr_t functionAddress, Args... args) const noexcept
18+
{
19+
return x86RetSpoof::invokeFastcall<ReturnType, Args...>(ecx, edx, functionAddress, this->gadgetAddress, args...);
20+
}
21+
22+
template <typename ReturnType, typename... Args>
23+
ReturnType invokeThiscall(std::uintptr_t ecx, std::uintptr_t functionAddress, Args... args) const noexcept
24+
{
25+
return x86RetSpoof::invokeThiscall<ReturnType, Args...>(ecx, functionAddress, this->gadgetAddress, args...);
26+
}
27+
28+
template <typename ReturnType, std::size_t index, typename... Args>
29+
ReturnType invokeThiscall(std::uintptr_t ecx, Args... args) const noexcept
30+
{
31+
return x86RetSpoof::invokeThiscall<ReturnType, Args...>(ecx, (*reinterpret_cast<std::uintptr_t**>(ecx))[index], this->gadgetAddress, args...);
32+
}
33+
34+
template <typename ReturnType, typename... Args>
35+
ReturnType invokeStdcall(std::uintptr_t functionAddress, Args... args) const noexcept
36+
{
37+
return x86RetSpoof::invokeStdcall<ReturnType, Args...>(functionAddress, this->gadgetAddress, args...);
38+
}
39+
40+
template <typename ReturnType, typename... Args>
41+
ReturnType invokeCdecl(std::uintptr_t functionAddress, Args... args) const noexcept
42+
{
43+
return x86RetSpoof::invokeCdecl<ReturnType, Args...>(functionAddress, this->gadgetAddress, args...);
44+
}
45+
};
46+
47+
inline RetSpoofInvoker invoker;
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#include <Windows.h>
22
#include <cstdint>
33

4-
#include "CharacterDataStack.hpp"
4+
#include "../CheatManager.hpp"
5+
#include "../RetSpoofInvoker.hpp"
56
#include "../offsets.hpp"
67

8+
#include "CharacterDataStack.hpp"
9+
710
void CharacterDataStack::push(const char* model, const std::int32_t skin) noexcept
8-
{
9-
using FnPush = int(__thiscall*)(void*, const char* model, std::int32_t skinid, std::int32_t, bool update_spells, bool dont_update_hud, bool, bool, bool change_particle, bool, char, const char*, std::int32_t, const char*, std::int32_t, bool, std::int32_t);
10-
static const auto Push{ reinterpret_cast<FnPush>(std::uintptr_t(::GetModuleHandle(nullptr)) + offsets::functions::FnCharacterDataStack__Push) };
11-
Push(this, model, skin, 0, false, false, false, false, true, false, -1, "\x00", 0, "\x00", 0, false, 1);
11+
{
12+
invoker.invokeThiscall<int>(std::uintptr_t(this), cheatManager.memory->moduleBase + offsets::functions::FnCharacterDataStack__Push, model, skin, 0, false, false, false, false, true, false, std::int8_t(-1), "\x00", 0, "\x00", 0, false, 1);
1213
}

R3nzSkinTFT/SkinDatabase.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@
55
#include "SkinDatabase.hpp"
66
#include "offsets.hpp"
77

8-
std::uint32_t SkinDatabase::getSkinsLenForModel(std::string model) noexcept
8+
std::int32_t SkinDatabase::getSkinsLenForModel(std::string model, const std::int32_t startIdx) const noexcept
99
{
10-
static const auto getCharacterPackage{ reinterpret_cast<std::uintptr_t(__cdecl*)(std::string&,std::uint32_t)>(cheatManager.memory->getLeagueModule() + offsets::functions::FnCharacterData__GetCharacterPackage) };
11-
const auto defaultSkinData{ *reinterpret_cast<std::uintptr_t*>(getCharacterPackage(model, 0u) + 0x34) };
12-
for (auto skinsLen{ 1u };; ++skinsLen)
13-
if (*reinterpret_cast<std::uintptr_t*>(getCharacterPackage(model, skinsLen) + 0x34) == defaultSkinData)
14-
return skinsLen - 1u;
10+
const auto defaultSkinData{ cheatManager.memory->getCharacterPackage(model, 0) };
11+
for (std::int32_t skinsLen{ startIdx };; ++skinsLen)
12+
if (cheatManager.memory->getCharacterPackage(model, skinsLen) == defaultSkinData)
13+
return skinsLen - 1;
1514
}
1615

1716
void SkinDatabase::update() noexcept
1817
{
19-
// automatically update number of skins
20-
for (auto& pet : this->pets)
21-
pet.skinCount = this->getSkinsLenForModel(pet.modelName);
18+
for (auto& pet : this->pets) {
19+
if (std::holds_alternative<std::int32_t>(pet.skinIds)) {
20+
pet.skinIds = this->getSkinsLenForModel(pet.modelName, std::get<std::int32_t>(pet.skinIds));
21+
} else if (std::holds_alternative<std::pair<std::int32_t, std::int32_t>>(pet.skinIds)) {
22+
const auto pair{ std::get<std::pair<std::int32_t, std::int32_t>>(pet.skinIds) };
23+
pet.skinIds = std::make_pair(pair.first, this->getSkinsLenForModel(pet.modelName, pair.first));
24+
}
25+
26+
pet.skinName = cheatManager.memory->translateString(pet.skinName);
27+
}
2228
}

0 commit comments

Comments
 (0)