Skip to content

feat: more engine fix ports#24

Merged
northaxosky merged 12 commits into
masterfrom
feat/more-engine-fix-ports
May 23, 2026
Merged

feat: more engine fix ports#24
northaxosky merged 12 commits into
masterfrom
feat/more-engine-fix-ports

Conversation

@northaxosky
Copy link
Copy Markdown
Contributor

@northaxosky northaxosky commented May 6, 2026

Summary

  • Muzzle Flash Light - cull the attached NiPointLight when a muzzle flash ends so disabled flashes stop leaking illumination.
  • Hi-Res Bloom - patch the hardcoded shr in BSShaderRenderTargets::Create so the bloom RT can render at full/half/quarter/eighth res via nBloomScale. Opt-in.
  • Alt-Tab Fullscreen - force the swap chain to borderless-windowed at creation and block DXGI Alt+Enter; sidesteps the exclusive-fullscreen alt-tab hang.
  • Power Grid Scrap - route workshop-tracked refs through Workshop::DeleteWorkshopItem so orphan power-grid entries don't survive into a recycled FormID.
  • DPI Scaling - set PER_MONITOR_AWARE_V2 early so non-100% Windows scaling doesn't blur the UI.
  • Animated Static Reload - reset the static animation FormList on game-load so anim states don't bleed across saves.
  • Viewmodel Shading - fix the first-person viewmodel shader so it picks up scene lighting correctly.
  • DoF Fix - restore depth-of-field rendering paths broken by the engine.
  • BethesdaNetCrash (OG fix) - fall back to MSVCR110.dll when the CRT shim DLL isn't in the IAT.
  • ConfigValidation - register the new TOML keys (and previously-missed bAnimSignedCrash / bBethesdaNetCrash) so SettingStore stops emitting "unknown key" warnings.

Depends/commonlibf4 bumped to track main HEAD (commonlibf4#8 merged: inline on ItemIsPowerConnection/ItemIsPowerReceiver so two TUs can include RE/P/PowerUtils.h without LNK2005).

… Grid Scrap

- Muzzle Flash Light: detour MuzzleFlash::UpdateLight to call SetAppCulled
  on the attached NiPointLight when the flash ends. Concept from
  WallSoGB/Fallout-Muzzle-Flash-Fix.
- Hi-Res Bloom: pattern-scan BSShaderRenderTargets::Create and rewrite the
  hardcoded shr-by-2 imm8 per nBloomScale (1=full, 2=half, 4=vanilla,
  8=eighth). Concept from WallSoGB/Fallout-High-Res-Bloom. Opt-in default.
- Alt-Tab Fullscreen: IAT-detour D3D11CreateDeviceAndSwapChain, install
  MakeWindowAssociation(NO_WINDOW_CHANGES|NO_ALT_ENTER), chain a WndProc
  via SetWindowLongPtrA that drops exclusive fullscreen on focus loss.
- Power Grid Scrap: hook TESObjectREFR::SetWantsDelete; if the deleted
  ref is workshop-linked and present in the workshop's powerGrid (V1170
  IsItemPresentInWorkshop check), call Workshop::DeleteWorkshopItem
  before the original SetWantsDelete proceeds. Concept from SUP F4SE
  V1170 by Tomm (MIT).

Bumps commonlibf4 to fix/inline-powerutils-helpers (PR #8 upstream); needed
because two TUs now include RE/P/PowerUtils.h transitively.
OG 1.10.163 imports wcsrtombs_s from MSVCR110.dll, not from
api-ms-win-crt-convert-l1-1-0.dll which is the modern CRT api-set used by
NG/AE. The IAT detour now walks both DLL names so the hook installs on all
three runtimes.
Adds bAnimSignedCrash, bBethesdaNetCrash, bMuzzleFlashLight, bAltTabFullscreen,
bPowerGridScrap, bHighResBloom and nBloomScale to the known-keys allowlist so
SettingStore stops emitting 'unknown key' warnings for them.
PR #8 (inline ItemIsPowerConnection / ItemIsPowerReceiver) was merged into
commonlibf4 main; track the merged SHA so the feature branch can be deleted.
@northaxosky northaxosky marked this pull request as draft May 6, 2026 20:11
… Fix

- DPI Scaling: preload-stage shim calling SetProcessDpiAwarenessContext
  (PMv2) with fallback cascade to SetProcessDpiAwareness and SetProcessDpiAware.
  No address-library binding required. Opt-in (bDpiScaling = false) since
  many users already apply the OS compat-tab shim manually.
- Animated Static Reload: vtable[0x9D] detour on
  TESObjectREFR::ShouldSaveAnimationOnSaving (RE::VTABLE::TESObjectREFR[0]).
  Forces save when base is BGSMovableStatic and an active NiControllerSequence
  is in kAnimating + kLoop. Restores the engine's animation state across
  save/load (Diamond City fans, settlement generators, etc.). Concept ported
  from SKSE Animated Static Reload (max-su-2019 / doodlum).
- Viewmodel Shading: detour DrawWorld::Move1stPersonToOrigin (OG addrlib
  76526, NG/AE 2318293), post-add BSShaderManager::State::forwardLightOffset
  to BSShaderAccumulator::eyePosition. Corrects specular highlights on the
  first-person viewmodel. Concept ported from WallSoGB Viewmodel Shading Fix
  (NVSE). Player-attached-light mirror fix (NV 0x87513F) is a follow-up.
- DoF Fix: detour ImageSpaceManager::RenderEffect worker (OG addrlib 325252,
  NG/AE 2316595) with a runtime-branched signature (OG passes the effect
  pointer in rdx, NG/AE pass an index into effectList._data). Filter on
  ImageSpaceEffectDepthOfField vtable; after vanilla DoF runs, re-issue the
  first-person viewmodel via BSShaderUtil::RenderScene (OG 1310228, NG/AE
  2317576) so the viewmodel stays sharp through DoF. Concept ported from
  WallSoGB Fallout-DoF-Fix (NVSE).
Detours BGSDistantObjectBlock::Prepare (OG addrlib 950871, NG/AE 2213394),
walks children of the prepared block, and forces kSpecular on each
BSGeometry's shade-slot property via BSShaderProperty::SetFlag (OG 1251793,
NG/AE 2316281). Pre-state gate skips re-walk on already-prepared blocks.

Re-enables specular sampling on distant-object LODs so they no longer look
flat. Default opt-in (bLODSpecular = false) because FOLIP-generated LOD packs
bake specular into the diffuse and would double-bright with the engine fix.
Coexistence shape pending answer from FOLIP author.

Concept ported from WallSoGB Fallout-LOD-Fixes sub-fix #1 (NVSE).
Conflicts resolved:
- AdConfigValidation: union of our keys + master's bUtilityShader; added
  bPipBoyCursorConstraints (missing on master).
- AdRegisterModules: union of our 10 modules + master's UtilityShader and
  PipBoyCursorConstraints. Kept AnimSignedCrash/BethesdaNetCrash registered
  (this branch ships the OG MSVCR110.dll fallback fix that addresses what
  prompted master's comment-out).
- VC/Addictol.vcxproj + .filters: union of file lists.
- .Build/F4SE/Plugins/Addictol.toml: re-added bAnimSignedCrash and
  bBethesdaNetCrash keys with default false, matching master's opt-in stance
  pending cross-runtime smoke test (PR #24).
- Depends/commonlibf4: took master's 23aa504e (descendant of our ec2bf96e;
  includes PR #8 inline fix plus 4 more commits).
- Version files: took master's; pre-build script will regenerate.
Reverses master hotfix 4d09f9d's opt-in defaults for AnimSignedCrash and
BethesdaNetCrash; this branch ships the OG MSVCR110.dll fallback (807a497)
that addressed the original failure. DpiScaling's install path no-ops via
ACCESS_DENIED if an OS compat-tab DPI shim already locked awareness, so
default-on is safe alongside the manual shim.
…x-ports

# Conflicts:
#	.Build/F4SE/Plugins/Addictol.toml
#	Addictol/Source/AdConfigValidation.cpp
#	Addictol/Source/AdRegisterModules.cpp
The previous approach subclassed the engine WndProc and called SetFullscreenState(FALSE) on focus loss, but never restored fullscreen on focus gain. After alt-tab back, the swap chain was windowed while the engine believed it was still in exclusive mode, causing a permanent black-screen lockup on the render thread.

Switch to the same approach used by SSE Engine Fixes / Display Tweaks: at D3D11CreateDeviceAndSwapChain, force Windowed=TRUE and clear ALLOW_MODE_SWITCH whenever the engine requested exclusive. Keep MakeWindowAssociation(NO_WINDOW_CHANGES | NO_ALT_ENTER) so DXGI cannot promote us back into exclusive on Alt+Enter. Drop the WndProc subclass and all g_swapChain/g_hwnd/g_origWndProc state.
@northaxosky northaxosky changed the title [WIP]: More EngineFixesSSE Ports feat: more engine fix ports May 23, 2026
Collapse 4 explainer blocks (AltTabFullscreen, ViewmodelShading, DofFix x2) to one line each. Removes restated rationale and 'before this change' framing; keeps the non-obvious WHY.
@northaxosky northaxosky marked this pull request as ready for review May 23, 2026 03:12
@northaxosky northaxosky merged commit b66a7dd into master May 23, 2026
1 check passed
@northaxosky northaxosky deleted the feat/more-engine-fix-ports branch May 23, 2026 03:27
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.

1 participant