Code refactoring
This commit is contained in:
@@ -36,7 +36,6 @@ void SetFixesEnabled(GameFixes fix, bool value) {
|
|||||||
if (SetFixes) SetFixes(fix, value);
|
if (SetFixes) SetFixes(fix, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool toto;
|
|
||||||
// Plugin variables for checkboxes and sliders
|
// Plugin variables for checkboxes and sliders
|
||||||
static bool fov_fix_enabled = false;
|
static bool fov_fix_enabled = false;
|
||||||
static bool Camera_fix_enabled = false;
|
static bool Camera_fix_enabled = false;
|
||||||
@@ -63,18 +62,6 @@ static bool popup_Informations = false;
|
|||||||
static bool show_log_overlay = false;
|
static bool show_log_overlay = false;
|
||||||
static std::string log_content;
|
static std::string log_content;
|
||||||
|
|
||||||
// Shader toggles and variables
|
|
||||||
static reshade::api::effect_uniform_variable u_td_show = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_td_enabled = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_td_world = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_td_AI = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_GodMode_show = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_GodMode_enabled = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_Invulnerability_show = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_Invulnerability_enabled = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_Stealth_show = {};
|
|
||||||
static reshade::api::effect_uniform_variable u_Stealth_enabled = {};
|
|
||||||
|
|
||||||
// Plugin settings
|
// Plugin settings
|
||||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||||
const char* FIX_VERSION = "0.9.7";
|
const char* FIX_VERSION = "0.9.7";
|
||||||
@@ -88,7 +75,24 @@ 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, HUD, some effects and enable cheats.";
|
extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, control FOV, camera distance, HUD, some effects and enable cheats.";
|
||||||
|
|
||||||
// UI sliders
|
// Prepare arrays of checkboxes for ImGui
|
||||||
|
static FixToggle individualFixes[] = {
|
||||||
|
{ "FOV", &fov_fix_enabled, GameFixes::FOV },
|
||||||
|
{ "Fog", &Fog_fix_enabled, GameFixes::Fog },
|
||||||
|
{ "Vignetting", &Vignetting_fix_enabled, GameFixes::Vignetting },
|
||||||
|
{ "Camera distance", &Camera_fix_enabled, GameFixes::Camera,
|
||||||
|
"Experimental fix. Use at your own risk." },
|
||||||
|
{ "HUD scaling", &HUD_fix_enabled, GameFixes::HUD },
|
||||||
|
{ "Chromatic aberrations", &CA_fix_enabled, GameFixes::ChromaticAberrations }
|
||||||
|
};
|
||||||
|
|
||||||
|
static FixToggle cheatFixes[] = {
|
||||||
|
{ "Time dilation", &Time_Dilation_fix_enabled, GameFixes::TimeDilation, "ALT + 1 (top keyboard row) to toggle" },
|
||||||
|
{ "God mode", &GodMode_fix_enabled, GameFixes::GodMode, "ALT + 2 (top keyboard row) to toggle.\nJacob won't receive any damage." },
|
||||||
|
{ "Ignore hits", &Ignore_hits_fix_enabled, GameFixes::Invulnerable, "ALT + 3 (top keyboard row) to toggle.\nJacob can't be hit." },
|
||||||
|
{ "Stealth mode",&Stealth_fix_enabled, GameFixes::Stealth, "ALT + 4 (top keyboard row) to toggle.\nEnemies won't attack you" }
|
||||||
|
};
|
||||||
|
// Prepare array of sliders for ImGui
|
||||||
static SliderFix sliders[6];
|
static SliderFix sliders[6];
|
||||||
|
|
||||||
// Load and unload game core dll functions /!\ necessary
|
// Load and unload game core dll functions /!\ necessary
|
||||||
@@ -225,23 +229,6 @@ static std::string read_log_file(const std::string& filename) {
|
|||||||
log = ss.str();
|
log = ss.str();
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
// Prepare arrays of checkboxes for ImGui
|
|
||||||
static FixToggle individualFixes[] = {
|
|
||||||
{ "FOV", &fov_fix_enabled, GameFixes::FOV },
|
|
||||||
{ "Fog", &Fog_fix_enabled, GameFixes::Fog },
|
|
||||||
{ "Vignetting", &Vignetting_fix_enabled, GameFixes::Vignetting },
|
|
||||||
{ "Camera distance", &Camera_fix_enabled, GameFixes::Camera,
|
|
||||||
"Experimental fix. Use at your own risk." },
|
|
||||||
{ "HUD scaling", &HUD_fix_enabled, GameFixes::HUD },
|
|
||||||
{ "Chromatic aberrations", &CA_fix_enabled, GameFixes::ChromaticAberrations }
|
|
||||||
};
|
|
||||||
|
|
||||||
static FixToggle cheatFixes[] = {
|
|
||||||
{ "Time dilation", &Time_Dilation_fix_enabled, GameFixes::TimeDilation, "ALT + 1 (top keyboard row) to toggle" },
|
|
||||||
{ "God mode", &GodMode_fix_enabled, GameFixes::GodMode, "ALT + 2 (top keyboard row) to toggle.\nJacob won't receive any damage." },
|
|
||||||
{ "Ignore hits", &Ignore_hits_fix_enabled, GameFixes::Invulnerable, "ALT + 3 (top keyboard row) to toggle.\nJacob can't be hit." },
|
|
||||||
{ "Stealth mode",&Stealth_fix_enabled, GameFixes::Stealth, "ALT + 4 (top keyboard row) to toggle.\nEnemies won't attack you" }
|
|
||||||
};
|
|
||||||
|
|
||||||
// Initialize ImGui widgets for Reshade
|
// Initialize ImGui widgets for Reshade
|
||||||
static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
||||||
@@ -377,19 +364,9 @@ static void on_reshade_present(reshade::api::effect_runtime* runtime) {
|
|||||||
static void on_reshade_begin_effects(reshade::api::effect_runtime* runtime, reshade::api::command_list* cmd_list,
|
static void on_reshade_begin_effects(reshade::api::effect_runtime* runtime, reshade::api::command_list* cmd_list,
|
||||||
reshade::api::resource_view rtv, reshade::api::resource_view rtv_srgb) {
|
reshade::api::resource_view rtv, reshade::api::resource_view rtv_srgb) {
|
||||||
if (!runtime) return;
|
if (!runtime) return;
|
||||||
u_td_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowTD");
|
FindAllUniformVariables(runtime, OSD_SHADER_NAME);
|
||||||
u_td_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "TD_Enabled");
|
|
||||||
u_td_world = runtime->find_uniform_variable(OSD_SHADER_NAME, "TD_World");
|
|
||||||
u_td_AI = runtime->find_uniform_variable(OSD_SHADER_NAME, "TD_AI");
|
|
||||||
u_GodMode_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowGodMode");
|
|
||||||
u_GodMode_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "GodMode_Enabled");
|
|
||||||
u_Invulnerability_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowInvuln");
|
|
||||||
u_Invulnerability_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "Invulnerability_Enabled");
|
|
||||||
u_Stealth_show = runtime->find_uniform_variable(OSD_SHADER_NAME, "OSD_ShowStealth");
|
|
||||||
u_Stealth_enabled = runtime->find_uniform_variable(OSD_SHADER_NAME, "Stealth_Enabled");
|
|
||||||
|
|
||||||
if (InterlockedCompareExchange(&g_uniformReseted, 1, 0) != 0) return; // reset OSD uniforms once
|
if (InterlockedCompareExchange(&g_uniformReseted, 1, 0) != 0) return; // reset OSD uniforms once
|
||||||
|
|
||||||
ResetAllUniformVariables(runtime, OSD_SHADER_NAME);
|
ResetAllUniformVariables(runtime, OSD_SHADER_NAME);
|
||||||
runtime->save_current_preset(); // Save shader preset
|
runtime->save_current_preset(); // Save shader preset
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user