Fix trampoline crash by replacing MenuCursor hooks

The previous MenuCursor detour hooks crashed at startup with 'REL/Trampoline.cpp: Failed to handle allocation request' because the plugin never allocated F4SE trampoline memory. Replaced detours with a MainMenu::AdvanceMovie vtable hook (which requires no trampoline) that re-expands cursor bounds immediately after vanilla title-screen parallax runs. Added UIAdvanceMenusFunctionCompleteEvent sink as additional safety net. Changed main menu disableFocusMenu to true to avoid fighting vanilla cursor/parallax state.
This commit is contained in:
2026-07-07 14:44:40 +12:00
parent f1635948ee
commit c957c117c0
5 changed files with 139 additions and 10 deletions
+52
View File
@@ -7,6 +7,58 @@ failed experiments, successful tests, and next steps.
---
---
## 2026-07-07 - Fix: Trampoline Crash on Load (MenuCursor Hook Replaced)
### Summary
The previous `MenuCursor::SetCursorConstraintsRaw` / `CenterCursor` detour hooks crashed at startup with `REL/Trampoline.cpp: Failed to handle allocation request` (Allocate Size: 14, Free Size: 0) because the plugin never allocated F4SE trampoline memory. Removed the detours and instead hook `MainMenu::AdvanceMovie` via vtable (same pattern as existing MainMenu input hooks) to re-expand cursor bounds immediately after vanilla title-screen parallax runs. Kept the `UIAdvanceMenusFunctionCompleteEvent` sink and per-frame `ReleaseMenuCursorConstraints()` as additional safety.
### Files Changed
- `plugin/src/F4TPrismaUI.cpp`
- `changelog.md`
- `docs/dev-log.md`
### Testing
- Built via `xmake build`.
- Launch game: should no longer show trampoline error dialog; custom main menu should appear after intro.
- Verify mouse reaches all screen edges on title screen.
### Known Issues
- Cursor snap-back fix needs in-game re-verification with the vtable-hook approach.
### Next Steps
- User verification after deploy.
## 2026-07-06 - Fix: Main Menu Cursor Snap-Back (MenuCursor Hooks)
### Summary
The custom main menu overlay still trapped the mouse in a central box even after per-frame `ReleaseMenuCursorConstraints()`. Vanilla `MainMenu` title-screen parallax calls `MenuCursor::SetCursorConstraintsRaw` and `CenterCursor` every frame **after** our task cleared bounds, immediately re-tightening them. Fixed by hooking both functions to expand constraints to the full window and skip re-centering while a custom overlay is visible, registering a `UIAdvanceMenusFunctionCompleteEvent` sink as a post-menu safety net, and using `disableFocusMenu=true` for the main menu (vanilla `MainMenu` already owns a working cursor).
### Files Changed
- `plugin/src/F4TPrismaUI.cpp`
- `ui/views/CommonwealthOnline/main-menu/shell.html` (removed stray viewport meta)
- `changelog.md`
- `docs/dev-log.md`
### Details
- `SetCursorConstraintsRaw` hook redirects to `(0, 0, windowWidth, windowHeight)` when main menu or server browser overlay is active.
- `CenterCursor` hook becomes a no-op while overlays are active.
- `ReleaseMenuCursorConstraints()` now also calls `SetCursorConstraintsRaw` with full-window dimensions.
- Main menu `Focus()` now passes `disableFocusMenu=true` so PrismaUI does not open its own FocusMenu on top of vanilla title-screen cursor handling.
### Testing
- Build via `build-all.bat`.
- Launch to title screen; wait for custom main menu overlay.
- Move mouse to all four corners — cursor should not snap back to center.
- Click each menu row; open MULTIPLAYER and confirm server browser cursor also spans full window.
### Known Issues
- None currently known for this fix.
### Next Steps
- User in-game verification.
## 2026-07-06 - Fix: MenuCursor Constraints + Bink Gating (cursor jolt + early overlay)
### Summary