Add AI time dilation cheat
This commit is contained in:
@@ -28,6 +28,7 @@ static SetIntFn SetFOV = nullptr;
|
|||||||
static SetIntFn SetHUDScale = nullptr;
|
static SetIntFn SetHUDScale = nullptr;
|
||||||
static SetIntFn SetCameraOffset = nullptr;
|
static SetIntFn SetCameraOffset = nullptr;
|
||||||
static SetFloatFn SetWorldTimeDilation = nullptr;
|
static SetFloatFn SetWorldTimeDilation = nullptr;
|
||||||
|
static SetFloatFn SetAITimeDilation = nullptr;
|
||||||
static SetFloatFn SetCameraSmoothness = nullptr;
|
static SetFloatFn SetCameraSmoothness = nullptr;
|
||||||
static GetGameInfosStruct GetGameInfos = nullptr;
|
static GetGameInfosStruct GetGameInfos = nullptr;
|
||||||
|
|
||||||
@@ -38,14 +39,15 @@ static bool HUD_fix_enabled = false;
|
|||||||
static bool CA_fix_enabled = false;
|
static bool CA_fix_enabled = false;
|
||||||
static bool Vignetting_fix_enabled = false;
|
static bool Vignetting_fix_enabled = false;
|
||||||
static bool Fog_fix_enabled = false;
|
static bool Fog_fix_enabled = false;
|
||||||
static bool World_Time_Dilation_fix_enabled = false;
|
static bool Time_Dilation_fix_enabled = false;
|
||||||
static bool prev_WorldTimeDilation = World_Time_Dilation_fix_enabled;
|
static bool prev_TimeDilation = Time_Dilation_fix_enabled;
|
||||||
static bool fix_enabled = false;
|
static bool fix_enabled = false;
|
||||||
static bool console = true;
|
static bool console = true;
|
||||||
static int worldFOVValue = 0;
|
static int worldFOVValue = 0;
|
||||||
static int HUDScaleValue = 0;
|
static int HUDScaleValue = 0;
|
||||||
static int cameraOffsetValue = 0;
|
static int cameraOffsetValue = 0;
|
||||||
static float worldTimeDilationValue = 1.f;
|
static float worldTimeDilationValue = 1.f;
|
||||||
|
static float AITimeDilationValue = 1.f;
|
||||||
static float cameraSmoothnessValue = 3.5f;
|
static float cameraSmoothnessValue = 3.5f;
|
||||||
|
|
||||||
// Overlays popups
|
// Overlays popups
|
||||||
@@ -55,15 +57,15 @@ static std::string log_content;
|
|||||||
|
|
||||||
// Plugin settings
|
// Plugin settings
|
||||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||||
const char* FIX_VERSION = "0.9.4";
|
const char* FIX_VERSION = "0.9.5";
|
||||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Control world time dilation.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.";
|
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Control time dilation.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.";
|
||||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||||
|
|
||||||
// Scaling factor based on screen resolution
|
// Scaling factor based on screen resolution
|
||||||
float scale = (float)screenHeight / 1200;
|
float scale = (float)screenHeight / 1200;
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) const char* NAME = "The Callisto Protocol";
|
extern "C" __declspec(dllexport) const char* NAME = "The Callisto Protocol";
|
||||||
extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, control FOV, camera distance, world time dilation, HUD and some effects.";
|
extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, control FOV, camera distance, time dilation, HUD and some effects.";
|
||||||
|
|
||||||
// Load and unload game core dll functions /!\ necessary
|
// Load and unload game core dll functions /!\ necessary
|
||||||
static void LoadFixDLL()
|
static void LoadFixDLL()
|
||||||
@@ -86,6 +88,7 @@ static void LoadFixDLL()
|
|||||||
SetHUDScale = (SetIntFn)GetProcAddress(fixLib, "SetHUDScale");
|
SetHUDScale = (SetIntFn)GetProcAddress(fixLib, "SetHUDScale");
|
||||||
SetCameraOffset = (SetIntFn)GetProcAddress(fixLib, "SetCameraOffset");
|
SetCameraOffset = (SetIntFn)GetProcAddress(fixLib, "SetCameraOffset");
|
||||||
SetWorldTimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetWorldTimeDilation");
|
SetWorldTimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetWorldTimeDilation");
|
||||||
|
SetAITimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetAITimeDilation");
|
||||||
SetCameraSmoothness = (SetFloatFn)GetProcAddress(fixLib, "SetCameraSmoothness");
|
SetCameraSmoothness = (SetFloatFn)GetProcAddress(fixLib, "SetCameraSmoothness");
|
||||||
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
||||||
|
|
||||||
@@ -94,6 +97,7 @@ static void LoadFixDLL()
|
|||||||
if (SetHUDScale) SetHUDScale(HUDScaleValue);
|
if (SetHUDScale) SetHUDScale(HUDScaleValue);
|
||||||
if (SetCameraOffset) SetCameraOffset(cameraOffsetValue);
|
if (SetCameraOffset) SetCameraOffset(cameraOffsetValue);
|
||||||
if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue);
|
if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue);
|
||||||
|
if (SetAITimeDilation) SetAITimeDilation(AITimeDilationValue);
|
||||||
if (SetCameraSmoothness) SetCameraSmoothness(cameraSmoothnessValue);
|
if (SetCameraSmoothness) SetCameraSmoothness(cameraSmoothnessValue);
|
||||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||||
if (SetFixesEnabled) {
|
if (SetFixesEnabled) {
|
||||||
@@ -103,7 +107,7 @@ static void LoadFixDLL()
|
|||||||
SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||||
SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||||
SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||||
SetFixesEnabled(GameFixes::WorldTimeDilation, World_Time_Dilation_fix_enabled);
|
SetFixesEnabled(GameFixes::WorldTimeDilation, Time_Dilation_fix_enabled);
|
||||||
SetFixesEnabled(GameFixes::DevConsole, console);
|
SetFixesEnabled(GameFixes::DevConsole, console);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,12 +131,13 @@ static void SaveSettings()
|
|||||||
pluginIniFile["2#Individual fix"]["Chromatic aberrations"] = CA_fix_enabled;
|
pluginIniFile["2#Individual fix"]["Chromatic aberrations"] = CA_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["Vignetting"] = Vignetting_fix_enabled;
|
pluginIniFile["2#Individual fix"]["Vignetting"] = Vignetting_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["Fog"] = Fog_fix_enabled;
|
pluginIniFile["2#Individual fix"]["Fog"] = Fog_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["World time dilation"] = World_Time_Dilation_fix_enabled;
|
pluginIniFile["2#Individual fix"]["Time dilation"] = Time_Dilation_fix_enabled;
|
||||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVValue;
|
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVValue;
|
||||||
pluginIniFile["3#Fixes tuning"]["HUD scale"] = HUDScaleValue;
|
pluginIniFile["3#Fixes tuning"]["HUD scale"] = HUDScaleValue;
|
||||||
pluginIniFile["3#Fixes tuning"]["Camera offset"] = cameraOffsetValue;
|
pluginIniFile["3#Fixes tuning"]["Camera offset"] = cameraOffsetValue;
|
||||||
pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue;
|
pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue;
|
||||||
|
pluginIniFile["3#Fixes tuning"]["AI time dilation scale"] = AITimeDilationValue;
|
||||||
pluginIniFile["3#Fixes tuning"]["Camera smoothness"] = cameraSmoothnessValue;
|
pluginIniFile["3#Fixes tuning"]["Camera smoothness"] = cameraSmoothnessValue;
|
||||||
|
|
||||||
pluginIniFile.save(SETTINGS_FILE);
|
pluginIniFile.save(SETTINGS_FILE);
|
||||||
@@ -151,11 +156,12 @@ static void LoadSettings()
|
|||||||
CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as<bool>();
|
CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as<bool>();
|
||||||
Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
|
Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
|
||||||
Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as<bool>();
|
Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as<bool>();
|
||||||
World_Time_Dilation_fix_enabled = pluginIniFile["2#Individual fix"]["World time dilation"].as<bool>();
|
Time_Dilation_fix_enabled = pluginIniFile["2#Individual fix"]["Time dilation"].as<bool>();
|
||||||
worldFOVValue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
worldFOVValue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||||
HUDScaleValue = pluginIniFile["3#Fixes tuning"]["HUD scale"].as<int>();
|
HUDScaleValue = pluginIniFile["3#Fixes tuning"]["HUD scale"].as<int>();
|
||||||
cameraOffsetValue = pluginIniFile["3#Fixes tuning"]["Camera offset"].as<float>();
|
cameraOffsetValue = pluginIniFile["3#Fixes tuning"]["Camera offset"].as<float>();
|
||||||
worldTimeDilationValue = pluginIniFile["3#Fixes tuning"]["World time dilation scale"].as<float>();
|
worldTimeDilationValue = pluginIniFile["3#Fixes tuning"]["World time dilation scale"].as<float>();
|
||||||
|
AITimeDilationValue = pluginIniFile["3#Fixes tuning"]["AI time dilation scale"].as<float>();
|
||||||
cameraSmoothnessValue = pluginIniFile["3#Fixes tuning"]["Camera smoothness"].as<float>();
|
cameraSmoothnessValue = pluginIniFile["3#Fixes tuning"]["Camera smoothness"].as<float>();
|
||||||
}
|
}
|
||||||
catch (const std::exception& e) {}
|
catch (const std::exception& e) {}
|
||||||
@@ -216,6 +222,8 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(10 * scale, 10 * scale));
|
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(10 * scale, 10 * scale));
|
||||||
|
if (ImGui::BeginTabBar("MainTabs")) {
|
||||||
|
if (ImGui::BeginTabItem("Fixes")) {
|
||||||
if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
if (ImGui::BeginTable("FixesTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||||
ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f);
|
ImGui::TableSetupColumn("LeftFix", ImGuiTableColumnFlags_WidthStretch, 0.4f);
|
||||||
ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f);
|
ImGui::TableSetupColumn("RightFix", ImGuiTableColumnFlags_WidthStretch, 0.6f);
|
||||||
@@ -264,13 +272,6 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Checkbox("World time dilation", &World_Time_Dilation_fix_enabled);
|
|
||||||
if (ImGui::IsItemHovered()) {
|
|
||||||
ImGui::BeginTooltip();
|
|
||||||
ImGui::Text("Use ALT + F1 shortcut to de/activate.");
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::Checkbox("HUD scaling", &HUD_fix_enabled)) {
|
if (ImGui::Checkbox("HUD scaling", &HUD_fix_enabled)) {
|
||||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::HUD, HUD_fix_enabled);
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::HUD, HUD_fix_enabled);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
@@ -316,19 +317,6 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("World time dilation", ImGuiTreeNodeFlags_DefaultOpen))
|
|
||||||
{
|
|
||||||
ImGui::SetNextItemWidth(180 * scale);
|
|
||||||
if (ImGui::SliderFloat("##WorldTimeDilationValue", &worldTimeDilationValue, 0, 2, "%.2f")) {
|
|
||||||
if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue); SaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ImGui::IsItemHovered()) {
|
|
||||||
ImGui::BeginTooltip();
|
|
||||||
ImGui::Text("Default value is 1.");
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(1);
|
||||||
if (ImGui::CollapsingHeader("HUD scaling", ImGuiTreeNodeFlags_DefaultOpen))
|
if (ImGui::CollapsingHeader("HUD scaling", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
{
|
{
|
||||||
@@ -353,6 +341,58 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginTabItem("Cheats"))
|
||||||
|
{
|
||||||
|
ImGui::Checkbox("Time dilation", &Time_Dilation_fix_enabled);
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::Text("Use ALT + F1 shortcut to de/activate.");
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginTable("SlidersTable", 2, ImGuiTableFlags_SizingStretchSame)) {
|
||||||
|
ImGui::TableSetupColumn("LeftSliders", ImGuiTableColumnFlags_WidthStretch, 0.5f);
|
||||||
|
ImGui::TableSetupColumn("RightSliders", ImGuiTableColumnFlags_WidthStretch, 0.5f);
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
if (ImGui::CollapsingHeader("World time dilation", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
|
{
|
||||||
|
ImGui::SetNextItemWidth(180 * scale);
|
||||||
|
if (ImGui::SliderFloat("##WorldTimeDilationValue", &worldTimeDilationValue, 0, 2, "%.2f")) {
|
||||||
|
if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue); SaveSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::Text("Will affect everything in the world.");
|
||||||
|
ImGui::Text("Default value is 1.");
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
|
||||||
|
if (ImGui::CollapsingHeader("AI time dilation", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
|
{
|
||||||
|
ImGui::SetNextItemWidth(180 * scale);
|
||||||
|
if (ImGui::SliderFloat("##AITimeDilationValue", &AITimeDilationValue, 0, 2, "%.2f")) {
|
||||||
|
if (SetAITimeDilation) SetAITimeDilation(AITimeDilationValue); SaveSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::Text("Will affect only enemies in the world.");
|
||||||
|
ImGui::Text("Default value is 1.");
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
ImGui::EndTabBar();
|
||||||
|
}
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
// Fix status
|
// Fix status
|
||||||
@@ -369,15 +409,18 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void on_reshade_present(reshade::api::effect_runtime* runtime) {
|
static void on_reshade_present(reshade::api::effect_runtime* runtime) {
|
||||||
if (runtime->is_key_pressed(VK_F1) && runtime->is_key_down(VK_MENU))
|
static bool wasTimeDilationInvoked = false;
|
||||||
World_Time_Dilation_fix_enabled = !World_Time_Dilation_fix_enabled;
|
bool timeDilationInvoked = runtime->is_key_down(VK_MENU) && runtime->is_key_down(VK_F1);
|
||||||
|
|
||||||
if (prev_WorldTimeDilation != World_Time_Dilation_fix_enabled) {
|
if (timeDilationInvoked && !wasTimeDilationInvoked)
|
||||||
if (SetFixesEnabled)
|
Time_Dilation_fix_enabled = !Time_Dilation_fix_enabled;
|
||||||
SetFixesEnabled(GameFixes::WorldTimeDilation, World_Time_Dilation_fix_enabled);
|
|
||||||
|
|
||||||
|
wasTimeDilationInvoked = timeDilationInvoked;
|
||||||
|
|
||||||
|
if (prev_TimeDilation != Time_Dilation_fix_enabled) {
|
||||||
|
if (SetFixesEnabled) SetFixesEnabled(GameFixes::WorldTimeDilation, Time_Dilation_fix_enabled); // Apply cheat
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
prev_WorldTimeDilation = World_Time_Dilation_fix_enabled;
|
prev_TimeDilation = Time_Dilation_fix_enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user