Skip to content

[codex] Avoid unsafe GFx movie replacement hangs#7

Open
nwn900 wants to merge 1 commit into
alexsylex:mainfrom
nwn900:codex/safe-swf-replacement
Open

[codex] Avoid unsafe GFx movie replacement hangs#7
nwn900 wants to merge 1 commit into
alexsylex:mainfrom
nwn900:codex/safe-swf-replacement

Conversation

@nwn900

@nwn900 nwn900 commented May 24, 2026

Copy link
Copy Markdown

Summary

This patch makes InfinityUI instance replacement safer for GFx movie clips that can fail or stall during patch loading.

  • Load replacement SWFs into a temporary movie clip first, verify the loaded movie/sprite definitions, and only then remove and rename over the original instance.
  • Keep the original instance in place when loadMovie fails or loaded definitions cannot be resolved, instead of removing the live UI element first.
  • Guard PatchGFxMovie against recursive patch passes when GFxMovieRoot::Advance(0) re-enters the hook during patching.
  • Add patching settings for safe replacement, slow patch/load warnings, and selectively disabling patch files.
  • Skip post-build deployment copies when the local Skyrim SE/VR plugin folder does not exist.

Why

I hit a game hang while playing with InfinityUI patches active. The previous replacement path removed the original movie clip before proving the replacement SWF had loaded successfully, and the Advance(0) calls used while patching could also re-enter InfinityUI patching for the same movie root. Together that made a bad or slow patch load much more likely to leave the menu in an unstable state.

The new default path is fail-closed: load and validate the replacement first, then swap it into place. If validation fails, the original UI element remains alive and InfinityUI logs the skipped replacement.

New Settings

  • bSafeReplacement:Patching defaults to true.
  • uSlowPatchWarningMS:Patching defaults to 250; set to 0 to disable slow patch warnings.
  • sDisabledPatchFiles:Patching defaults to empty; accepts comma- or semicolon-separated patch path suffixes to skip.

Validation

  • git diff --check
  • cmake --build build\se-only\relwithdebinfo through the Visual Studio developer environment

Note: running the build from a plain PowerShell initially failed because MSVC's standard library include paths were not loaded in that shell. The same build completed successfully after VsDevCmd.bat -arch=x64 initialized the compiler environment.

@nwn900 nwn900 marked this pull request as ready for review May 24, 2026 19:15
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