Add console enabling option. Improved logs
This commit is contained in:
@@ -27,6 +27,7 @@ std::shared_ptr<spdlog::logger> logger;
|
|||||||
|
|
||||||
// Plugin states
|
// Plugin states
|
||||||
static bool AOBScanDone = false;
|
static bool AOBScanDone = false;
|
||||||
|
static bool g_Console = false;
|
||||||
static bool g_fix_enabled = false;
|
static bool g_fix_enabled = false;
|
||||||
static bool g_fov_fix_enabled = false;
|
static bool g_fov_fix_enabled = false;
|
||||||
static bool g_ultrawide_fix_enabled = false;
|
static bool g_ultrawide_fix_enabled = false;
|
||||||
@@ -245,13 +246,13 @@ extern "C" __declspec(dllexport) void SetFixEnabled(bool enabled, bool init)
|
|||||||
if (!init && Vignettingaddress) VignettingFixEnabled();
|
if (!init && Vignettingaddress) VignettingFixEnabled();
|
||||||
if (!init && Fogaddress) FogFixEnabled();
|
if (!init && Fogaddress) FogFixEnabled();
|
||||||
if (!init && VolumetricFogaddress) VolumetricFogFixEnabled();
|
if (!init && VolumetricFogaddress) VolumetricFogFixEnabled();
|
||||||
HUDFixEnabled();
|
if (!init && GObjectsaddress && AppendStringaddress && ProcessEventaddress) EnableConsole();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setters for Reshade addon call
|
// Setters for Reshade addon call
|
||||||
extern "C" __declspec(dllexport) void SetFixesEnabled(GameFixes fix, bool enabled)
|
extern "C" __declspec(dllexport) void SetFixesEnabled(GameFixes fix, bool enabled)
|
||||||
{ // Set each fix individually
|
{ // Set each fix individually
|
||||||
if (fix == GameFixes::DevConsole) EnableConsole();
|
if (fix == GameFixes::DevConsole) { g_Console = enabled; EnableConsole(); };
|
||||||
if (fix == GameFixes::FOV) { g_fov_fix_enabled = enabled; FOVFixEnabled(); }
|
if (fix == GameFixes::FOV) { g_fov_fix_enabled = enabled; FOVFixEnabled(); }
|
||||||
if (fix == GameFixes::UltraWide) { g_ultrawide_fix_enabled = enabled; UltraWideFixEnabled(); }
|
if (fix == GameFixes::UltraWide) { g_ultrawide_fix_enabled = enabled; UltraWideFixEnabled(); }
|
||||||
if (fix == GameFixes::Camera) { g_Camera_fix_enabled = enabled; CameraFixEnabled(); }
|
if (fix == GameFixes::Camera) { g_Camera_fix_enabled = enabled; CameraFixEnabled(); }
|
||||||
@@ -457,20 +458,19 @@ static void VolumetricFogFixEnabled() {
|
|||||||
// UE Console creation
|
// UE Console creation
|
||||||
static void EnableConsole()
|
static void EnableConsole()
|
||||||
{
|
{
|
||||||
logger->info("-------------- Console re-enabling --------------");
|
if (g_Console_Enabled || !g_Console || !GObjectsaddress || !AppendStringaddress || !ProcessEventaddress) {
|
||||||
if (!GObjectsaddress || !AppendStringaddress || !ProcessEventaddress) {
|
if (!g_Console && g_fix_enabled)
|
||||||
//if (!GObjectsaddress || !GNamesaddress || !ProcessEventaddress) {
|
logger->info("------------------ User inputs ------------------");
|
||||||
logger->warn("Could not re-enable console");
|
|
||||||
logger->info("------------------ User inputs ------------------");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger->info("-------------- Console re-enabling --------------");
|
||||||
std::thread([&]() {
|
std::thread([&]() {
|
||||||
auto start = std::chrono::high_resolution_clock::now(); // Measure the time to renable console
|
auto start = std::chrono::high_resolution_clock::now(); // Measure the time to renable console
|
||||||
UEngine* Engine = nullptr;
|
UEngine* Engine = nullptr;
|
||||||
|
|
||||||
for (int i = 0; i < 100; ++i) { // gives 10 seconds to find UE Engine
|
for (int i = 0; i < 10; ++i) { // gives 10 seconds to find UE Engine
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||||
Engine = UEngine::GetEngine();
|
Engine = UEngine::GetEngine();
|
||||||
if (Engine && Engine->ConsoleClass && Engine->GameViewport)
|
if (Engine && Engine->ConsoleClass && Engine->GameViewport)
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user