添加项目文件。

This commit is contained in:
2200151533
2024-01-22 14:43:11 +08:00
commit 76c8f88a5c
3811 changed files with 1293284 additions and 0 deletions

72
src/Console.cpp Normal file
View File

@ -0,0 +1,72 @@
#include "../pch.h"
#include "../include/Console.hpp"
namespace DX11_Base {
Console::Console()
{
return;
}
void Console::InitializeConsole(const char* ConsoleName)
{
AllocConsole();
g_Handle = GetStdHandle(STD_OUTPUT_HANDLE);
g_hWnd = GetConsoleWindow();
freopen_s(&stream_in, "CONIN$", "r", stdin);
freopen_s(&stream_out, "CONOUT$", "w", stdout);
freopen_s(&stream_error, "CONOUT$", "w", stderr);
SetConsoleTitleA(ConsoleName);
ShowWindow(g_hWnd, SW_SHOW);
return;
}
void Console::printdbg(const char* Text, int Color, ...)
{
SetConsoleTextAttribute(g_Handle, Color);
va_list arg;
va_start(arg, Color);
vfprintf(stream_out, Text, arg);
va_end(arg);
SetConsoleTextAttribute(g_Handle, color.DEFAULT);
return;
}
void Console::scandbg(const char* Text, ...)
{
va_list arg;
va_start(arg, Text);
vfscanf(stream_in, Text, arg);
va_end(arg);
return;
}
void Console::LogEvent(std::string TEXT, bool FLAG)
{
std::string output;
std::string append;
int color;
switch (FLAG) {
case(TRUE):
output = " [ON]\n";
color = g_Console->color.green;
append = TEXT + output;
printdbg(append.c_str(), color);
break;
case(FALSE):
output = " [OFF]\n";
color = g_Console->color.red;
append = TEXT + output;
printdbg(append.c_str(), color);
break;
}
}
void Console::DestroyConsole()
{
fclose(stream_in);
fclose(stream_out);
fclose(stream_error);
DestroyWindow(g_hWnd);
FreeConsole();
return;
}
}

290
src/D3D11Window.cpp Normal file
View File

@ -0,0 +1,290 @@
#include "../pch.h"
#include "../include/D3D11Window.hpp"
IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
float HSV_RAINBOW_SPEED = 0.001;
static float HSV_RAINBOW_HUE = 0;
void SV_RAINBOW(float saturation, float value, float opacity)
{
using namespace DX11_Base;
HSV_RAINBOW_HUE -= HSV_RAINBOW_SPEED;
if (HSV_RAINBOW_HUE < -1.f) HSV_RAINBOW_HUE += 1.f;
for (int i = 0; i < 860; i++)
{
float hue = HSV_RAINBOW_HUE + (1.f / (float)860) * i;
if (hue < 0.f) hue += 1.f;
g_Menu->dbg_RAINBOW = ImColor::HSV(hue, (saturation / 255), (value / 255), (opacity / 255));
}
}
typedef BOOL(WINAPI* hk_SetCursorPos)(int, int);
hk_SetCursorPos origSetCursorPos = NULL;
BOOL WINAPI HOOK_SetCursorPos(int X, int Y)
{
if (DX11_Base::g_GameVariables->m_ShowMenu)
return FALSE;
return origSetCursorPos(X, Y);
}
bool HookCursor()
{
if (MH_CreateHook(&SetCursorPos, &HOOK_SetCursorPos, reinterpret_cast<LPVOID*>(&origSetCursorPos)) != MH_OK)
return FALSE;
if (MH_EnableHook(&SetCursorPos) != MH_OK)
return FALSE;
return TRUE;
}
namespace DX11_Base {
static uint64_t* MethodsTable = NULL;
LRESULT D3D11Window::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (g_GameVariables->m_ShowMenu) {
ImGui_ImplWin32_WndProcHandler((HWND)g_D3D11Window->m_OldWndProc, msg, wParam, lParam);
return TRUE;
}
return CallWindowProc((WNDPROC)g_D3D11Window->m_OldWndProc, hWnd, msg, wParam, lParam);
}
/// <summary>
/// INITIALIZE
/// </summary>
bool D3D11Window::Hook()
{
if (InitHook()) {
CreateHook(8, (void**)&oIDXGISwapChainPresent, HookPresent);
CreateHook(12, (void**)&oID3D11DrawIndexed, MJDrawIndexed);
Sleep(1000);
#if DEBUG
g_Console->printdbg("D3D11Window::Hook Initialized\n", g_Console->color.pink);
#endif
return TRUE;
}
#if DEBUG
g_Console->printdbg("[+] D3D11Window::Hook Failed to Initialize\n", g_Console->color.red);
#endif
return FALSE;
}
bool D3D11Window::CreateHook(uint16_t Index, void** Original, void* Function)
{
assert(Index >= 0 && Original != NULL && Function != NULL);
void* target = (void*)MethodsTable[Index];
if (MH_CreateHook(target, Function, Original) != MH_OK || MH_EnableHook(target) != MH_OK) {
return FALSE;
}
return TRUE;
}
bool D3D11Window::InitHook()
{
if (!InitWindow())
return FALSE;
HMODULE D3D11Module = GetModuleHandleA("d3d11.dll");
D3D_FEATURE_LEVEL FeatureLevel;
const D3D_FEATURE_LEVEL FeatureLevels[] = { D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_11_0 };
DXGI_RATIONAL RefreshRate;
RefreshRate.Numerator = 60;
RefreshRate.Denominator = 1;
DXGI_MODE_DESC BufferDesc;
BufferDesc.Width = 100;
BufferDesc.Height = 100;
BufferDesc.RefreshRate = RefreshRate;
BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
DXGI_SAMPLE_DESC SampleDesc;
SampleDesc.Count = 1;
SampleDesc.Quality = 0;
DXGI_SWAP_CHAIN_DESC SwapChainDesc;
SwapChainDesc.BufferDesc = BufferDesc;
SwapChainDesc.SampleDesc = SampleDesc;
SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
SwapChainDesc.BufferCount = 1;
SwapChainDesc.OutputWindow = WindowHwnd;
SwapChainDesc.Windowed = 1;
SwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
SwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
IDXGISwapChain* SwapChain;
ID3D11Device* Device;
ID3D11DeviceContext* Context;
if (D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, FeatureLevels, 1, D3D11_SDK_VERSION, &SwapChainDesc, &SwapChain, &Device, &FeatureLevel, &Context) < 0)
{
DeleteWindow();
return FALSE;
}
MethodsTable = (uint64_t*)::calloc(205, sizeof(uint64_t));
memcpy(MethodsTable, *(uint64_t**)SwapChain, 18 * sizeof(uint64_t));
memcpy(MethodsTable + 18, *(uint64_t**)Device, 43 * sizeof(uint64_t));
memcpy(MethodsTable + 18 + 43, *(uint64_t**)Context, 144 * sizeof(uint64_t));
Sleep(1000);
// INIT NOTICE
Beep(300, 300);
MH_Initialize();
SwapChain->Release();
SwapChain = NULL;
Device->Release();
Device = NULL;
Context->Release();
Context = NULL;
DeleteWindow();
return TRUE;
}
bool D3D11Window::InitWindow()
{
WindowClass.cbSize = sizeof(WNDCLASSEX);
WindowClass.style = CS_HREDRAW | CS_VREDRAW;
WindowClass.lpfnWndProc = DefWindowProc;
WindowClass.cbClsExtra = 0;
WindowClass.cbWndExtra = 0;
WindowClass.hInstance = GetModuleHandle(NULL);
WindowClass.hIcon = NULL;
WindowClass.hCursor = NULL;
WindowClass.hbrBackground = NULL;
WindowClass.lpszMenuName = NULL;
WindowClass.lpszClassName = L"MJ";
WindowClass.hIconSm = NULL;
RegisterClassEx(&WindowClass);
WindowHwnd = CreateWindow(WindowClass.lpszClassName, L"DX11 Window", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, NULL, NULL, WindowClass.hInstance, NULL);
if (WindowHwnd == NULL) {
return FALSE;
}
#if DEBUG
g_Console->printdbg("D3D11Window::Window Created\n", g_Console->color.pink);
#endif
return TRUE;
}
bool D3D11Window::DeleteWindow()
{
DestroyWindow(WindowHwnd);
UnregisterClass(WindowClass.lpszClassName, WindowClass.hInstance);
if (WindowHwnd != NULL) {
return FALSE;
}
#if DEBUG
g_Console->printdbg("D3D11Window::Window Destroyed\n", g_Console->color.pink);
#endif
return TRUE;
}
bool D3D11Window::Init(IDXGISwapChain* swapChain)
{
if (SUCCEEDED(swapChain->GetDevice(__uuidof(ID3D11Device), (void**)&m_Device))) {
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui::GetIO().WantCaptureMouse || ImGui::GetIO().WantTextInput || ImGui::GetIO().WantCaptureKeyboard;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.IniFilename = NULL;
m_Device->GetImmediateContext(&m_DeviceContext);
DXGI_SWAP_CHAIN_DESC Desc;
swapChain->GetDesc(&Desc);
g_GameVariables->g_GameWindow = Desc.OutputWindow;
ID3D11Texture2D* BackBuffer;
swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&BackBuffer);
m_Device->CreateRenderTargetView(BackBuffer, NULL, &m_RenderTargetView);
BackBuffer->Release();
ImGui_ImplWin32_Init(g_GameVariables->g_GameWindow);
ImGui_ImplDX11_Init(m_Device, m_DeviceContext);
ImGui_ImplDX11_CreateDeviceObjects();
ImGui::GetIO().ImeWindowHandle = g_GameVariables->g_GameWindow;
m_OldWndProc = (WNDPROC)SetWindowLongPtr(g_GameVariables->g_GameWindow, GWLP_WNDPROC, (__int3264)(LONG_PTR)WndProc);
b_ImGui_Initialized = TRUE;
#if DEBUG
g_Console->printdbg("D3D11Window::Swapchain Initialized\n", g_Console->color.pink);
#endif
return 1;
}
b_ImGui_Initialized = FALSE;
return 0;
}
/// <summary>
/// RENDER LOOP
/// </summary>
HRESULT APIENTRY D3D11Window::HookPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
{
if (g_KillSwitch) {
g_Hooking->Unhook();
g_D3D11Window->oIDXGISwapChainPresent(pSwapChain, SyncInterval, Flags);
g_Running = FALSE;
return 0;
}
g_D3D11Window->Overlay(pSwapChain);
return g_D3D11Window->oIDXGISwapChainPresent(pSwapChain, SyncInterval, Flags);
}
void APIENTRY D3D11Window::MJDrawIndexed(ID3D11DeviceContext* pContext, UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation) {
return;
}
void D3D11Window::Overlay(IDXGISwapChain* pSwapChain)
{
if (!b_ImGui_Initialized)
Init(pSwapChain);
SV_RAINBOW(169, 169, 200);
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
ImGui::GetIO().MouseDrawCursor = g_GameVariables->m_ShowMenu;
// Render Menu Loop
g_Menu->Draw();
//͸<><CDB8>
ESP();
ImGui::EndFrame();
ImGui::Render();
m_DeviceContext->OMSetRenderTargets(1, &m_RenderTargetView, NULL);
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
}
/// <summary>
/// UNHOOK
/// </summary>
void D3D11Window::Unhook()
{
SetWindowLongPtr(g_GameVariables->g_GameWindow, GWLP_WNDPROC, (LONG_PTR)m_OldWndProc);
DisableAll();
return;
}
void D3D11Window::DisableHook(uint16_t Index)
{
assert(Index >= 0);
MH_DisableHook((void*)MethodsTable[Index]);
return;
}
void D3D11Window::DisableAll()
{
DisableHook(8);
DisableHook(12);
free(MethodsTable);
MethodsTable = NULL;
return;
}
D3D11Window::~D3D11Window()
{
Unhook();
}
}

47
src/Game.cpp Normal file
View File

@ -0,0 +1,47 @@
#include "../pch.h"
#include "../include/Game.hpp"
namespace DX11_Base {
GameData::GameData()
{
#if DEBUG
g_Console->printdbg("GameData::Initialized\n", g_Console->color.pink);
#endif
return;
}
GameVariables::GameVariables()
{
#if DEBUG
g_Console->printdbg("GameVariables::Initialized\n", g_Console->color.pink);
#endif
return;
}
// Get Process Window Information
void GameVariables::Init()
{
g_GamePid = GetCurrentProcessId();
g_GameHandle = GetCurrentProcess();
g_GameWindow = GetForegroundWindow();
RECT tempRECT;
GetWindowRect(g_GameWindow, &tempRECT);
g_GameWidth = tempRECT.right - tempRECT.left;
g_GameHeight = tempRECT.bottom - tempRECT.top;
char tempTitle[MAX_PATH];
GetWindowTextA(g_GameWindow, tempTitle, sizeof(tempTitle));
g_GameTitle = tempTitle;
char tempClassName[MAX_PATH];
GetClassNameA(g_GameWindow, tempClassName, sizeof(tempClassName));
g_ClassName = tempClassName;
char tempPath[MAX_PATH];
GetModuleFileNameExA(g_GameHandle, NULL, tempPath, sizeof(tempPath));
g_GamePath = tempPath;
#if DEBUG
g_Console->printdbg("GameData::Init - Process Window Info Established\n", g_Console->color.pink);
#endif
}
}

38
src/Hooking.cpp Normal file
View File

@ -0,0 +1,38 @@
#include "../pch.h"
#include "../include/Hooking.hpp"
namespace DX11_Base {
Hooking::Hooking()
{
MH_Initialize();
#if DEBUG
g_Console->printdbg("Hooking::Initialized\n", g_Console->color.pink);
#endif
return;
}
Hooking::~Hooking()
{
MH_RemoveHook(MH_ALL_HOOKS);
}
void Hooking::Hook()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>HOOK
g_GameVariables->Init();
g_D3D11Window->Hook();
Config.Init();
MH_EnableHook(MH_ALL_HOOKS);
#if DEBUG
g_Console->printdbg("Hooking::Hook Initialized\n", g_Console->color.pink);
#endif
return;
}
void Hooking::Unhook()
{
g_D3D11Window->Unhook();
MH_RemoveHook(MH_ALL_HOOKS);
g_Console->DestroyConsole();
return;
}
}

250
src/Menu.cpp Normal file
View File

@ -0,0 +1,250 @@
#include "../pch.h"
#include "../include/Menu.hpp"
#include "SDK.hpp"
#include "config.h"
void ExploitFly(bool IsFly)
{
SDK::APalPlayerCharacter* p_appc = Config.GetPalPlayerCharacter();
if (p_appc != NULL)
{
if (IsFly)
{
if (Config.GetPalPlayerCharacter()->GetPalPlayerController() != NULL)
{
Config.GetPalPlayerCharacter()->GetPalPlayerController()->StartFlyToServer();
}
}
else
{
if (Config.GetPalPlayerCharacter()->GetPalPlayerController() != NULL)
{
Config.GetPalPlayerCharacter()->GetPalPlayerController()->EndFlyToServer();
}
}
}
}
namespace DX11_Base {
namespace Styles {
void InitStyle()
{
ImGuiStyle& style = ImGui::GetStyle();
ImVec4* colors = ImGui::GetStyle().Colors;
// STYLE PROPERTIES
style.WindowTitleAlign = ImVec2(0.5f, 0.5f);
// Base ImGui Styling , Aplying a custyom style is left up to you.
ImGui::StyleColorsClassic();
/// EXAMPLE COLOR
//colors[ImGuiCol_FrameBg] = ImVec4(0, 0, 0, 0);
// COLORS
if (g_Menu->dbg_RAINBOW_THEME) {
// RGB MODE STLYE PROPERTIES
colors[ImGuiCol_Separator] = ImVec4(g_Menu->dbg_RAINBOW);
colors[ImGuiCol_TitleBg] = ImVec4(0, 0, 0, 1.0f);
colors[ImGuiCol_TitleBgActive] = ImVec4(0, 0, 0, 1.0f);
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0, 0, 0, 1.0f);
}
else {
/// YOUR DEFAULT STYLE PROPERTIES HERE
}
}
}
namespace Tabs {
void TABPlayer()
{
//<2F>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
ImGui::Checkbox("SpeedHack", &Config.IsSpeedHack);
ImGui::Checkbox("AttackHack", &Config.IsAttackModiler);
ImGui::Checkbox("DefenseHack", &Config.IsDefuseModiler);
ImGui::Checkbox("InfStamina", &Config.IsInfStamina);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
ImGui::SliderFloat("SpeedModifilers", &Config.SpeedModiflers, 1, 10);
ImGui::SliderInt("AttackModifilers", &Config.DamageUp, 0, 200000);
ImGui::SliderInt("defenseModifilers", &Config.DefuseUp, 0, 200000);
//<2F><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
if (ImGui::Button("PrintPlayerAddr", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20)))
{
SDK::APalPlayerCharacter* p_appc = Config.GetPalPlayerCharacter();
if (p_appc != NULL)
{
g_Console->printdbg("\n\n[+] APalPlayerCharacter: %x [+]\n\n", g_Console->color.green, p_appc);
}
}
}
void TABExploit()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD>õİ<C3B5>
//Config.GetPalPlayerCharacter()->GetPalPlayerController()->GetPalPlayerState()->RequestSpawnMonsterForPlayer(name, 5, 1);
if (ImGui::Button("ExploitFly", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20)))
{
ExploitFly(true);
}
if (ImGui::Button("DisableFly", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20)))
{
ExploitFly(false);
}
if (ImGui::Button("Respawn", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20)))
{
SDK::APalPlayerCharacter* p_appc = Config.GetPalPlayerCharacter();
if (p_appc != NULL)
{
if (Config.GetPalPlayerCharacter()->GetPalPlayerController() != NULL)
{
Config.GetPalPlayerCharacter()->GetPalPlayerController()->GetPalPlayerState()->RequestRespawn();
}
}
}
if (ImGui::Button("DeleteSelf", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20)))
{
SDK::APalPlayerCharacter* p_appc = Config.GetPalPlayerCharacter();
if (p_appc != NULL)
{
if (Config.GetPalPlayerCharacter()->GetPalPlayerController() != NULL)
{
Config.GetPalPlayerCharacter()->GetPalPlayerController()->GetPalPlayerState()->Debug_RequestDeletePlayerSelf_ToServer();
}
}
}
}
void TABConfig()
{
ImGui::Text("PalWorld Menu");
ImGui::Text("VERSION: v1.0");
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
if (ImGui::Button("UNHOOK DLL", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20))) {
#if DEBUG
g_Console->printdbg("\n\n[+] UNHOOK INITIALIZED [+]\n\n", g_Console->color.red);
#endif
g_KillSwitch = TRUE;
}
}
}
void Menu::Draw()
{
if (g_GameVariables->m_ShowMenu)
MainMenu();
if (g_GameVariables->m_ShowHud)
HUD(&g_GameVariables->m_ShowHud);
if (g_GameVariables->m_ShowDemo)
ImGui::ShowDemoWindow();
}
void Menu::MainMenu()
{
if (!g_GameVariables->m_ShowDemo)
Styles::InitStyle();
if (g_Menu->dbg_RAINBOW_THEME) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(g_Menu->dbg_RAINBOW));
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(g_Menu->dbg_RAINBOW));
ImGui::PushStyleColor(ImGuiCol_BorderShadow, ImVec4(g_Menu->dbg_RAINBOW));
}
if (!ImGui::Begin("PalWorld", &g_GameVariables->m_ShowMenu, 96))
{
ImGui::End();
return;
}
if (g_Menu->dbg_RAINBOW_THEME) {
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
}
// Display Menu Content
//Tabs::TABMain();
ImGui::Text("Testing some case...");
if (ImGui::BeginTabBar("##tabs", ImGuiTabBarFlags_None))
{
if (ImGui::BeginTabItem("Player"))
{
Tabs::TABPlayer();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("EXPLOIT"))
{
Tabs::TABExploit();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("CONFIG"))
{
Tabs::TABConfig();
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
ImGui::End();
}
void Menu::HUD(bool* p_open)
{
}
void Menu::Loops()
{
if (Config.IsSpeedHack)
{
if (Config.GetUWorld()
|| Config.GetUWorld()->PersistentLevel
|| Config.GetUWorld()->PersistentLevel->WorldSettings)
{
Config.GetUWorld()->PersistentLevel->WorldSettings->TimeDilation = Config.SpeedModiflers;
}
}
if (Config.IsAttackModiler)
{
if (Config.GetPalPlayerCharacter() != NULL && Config.GetPalPlayerCharacter()->CharacterParameterComponent->AttackUp != Config.DamageUp)
{
if (Config.GetPalPlayerCharacter()->CharacterParameterComponent != NULL)
{
Config.GetPalPlayerCharacter()->CharacterParameterComponent->AttackUp = Config.DamageUp;
}
}
}
if (Config.IsDefuseModiler)
{
if (Config.GetPalPlayerCharacter() != NULL && Config.GetPalPlayerCharacter()->CharacterParameterComponent->DefenseUp != Config.DefuseUp)
{
if (Config.GetPalPlayerCharacter()->CharacterParameterComponent != NULL)
{
Config.GetPalPlayerCharacter()->CharacterParameterComponent->DefenseUp = Config.DefuseUp;
}
}
}
if (Config.IsInfStamina)
{
if (Config.GetPalPlayerCharacter() != NULL)
{
if (Config.GetPalPlayerCharacter()->CharacterParameterComponent != NULL)
{
Config.GetPalPlayerCharacter()->CharacterParameterComponent->SP.Value = 9999;
}
}
}
}
}