Add a function to apply cvars visual effects. Add a fallback function to retrieve GWorld.

This commit is contained in:
2026-04-04 16:21:51 +02:00
parent 4df2ca12da
commit f20997762f

View File

@@ -1,8 +1,13 @@
#pragma once #pragma once
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <GameFixes.h>
#include <atomic> #include <atomic>
inline std::atomic_bool g_Console_Enabled { false }; inline std::atomic<bool> g_Console_Enabled = false;
inline std::atomic<bool> gPendingFog = false; // Used to toggle Fog effect once
inline std::atomic<bool> gPendingDOF = false; // Used to toggle DOF effect once
inline std::atomic<bool> gPendingCA = false; // Used to toggle chromatic aberrations effect once
inline std::atomic<bool> gPendingVignetting = false; // Used to toggle chromatic aberrations effect once
namespace SDK { namespace SDK {
class UEngine; class UEngine;
@@ -20,6 +25,14 @@ namespace SDK {
class APlayerController; class APlayerController;
} }
namespace UC {
class FString;
}
void ApplyVisualEffect(GameFixes fix, bool enabled);
UC::FString GetCommand(GameFixes fix, bool enabled);
/** /**
* @brief Gets the current game resolution (not native display) and aspect ratio. * @brief Gets the current game resolution (not native display) and aspect ratio.
* @param outWidth screen width. * @param outWidth screen width.
@@ -29,6 +42,13 @@ namespace SDK {
void GetResolution(int& outWidth, int& outHeight, float& outAspectRatio); void GetResolution(int& outWidth, int& outHeight, float& outAspectRatio);
// Unreal Engine functions // Unreal Engine functions
/**
* @brief Gets the current World from an UObject.
* @param ptr pointer to an object (eg: AActor).
* @return UWorld* or nullptr.
*/
SDK::UWorld* GetWorldFromContext(uintptr_t ptr);
/** /**
* @brief Gets the current player Pawn from the world. * @brief Gets the current player Pawn from the world.
* @param world Optional UWorld pointer. * @param world Optional UWorld pointer.