Xenon:一个开源通用游戏作弊框架 C++ 实现
kiocode / **xenon-cheats ** Public
C++ Modern Framework For Game Cheating kiocode.com/
Xenon Framework - C++ 游戏破解框架
Xenon 是一个强大而灵活的 C++ 框架,专为创建内部和外部游戏作弊程序而设计。它提供了一个模块化的架构,使开发者能够轻松地实现诸如 ESP、Aimbot、Radar 等功能。Xenon 支持包括 Unreal Engine 和 Unity 在内的多种游戏引擎,并且被设计成通用的,这意味着它可以适应各种游戏,只需要进行极少的更改。
本自述文件概述了该框架,展示了如何使用 Xenon 创建项目的示例,并比较了内部和外部作弊,以及对 Unreal Engine 和 Unity 的支持。
注意:完整的文档正在编写中
目录
简介
Xenon 旨在通过提供一组可重用的组件和实用工具来简化游戏作弊程序的创建过程。它抽象了底层细节,使开发者能够专注于实现特定于游戏的逻辑。该框架支持内部 (DLL 注入) 和外部 (独立应用程序) 作弊,并且可以适应于不同的游戏引擎。
主要特点:
- 模块化设计:轻松添加或删除诸如 ESP、Aimbot、Radar 等功能。
- 通用兼容性:适用于 Unreal Engine、Unity 和其他引擎。
- 可定制的 UI:内置对 ImGui 的支持,用于创建游戏内覆盖。
- 内存管理:提供用于读取/写入游戏内存的实用工具。
- 事件驱动架构:挂钩到游戏事件,例如更新或渲染。
- 自动 DLL 注入:内置系统,用于将 DLL 注入到游戏进程中(正在开发中,但在许多情况下可以正常工作)。
内部作弊 vs 外部作弊
内部作弊
内部作弊以 DLL 的形式实现,这些 DLL 被注入到游戏进程中。它们可以直接访问游戏的内存和函数,这使得它们功能强大,但也更容易被反作弊系统检测到。
优点:
- 直接访问游戏内存和函数。
- 更容易实现诸如 ESP 或 Aimbot 等复杂功能。
缺点:
- 被反作弊系统检测到的风险更高。
- 需要 DLL 注入,这可能更难设置。
示例:
#include <Windows.h>
#include "basic_ue.hpp"
#include <xenon/xenon.hpp>
DWORD WINAPI MainThread(LPVOID lpReserved) {
Builder builder("Internal Cheat Example");
std::shared_ptr<GameVariables> pGameVariables = builder.xenonConfig->g_pGameVariables;
// ... (setup configurations and features)
Cheat cheat = builder.Build();
cheat.Run();
return TRUE;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
CreateThread(nullptr, 0, MainThread, hModule, 0, nullptr);
}
return TRUE;
}
外部作弊
外部作弊作为独立的应用程序运行,并通过内存读取/写入与游戏进程交互。通常,它们更安全,不易被检测到,但与内部作弊相比,功能可能有限。
优点:
- 被检测到的风险较低。
- 更容易开发和调试。
缺点:
- 对游戏内存和函数的访问权限有限。
- 可能需要付出更多努力才能实现复杂功能。
示例:
#include <windows.h>
#include <xenon/xenon.hpp>
int main() {
Builder builder("External Cheat Example");
builder.xenon->g_pSystem->IsInternal(false);
// ... (setup configurations and features)
Cheat cheat = builder.Build();
cheat.Run();
return 0;
}
支持的游戏引擎
Unreal Engine
Xenon 提供了对 Unreal Engine 游戏的内置支持。 (查看此示例项目)
示例:
pSystem->IsUnrealEngine(UnrealEngineVersion::UE4);
pSystem->m_fnW2S3D = [](Vec3 pos) {
SDK::FVector2D screenPos;
SDK::FVector unrealPos(pos.x, pos.z, pos.y);
if (UE::m_pMyController->ProjectWorldLocationToScreen(unrealPos, &screenPos, false)) {
return Vec2(screenPos.X, screenPos.Y);
}
return Vec2(-99, -99);
};
Unity
Xenon 也可以被调整为与 Unity 游戏一起使用,尽管它需要额外的设置才能访问 Unity 特定的数据结构。Xenon 具有自定义的 IL2CPP Resolver 集成,经过改进,可避免在获取目标时发生崩溃。
示例:
pSystem->IsUnityEngine(true);
// Unity-specific memory reading/writing logic goes here.
//..
Cheat cheat = builder.Build();
cheat.Run();
if (IL2CPP::Initialize(true)) {
spdlog::info("Il2Cpp initialize success.");
}
else {
spdlog::error("Il2Cpp initialize failed.");
Sleep(300);
exit(0);
}
if (!cheat.FetchSDK()) return FALSE;
快速上手
内部作弊示例
下面是一个用于 Unreal Engine 游戏的内部作弊示例:
#include <Windows.h>
#include <xenon/xenon.hpp>
DWORD WINAPI MainThread(LPVOID lpReserved) {
Builder builder("Internal Cheat Example");
std::shared_ptr<GameVariables> pGameVariables = builder.xenonConfig->g_pGameVariables;
std::shared_ptr<EspConfig> pEspConfig = builder.xenonConfig->g_pEspConfig;
pSystem->IsInternal(true);
pSystem->IsUnrealEngine(UnrealEngineVersion::UE4); // check your game
pSystem->SetGameDimension(GameDimension::DIM_3D);
pSystem->SetRenderingType(RenderingType::DX11);
builder.SetInfoLogLevel();
builder.SetConsoleEnabled();
pEspConfig->m_nLimitDistance = 10000;
pEspConfig->m_fHealthBarWidth = 40;
builder.GameManager->OnEvent("Update", [pGameVariables]() {
// Update game variables and targets,
// so there you can get players in any way you need in any game
});
Cheat cheat = builder.Build();
cheat.UseUICustom(RenderingHookType::KIERO);
cheat.UseUIMenu();
cheat.Run();
return TRUE;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dReasonForCall, LPVOID lpReserved)
{
switch (dReasonForCall)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
CreateThread(nullptr, 0, MainThread, hModule, 0, nullptr);
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
外部作弊示例
下面是一个用于 2D 游戏的外部作弊示例:
#include <windows.h>
#include <xenon/xenon.hpp>
int main() {
Builder builder("External Cheat Example");
builder.xenon->g_pSystem->IsInternal(false);
builder.SetConsoleEnabled();
builder.SetInfoLogLevel();
builder.xenon->g_pSystem->SetGameDimension(GameDimension::DIM_2D);
builder.xenon->g_cMemoryService->AttachGame("Your\\Game\\Path.exe");
uintptr_t serverAddr = builder.xenon->g_cMemoryService->ReadPointer(offsets.staticServerAddr);
uintptr_t clientAddr = builder.xenon->g_cMemoryService->ReadPointer(offsets.staticClientAddr);
if (!serverAddr || !clientAddr) {
spdlog::error("Failed to find server or client address");
return 1;
}
builder.GameManager->OnEvent("Update", [builder]() {
// Update game variables and targets
});
Cheat cheat = builder.Build();
cheat.UseUICustom();
cheat.UseUIMenu();
cheat.Run();
return 0;
}
自动 DLL 注入
Xenon 包括一个内置系统,用于将 DLL 自动注入到游戏进程中。此功能仍在开发中,但在许多情况下都可以正常工作。
示例:
#include <spdlog/spdlog.h>
#include <xenon/xenon.hpp>
#include <xenon/components/services/injection_service.hpp>
void Inject(std::string dllPath, std::string exePath, std::string launchOptions) {
Builder builder("Custom Injector");
builder.SetDebugLogLevel();
spdlog::info("Game Path: {}", exePath);
spdlog::info("DLL Path: {}", dllPath);
HANDLE hProcess, hThread;
if (!builder.xenon->g_cInjectionService->OpenGame(&hProcess, &hThread, exePath, launchOptions)) {
spdlog::error("Failed to open game process.");
system("pause");
return;
}
builder.xenon->g_cInjectionService->Inject(hProcess, dllPath, InjectionType::LoadLibraryDLL);
Sleep(3000);
ResumeThread(hThread);
CloseHandle(hProcess);
}
int main() {
// Example usage:
Inject("E:\\Projects\\xenon\\example-redmatch2-internal\\build\\example-redmatch2-internal.dll",
"D:\\Steam\\steamapps\\common\\Redmatch 2\\Redmatch 2.exe", "");
//Inject("E:\\Projects\\xenon\\example-amongus-internal\\build\\example-amongus-internal.dll",
// "D:\\Among Us\\Among Us.exe", "");
return 0;
}
配置和定制
Xenon 是高度可定制的。您可以通过 Builder
类配置诸如 ESP、Aimbot 和 Radar 等功能。例如:
std::shared_ptr<AimConfig> pAimConfig = builder.xenonConfig->g_pAimConfig;
pAimConfig->m_fDistanceScale = 0.06f;
pAimConfig->m_nLimitDistance = 100000;
std::shared_ptr<UIConfig> pUIConfig = builder.xenonConfig->g_pUIConfig;
pUIConfig->m_qActions->AddSlider("Distance Scale", &pAimConfig->m_fDistanceScale, 0.001, 2);
Star History
问题
如有任何问题,请在 Issues 中提问,在提问之前请检查问题是否已经存在。
贡献
欢迎贡献!请阅读 CONTRIBUTING.md 文件,了解如何为该项目做出贡献。
许可协议
该项目已获得 MIT 许可。有关详细信息,请参阅 LICENSE 文件。
有关更多信息,请访问 Xenon GitHub 仓库。