Commit Graph
102 Commits
Author SHA1 Message Date
andrew 2a3e614a47 Add quit confirmation to main menu
Implement a quit confirmation dialog that appears when the QUIT button is selected on the main menu. The dialog displays 'EXIT GAME?' with YES/NO options. YES sends a coAction quit request to the plugin, which hides the overlay, disconnects any active server session, and sets RE::Main::quitGame to exit the game. NO returns to the main menu. Includes full keyboard (arrow keys, Enter, Escape), gamepad (dpad, A/B buttons), and mouse support. Default selection is NO.
2026-07-07 22:33:33 +12:00
andrew 549c117818 Restyle server browser UI; hide overlay on join
Restyles the server browser to match main-menu/settings (Futura PT Demibold, amber/green palette, yellow selection bars, shared panel chrome), removes SVG border strips, and tweaks modal width/layout. Adds JS + C++ coordination so the custom main-menu overlay hides when a server join begins (C++ invokes onSessionLoading and calls HideMainMenu; CompleteJoinFailure restores the menu/browser). Controller glyph tint now derives from --co-amber. Updates changelog and dev-log; includes compiled Vault109 script update.
2026-07-07 17:43:52 +12:00
andrew 9447bc308f Embed server browser as main menu modal
Refactors the browser UI into a reusable `CO_Browser.create()` module and adds embedded modal styling so MULTIPLAYER opens inside the main menu instead of swapping to a separate view. Updates main-menu JS/CSS to host, animate, and route input for the browser panel while keeping nav and prompts in sync. On the C++ side, PrismaUI now drives browser show/hide and event dispatch through the main menu view, and `ServerBrowserBridge::SetView()` was added so bridge events target the active host view.
2026-07-07 17:35:15 +12:00
andrew 2961eb6512 Prevent title-screen OS cursor trampoline
Stop the title-screen from forcing the Windows cursor back into a small centered box while the Commonwealth Online overlay owns input. Changes:

- Intercept SetCursorPos and ClipCursor in the Fallout4.exe import table (IAT) and make them no-ops while the overlay owns the pointer.
- Hook MainMenu BSInputEventUser vtable cursor/mouse-move slots to consume events when custom menu input is captured.
- ReleaseMenuCursorConstraints(): clear constraints, unset forceOSCursorPos, expand cursor bounds to the full window, and clear OS ClipCursor. Re-assert each frame during AdvanceMovie.
- Add InstallCursorApiHooks() and wire it into PrismaUI init; add logging.
- Update changelog.md to document the fix. Binary compiled script and minor source formatting updated.
2026-07-07 17:11:52 +12:00
andrew c957c117c0 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.
2026-07-07 14:44:40 +12:00
andrew f1635948ee Add custom main-menu overlay & input routing
Integrates a PrismaUI full-screen main-menu overlay with input capture and a bridge to the server browser. Adds F4TMainMenuBridge and F4TMainMenuVanillaSettings stubs, exposes Show/Hide/IsMainMenuVisible/IsCustomMenuInputCaptured in F4TPrismaUI, and routes gamepad input via SetMainMenuActive in F4TMenuInput. MainMenuInject implements robust readiness checks with Bink/frame gating and disables legacy multiplayer-row injection (constexpr false). Fixes cursor clipping by clearing RE::MenuCursor constraints each frame and removes unsupported viewport meta from HTML. Adds window.CO_App/handleControllerInput stubs and updates docs/changelog.
2026-07-06 17:47:57 +12:00
andrew 89c3e82554 Implement proxy weapon animation sync for ranged guns
Milestone 1: Proxy actors now equip remote players' right-hand weapons and play armed idle/locomotion poses when weaponDrawn=true. Adds rightHand weapon slot to equippedItems protocol, weapon graph variable support (iSyncGunDown: 0=drawn, 1=holstered), and weapon FSM events (weaponDraw, readyStateEnter, gunDownStateEnter). Fixes two critical animation state churn bugs: frustum-visibility flicker no longer resets animation state on every update tick, and idle proxies no longer register as changed on every frame. Includes WeaponBehavior graph loading via AIProcess::RequestLoadAnimationsForWeaponChange() and manual weapon attachment fallback. New docs/weapon-animation-sync.md reference guide maps animation events and variables from F4-Animation-Research. Experimental alert-state reassertion for armed proxies to test NPC combat state gating of weapon-ready poses.
2026-07-02 17:23:09 +12:00
andrew a6d4cc2ba6 Use console commands to start MQ102 on Vault exit
Replace direct TESQuest::SetStage usage with console commands to reliably start and advance MQ102 when leaving COVault109. TryStartOutOfTimeQuest now includes RE::Console, issues `startquest MQ102` and `setstage MQ102 10`, and uses a static one-time guard (outOfTimeQuestStartIssued) to avoid repeated issuance. Removed the unreliable currentStage check and adjusted constants/naming and log output. Updated changelog and dev-log to document the implementation and touched compiled script binary.
2026-06-30 22:46:06 +12:00
andrewandCursor 771f855f89 Add automatic quest start for Out of Time (MQ102) on COVault109 exit
When the player leaves COVault109 for the first time, the plugin now automatically
starts the Out of Time quest (MQ102, FormID 0x0001CC2A) and sets it to stage 10,
skipping the vault entry sequence for a smoother multiplayer transition.

The implementation uses TESDataHandler::LookupForm to safely resolve the quest,
includes defensive null checks, and only triggers once by checking the quest
currentStage field. Appropriate logging is added for debugging.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 22:33:21 +12:00
andrew d328bfb647 Add complexionFormId to appearance payload
Introduce complexionFormId (TXST) into RemoteAppearance and the appearance protocol so complexion textures are captured and serialized. Updates: header/state, Networking JSON parse/serialize, proxy actor comparisons, main capture logic, protocol docs, fake client/player samples, changelog and dev-log. Capture reads PlayerCharacter::complexion and serializes it, but applying to proxies is intentionally a no-op because TESNPC proxies lack a complexion field (documented in comments/dev-log). Files: plugin/include/F4TRemotePlayerState.h, plugin/src/*, protocol/packets.md, server/fake_client.py, server/fake_player.py, changelog.md, docs/dev-log.md.
2026-06-30 22:20:44 +12:00
andrew 76fd8772bd Add appearance tint syncing (appearance v3)
Introduce tint syncing for skin/complection/makeup/beard by adding RemoteAppearanceTint and a tints vector, and bump appearance payload version to 3. Parse/emit tints in networking and update fake server/client test payloads. Capture live Player/NPC tintingData during appearance capture. Apply tints to proxies by updating existing entries or reconstructing missing ones via template resolution and MakeTintEntry (game allocator + vtable fixup); unresolved templates are skipped with throttled warnings. Update docs/changelog and add logging for applied tints. Backwards compatible with v1/v2 packets.
2026-06-30 22:07:49 +12:00
andrew 5b54db64d4 Character Appearance Phase 1 Done
Bump appearance payloads to version 2 and add `morphRegions` and `facialBoneMorphs` capture, serialization, and proxy application. Also fix head-part syncing when sender and proxy counts differ by reallocating the proxy array instead of deferring the whole list, and update the Python harness and protocol docs to match.
2026-06-30 17:37:02 +12:00
andrew 8ff1a90fa5 Revert "Add Pip-Boy state to transform sync"
This reverts commit 4ed671464e.
2026-06-30 16:59:42 +12:00
andrew 683feabb77 Revert "Handle Vault 109 quest handoff"
This reverts commit 6fdc63c36d.
2026-06-30 16:59:34 +12:00
andrew 6fdc63c36d Handle Vault 109 quest handoff
When the local player leaves COVault109, the plugin now completes MQ101 and starts MQ102 at stage 10 on the game thread, with a log entry for confirmation. Updated the changelog and architecture/dev-log docs to reflect the new Vault 109 flow, and refreshed the compiled Creation Kit script artifact.
2026-06-30 16:21:30 +12:00
andrew 4ed671464e Add Pip-Boy state to transform sync
Adds optional `isPipboyOpen` to transform packets, remote player state, proxy animation logging, and fake client/player samples. Updates protocol and architecture docs to describe the new Pip-Boy open/raising/closing state and related movement-state handling.
2026-06-30 16:00:07 +12:00
andrew 4b8f5246c4 Add appearance sync and late-join replay
Adds optional `appearance` snapshots to transform packets, applies supported appearance data to runtime proxies, and has the server replay stored transforms to newly connected clients so late joiners receive current visuals immediately.
2026-06-29 16:46:50 +12:00
andrew ad7f287899 Add optional apparel sync (equippedItems)
Introduce an optional equippedItems transform extension to snapshot tracked visible apparel slots. Plugin: capture local equipped ARMO form IDs on the game-thread, include equippedItems in transform packets, parse equippedItems on the networking thread, and apply/clear synced apparel on runtime proxies (with defensive logging for missing forms). Server: fake_client parses and prints equippedItems. Docs and protocol updated; changelog and dev-log entry added. Backwards-compatible: equippedItems is optional and empty formId denotes intentional unequip.
2026-06-29 16:02:03 +12:00
andrew d0649667f7 Harden runtime proxy adoption
Ignore deleted actors during proxy candidate selection, delete stale saved runtime proxies before spawning fresh ones, and promote proxies based on loaded 3D instead of camera visibility. Updated docs and changelog accordingly.
2026-06-29 15:37:05 +12:00
andrew b505477e08 Add COVault109 solo-cell handling
Implement solo-cell logic to suppress transform packet sends and remote proxy representation while the local player is in COVault109, allowing first-time character creation to remain visually single-player. One entry location update is sent so other clients can hold stale proxies before suppression begins. Added F4TSoloCell.h helper for load-order-independent solo cell recognition by editor ID and cached FormID.
2026-06-29 14:46:11 +12:00
andrew 37d6afbd5a Improve first-time Looks menu face framing
Replace ineffective third-person zoom with FOV narrowing (40°) to magnify the character's face for easier facial-feature editing. Center the player on the fixed LooksMenu camera's optical axis for the first few polls to prevent off-center framing caused by the camera not being perfectly aimed at the player. Capture and restore FOV and player transforms on menu open/close. Add diagnostic logging to track camera position, player position, and menu camera behavior.
2026-06-28 21:31:15 +12:00
andrew 2f37feb5b7 Restore LooksMenu camera state
Capture the pre-LooksMenu third-person camera settings and restore them when character customization closes, so first-time customization returns to the normal over-the-shoulder view and movement controls. Also clear the saved snapshot during reset paths so cleanup still runs if the menu flow exits early.
2026-06-28 18:59:59 +12:00
andrew 22394a77ff Improve Vault109 chargen flow and LooksMenu handling
Move first-time character menu orchestration out of Papyrus and into the C++ session-launch flow. CO_Vault109StartQuestScript.psc now only teleports the player and sets stage 10. F4TSessionLaunch.cpp adds camera preparation/restoration, direct PlayerCamera/ThirdPersonState face-camera tuning, primary console ShowLooksMenu 14 path, Actor.ShowLooksMenu fallback, retry/timeouts and guarded state resets. Added logging and counters for Looks/SPECIAL menu polling. Updated changelog.md and docs/dev-log.md to describe the new flow and testing notes.
2026-06-28 17:39:47 +12:00
andrew 904394999a Start first-time join in COVault109 and trigger quest
Change first-time session launch to use the COVault109 start cell and invoke a start quest so the quest can place the player at its preset spawn. Replaces coc SanctuaryExt with coc COVault109, changes the spawn-detection to match the COVault109 editor ID, adds a g_vault109StartQuestIssued flag and IssueVault109StartQuest() to run `startquest CO_Vault109StartQuest` once, and updates logs and reset logic. Also updates docs (changelog.md, docs/dev-log.md) and includes the updated CommonwealthOnline_Vault109.esp binary.
2026-06-26 17:59:57 +12:00
andrew 8772e024f8 Improve server profile resolution and save handling
Add host normalization and ResolveServerKey to match equivalent endpoints (localhost/127.0.0.1, bracketed IPv6, etc.) so reconnects reuse existing server profiles. Harden profile storage: sanitize save-folder components, use Documents fallback via _dupenv_s when needed, log write/open failures, and fix Windows build issues from unsafe getenv usage. Make session launch resilient to missing or rotated exit saves by accepting Exitsave... names, refreshing to the newest exit save, and falling back to first-time flow from the main menu (instead of hard-failing). Update session launch to prefer resolved profile keys, touch/bind profiles appropriately, and improve related load error handling. Also add a simple Creation Kit quest script (CO_Vault109StartQuestScript) and update changelog/docs to document these changes.
2026-06-26 15:29:16 +12:00
andrew 77751c69f7 Use world-state host for server weather actions
Stop hardcoding player 1 for server-initiated weather/time and instead use the current world-state host. Plugin code now defers weather commands until GetWorldStateHostPlayerId() is available, uses IsWorldStateHost() to gate execution, logs local/host IDs, and requeues when host assignment is missing. Relay logic now attempts ForceHostWorldStateBroadcast and logs if relay fails. Updated protocol docs, dev server UI tooltips, presets comment, changelog, and dev log to reflect world-state host terminology and behavior. This ensures weather/time control survives host reassignment and avoids dropped commands on reconnect/restart.
2026-06-25 10:48:18 +12:00
andrew c4466718a3 Convert HHmm to Fallout game-hour float
Add parsing and application of HHmm time strings as Fallout game-hour floats so GUI time presets apply correctly. Introduce ParseHHmmToGameHour in plugin/src/F4TWorldStateSync.cpp and use it when building the console command (formats as set gamehour to <float> with fallback to the raw HHmm string if parsing fails). Improve logging to indicate when a parsed HHmm was used. Update protocol/server-world-state.md, changelog.md, and docs/dev-log.md to document the behavior and rationale.
2026-06-24 12:34:18 +12:00
andrew 1493e68349 Fix GUI weather: valid IDs, defer & reset
Replace invalid Fallout 4 weather form IDs with valid ones (including fixing Clear from 0002852a -> 0002b52a) and update protocol examples and server presets accordingly. Change the plugin to re-queue/defer server weather payloads when the local assigned player ID is not yet available (so early GUI clicks are not dropped) and add a log entry when deferring. Reset player/host assignment on server startup (_next_player_id = 1 and clear _world_state_host_player_id) to avoid stale host IDs after restarts. Also update changelog and developer log entries describing the fixes and recommended manual testing steps.
2026-06-24 12:26:55 +12:00
andrew 4c17e70620 Add serverWorldState packet and GUI controls
Introduce a server-authoritative world-state packet to control weather and time from the dev server GUI. Adds protocol docs and message type (serverWorldState), a new Weather/Time tab in dev_server_app.py, server-side broadcasting in server_core.py, and preset utilities in server/world_state_presets.py. Plugin changes (F4TNetworking.cpp, F4TWorldStateSync.*) queue and apply incoming serverWorldState on the game thread, run `set gamehour` for all clients, and run `fw <8-digit-id>` on the assigned player 1 then force the host to relay a worldState snapshot. Also includes parsing/validation of hex form IDs, logging improvements, and minimal fake client handling. This ensures consistent server-driven time/weather and documents usage and presets.
2026-06-23 23:03:34 +12:00
andrew 70933db6e5 Event-driven world time sync (timeSync flag)
Introduce an optional timeSync field and event-driven time pushes so host time is only re-applied on connect, resume-from-freeze, or large jumps while weather continues on ~1 Hz heartbeats. Added IsGameTimeFrozen detection and client buffering of latest host time; clients apply host time only when timeSync is true or when gameplay just resumed. Updated networking to read/write timeSync, adjusted F4TWorldStateSync logic (separate time vs weather send/apply paths, changed function signatures and behavior), and updated protocol/docs/changelog and fake_client logging to reflect the new field and behavior.
2026-06-23 15:55:05 +12:00
andrew 99595ef87c Add host-authoritative world-state sync
Implement host-authoritative time/weather sync across server and clients. Adds a new worldState packet (and worldStateHost for host assignment) and server-side host tracking/reassignment to the lowest remaining playerId when the host disconnects. Plugin-side changes introduce F4T::WorldStateSync (new header + implementation), polling/apply hooks in the game-thread main loop, and Networking support to send/receive/parse worldState/worldStateHost packets. The server validates host-only sends, relays worldState to peers, broadcasts worldStateHost on host handoff, and augments logging/stats. Protocol and documentation files updated (protocol/world-state.md, docs/*) and server/fake_client.py extended to track/print host world-state snapshots.
2026-06-22 21:50:59 +12:00
andrew 9ceb6601ae Add LAN discovery and Local servers UI
Adds LAN server discovery and a Local tab in the multiplayer UI so clients can find relays on the same LAN. Introduces a new F4T::LanDiscovery module (plugin/include/F4TLanDiscovery.h, plugin/src/F4TLanDiscovery.cpp) that probes LAN hosts via UDP discover (port 7778) and TCP welcome fallback (port 7777). Server-side support includes a UDP responder (server/lan_discovery.py) and integration in server_core.py to start/stop discovery.

Plugin changes (F4TServerBrowserBridge/Data) add background scanning, dispatch results to the game thread, new local-server storage and events (scanLocalServers, localServersUpdated, localScanStarted/localScanFinished), and small join/recent handling updates. UI changes (ui/.../app.js and components) add localServers state, scanning UX, Recent persistence (localStorage), and join logic for local/direct entries. Docs updated (docs/protocol.md, docs/dev-log.md, server/README.md) and build script links iphlpapi. Also removes two unused exported sprite PNGs.
2026-06-22 15:53:17 +12:00
andrew 1353e5a52c Gamepad-aware cursor handling in server browser
Add gamepad-aware pointer handling so the server browser hides the mouse cursor when a controller is connected and only shows it after mouse movement/click. Changes include:

- PrismaUI: track browser pointer mode, prefer gamepad detection, suppress native CursorMenu/MenuCursor when in gamepad mode, unfocus the Ultralight view to prevent PrismaUI drawing its cursor, and restore pointer mode on mouse activity. Integrate pointer-mode initialization on browser show and call PollGamepad + UpdateBrowserPointerMode in the permanent task loop.
- MenuInput: expose IsGamepadConnected(), provide PollGamepad() wrapper and simplify Register() logging.
- UI: add window.CO_App.setPointerMode to toggle a co-gamepad-mode class and clear hover state; add CSS to hide the HTML cursor when co-gamepad-mode is active.
- docs: add dev-log entries describing the PrismaUI Ultralight cursor fix and the new gamepad-aware server browser behavior.

These changes ensure consistent cursor behavior between mouse and controller input, prevent the Ultralight cursor from appearing in controller mode, and restore the cursor after mouse interaction.
2026-06-18 14:37:31 +12:00
andrew f720d35d2a Add controller support and safe main menu hooks
Enable gamepad navigation for the PrismaUI server browser and install MainMenu input hooks safely. Poll XInput each game-thread tick and forward button/stick changes to the browser (ForwardButtonEvent / ForwardThumbstickEvent), allocate an input-enable layer to suppress vanilla kMenu events while the browser is open, and register polling via the F4SE task interface. Replace direct vtable writes that caused a loading-screen crash with REL::Relocation::write_vfunc on the MainMenu BSInputEventUser secondary vtable and install OnButton/OnThumbstick hooks once at plugin Install(). Add MainMenu API to suppress inputEventHandling and call it when showing/hiding the browser. Also update PrismaUI browser JS to support controller focus for direct-connect, filter activation/cycling, improved controller prompts, and add CSS for focused direct-connect fields. Files touched include plugin/src/F4TMenuInput.cpp, plugin/src/F4TMainMenuInject.cpp, plugin/include headers, PrismaUI view JS/components, styles, and documentation.
2026-06-18 14:26:33 +12:00
andrew f56b6cf113 Maintain runtime proxy frustum visibility
Add periodic nudging to restore proxy frustum visibility when a proxy is near the local player to prevent proxies from remaining invisible after a frustum cull. Introduce kRuntimeProxyVisibilityNudgeInterval and kRuntimeProxyForceVisibilityRange, track lastObservedProxyVisible on ProxyActorSlot, and add MaintainRuntimeProxyFrustumVisibility and NudgeProxyFrustumVisibilityIfNearLocalPlayer helpers (with throttled logging and animation re-apply when visibility is regained). Switch several readiness checks from ProxyMeshReadyForPresentation to ProxyHasLoaded3D, and stop gating puppet updates on IsVisible so puppets continue to update while the mesh is loaded even if frustum-cleared. Also reset lastObservedProxyVisible when clearing a slot.
2026-06-16 16:44:09 +12:00
andrew cd3679e548 Improve runtime proxy 3D recovery and head refresh
Make proxy 3D/visibility handling more robust to avoid headless A-poses and corrupted movement after PlaceAtMe spawns or 3D reloads. Added helpers to check mesh readiness, queue targeted 3D updates, and refresh head/face nodes; introduce settle/wait timing (2s default, 12s max) and recovery state tracking on proxy slots. Retain proxies for prior exterior cells when appropriate, reset/clear additional slot flags on lifecycle changes, and block puppet updates while proxies are settling. Adjusted animation sync and puppet logic to require visible/loaded meshes before applying motion feedback. Added related includes and expanded logging to aid diagnostics.
2026-06-16 16:36:43 +12:00
andrew 73d44a828b Improve proxy mesh readiness and spawn logic
Introduce ProxyMeshReadyForPresentation to treat partially loaded but visible proxy meshes as ready (avoids headless A-poses). Track lastObservedRemoteCellId on proxy slots and use it to detect remote cell changes so proxies can be restored or snapped when needed. Harden spawn lifecycle handling: reset stale promoted state, add/clear fields (pendingSpawnHandle, spawnAttempted, spawnFailed, lifecycleState, holdReason, visibility flags) and ensure slots are properly reinitialized. Replace ProxyHasLoaded3D checks with the new readiness check in animation sync and movement updates. Also publish an initial transform (including cell/worldspace info) immediately on connect so host/client can resolve same-cell placements without waiting for movement.
2026-06-16 16:08:59 +12:00
andrew 31406a1275 Add hover sync and CO hover component
Add a hover system to restore :hover-like behavior for custom UI elements in the CommonwealthOnline view. Changes include:

- plugin/src/F4TPrismaUI.cpp: add SyncBrowserHover() which reads the native cursor position, converts it to client coordinates, and invokes a JS update on the server browser view; register a periodic task to call SyncBrowserHover every other tick.
- ui/views/CommonwealthOnline/browser/components/hover.js: new component that tracks pointer position, determines hovered targets using a selector list, and applies/removes a .hovered class; exposes bind(), updateFromPoint(), and clear().
- ui/views/CommonwealthOnline/browser/app.js & index.html: include and bind the new hover component during UI initialization.
- ui/views/CommonwealthOnline/browser/styles.css: add .hovered variants and transitions for nav items, buttons, rows, and filter controls to match hover visuals.
- steam_interfaces.txt: add a list of Steam interface version strings (new file).

Purpose: ensure custom buttons/rows that don't receive native :hover updates from the renderer get visible hover feedback by syncing the native cursor into the web UI and toggling a .hovered class.
2026-06-16 15:55:32 +12:00
andrew e61922678b Add server validation, profile store, session launch
Introduce server validation and a session launch flow with persistent server profiles.

- Add ConnectAndValidateServer to Networking to validate handshake/timeouts and return human-friendly errors; avoid auto-connecting in transform send path and remove unconditional local connect on startup.
- Add ServerProfileStore (header + implementation) to persist server->saveFile bindings under Documents/My Games/.../CommonwealthOnline/server-profiles.json with thread-safe load/save, lookup, touch and bind operations.
- Add SessionLaunch (header + implementation) to handle launching validated sessions, first-time join flow (auto coc to SanctuaryExt, character creation menus, save binding), F4SE message handling and periodic Update processing.
- Update ServerBrowserBridge to parse/validate ports, use ConnectAndValidateServer, display joinLoading UI events, schedule validated session launch on the game task thread, and centralize join success/failure handling.
- Wire SessionLaunch into main.cpp (update loop and F4SE message hook).
- Improve direct-connect UI in app.js with client-side validation, port parsing, and handling of joinLoading events.

These changes provide better connection validation, user feedback during joins, and automatic handling for first-time server joins with persistence of associated saves.
2026-06-09 16:26:33 +12:00
andrew fb4e238fcc Add dynamic UI theme for server browser
Introduce runtime-driven UI theming for the server browser

- Expose PushUITheme() in F4TServerBrowserBridge and implement ColorToJson + PushUIThemeInternal to serialize HUD colors and invoke a JS hook.
- Call PushUITheme on UI initialization and when the browser is shown so the webview receives current HUD colors.
- Add frontend handler for "uiTheme" in app.js and a new components/theme.js that implements window.applyCoTheme to set CSS vars and tint the cursor SVG.
- Update styles.css to use RGB component CSS variables (--co-r/--co-g/--co-b and background equivalents) so colors can be overridden at runtime.
- Update index.html to include the new theme script and tweak cursor SVG stroke width; cursor asset updated as well.

This enables the plugin to synchronize the in-game HUD colors with the browser UI dynamically.
2026-06-09 15:19:03 +12:00
andrew 1f80b8ea49 Ensure main menu in MAIN_STATE before multiplayer
Add EnsureMainMenuMainState to try returning the main menu to MAIN_STATE by repeatedly invoking onCancelPress (up to 12 attempts with args true,false). Modify OpenMultiplayerMenu to early-return on null, call the new helper and log a warning if it cannot restore MAIN_STATE before proceeding, and preserve the existing uiMovie handling.
2026-06-09 14:56:38 +12:00
andrew d4d3268b12 Add runtime MainMenu injection and docs
Introduce a C++ runtime injection that adds a Multiplayer row to the Fallout 4 main menu instead of patching MainMenu.swf. Adds F4TMainMenuInject.h/cpp implementing injection, ITEM_PRESS handling, accept/button hooks, resync tasks and logging; integrates installation by calling MainMenuInject::Install() from PrismaUI init. Update PrismaUI to use the new helper and remove a duplicate IsMainMenuOnMainPanel implementation. Documentation updated to deprecate FFDec SWF patching (new docs/MainMenu_Injection.md, note in FFDEC guide, and setup.md) and restore-vanilla-mainmenu.ps1 messaging updated to instruct using the runtime injection.
2026-06-09 14:52:27 +12:00
andrew 9c84c9d4bc Add FFDec docs/tools and server-browser fixes
Add comprehensive FFDec walkthrough and short patch docs for safely adding a Multiplayer item to MainMenu.swf, plus helper scripts to extract the vanilla SWF and restore it (tools/extract_ba2.py, tools/restore-vanilla-mainmenu.ps1). Update exported MainMenu.as with a warning comment and remove an outdated exported PATCH markdown. Patch binary Interface/MainMenu.swf (updated).

Hardening fixes in the plugin: include GFx headers, avoid leaving the PrismaUI overlay focused after menu changes, only call OnBrowserHidden when the browser was actually visible, and add IsMainMenuOnMainPanel() so WatchMainMenuState ignores MainMenu when not on the MAIN_STATE. Ensure events are only dispatched when the browser is valid & visible (CanDispatchToBrowser) and make Scaleform UI hide the browser immediately during transitions. These changes prevent the overlay from staying focused during Settings transitions and stop JS events from being sent to a hidden/invalid view.
2026-06-08 22:26:00 +12:00
andrew fe620020be Add PrismaUI HTML server browser & integration
Integrate a PrismaUI_F4-based HTML server browser and related tooling. Adds a ThirdParty submodule (framework-F4-Conversion), UI views (CommonwealthOnline browser HTML/JS/CSS), and multiple plugin headers/sources to bridge PrismaUI/Scaleform, handle menu input, and manage server browser data and actions (mock server list, join/connect flow).

Key changes:
- New build/deploy scripts: build-prismaui.bat, build-all.bat, deploy-all.bat, deploy-ui.bat and a PowerShell helper for linking the Ultralight SDK (ULTRALIGHT_SDK_PATH, default F:\\UltralightSDK).
- Plugin additions: F4TPrismaUI, F4TScaleformUI, F4TServerBrowserBridge, F4TServerBrowserData, F4TMenuInput, F4TDebugOverlay and implementations to create/show/hide the HTML view, forward controller input, register Scaleform functions (openManager/closeManager), and push UI events.
- Networking: add ConnectToServer(host,port) and keep ConnectToLocalServer() as wrapper; update connection logs and error handling.
- Main menu SWF/AS updates: updated MainMenu.swf and MainMenu.as to call closeManager() when leaving multiplayer and to integrate open/close hooks.
- Documentation: plugin/setup.md updated with PrismaUI build/deploy instructions.
- Removed Main_ModManager.swf (deleted).

Primary intent: provide an in-game HTML server browser (toggleable with F9 or Scaleform calls), wire up controller input, and add build/deploy workflow for PrismaUI/Ultralight so developers can build and deploy the UI and plugin together. Mock server data is used for now; network join/connect plumbing is provided for local/dev servers.
2026-06-08 14:02:49 +12:00
andrew 2ced73f7b9 Handle runtime proxy 3D unload/recovery
Track and recover runtime proxy actors when their 3D meshes unload and reload. Adds slot flags (proxyObservedLoaded3D, proxyPending3DRecovery, proxy3DResetQueued), MaintainRuntimeProxy3DState and RecoverRuntimeProxyAfter3DReload to defer animation/puppet updates while mesh is missing, queue Reset3D and restore animation/locomotion state once fully loaded. Integrates checks throughout controller logic to skip smoothing/updates for proxies without 3D and updates slot initialization/reset. Also prevents puppet-driven motion/graph speed writes when the actor's 3D is unloaded to avoid corrupted PlaceAtMe proxies, with logging for diagnostics.
2026-06-07 21:31:28 +12:00
andrew 9b133b3109 Add proxy positioning API and CK-placed pool
Add a ProxyGameAPI (F4TProxyGameAPI.h/.cpp) exposing PositionRemoteActor which centralizes positioning logic, play-space resolution, MoveRefrToPosition-style moves, and 20Hz throttling bypass for forced moves. Replace ad-hoc SetPosition/SetHeading calls across the proxy controller to use the new API, ensuring correct cell/worldspace migration, logging, and move-rate throttling.

Introduce support for Creation Kit placed proxy refs: detect CK-placed proxies by editor ID prefix or base form, populate a per-cell proxy pool, and prefer assigning CK-placed proxies for runtime remotes (with fallbacks). Update proxy spawn/holding logic (skip smooth frame once, handle settle states, preserve/reuse CK pool entries) and improve worldspace/cell mismatch checks to avoid incorrect movement across play spaces.

Other changes: add CommonwealthOnline.esp resource file, update setup.md with the new local FormID (0x002666) for COPlayerProxy, enable animation sync gating to require loaded 3D, and small logging/message improvements.
2026-06-07 21:24:07 +12:00
andrew cc4d8aac5a Add Papyrus sync scripts and proxy spawn refactor
Add new Papyrus scripts (CoSync.psc, CoSyncPlayer.psc, CoSyncQuest.psc) providing native bindings and quest/player proxy logic for networking: connection/session APIs, entity management, world/weather/workshop/companion sync, consumable/pipboy/door/power-armor events, and proxy animation/initialization handlers. Refactor the proxy actor controller (F4TProxyActorController.cpp) to support dynamic/runtime proxy spawning and improved lifecycle/visibility handling: change proxy base/form IDs to COPlayerProxy/CommonwealthOnline, add process-list actor lookup, spawn helpers, play-space/cell checks, 3D visibility refresh, ActorHandle usage, and spawn mutexes and globals for safer spawning. Update docs and setup (architecture.md, limitations.md, plugin/setup.md) to describe global dynamic spawn behavior, max runtime proxies (kMaxRuntimeProxyActors = 4), and validation checklist; update launch-two-fallout4.bat to show instance log locations. Misc: small tweaks to logging and debug flags to gate diagnostics.
2026-06-07 20:31:51 +12:00
andrew 21c8bf9593 Smooth remote proxy rotation and conditional snapping
Add interpolation for remote proxy rotation and conditional snapping logic. Introduces kProxyRotationLerpAlpha and a ShouldSnapRemoteMovement declaration, and uses LerpRotation to smoothly apply headings for non-slot proxies (and slot-backed proxies in frame smoothing) unless movement type or large drift forces a snap. Adds a kLargeDriftSnapDistance threshold and threads a computed headingToApply through proxy locomotion/animation calls. Also updates the informational log to mention rotation lerp and removes an unused void cast.
2026-06-07 16:34:21 +12:00
andrew 8dfec0a4b3 Rename project to Commonwealth Online
Replace occurrences of "Fallout 4 Together" with "Commonwealth Online" across docs and testing guidance. Add Interface assets and tooling: MainMenu/Pipboy SWFs, translation/fonts, exported scripts (Interface/exported/scripts/MainMenu.as) and a PATCH_MainMenu_Multiplayer.md describing how to add a Multiplayer menu entry that calls root.f4se.plugins.commonwealthOnline.openManager(). Also add build/run batch scripts and apply assorted updates to README, plugin, server and protocol documentation/source to align with the rename and UI changes.
2026-06-07 16:22:50 +12:00
andrew c4a7b6dedb Fix proxy stop/land animation linger & snap
Prevent proxies from continuing jog/landing animations after a remote stops and fix snap desyncs. Treat network-authoritative idle (graphSpeed < 0) as definitive and stop falling back to measured lerp speed; pin/snap position when remote is not locomoting and ensure transforms snap on stop receive. Shorten sender-side hold times for movement and jump states to reduce stale motion in packets, and use isMoving (not stale graphSpeed) for landing resume decisions. Changes in plugin sources and main config, plus an updated dev log entry.
2026-06-05 16:12:34 +12:00