www
www
This commit is contained in:
1 parent
3933cd1901
commit
0aa65c433d
98 files changed
+56670
No files matched your search
@@ -0,0 +1,108 @@
|
||||
#include "SkillHack.h"
|
||||
|
||||
#include "HookManager.h"
|
||||
#include "helpers.h"
|
||||
|
||||
SkillHackModule* SkillHackModule::s_instance_ = nullptr;
|
||||
|
||||
SkillHackModule::SkillHackModule()
|
||||
: BaseModule("SkillHack", "Free Skill", ModuleCategory::Player) {
|
||||
s_instance_ = this;
|
||||
}
|
||||
|
||||
SkillHackModule::~SkillHackModule() {
|
||||
s_instance_ = nullptr;
|
||||
}
|
||||
|
||||
void SkillHackModule::RegisterTab() {
|
||||
}
|
||||
|
||||
void SkillHackModule::InstallHooks() {
|
||||
if (hooks_installed_) {
|
||||
return;
|
||||
}
|
||||
|
||||
HookManagerRuntime& hooks = HookManagerRuntime::Instance();
|
||||
|
||||
auto create_and_enable = [&](uintptr_t slot, void* callback, void** tramp_out) {
|
||||
void* target = GetIl2cppSlot(slot);
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
if (hooks.CreateHook(target, callback, tramp_out) == 0) {
|
||||
hooks.EnableHook(target, true);
|
||||
}
|
||||
};
|
||||
|
||||
create_and_enable(IL2CPP::Game_EntityActor_E, reinterpret_cast<void*>(&DispatcherHook), &tramp_dispatch_1_);
|
||||
create_and_enable(IL2CPP::Game_EntityActor_F, reinterpret_cast<void*>(&DispatcherHook), &tramp_dispatch_2_);
|
||||
create_and_enable(IL2CPP::Game_SkillAction_K, reinterpret_cast<void*>(&CooldownBypassHook), &tramp_cooldown_);
|
||||
create_and_enable(IL2CPP::Game_SkillAction_L, reinterpret_cast<void*>(&AvailBypassHook), &tramp_avail_);
|
||||
create_and_enable(IL2CPP::Game_SkillAction_J, reinterpret_cast<void*>(&CostBypassHook), &tramp_cost_);
|
||||
create_and_enable(IL2CPP::Game_EntityActor_D, reinterpret_cast<void*>(&DispatcherHook), &tramp_dispatch_3_);
|
||||
|
||||
hooks_installed_ = true;
|
||||
}
|
||||
|
||||
void SkillHackModule::Render() {
|
||||
InstallHooks();
|
||||
|
||||
if (!ImGui::CollapsingHeader(Tr("Free Skill"), ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool enabled = Enabled();
|
||||
if (ImGui::Checkbox(Tr("ON / OFF"), &enabled)) {
|
||||
SetEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void SkillHackModule::Update() {
|
||||
}
|
||||
|
||||
BOOL SkillHackModule::DispatcherHook() {
|
||||
if (s_instance_ && s_instance_->Enabled()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (s_instance_ && s_instance_->tramp_dispatch_1_) {
|
||||
auto original = reinterpret_cast<BOOL(*)()>(s_instance_->tramp_dispatch_1_);
|
||||
return original();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
float SkillHackModule::CooldownBypassHook() {
|
||||
if (s_instance_ && s_instance_->Enabled()) {
|
||||
return 100.0f;
|
||||
}
|
||||
|
||||
if (s_instance_ && s_instance_->tramp_cooldown_) {
|
||||
auto original = reinterpret_cast<float(*)()>(s_instance_->tramp_cooldown_);
|
||||
return original();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
BOOL SkillHackModule::AvailBypassHook() {
|
||||
if (s_instance_ && s_instance_->Enabled()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (s_instance_ && s_instance_->tramp_avail_) {
|
||||
auto original = reinterpret_cast<BOOL(*)()>(s_instance_->tramp_avail_);
|
||||
return original();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SkillHackModule::CostBypassHook() {
|
||||
if (s_instance_ && s_instance_->Enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_instance_ && s_instance_->tramp_cost_) {
|
||||
auto original = reinterpret_cast<void(*)()>(s_instance_->tramp_cost_);
|
||||
original();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user