Skip to content

Commit

Permalink
feat(VR): add option to completely disable SSR
Browse files Browse the repository at this point in the history
Because VR requires a hidden setting, once enabled on boot, it will
persist. Now, if SSR is disabled on boot, it will completely disable the
SSR path for maximum performance. However, a restart is necessary to
reenable.
  • Loading branch information
alandtse committed Sep 22, 2024
1 parent 88b4048 commit f9c6ea4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/Features/DynamicCubemaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ void DynamicCubemaps::DrawSettings()
recompileFlag |= ImGui::Checkbox("Enable Screen Space Reflections", reinterpret_cast<bool*>(&settings.EnabledSSR));
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text("Enable Screen Space Reflections on Water");
if (REL::Module::IsVR() && !enabledAtBoot) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
ImGui::Text(
"A restart is required to enable in VR. "
"Save Settings after enabling and restart the game.");
ImGui::PopStyleColor();
}
}
if (settings.EnabledSSR) {
recompileFlag |= ImGui::SliderInt("Max Iterations", reinterpret_cast<int*>(&settings.MaxIterations), 1, 128);
Expand Down Expand Up @@ -185,7 +192,7 @@ void DynamicCubemaps::DataLoaded()

void DynamicCubemaps::PostPostLoad()
{
if (REL::Module::IsVR()) {
if (REL::Module::IsVR() && settings.EnabledSSR) {
std::map<std::string, uintptr_t> earlyhiddenVRCubeMapSettings{
{ "bScreenSpaceReflectionEnabled:Display", 0x1ED5BC0 },
};
Expand All @@ -198,6 +205,7 @@ void DynamicCubemaps::PostPostLoad()
*setting = true;
}
}
enabledAtBoot = true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Features/DynamicCubemaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct DynamicCubemaps : Feature

Settings settings;
std::string maxIterationsString = ""; // required to avoid string going out of scope for defines

bool enabledAtBoot = false;
void UpdateCubemap();

void PostDeferred();
Expand Down

0 comments on commit f9c6ea4

Please sign in to comment.