Skip to content

fix: internal stability and correctness fixes#51

Merged
codepuncher merged 4 commits into
mainfrom
fix/audit-quick-wins
Jun 16, 2026
Merged

fix: internal stability and correctness fixes#51
codepuncher merged 4 commits into
mainfrom
fix/audit-quick-wins

Conversation

@codepuncher

@codepuncher codepuncher commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Changes

MenuUI — wrap RenderSettings body in try/catch (...) to prevent undefined behaviour from exceptions crossing the __stdcall DLL boundary into SKSEMenuFramework.

InputHandler — add break after the first keyCode match in ScanInputEvents; keyCodes are unique so continuing the loop served no purpose.

MCMNavigator

  • Capture both Invoke return values in SelectEntryByName; warn and return false if either fails instead of silently succeeding.
  • Guard GetElement calls with !entry.IsObject() in both SelectEntryByName and CollectEntryNames.
  • Move four internal-only helpers (IsModAlreadyOpen, CacheModListFromGFx, NavigateToTargetImpl, ReadModArraysIntoCache) into the anonymous namespace; they were previously at MCMNavigator:: scope but undeclared in the header.
  • Simplify ClearPapyrusPending scope-guard to destructor-only (with NOLINTNEXTLINE for the special-member-functions check).

Config

  • Add #include <string> directly to Config.h (was relying on transitive inclusion).
  • Add kCount sentinel to LongPressAction enum and a static_assert verifying kActionOptions stays in sync.
  • Check LoadFile return code in SaveSettings; warn if the existing INI could not be parsed.
  • Warn at load time when sButtonStartAction=MCM or sButtonBackAction=MCM but the corresponding mod name is not set.

Copilot AI review requested due to automatic review settings June 16, 2026 20:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR applies a set of internal correctness/safety hardening changes identified during an audit, primarily around Scaleform/GFx interactions, input scanning, and configuration integrity checks.

Changes:

  • Prevent exceptions from escaping across the __stdcall Menu Framework callback boundary; harden GFx list traversal and invocation success handling in MCM navigation.
  • Fix input scanning to stop after the first matching keyCode (since the configured codes are unique in current usage).
  • Tighten configuration correctness with direct includes, an enum sentinel + compile-time sync check, and additional load/save-time warnings.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/MenuUI.cpp Wraps RenderSettings in try/catch (...) to avoid exceptions crossing the DLL callback boundary.
src/MCMNavigator.cpp Adds safer GFx element/object checks, verifies Invoke success, and scopes internal helpers to the TU.
src/InputHandler.cpp Stops scanning configured buttons after the first keyCode match.
src/LongPressAction.h Adds kCount sentinel to support compile-time sync checks.
src/Config.h Adds <string> include and a static_assert tying kActionOptions to the enum size.
src/Config.cpp Adds warnings for inconsistent MCM config and warns when saving over an unparsable INI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/MenuUI.cpp
@codepuncher codepuncher force-pushed the fix/audit-quick-wins branch from 00cdcb8 to d196b55 Compare June 16, 2026 20:44
Copilot AI review requested due to automatic review settings June 16, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/MenuUI.cpp
@codepuncher codepuncher merged commit 0a6f093 into main Jun 16, 2026
19 checks passed
@codepuncher codepuncher deleted the fix/audit-quick-wins branch June 16, 2026 21:29
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.

2 participants