Skip to content

runtime/shims: shim PSM app-notification and WER file registration APIs (RT-PSM-APPNOTIFY-WER) - #1240

Open
piyonchu wants to merge 1 commit into
ProjectLeonida:mainfrom
piyonchu:pr/psm-appnotify-wer-shims
Open

piyonchu wants to merge 1 commit into
ProjectLeonida:mainfrom
piyonchu:pr/psm-appnotify-wer-shims

Conversation

@piyonchu

@piyonchu piyonchu commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Claim ID: RT-PSM-APPNOTIFY-WER

Adds runtime/shims/appnotify.cpp and runtime/test/appnotify_test.cpp (wired into runtime/CMakeLists.txt and scripts/build_runtime.ps1):

  • Shims RegisterAppConstrainedChangeNotification and UnregisterAppConstrainedChangeNotification across kernel32.dll, kernelbase.dll, twinapi.appcore.dll, and api-ms-win-core-psm-appnotify-l1-1-0/1.dll, returning distinct tracked registration handles, ignoring nullptr/foreign/already-freed handles cleanly on unregister, and using constant-initialized SRWLOCK + raw lists to avoid MSVC TLS init guards. (RegisterAppStateChangeNotification and UnregisterAppStateChangeNotification are left out so they do not collide with #769.)
  • Shims WerRegisterFile / WerUnregisterFile across kernel32.dll, kernelbase.dll, wer.dll, and api-ms-win-core-windowserrorreporting-l1-1-0/1.dll, tracking normalized GAME:/G:/T: and host paths in-process without mutating host WER state or creating files on disk.
  • Adds unit tests in runtime/test/appnotify_test.cpp executed via rt::shims::find.

Verification

  • Host: Windows 11 (10.0.26100 SDK), MSVC (RelWithDebInfo), rebased onto cont/main (871e4b8b9), commit b607337fd.
  • ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure: 100% tests passed out of 148 (including #83 appnotify), with 7 game-data tests skipped (LEONIDA_GAME_DIR unset) and 2 gameinput tests disabled (no SDL3).
  • python -I tests/test_build_runtime_fallback.py: passed (10/10).
  • python -I scripts/check_no_game_data.py ... and git diff --check cont/main..HEAD: clean.
  • No game files used; CPU runtime test only (no GPU required). AI-assisted.

@aslan2142

Copy link
Copy Markdown
Collaborator

@piyonchu one overlap to sort out before this can go in:

AI-assisted (Claude Code, Claude Opus 5.5).

@piyonchu
piyonchu force-pushed the pr/psm-appnotify-wer-shims branch from 875fa5c to b607337 Compare November 25, 2026 02:08
@piyonchu

Copy link
Copy Markdown
Contributor Author

Thanks for catching the #769 overlap, @aslan2142! Updated #1240 (b607337fd) and rebased cleanly onto main (871e4b8b9):

  • Dropped RegisterAppStateChangeNotification and UnregisterAppStateChangeNotification from runtime/shims/appnotify.cpp and runtime/test/appnotify_test.cpp so there is no SHIM_TABLE registry collision with #769.
  • Kept RegisterAppConstrainedChangeNotification, UnregisterAppConstrainedChangeNotification, WerRegisterFile, and WerUnregisterFile, plus re-tested ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure (100% passed out of 148, #83 appnotify passed) and python -I tests/test_build_runtime_fallback.py (10/10 passed).

I also left a brief note on #769 with the negative test cases (nullptr registration pointer, null callback zeroing *Registration, nullptr/foreign-handle unregister) in case they are useful for lifecycle_test.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
@piyonchu
piyonchu force-pushed the pr/psm-appnotify-wer-shims branch from b607337 to cdee0f8 Compare November 25, 2026 14:28
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 26, 2026
@piyonchu

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main (fac8b4bb9, head commit 677379b01), resolving the scripts/build_runtime.ps1 fallback file list conflict cleanly (shims\xapu_queue.cpp + shims\appnotify.cpp).

Verified locally after rebase:

  • git diff --check cont/main..HEAD
  • python -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/shims/appnotify.cpp runtime/test/appnotify_test.cpp scripts/build_runtime.ps1
  • cmake --build runtime/build --config RelWithDebInfo --target gta6rt appnotify_test
  • ctest --test-dir runtime/build -C RelWithDebInfo -R "^appnotify$" --output-on-failure (1/1 passed)

@piyonchu
piyonchu force-pushed the pr/psm-appnotify-wer-shims branch from cdee0f8 to 677379b Compare November 26, 2026 21:40
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