Skip to content

Conversation

@davo0411
Copy link
Collaborator

@davo0411 davo0411 commented Dec 17, 2025

UNTESTED.

Adds conditional checks to see if the 3 main FWMF .dlls are detected, and disables IBL via a new shader permutation on world maps. Should keep IBL on vanilla / other map types.

Easily expanded to PP in future

Summary by CodeRabbit

  • Bug Fixes
    • Adjusted ambient lighting calculations for world map rendering to prevent unintended lighting contributions.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

📝 Walkthrough

Walkthrough

Adds runtime detection of Flat World Map Framework (FWMF) and a global flag; when detected it sets a build define (FWMF_DETECTED) for WORLD_MAP permutations and guards static Diffuse IBL / IBL color code in the Lighting.hlsl shader to skip those contributions for world-map builds.

Changes

Cohort / File(s) Summary
Shader: WORLD_MAP IBL guards
package/Shaders/Lighting.hlsl
Wraps EnableDiffuseIBL, iblColor accumulation, and nested SKYLIGHTING branches with `#if !defined(WORLD_MAP)
Global flag declaration & definition
src/Globals.h, src/Globals.cpp
Adds extern bool flatWorldMapDetected; declaration and defines bool globals::flatWorldMapDetected = false; to track runtime detection of FWMF.
Startup detection & define injection
src/XSEPlugin.cpp
Adds GetModuleHandleA checks for known FWMF DLLs, logs detection, sets globals::flatWorldMapDetected, and injects the FWMF_DETECTED define via globals::state->SetDefines for WORLD_MAP shader permutations when present.

Sequence Diagram(s)

sequenceDiagram
    participant Plugin as XSEPlugin (startup)
    participant Globals as globals (flag)
    participant BuildState as State (shader defines)
    participant Shader as Lighting.hlsl

    Plugin->>Plugin: on Load, call GetModuleHandleA for FWMF DLLs
    alt FWMF found
        Plugin->>Globals: set flatWorldMapDetected = true
        Plugin->>BuildState: SetDefines("FWMF_DETECTED")
    end
    Note over BuildState,Shader: WORLD_MAP shader permutation compiles with/without FWMF_DETECTED
    BuildState->>Shader: provide defines (WORLD_MAP [+ FWMF_DETECTED])
    alt WORLD_MAP && FWMF_DETECTED
        Shader->>Shader: skip Diffuse IBL and iblColor blocks (guards active)
    else
        Shader->>Shader: include Diffuse IBL and iblColor logic
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review XSEPlugin DLL detection logic and ordering relative to existing initialization.
  • Verify SetDefines call targets the correct shader permutations and persists before shader compile.
  • Check header/translation unit visibility and linkage of globals::flatWorldMapDetected.
  • Confirm preprocessor guards in Lighting.hlsl are correctly scoped and do not leave dangling code paths.

Possibly related issues

Possibly related PRs

Suggested reviewers

  • jiayev
  • doodlum
  • alandtse

Poem

🐰
I sniffed the map for hidden signs,
If flat‑world tricks would cross the lines,
I set a flag, the shader knows—
IBL sleeps where the flat map grows!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding conditional shader defines based on DLL detection to address IBL overexposure on the flat world map framework.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

Using provided base ref: f8451d0
Using base ref: f8451d0
Base commit date: 2025-12-16T01:09:14Z (Tuesday, December 16, 2025 01:09 AM)
No actionable suggestions for changed features.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8451d0 and def487c.

📒 Files selected for processing (1)
  • package/Shaders/Lighting.hlsl (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not include TODO/FIXME placeholders; provide complete, working solutions

Files:

  • package/Shaders/Lighting.hlsl
**/*

⚙️ CodeRabbit configuration file

**/*: When reviewing PRs, please provide suggestions for:

  1. Conventional Commit Titles (if not following https://www.conventionalcommits.org/ or
    if the existing title does not describe the code changes):
    Format: type(scope): description
    Length: 50 characters limit for title, 72 for body
    Style: lowercase description, no ending period
    Examples:

    • feat(vr): add cross-eye sampling
    • fix(water): resolve flowmap bug
    • docs: update shader documentation
  2. Issue References (if PR fixes bugs or implements features):
    Suggest adding appropriate GitHub keywords:

    • "Fixes #123" or "Closes #123" for bug fixes
    • "Implements #123" or "Addresses #123" for features
    • "Related to #123" for partial implementations

Otherwise, use your standard review approach focusing on code quality.

Files:

  • package/Shaders/Lighting.hlsl
🧠 Learnings (4)
📓 Common learnings
Learnt from: jiayev
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-08-03T18:37:19.690Z
Learning: ISReflectionsRayTracing.hlsl and ISWorldMap.hlsl in the skyrim-community-shaders repository are image-space post-processing shaders that perform color sampling and blending operations that need proper linear color space handling for the linear lighting system. ISReflectionsRayTracing handles screen-space reflections and should use conditional Color::IrradianceToLinear/Gamma conversions similar to ISCompositeLensFlareVolumetricLighting.hlsl. ISWorldMap performs 7x7 color accumulation that should be done in linear space similar to the pattern used in ISSAOComposite.hlsl.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 577
File: features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli:57-61
Timestamp: 2025-06-17T05:40:22.785Z
Learning: Default parameter values are supported in the HLSL compiler used by the skyrim-community-shaders project, contrary to standard HLSL (FXC/DXC) limitations.
Learnt from: ThePagi
Repo: doodlum/skyrim-community-shaders PR: 1369
File: package/Shaders/Lighting.hlsl:0-0
Timestamp: 2025-08-05T17:40:44.828Z
Learning: In the skyrim-community-shaders repository, ultra trees (object LOD trees) are detected using a compound shader define condition `defined(DO_ALPHA_TEST) && defined(LOD_BLENDING) && defined(RIM_LIGHTING) && defined(SOFT_LIGHTING)` because "they have no define" according to the comment. The `ExtraFlags::IsTree` flag is used for different tree handling (AO removal in skylighting) and may not apply to ultra trees specifically. Before replacing the compound condition with `IsTree`, verification is needed to ensure the flag covers ultra trees.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use `uint` type instead of `bool` for compatibility reasons. This ensures consistent 4-byte size, proper 16-byte alignment in constant buffers, and cross-platform compatibility when passing data between C++ and HLSL shaders.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use `uint` type instead of `bool` for compatibility reasons. This ensures consistent size, alignment, and cross-platform compatibility when passing data to shader constant buffers.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-01T18:01:07.079Z
Learning: In the skyrim-community-shaders project, simple scalar constants in HLSL shaders use #define (e.g., #define NTHREADS 128), while more complex constants use static const within namespaces (e.g., Math namespace in Math.hlsli). For epsilon standardization, #define is the appropriate choice since epsilon values are simple scalar constants.
Learnt from: CR
Repo: doodlum/skyrim-community-shaders PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-17T18:37:35.839Z
Learning: Applies to features/*/Shaders/**/*.{hlsl,hlsli,fx,fxh} : Avoid GPU register/buffer conflicts in HLSL; verify register usage (e.g., with hlslkit buffer scanning)
📚 Learning: 2025-08-03T18:37:19.690Z
Learnt from: jiayev
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-08-03T18:37:19.690Z
Learning: ISReflectionsRayTracing.hlsl and ISWorldMap.hlsl in the skyrim-community-shaders repository are image-space post-processing shaders that perform color sampling and blending operations that need proper linear color space handling for the linear lighting system. ISReflectionsRayTracing handles screen-space reflections and should use conditional Color::IrradianceToLinear/Gamma conversions similar to ISCompositeLensFlareVolumetricLighting.hlsl. ISWorldMap performs 7x7 color accumulation that should be done in linear space similar to the pattern used in ISSAOComposite.hlsl.

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-08-17T18:37:35.839Z
Learnt from: CR
Repo: doodlum/skyrim-community-shaders PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-17T18:37:35.839Z
Learning: Applies to features/*/Shaders/**/*.{hlsl,hlsli,fx,fxh} : Avoid GPU register/buffer conflicts in HLSL; verify register usage (e.g., with hlslkit buffer scanning)

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-07-01T18:01:07.079Z
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-01T18:01:07.079Z
Learning: In the skyrim-community-shaders project, simple scalar constants in HLSL shaders use #define (e.g., #define NTHREADS 128), while more complex constants use static const within namespaces (e.g., Math namespace in Math.hlsli). For epsilon standardization, #define is the appropriate choice since epsilon values are simple scalar constants.

Applied to files:

  • package/Shaders/Lighting.hlsl
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Validate shader compilation (VR, .github/configs/shader-validation-vr.yaml)
  • GitHub Check: Build plugin and addons
  • GitHub Check: Validate shader compilation (Flatrim, .github/configs/shader-validation.yaml)
🔇 Additional comments (1)
package/Shaders/Lighting.hlsl (1)

2734-2740: LGTM - Correctly disables static/interior IBL for world map.

This guard appropriately prevents IBL modifications to directionalAmbientColor when rendering the world map, which addresses the overexposure issue described in the PR. The approach is consistent with how other features (CLOUD_SHADOWS, SKYLIGHTING) are disabled for WORLD_MAP at lines 885-888.

@github-actions
Copy link

✅ A pre-release build is available for this PR:
Download

@jiayev
Copy link
Collaborator

jiayev commented Dec 17, 2025

ibl does work nice on normal world map tho
might be better just to detect the dll

@davo0411
Copy link
Collaborator Author

ibl does work nice on normal world map tho might be better just to detect the dll

if its needed on regular worldmap i can re-do this but i'll only get a chance when im back, and it'll end up on backburner, i just didn't think that would really matter.

@davo0411 davo0411 changed the title fix(ibl): stop ibl overexposure on flat world map fix(ibl): conditional FWMF .dll check to stop overexposure Dec 21, 2025
@davo0411 davo0411 marked this pull request as draft December 21, 2025 22:42
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
package/Shaders/Lighting.hlsl (1)

2759-2770: IBL color accumulation correctly guarded, but fog IBL path remains unguarded.

This guard is correctly implemented. However, the fog IBL code at lines 3147-3151 still lacks a matching guard:

#		if defined(IBL)
	if (SharedData::iblSettings.EnableDiffuseIBL && !SharedData::InInterior) {
		fogColor = ImageBasedLighting::GetFogIBLColor(fogColor);
	}
#		endif

For consistency and to fully prevent IBL-related brightness issues on the flat world map, consider adding the same guard:

#		if defined(IBL) && (!defined(WORLD_MAP) || !defined(FWMF_DETECTED))
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between def487c and 26e2cb1.

📒 Files selected for processing (4)
  • package/Shaders/Lighting.hlsl (2 hunks)
  • src/Globals.cpp (1 hunks)
  • src/Globals.h (1 hunks)
  • src/XSEPlugin.cpp (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not include TODO/FIXME placeholders; provide complete, working solutions

Files:

  • src/Globals.cpp
  • src/XSEPlugin.cpp
  • src/Globals.h
  • package/Shaders/Lighting.hlsl
src/**/*.{cpp,cxx,cc,h,hpp,hxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{cpp,cxx,cc,h,hpp,hxx}: Ensure SE/AE/VR runtime compatibility; use runtime detection patterns (e.g., REL::RelocateMember())
Include robust error handling and resource management with graceful degradation in the plugin code

Files:

  • src/Globals.cpp
  • src/XSEPlugin.cpp
  • src/Globals.h
**/*

⚙️ CodeRabbit configuration file

**/*: When reviewing PRs, please provide suggestions for:

  1. Conventional Commit Titles (if not following https://www.conventionalcommits.org/ or
    if the existing title does not describe the code changes):
    Format: type(scope): description
    Length: 50 characters limit for title, 72 for body
    Style: lowercase description, no ending period
    Examples:

    • feat(vr): add cross-eye sampling
    • fix(water): resolve flowmap bug
    • docs: update shader documentation
  2. Issue References (if PR fixes bugs or implements features):
    Suggest adding appropriate GitHub keywords:

    • "Fixes #123" or "Closes #123" for bug fixes
    • "Implements #123" or "Addresses #123" for features
    • "Related to #123" for partial implementations

Otherwise, use your standard review approach focusing on code quality.

Files:

  • src/Globals.cpp
  • src/XSEPlugin.cpp
  • src/Globals.h
  • package/Shaders/Lighting.hlsl
🧠 Learnings (12)
📓 Common learnings
Learnt from: jiayev
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-08-03T18:37:19.690Z
Learning: ISReflectionsRayTracing.hlsl and ISWorldMap.hlsl in the skyrim-community-shaders repository are image-space post-processing shaders that perform color sampling and blending operations that need proper linear color space handling for the linear lighting system. ISReflectionsRayTracing handles screen-space reflections and should use conditional Color::IrradianceToLinear/Gamma conversions similar to ISCompositeLensFlareVolumetricLighting.hlsl. ISWorldMap performs 7x7 color accumulation that should be done in linear space similar to the pattern used in ISSAOComposite.hlsl.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
📚 Learning: 2025-08-17T18:37:35.839Z
Learnt from: CR
Repo: doodlum/skyrim-community-shaders PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-17T18:37:35.839Z
Learning: Applies to features/**/*.{cpp,cxx,cc,h,hpp,hxx} : Register new features in the globals::features namespace

Applied to files:

  • src/Globals.cpp
  • src/XSEPlugin.cpp
  • src/Globals.h
📚 Learning: 2025-08-17T18:37:35.839Z
Learnt from: CR
Repo: doodlum/skyrim-community-shaders PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-17T18:37:35.839Z
Learning: Applies to src/**/*.{cpp,cxx,cc,h,hpp,hxx} : Ensure SE/AE/VR runtime compatibility; use runtime detection patterns (e.g., REL::RelocateMember())

Applied to files:

  • src/XSEPlugin.cpp
📚 Learning: 2025-08-03T18:37:19.690Z
Learnt from: jiayev
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-08-03T18:37:19.690Z
Learning: ISReflectionsRayTracing.hlsl and ISWorldMap.hlsl in the skyrim-community-shaders repository are image-space post-processing shaders that perform color sampling and blending operations that need proper linear color space handling for the linear lighting system. ISReflectionsRayTracing handles screen-space reflections and should use conditional Color::IrradianceToLinear/Gamma conversions similar to ISCompositeLensFlareVolumetricLighting.hlsl. ISWorldMap performs 7x7 color accumulation that should be done in linear space similar to the pattern used in ISSAOComposite.hlsl.

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-08-17T18:37:35.839Z
Learnt from: CR
Repo: doodlum/skyrim-community-shaders PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-17T18:37:35.839Z
Learning: Applies to features/*/Shaders/**/*.{hlsl,hlsli,fx,fxh} : Avoid GPU register/buffer conflicts in HLSL; verify register usage (e.g., with hlslkit buffer scanning)

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-07-01T18:01:07.079Z
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-01T18:01:07.079Z
Learning: In the skyrim-community-shaders project, simple scalar constants in HLSL shaders use #define (e.g., #define NTHREADS 128), while more complex constants use static const within namespaces (e.g., Math namespace in Math.hlsli). For epsilon standardization, #define is the appropriate choice since epsilon values are simple scalar constants.

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-06-17T05:40:22.785Z
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 577
File: features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli:57-61
Timestamp: 2025-06-17T05:40:22.785Z
Learning: Default parameter values are supported in the HLSL compiler used by the skyrim-community-shaders project, contrary to standard HLSL (FXC/DXC) limitations.

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-08-05T17:40:44.828Z
Learnt from: ThePagi
Repo: doodlum/skyrim-community-shaders PR: 1369
File: package/Shaders/Lighting.hlsl:0-0
Timestamp: 2025-08-05T17:40:44.828Z
Learning: In the skyrim-community-shaders repository, ultra trees (object LOD trees) are detected using a compound shader define condition `defined(DO_ALPHA_TEST) && defined(LOD_BLENDING) && defined(RIM_LIGHTING) && defined(SOFT_LIGHTING)` because "they have no define" according to the comment. The `ExtraFlags::IsTree` flag is used for different tree handling (AO removal in skylighting) and may not apply to ultra trees specifically. Before replacing the compound condition with `IsTree`, verification is needed to ensure the flag covers ultra trees.

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-08-17T18:37:35.839Z
Learnt from: CR
Repo: doodlum/skyrim-community-shaders PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-17T18:37:35.839Z
Learning: Applies to features/*/Shaders/**/*.{hlsl,hlsli,fx,fxh} : Place all feature shaders under features/YourFeature/Shaders/

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-06-08T11:25:14.536Z
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use `uint` type instead of `bool` for compatibility reasons. This ensures consistent 4-byte size, proper 16-byte alignment in constant buffers, and cross-platform compatibility when passing data between C++ and HLSL shaders.

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-07-05T05:20:45.823Z
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.

Applied to files:

  • package/Shaders/Lighting.hlsl
📚 Learning: 2025-10-02T14:20:33.454Z
Learnt from: ThePagi
Repo: doodlum/skyrim-community-shaders PR: 1369
File: src/Features/SnowCover.cpp:515-515
Timestamp: 2025-10-02T14:20:33.454Z
Learning: In the Community Shaders codebase (skyrim-community-shaders repository), hardcoded shader resource slot numbers are used directly in code rather than being defined as named constants. This is the established convention and should not be flagged as an issue.

Applied to files:

  • package/Shaders/Lighting.hlsl
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Validate shader compilation (Flatrim, .github/configs/shader-validation.yaml)
  • GitHub Check: Build plugin and addons
  • GitHub Check: Validate shader compilation (VR, .github/configs/shader-validation-vr.yaml)
🔇 Additional comments (3)
package/Shaders/Lighting.hlsl (1)

2734-2740: LGTM - Guard correctly scopes diffuse IBL settings for FWMF world map.

The preprocessor condition !defined(WORLD_MAP) || !defined(FWMF_DETECTED) correctly allows this block to execute in all cases except when both defines are present, which is the intended behavior.

src/Globals.cpp (1)

48-49: LGTM - Clean global variable definition.

Properly initialized and correctly placed in the globals namespace.

src/Globals.h (1)

243-250: LGTM - Well-documented extern declaration.

The documentation clearly explains the purpose and detection mechanism. Follows the existing pattern for global declarations in this file.

Comment on lines 206 to 233
/**
* @brief Detect Flat World Map Framework DLLs at startup.
*
* Uses GetModuleHandleA() to avoid loading DLLs ourselves (consistent with
* optional module detection pattern). When detected, features like IBL and
* Post-Processing effects can avoid applying on world map to prevent
* visual artifacts with FWMF's flat texture replacement.
*
* Future: expand to detect Post-Processing modules that also distort FWMF output.
*/
const char* fwmfDLLs[] = {
"BakaWorldMapSpeed.dll",
"BakaWorldMapFOV.dll",
"FlatMapMarkersSSE.dll"
};

for (const char* dllName : fwmfDLLs) {
if (GetModuleHandleA(dllName) != nullptr) {
logger::info("Detected Flat World Map Framework mod: {} - Imagespace effects will be disabled on world map", dllName);
globals::flatWorldMapDetected = true;
break;
}
}

if (globals::flatWorldMapDetected) {
// Add shader define so WORLD_MAP permutations can conditionally disable IBL
globals::state->SetDefines("FWMF_DETECTED");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for DLL name references in the codebase
rg -i "BakaWorldMap|FlatMapMarkers" -g '!*.dll'

Repository: doodlum/skyrim-community-shaders

Length of output: 58


🌐 Web query:

Flat World Map Framework mod DLL names SKSE

💡 Result:

Short answer: Flat World Map Framework (FWMF) itself is not an SKSE plugin and does not include a primary SKSE DLL. The SKSE-related component commonly used with FWMF is the separate "Flat Map Markers" SKSE plugin (often distributed alongside or as an optional file), whose code has been bundled into other projects (e.g., EnderalSE.dll) in some distributions. Sources: Nexus FWMF files page and Enderal project notes. [1][2]

Sources

  • Flat World Map Framework (FWMF) — Nexus files listing (shows FWMF as a non-SKSE framework; separate "Flat Map Markers" file available). [1]
  • Enderal project notes / credits (shows Flat Map Markers code included into EnderalSE.dll in that project). [2]

🏁 Script executed:

#!/bin/bash
# Search for any comments or references to mod compatibility in the codebase
rg -i "enderal|bundled|bundling" --type cpp --type hpp

Repository: doodlum/skyrim-community-shaders

Length of output: 103


🏁 Script executed:

#!/bin/bash
# Search for any comments or references to bundled mods
rg -i "enderal|bundled" -t cpp -t c -t h

Repository: doodlum/skyrim-community-shaders

Length of output: 224


🏁 Script executed:

#!/bin/bash
# Simple search without type restrictions
rg -i "enderal|bundled"

Repository: doodlum/skyrim-community-shaders

Length of output: 58


DLL names are correct; document known limitation with bundled variants.

The three DLL names are accurate for their respective mods:

  • BakaWorldMapSpeed.dll and BakaWorldMapFOV.dll are from the "Baka Flat World Map" mod
  • FlatMapMarkersSSE.dll is from the "Flat Map Markers" SKSE plugin

However, the detection has a known limitation: "Flat Map Markers" code is sometimes bundled into other DLLs (e.g., EnderalSE.dll in certain distributions). The current approach will not detect these bundled variants. Consider adding a comment documenting this limitation, and potentially expand detection in a future update to handle bundled scenarios beyond just Post-Processing modules.

🤖 Prompt for AI Agents
In src/XSEPlugin.cpp around lines 206 to 233, the FWMF DLL detection loop works
but lacks documentation about a known limitation where Flat Map Markers may be
bundled into other DLLs (e.g., EnderalSE.dll) and so won't be detected; add a
brief comment above the fwmfDLLs array explaining that bundled variants exist
(mention EnderalSE.dll as an example), note that current detection uses
GetModuleHandleA and will miss bundled plugins, and add a TODO suggesting future
improvements (e.g., scanning loaded module names for known substrings, checking
exported symbol names, or providing a user-configurable override) so maintainers
know safe extension paths.

@alandtse
Copy link
Collaborator

Instead of hardcoding one mod/dll. Think about making this data driven via our settings file. We can prepopulate bad mods in the settings. The structure can likely do osmething like if dlls detected, create a define. Perhaps we can make it so features dynamically have a define that disables them. But think about scalability.

@davo0411
Copy link
Collaborator Author

davo0411 commented Dec 29, 2025

I did make it create a define based on present .dlls. Idk how to get the dlls any smoother than hard coding the names.

I can't think of another use case where we're going to need to disable features based on mod .dlls, but i can expand this to be a whole system if preferred, but this is meant to be a quick fix. Don't want to waste time expanding this, splitting the PRs up etc.

davo0411 and others added 2 commits December 29, 2025 17:46
Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
@alandtse
Copy link
Collaborator

Make it data driven in the settings file. You can't just do one off non scalable code. It adds tech debt. Slop coding doesn't work for complex projects.

@davo0411 davo0411 changed the title fix(ibl): conditional FWMF .dll check to stop overexposure feat: conditional shader defines based on user-defined .dlls Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants