Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Features/Upscaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ void Upscaling::RestoreDefaultSettings()
settings = {};
}

void Upscaling::DataLoaded()
{
// Fix screenshots fix from Engine Fixes
RE::GetINISetting("bUseTAA:Display")->data.b = false;
}

Comment on lines +355 to +360

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

❓ Verification inconclusive

Null deref risk and unconditional TAA disable; gate by method and add nullptr guard

RE::GetINISetting(...) can return nullptr; dereferencing causes a crash. Also, this forces TAA off even when upscaling is kNONE or kTAA, diverging from the PR intent (“when upscaling enabled”) and may affect VR.

Suggested fix:

 void Upscaling::DataLoaded()
 {
-	// Fix screenshots fix from Engine Fixes
-	RE::GetINISetting("bUseTAA:Display")->data.b = false;
+	// Fix screenshots when upscaling is active: disable menu TAA toggle to prevent artifacts
+	if (globals::game::isVR)
+		return;  // Avoid touching Display INI in VR paths
+
+	auto* setting = RE::GetINISetting("bUseTAA:Display");
+	if (!setting) {
+		logger::warn("[Upscaling] INI setting 'bUseTAA:Display' not found; screenshot fix not applied");
+		return;
+	}
+
+	const auto method = GetUpscaleMethod();
+	if (method != UpscaleMethod::kNONE && method != UpscaleMethod::kTAA) {
+		setting->data.b = false;
+	}
 }
  • If you intend the change to persist to disk, also call iniPrefSettingCollection->WriteSetting(setting) (consistent with SaveSettings), otherwise leave it in-memory only.

Please verify lifecycle order so that settings are loaded before DataLoaded() (to ensure GetUpscaleMethod() reflects the user config).


Guard GetINISetting and conditionally disable TAA

RE::GetINISetting(...) can return nullptr (crash); the current code also unconditionally disables TAA even for kNONE/kTAA and in VR — add a nullptr guard, skip touching the INI in VR, and only disable when upscaling is active.

 void Upscaling::DataLoaded()
 {
-	// Fix screenshots fix from Engine Fixes
-	RE::GetINISetting("bUseTAA:Display")->data.b = false;
+	// Fix screenshots when upscaling is active: disable menu TAA toggle to prevent artifacts
+	if (globals::game::isVR)
+		return;  // Avoid touching Display INI in VR paths
+
+	auto* setting = RE::GetINISetting("bUseTAA:Display");
+	if (!setting) {
+		logger::warn("[Upscaling] INI setting 'bUseTAA:Display' not found; screenshot fix not applied");
+		return;
+	}
+
+	const auto method = GetUpscaleMethod();
+	if (method != UpscaleMethod::kNONE && method != UpscaleMethod::kTAA) {
+		setting->data.b = false;
+	}
 }

If persistence is required, call iniPrefSettingCollection->WriteSetting(setting). Verify lifecycle order so settings are loaded before DataLoaded() (so GetUpscaleMethod() reflects user config).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
void Upscaling::DataLoaded()
{
// Fix screenshots fix from Engine Fixes
RE::GetINISetting("bUseTAA:Display")->data.b = false;
}
void Upscaling::DataLoaded()
{
// Fix screenshots when upscaling is active: disable menu TAA toggle to prevent artifacts
if (globals::game::isVR)
return; // Avoid touching Display INI in VR paths
auto* setting = RE::GetINISetting("bUseTAA:Display");
if (!setting) {
logger::warn("[Upscaling] INI setting 'bUseTAA:Display' not found; screenshot fix not applied");
return;
}
const auto method = GetUpscaleMethod();
if (method != UpscaleMethod::kNONE && method != UpscaleMethod::kTAA) {
setting->data.b = false;
}
}
🤖 Prompt for AI Agents
In src/Features/Upscaling.cpp around lines 355 to 360, guard the
RE::GetINISetting call (it may return nullptr) and only disable TAA when
upscaling is actually active and not in VR: check GetINISetting(...) for nullptr
before using it, check the runtime VR flag and
GetUpscaleMethod()/upscaling-enabled condition and return early if VR or
upscaling is inactive, then set the INI setting only when safe; if you need the
change to persist, call iniPrefSettingCollection->WriteSetting(setting) after
modifying it and ensure DataLoaded() runs after settings are loaded so
GetUpscaleMethod() reflects user config.

void Upscaling::Load()
{
*(uintptr_t*)&ptrD3D11CreateDeviceAndSwapChainUpscaling = SKSE::PatchIAT(hk_D3D11CreateDeviceAndSwapChainUpscaling, "d3d11.dll", "D3D11CreateDeviceAndSwapChain");
Expand Down
1 change: 1 addition & 0 deletions src/Features/Upscaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct Upscaling : Feature
virtual void SaveSettings(json& o_json) override;
virtual void LoadSettings(json& o_json) override;
virtual void RestoreDefaultSettings() override;
virtual void DataLoaded() override;

/**
* @brief Installs Direct3D-related hooks for device and factory creation.
Expand Down