Files
ReshadePluginsCore/BlackMythWukong/dllmain.cpp

462 lines
22 KiB
C++
Raw Normal View History

2026-02-19 21:49:47 +01:00
#include "CommonHeaders.h"
#include "UEngine.hpp"
#include "UETools.hpp"
#include "UEvars.hpp"
#include "Logger.hpp"
#include "SDK/Basic.hpp"
#include "SDK/Engine_classes.hpp"
#include "SDK/b1_classes.hpp"
#include "SDK/b1_Managed_classes.hpp"
using namespace SDK;
// Constants
const std::string PLUGIN_NAME = "BlackMythWukong";
const std::string PLUGIN_LOG = PLUGIN_NAME + ".log";
constexpr ULONGLONG DEFAULT_ACTORS_SCAN_BETWEEN_TICKS = 100; // Used for enemies time dilation
// Logger
std::shared_ptr<spdlog::logger> logger;
// Screen informations
static int screenWidth = GetSystemMetrics(SM_CXSCREEN);
static int screenHeight = GetSystemMetrics(SM_CYSCREEN);
static float aspectRatio = (float)screenWidth / screenHeight;
float baseAspect = 1.777778f;
// Plugin states
static bool AOBScanDone = false;
static bool g_Console = false;
static bool g_fix_enabled = false;
static bool g_fov_fix_enabled = false;
static bool g_camera_fix_enabled = false;
static bool g_ultrawide_fix_enabled = false;
static bool g_DOF_fix_enabled = false;
static bool g_sharpening_fix_enabled = false;
static bool g_HUD_fix_enabled = false;
static bool g_Vignetting_fix_enabled = false;
static bool g_Fog_fix_enabled = false;
static bool g_TimeDilation_fix_enabled = false;
static bool g_GodMode_fix_enabled = false;
static bool g_Stamina_fix_enabled = false;
static bool g_Mana_fix_enabled = false;
static int g_AdditionalFOVValue = 0;
static float g_cameraDistanceMultiplier = 1.f;
static float g_Sharpening = 3.22f;
static float g_WorldTimeDilationValue = 1.f;
static float g_AITimeDilationValue = 1.f;
static int g_HUDOffsets = 0;
2026-02-20 10:45:11 +01:00
static float g_Health = 0.f;
static float g_Stamina = 0.f;
static float g_Mana = 0.f;
2026-02-19 21:49:47 +01:00
static bool user_inputs_logged = false;
// Shared values
static float g_FOV_In = 79.8f;
static float g_FOV_Out = 79.8f;
static float g_Camera_In = 720;
static float g_Camera_Out = 720;
// AOB Scan pointers
static uint8_t* FOVaddress = nullptr;
static uint8_t* Cameraaddress = nullptr;
static uint8_t* DOFaddress = nullptr;
static uint8_t* Sharpeningaddress = nullptr;
static uint8_t* Vignettingaddress = nullptr;
static uint8_t* Fogaddress1 = nullptr;
static uint8_t* Fogaddress2 = nullptr;
static uint8_t* WorldTimedilationaddress = nullptr;
static uint8_t* Timedilationaddress = nullptr;
// Hooking
static SafetyHookMid FOVHook{};
static SafetyHookMid CameraHook{};
static SafetyHookMid SharpeningHook{};
static SafetyHookMid PEHook{};
static SafetyHookMid WorldTimeDilationHook{};
static SafetyHookMid TimeDilationHook{};
// Prototypes
static void FOVFixEnabled();
static void CameraFixEnabled();
static void UltraWideFixEnabled();
static void SharpeningFixEnabled();
static void HUDFixEnabled(UUserWidget* widget, bool writeLog);
static void LogHUD(GameFixes fix);
static void DOFFixEnabled();
static void CAFixEnabled();
static void VignettingFixEnabled();
static void FogFixEnabled();
static void EnableConsole();
static void EnableCheats(Cheat cheat);
static void ProcessEvent();
static UUserWidget* g_HUD = nullptr;
extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init) {
g_fix_enabled = enabled;
if (!AOBScanDone) { // Unreal Engine 5.0.0
logger->info("--------------- AOB scan started ---------------");
constexpr auto FOVStringObfuscated = make_obfuscated<0x83>("EB ?? F3 0F 10 ?? ?? ?? ?? ?? F3 0F 11 ?? ?? 0F ?? ?? 8B 83");
constexpr auto CameraStringObfuscated = make_obfuscated<0x59>("0F ?? ?? 0F ?? ?? 0F ?? ?? F2 0F ?? ?? F2 0F 59 ?? ?? F2 0F 59 ?? ?? F2 0F ?? ?? F2 0F 10 ?? ?? ?? F2 0F ?? ?? F2 0F 11");
constexpr auto DOFStringObfuscated = make_obfuscated<0x45>("8B ?? ?? E8 ?? ?? ?? ?? 48 ?? ?? 48 6B ?? ?? 48 8D 0D");
constexpr auto SharpeningStringObfuscated = make_obfuscated<0x45>("F3 44 0F ?? ?? ?? 44 0F ?? ?? 73 ?? 45 0F ?? ?? EB ?? F3 44 0F ?? ?? ?? ?? ?? ?? F3 41");
constexpr auto VignettingStringObfuscated = make_obfuscated<0x7D>("8B ?? 83 ?? ?? 7D ?? 89 B3 ?? ?? ?? ?? EB");
constexpr auto Fog1StringObfuscated = make_obfuscated<0xF7>("48 83 ?? ?? E8 ?? ?? ?? ?? F7 44 24 ?? ?? ?? ?? ?? 74");
constexpr auto Fog2StringObfuscated = make_obfuscated<0xF7>("48 8D ?? ?? 48 8D ?? ?? ?? E8 ?? ?? ?? ?? F7 44 24 ?? ?? ?? ?? ?? 74");
constexpr auto WorldTimeDilationStringObfuscated = make_obfuscated<0x59>("F3 0F 10 81 ?? ?? ?? ?? F3 0F 59 ?? ?? ?? ?? ?? F3 0F 59 ?? ?? ?? ?? ?? C3");
constexpr auto TimeDilationStringObfuscated = make_obfuscated<0x59>("F3 0F ?? ?? ?? ?? ?? ?? EB ?? F3 0F ?? ?? ?? ?? ?? ?? 48 8B ?? ?? 4C ?? ?? F3 0F ?? ?? 44");
using AOBScan::Make;
using OffsetScan::Make;
// Prepare all data for scanning
std::vector<AOBScanEntry> signatures = {
Make(&FOVaddress, FOVStringObfuscated, "FOV"),
Make(&Cameraaddress, CameraStringObfuscated, "Camera distance"),
Make(&DOFaddress, DOFStringObfuscated, "Depth of field"),
Make(&Sharpeningaddress, SharpeningStringObfuscated, "Sharpening"),
Make(&Vignettingaddress, VignettingStringObfuscated, "Vignetting"),
Make(&Fogaddress1, Fog1StringObfuscated, "Fog"),
Make(&Fogaddress2, Fog2StringObfuscated, "Fog"),
Make(&WorldTimedilationaddress, WorldTimeDilationStringObfuscated, "World time dilation"),
Make(&Timedilationaddress, TimeDilationStringObfuscated, "Actor time dilation")
};
// Scan all signature in a batch
Memory::AOBScanBatch(signatures, logger);
if (FOVaddress && Cameraaddress && Sharpeningaddress && Vignettingaddress && Fogaddress1 && Fogaddress2 && WorldTimedilationaddress && Timedilationaddress)
logger->info("All AOB signatures found. Ready to patch...");
if (!GObjectsaddress || !AppendStringaddress || !ProcessEventaddress) {
logger->info("------------ UEngine offsets search ------------");
uint8_t* baseModule = reinterpret_cast<uint8_t*>(GetModuleHandleA(nullptr)); // Get game base address
constexpr auto GObjetcsStringObfuscated = make_obfuscated<0x8D>("48 8B ?? ?? ?? ?? ?? 48 8B ?? ?? 4C 8D ?? ?? EB ?? 4C");
constexpr auto GWorldStringObfuscated = make_obfuscated<0x83>("48 8B 05 ?? ?? ?? ?? 48 8D 95 ?? ?? ?? ?? 48 8B ?? ?? 48 89 8D ?? ?? ?? ?? 48 8D 8D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 9D ?? ?? ?? ?? 48 8D 8D");
constexpr auto AppendStringStringObfuscated = make_obfuscated<0x80>("48 89 ?? ?? ?? 57 48 83 ?? ?? 80 3D ?? ?? ?? ?? ?? 48 ?? ?? 48 ?? ?? 74 ?? 4C 8D 05 ?? ?? ?? ?? EB ?? 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 4C ?? ?? C6 05 ?? ?? ?? ?? ?? 8B ?? 8B ?? 0F ?? ?? C1 ?? ?? 89 4C ?? ?? 89 54 ?? ?? 48 8B ?? ?? ?? 48 C1 ?? ?? 8D ?? ?? 49 03 ?? ?? ?? 48 ?? ?? E8 ?? ?? ?? ?? 83");
constexpr auto ProcessEventStringObfuscated = make_obfuscated<0x56>("40 ?? 56 57 41 ?? 41 ?? 41 ?? 41 ?? 48 81 ?? ?? ?? ?? ?? 48 8D ?? ?? ?? 48 89 ?? ?? ?? ?? ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 48 89 ?? ?? ?? ?? ?? 4D");
// Prepare all data for scanning
std::vector<OffsetScanEntry> UEoffsetsScans = {
Make(&GObjectsaddress, GObjetcsStringObfuscated, "GObjects", OffsetCalcType::GetOffsetFromOpcode, &Offsets::GObjects, 0x3),
Make(&GWorldaddress, GWorldStringObfuscated, "GWorld", OffsetCalcType::GetOffsetFromOpcode, &Offsets::GWorld, 0x3),
Make(&AppendStringaddress, AppendStringStringObfuscated, "AppendString", OffsetCalcType::UE_CalculateOffset, &Offsets::AppendString),
Make(&ProcessEventaddress, ProcessEventStringObfuscated, "ProcessEvent", OffsetCalcType::UE_CalculateOffset, &Offsets::ProcessEvent)
};
// Retrieve all Unreal Engine offsets in a batch
Memory::OffsetScanBatch(UEoffsetsScans, baseModule, logger, "");
}
logger->info("-------------- Fixes initialisation -------------");
AOBScanDone = true;
}
if (!init && FOVaddress) FOVFixEnabled();
if (!init && FOVaddress) UltraWideFixEnabled();
if (!init && Cameraaddress) CameraFixEnabled();
if (!init && DOFaddress) DOFFixEnabled();
if (!init && Sharpeningaddress) SharpeningFixEnabled();
if (!init && Vignettingaddress) VignettingFixEnabled();
if (!init && Fogaddress1 && Fogaddress2) FogFixEnabled();
if (!init) HUDFixEnabled(g_HUD, true);
if (!init && WorldTimedilationaddress) {
EnableCheats(Cheat::TimeDilation);
EnableCheats(Cheat::GodMode);
EnableCheats(Cheat::Stamina);
EnableCheats(Cheat::Mana);
}
ProcessEvent();
}
// Setters for Reshade addon call
extern "C" __declspec(dllexport) void SetFixesEnabled(GameFixes fix, bool enabled) { // Set each fix individually
if (fix == GameFixes::DevConsole) { g_Console = enabled; EnableConsole(); }
if (fix == GameFixes::FOV) { g_fov_fix_enabled = enabled; FOVFixEnabled(); }
if (fix == GameFixes::Camera) { g_camera_fix_enabled = enabled; CameraFixEnabled(); }
if (fix == GameFixes::HUD) { g_HUD_fix_enabled = enabled; HUDFixEnabled(g_HUD, true); }
if (fix == GameFixes::UltraWide) { g_ultrawide_fix_enabled = enabled; UltraWideFixEnabled(); }
if (fix == GameFixes::DOF) { g_DOF_fix_enabled = enabled; DOFFixEnabled(); }
if (fix == GameFixes::Vignetting) { g_Vignetting_fix_enabled = enabled; VignettingFixEnabled(); }
if (fix == GameFixes::Sharpening) { g_sharpening_fix_enabled = enabled; SharpeningFixEnabled(); }
if (fix == GameFixes::Fog) { g_Fog_fix_enabled = enabled; FogFixEnabled(); }
if (fix == GameFixes::TimeDilation) { g_TimeDilation_fix_enabled = enabled; EnableCheats(Cheat::TimeDilation); }
if (fix == GameFixes::GodMode) { g_GodMode_fix_enabled = enabled; EnableCheats(Cheat::GodMode); }
if (fix == GameFixes::Stamina) { g_Stamina_fix_enabled = enabled; EnableCheats(Cheat::Stamina); }
if (fix == GameFixes::Mana) { g_Mana_fix_enabled = enabled; EnableCheats(Cheat::Mana); }
}
extern "C" __declspec(dllexport) void SetValues(GameSetting setting, float value) {
if (setting == GameSetting::FOV) g_AdditionalFOVValue = (int)(value);
if (setting == GameSetting::CameraDistance) g_cameraDistanceMultiplier = value;
if (setting == GameSetting::Sharpening) g_Sharpening = value;
if (setting == GameSetting::WorldTimeDilation) g_WorldTimeDilationValue = value;
if (setting == GameSetting::AITimeDilation)
g_AITimeDilationValue = value;
if (setting == GameSetting::HUD) {
g_HUDOffsets = ((int)value * screenWidth) / 100;
HUDFixEnabled(g_HUD, false);
}
}
// Getters for Reshade addon call
extern "C" __declspec(dllexport) void GetGameInfos(GameInfos* infos) {
if (!infos) return;
infos->FOVIn = g_FOV_In;
infos->FOVOut = g_FOV_Out;
infos->cameraIn = g_Camera_In;
infos->cameraOut = g_Camera_Out;
2026-02-20 10:45:11 +01:00
infos->Health = g_Health;
infos->Stamina = g_Stamina;
infos->Mana = g_Mana;
2026-02-19 21:49:47 +01:00
infos->consoleEnabled = g_Console_Enabled;
}
// Hook injections
static void ProcessEvent() {
if (!PEHook && ProcessEventaddress) {
PEHook = safetyhook::create_mid(ProcessEventaddress,
[](SafetyHookContext& ctx) {
UObject* object = (UObject*)ctx.rcx;
UFunction* func = (UFunction*)ctx.rdx;
if (object && func) {
std::string funcName = func->GetName();
std::string objectName = object->GetName();
if (funcName == "Construct") {
if (objectName.contains("BUI_BattleMain_C")) g_HUD = (UUserWidget*)object;
HUDFixEnabled(g_HUD, false);
}
if (funcName == "Destruct") {
if (objectName.contains("BUI_BattleMain_C")) g_HUD = nullptr;
}
}
});
}
}
static void FOVFixEnabled() {
if (g_fix_enabled && g_fov_fix_enabled && FOVaddress) {
if (!FOVHook) { // Hook only once
FOVHook = safetyhook::create_mid(FOVaddress + 0xa,
[](SafetyHookContext& ctx) {
g_FOV_In = ctx.xmm0.f32[0];
ctx.xmm0.f32[0] += (g_fix_enabled && g_fov_fix_enabled ? g_AdditionalFOVValue : 0);
g_FOV_Out = ctx.xmm0.f32[0];
});
}
}
logger->info("FOV fix {}", g_fov_fix_enabled ? "enabled" : "disabled");
}
static void CameraFixEnabled() {
if (g_fix_enabled && g_camera_fix_enabled && Cameraaddress) {
if (!CameraHook) { // Hook only once
CameraHook = safetyhook::create_mid(Cameraaddress,
[](SafetyHookContext& ctx) {
g_Camera_In = ctx.xmm1.f32[0];
ctx.xmm1.f32[0] *= g_cameraDistanceMultiplier;
g_Camera_Out = ctx.xmm1.f32[0];
});
}
else CameraHook.enable();
}
if (!(g_fix_enabled && g_camera_fix_enabled) && Cameraaddress && CameraHook)
CameraHook.disable();
if (Cameraaddress)
logger->info("Camera distance fix {}", g_fix_enabled && g_camera_fix_enabled ? "enabled" : "disabled");
}
static void SharpeningFixEnabled() {
if (g_fix_enabled && g_sharpening_fix_enabled && Sharpeningaddress) {
if (!SharpeningHook) { // Hook only once
SharpeningHook = safetyhook::create_mid(Sharpeningaddress + 0x1b,
[](SafetyHookContext& ctx) {
ctx.xmm12.f32[0] = g_Sharpening;
});
}
else SharpeningHook.enable();
}
if (!(g_fix_enabled && g_sharpening_fix_enabled) && Sharpeningaddress && SharpeningHook)
SharpeningHook.disable();
if (Sharpeningaddress)
logger->info("Sharpening fix {}", g_fix_enabled && g_sharpening_fix_enabled ? "enabled" : "disabled");
}
void ApplyHUDUltraWide(UUserWidget* widget, float spacing) {
if (!widget || !widget->Class || !widget->WidgetTree) return;
UWidget* root = widget->WidgetTree->RootWidget;
if (!root || !root->IsA(UCanvasPanel::StaticClass())) return;
UCanvasPanel* canvas = (UCanvasPanel*)root;
for (int i = 0; i < canvas->GetChildrenCount(); ++i) {
UWidget* child = canvas->GetChildAt(i);
if (!child || !child->Slot) continue;
if (!child->Slot->IsA(UCanvasPanelSlot::StaticClass())) continue;
auto* slot = (UCanvasPanelSlot*)child->Slot;
auto anchors = slot->GetAnchors();
FMargin offsets = slot->GetOffsets();
// Left anchor
if (anchors.Minimum.X == 0.f && anchors.Maximum.X == 0.f)
offsets.Left = spacing;
// Right anchor
else if (anchors.Minimum.X == 1.f && anchors.Maximum.X == 1.f)
offsets.Left = -spacing;
// Horizontal stretch anchor (0 → 1)
else if (anchors.Minimum.X == 0.f && anchors.Maximum.X == 1.f) {
offsets.Left = spacing;
offsets.Right = spacing;
}
slot->SetOffsets(offsets);
}
}
// HUD fix hook UUserWidget -> AddToViewPort to log and know which HUD widget will be targeted
static void HUDFixEnabled(UUserWidget* widget, bool writeLog) {
float targetOffset = g_fix_enabled && g_HUD_fix_enabled ? g_HUDOffsets : 0.f;
ApplyHUDUltraWide(widget, targetOffset);
if (writeLog) logger->info("HUD fix {}", g_fix_enabled && g_HUD_fix_enabled ? "enabled" : "disabled");
}
// Cheats
static UWorld* LastWorld = nullptr;
static ULONGLONG lastScanTick = 0; // Last time Actors were scanned for enemies time dilation
static void EnableCheats(Cheat cheat) {
if (WorldTimedilationaddress && !WorldTimeDilationHook) {
WorldTimeDilationHook = safetyhook::create_mid(WorldTimedilationaddress + 0x10,
[](SafetyHookContext& ctx) {
// From AWorldSettings retrieved from world->K2_GetWorldSettings()
ctx.xmm0.f32[0] *= g_TimeDilation_fix_enabled ? g_WorldTimeDilationValue : 1.f;
ULONGLONG now = GetTickCount64();
if (now - lastScanTick < DEFAULT_ACTORS_SCAN_BETWEEN_TICKS) return;
lastScanTick = now;
// Get player pawn
APawn* playerPawn = GetPawnFromWorld();
if (playerPawn && playerPawn->Class) {
2026-02-20 10:45:11 +01:00
// Retrieve current values for UI Reshade addon
g_Health = UBGUFunctionLibraryCS::GetAttrValue(playerPawn, EBGUAttrFloat::Hp);
g_Stamina = UBGUFunctionLibraryCS::GetAttrValue(playerPawn, EBGUAttrFloat::Stamina);
g_Mana = UBGUFunctionLibraryCS::GetAttrValue(playerPawn, EBGUAttrFloat::Mp);
2026-02-19 21:49:47 +01:00
if (g_GodMode_fix_enabled) { // God mode cheat
float maxHp = UBGUFunctionLibraryCS::GetAttrValue(playerPawn,EBGUAttrFloat::HpMax);
UBGUFunctionLibraryCS::BGUSetAttrValue(playerPawn, EBGUAttrFloat::Hp, maxHp);
}
if (g_Stamina_fix_enabled) { // Stamina cheat
float maxStamina = UBGUFunctionLibraryCS::GetAttrValue(playerPawn, EBGUAttrFloat::StaminaMax);
UBGUFunctionLibraryCS::BGUSetAttrValue(playerPawn, EBGUAttrFloat::Stamina, maxStamina);
}
if (g_Mana_fix_enabled) { // Mana cheat
float maxMana = UBGUFunctionLibraryCS::GetAttrValue(playerPawn, EBGUAttrFloat::MpMax);
UBGUFunctionLibraryCS::BGUSetAttrValue(playerPawn, EBGUAttrFloat::Mp, maxMana);
}
}
});
}
// Enemies time dilation
if (Timedilationaddress && !TimeDilationHook) {
TimeDilationHook = safetyhook::create_mid(Timedilationaddress,
[](SafetyHookContext& ctx) {
if (!ctx.rbx) return;
UObject* object = (UObject*)ctx.rbx;
if (!object || !object->Class) return;
if (object->IsA(ABGUCharacter::StaticClass())) {
ABGUCharacter* character = static_cast<ABGUCharacter*>(object);
if (character->Controller && character->Controller->IsA(AAIController::StaticClass())) {
AActor* enemy = static_cast<AActor*>(character);
if (enemy)
enemy->CustomTimeDilation = g_TimeDilation_fix_enabled ? g_AITimeDilationValue : 1.f;
}
}
});
}
if (cheat == Cheat::TimeDilation) logger->info("Time dilation cheat {}", g_TimeDilation_fix_enabled ? "enabled" : "disabled");
if (cheat == Cheat::GodMode) logger->info("God mode cheat {}", g_GodMode_fix_enabled ? "enabled" : "disabled");
if (cheat == Cheat::Stamina) logger->info("Stamina cheat {}", g_Stamina_fix_enabled ? "enabled" : "disabled");
if (cheat == Cheat::Mana) logger->info("Mana cheat {}", g_Mana_fix_enabled ? "enabled" : "disabled");
}
// Memory patch fixes
static void UltraWideFixEnabled() {
if (g_fix_enabled && g_ultrawide_fix_enabled && FOVaddress)
Memory::PatchBytes(FOVaddress + 0x1b, "\x31\xC9\x90\x90\x90\x90\x90", 7); // bConstrainAspectRatio = 0
if (!(g_fix_enabled && g_ultrawide_fix_enabled) && FOVaddress)
Memory::RestoreBytes(FOVaddress + 0x1b);
if (FOVaddress)
logger->info("Ultrawide fix {}", g_fix_enabled && g_ultrawide_fix_enabled ? "enabled" : "disabled");
}
static void DOFFixEnabled() {
if (g_fix_enabled && g_DOF_fix_enabled && DOFaddress)
Memory::PatchBytes(DOFaddress, "\x31\xFF\x90", 3); // xor edi,edi r.DepthOfFieldQuality = 0
if (!(g_fix_enabled && g_DOF_fix_enabled) && DOFaddress)
Memory::RestoreBytes(DOFaddress);
if (DOFaddress)
logger->info("Depth of field fix {}", g_fix_enabled && g_DOF_fix_enabled ? "enabled" : "disabled");
}
static void VignettingFixEnabled() {
if (g_fix_enabled && g_Vignetting_fix_enabled && Vignettingaddress)
Memory::PatchBytes(Vignettingaddress, "\x31\xC9", 2); // xor ecx,ecx r.Tonemapper.Quality=0
if (!(g_fix_enabled && g_Vignetting_fix_enabled) && Vignettingaddress)
Memory::RestoreBytes(Vignettingaddress);
if (Vignettingaddress)
logger->info("Vignetting fix {}", g_fix_enabled && g_Vignetting_fix_enabled ? "enabled" : "disabled");
}
static void FogFixEnabled() {
if (g_fix_enabled && g_Fog_fix_enabled && Fogaddress1 && Fogaddress2) {
Memory::PatchBytes(Fogaddress1 + 0x11, "\xEB", 1); // r.Fog = 0
Memory::PatchBytes(Fogaddress2 + 0x16, "\xEB", 1); // r.Fog = 0
}
if (!(g_fix_enabled && g_Fog_fix_enabled) && Fogaddress1 && Fogaddress2) {
Memory::RestoreBytes(Fogaddress1 + 0x11);
Memory::RestoreBytes(Fogaddress2 + 0x16);
}
if (Fogaddress1 && Fogaddress2)
logger->info("Fog fix {}", g_fix_enabled && g_Fog_fix_enabled ? "enabled" : "disabled");
}
// UE Console creation
static void EnableConsole() {
if (g_Console_Enabled || !g_Console || !GObjectsaddress || !AppendStringaddress || !ProcessEventaddress) {
if (!g_Console && !user_inputs_logged) {
logger->info("------------------ User inputs ------------------");
user_inputs_logged = true;
}
return;
}
logger->info("-------------- Console re-enabling --------------");
ReactivateDevConsole(logger);
}
// Standard dll entry
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID) {
if (reason == DLL_PROCESS_ATTACH) {
logger = InitializeLogger("Black Myth Wukong", PLUGIN_LOG);
logger->info("Plugin {} loaded.", PLUGIN_NAME);
}
else if (reason == DLL_PROCESS_DETACH) {
logger->info("Plugin {} unloaded.", PLUGIN_NAME);
spdlog::drop_all();
}
return TRUE;
}