Files
2026-04-22 07:21:43 +02:00

67 lines
1.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "framework.h"
// asset path for the custom event map.
static const wchar_t* CustomMapPath = L"/Game/Apfel/Maps/CustomEvent";
DWORD InputThread(LPVOID)
{
while (true)
{
if (GetAsyncKeyState(VK_F6) & 0x01)
{
UKismetSystemLibrary::ExecuteConsoleCommand(UWorld::GetWorld(), L"startaircraft", nullptr);
}
// F7 manually force-start the live event
if (GetAsyncKeyState(VK_F7) & 0x01)
{
EventHandler::BeginEvent();
}
}
}
DWORD Initialize(LPVOID)
{
AllocConsole();
FILE* File;
freopen_s(&File, "CONOUT$", "w+", stdout);
MH_Initialize();
Sleep(5000);
TArray<ULocalPlayer*>& LocalPlayers = UWorld::GetWorld()->OwningGameInstance->LocalPlayers;
LocalPlayers[0]->PlayerController->SwitchLevel(CustomMapPath);
LocalPlayers.Remove(0);
LocalPlayers.Free();
for (uintptr_t ByteOffset : GOffsets::BytesToPatch)
{
Memory::PatchByte(ByteOffset);
}
*(bool*)Memory::GetAddress(GOffsets::GIsClient) = false;
Hooks::Server::Initialize();
Hooks::GameMode::Initialize();
Hooks::PlayerController::Initialize();
Hooks::Pawn::Initialize();
Hooks::Abilities::Initialize();
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved)
{
switch (ulReason)
{
case DLL_PROCESS_ATTACH:
CreateThread(0, 0, Initialize, 0, 0, 0);
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}