From 563ac4061fe25e1ee4a51c874e7afaed4456b5da Mon Sep 17 00:00:00 2001 From: netniV Date: Sun, 15 Nov 2026 13:04:30 +0000 Subject: [PATCH 1/3] Add macOS mouse navigation and refresh project documentation --- .gitignore | 1 + .vscode/settings.json | 19 +- .vscode/tasks.json | 18 ++ AGENTS.md | 4 + CHANGELOG.md | 129 +++++++++++- CONTRIBUTING.md | 5 + README.md | 15 +- docs/EXAMPLE_SETTINGS.md | 22 ++ docs/FEATURES.md | 4 + docs/IL2CPP.md | 4 + docs/IL2CPP_SHUTDOWN_VALIDATION.md | 4 + docs/INSTALL.md | 30 ++- docs/KEYMAPPING.md | 4 + docs/RELEASING.md | 4 + docs/THIRD_PARTY.md | 4 + docs/VERSION_SUBSTITUTION.md | 4 + docs/WINDOWS_DLL_PROVENANCE.md | 4 + .../2026-10-21-kirshara-queue-fixes.md | 189 ------------------ .../example_community_patch_settings.toml | 16 -- .../example_community_patch_settings_en.toml | 4 + src/libs/il2cpp/include/il2cpp/il2cpp.h | 2 +- src/libs/il2cpp/src/api.cc | 2 +- src/libs/unity/include/unity/input.h | 5 + src/libs/unity/src/input.cc | 20 +- src/mod/config.cc | 1 + src/mod/config.h | 1 + src/mod/features/camera.cc | 2 +- src/mod/features/chat.cc | 12 +- src/mod/features/features.h | 5 + src/mod/features/mouse_navigation.h | 42 ++++ src/mod/features/mouse_navigation_mac.mm | 77 +++++++ src/mod/mod.cc | 4 + tests/il2cpp_bindings.cc | 27 +++ tests/il2cpp_gc.cc | 2 +- tests/mod_logic.cc | 21 +- 35 files changed, 464 insertions(+), 243 deletions(-) create mode 100644 .vscode/tasks.json create mode 100644 docs/EXAMPLE_SETTINGS.md delete mode 100644 docs/archive/2026-10-21-kirshara-queue-fixes.md delete mode 100644 docs/configuration/example_community_patch_settings.toml create mode 100644 src/mod/features/mouse_navigation.h create mode 100644 src/mod/features/mouse_navigation_mac.mm diff --git a/.gitignore b/.gitignore index 05bedbe84..516e5bdae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .vscode/* !.vscode/extensions.json !.vscode/settings.json +!.vscode/tasks.json .vs/ /.idea/ /out/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 5e1dac4e6..435ba4cc9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,20 @@ "clangd.arguments": [ "--compile-commands-dir=.vscode" ], - "cmake.ignoreCMakeListsMissing": true -} \ No newline at end of file + "cmake.ignoreCMakeListsMissing": true, + "[c]": { + "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd", + "editor.formatOnSave": true + }, + "[cpp]": { + "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd", + "editor.formatOnSave": true + }, + "[zig]": { + "editor.defaultFormatter": "ziglang.vscode-zig", + "editor.formatOnSave": true + }, + "[objective-cpp]": { + "editor.formatOnSave": false + } +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..f07e1c9e5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,18 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Format project", + "type": "process", + "command": "zig", + "args": [ + "build", + "fmt" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [] + } + ] +} diff --git a/AGENTS.md b/AGENTS.md index e30c7b916..a2fa72f58 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,9 @@ # Agent guide +

+ STFC Community Mod +

+ STFC Community Mod hooks a Unity IL2CPP game to add desktop features on Windows and macOS. Read [CONTRIBUTING.md](CONTRIBUTING.md) for builds and tests. Before changing bindings or hooks, read the [IL2CPP reference](docs/IL2CPP.md). diff --git a/CHANGELOG.md b/CHANGELOG.md index b8829b5c6..8ee16738e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,135 @@ -# Changelog +# Changelog for STFC Community Mod + +

+ STFC Community Mod +

These are historical release notes. Settings, shortcuts, and build tools below describe those releases. For current behavior, see [Features](docs/FEATURES.md), [Keyboard shortcuts](docs/KEYMAPPING.md), and [Contributing](CONTRIBUTING.md). +## Unreleased + +Changes on `dev` since the `v1.1.10.0` tag. Pending working-tree changes are not included. + +### Features and fixes + +- Added dock switching in the ship management screen. +- Added opt-in live fleet-state sync through `fleets` and enabled Kir'Shara queue protections on macOS. +- Fixed wave joining and chat auto-opening, Alliance Games Store research and purchase refresh, + galaxy-map drag momentum, and station-exterior zoom restoration after visiting the interior. +- Fixed fleet-sync number conversion on supported macOS versions and the first-sync flag for Haven. +- Improved Galactic Anomaly timer recovery across HUD canvases. +- Fixed initial system zoom and added guards during restart and macOS runtime shutdown. +- Made sync delivery track acknowledgements independently for each target, retry failed uploads, + and reject work from previous login sessions. Sync workers retain settings safely across reloads. +- Improved pooled inventory-widget tracking, mission HUD refreshes, ship pinning, shortcut sequencing, + and notification text substitution. Store-popup suppression now keeps the first popup per session. + +### Development + +- Replaced XMake with Zig builds and packaging, supporting Zig 0.16 and 0.17. +- Added typed IL2CPP bindings, shared Unity helpers, and transactional feature hook installation. +- Updated SPUD, reorganized sources under `src`, and expanded native tests. +- Hardened the macOS loader and launcher and rewrote installation and contributor guides. +- Restricted release tags to their appropriate branches. + +## 1.1.10 + +Includes changes from the 1.1.9 beta series. + +### Features + +- Added cross-platform notification audio cues and an `All` wildcard for named audio suppression. +- Added an opt-in Galactic Anomaly countdown, configurable instant cargo totals, and automatic + Warp/Jump labels on the system course button. +- Added station-interior zoom-out, expanded Haven zoom with road-surface detail, and applied backdrop + scaling on system entry. Added an option to disable target camera lock. +- Added Shift+click ship pinning, preferred ships with applied Forbidden Tech when pinned levels tie, + and expanded ship-management, ship-swap, officer-swap, and officer-preset shortcuts. +- Added options to hide chat player titles and the artifact Exchange All button. +- Added confirmation skipping for the Excelsior's Decloaking Deflector and the Alliance max-level + contribution warning, plus Forbidden Tech names in selection lists. +- Added sync for Away Team assignments and trait demand, Haven building pieces and map data, + and opt-in local-player profiles and faction-store offers. +- Added log history and newest-first Haven help history. + +### Fixes + +- Protected and recovered Kir'Shara queues after target or address changes. +- Restored battle-log and ship sync for client build 267 and re-emitted job events when timing changes. +- Fixed artifact-gallery navigation, mission HUD visibility, player titles on Windows, and ship shortcut + hints when dock indices have gaps. +- Preserved 64-bit ship locale IDs and fixed x64 trampoline offsets when multiple instructions expand. +- Made empty shortcut strings disable bindings, coordinated WASD movement with configured hotkeys, + and corrected feature and patch enablement. +- Made daily faction bulk-claim defaults explicit and primary-action target visibility protection opt-in. + +## 1.1.8 + +Includes changes from the 1.1.7 beta series. + +### Features + +- Added faction filtering for daily bulk claims, configurable fleet-label detail, and native navigation actions. +- Added construction, battle-log, and shield shortcuts, and displayed mod bindings in native shortcut hints. +- Improved ship management and added arrow-key rotation of the station exterior. +- Added named audio suppression, per-ship instant-jump configuration, and tagged-chest purchase sliders. +- Restored configurable double-tap Escape exit and added a clear-cache-and-restart shortcut. +- Added macOS `-ccm` settings-path overrides, Haven support, and Windows DLL build provenance and attestation. + +### Fixes + +- Fixed text-input focus detection, modified directional hotkeys, and armada notifications. +- Fixed bulk-claim flyouts reopening after reward presentation and limited daily faction filtering to + Federation, Klingon, and Romulan dailies. +- Extended donation sliders on macOS, corrected base-raid defender names in battle logs, and fixed + the garbage-collector finalizer callback. + +## 1.1.6 + +Includes changes from the 1.1.5 beta series. + +### Features + +- Added mission HUD visibility settings, cargo-format precision, BDA officer sorting, and ship-level scaling. +- Added automatic confirmation for Forbidden Tech upgrades and instant warp. +- Added left/right arrow navigation for artifacts and translated example settings. + +### Fixes + +- Restored sync compatibility with M93.3.0 and corrected RTC slot parsing and Alliance resource sync names. +- Fixed macOS ARM64 loading-transition crashes, stale zoom scene pointers, and Right Alt detection. +- Restored unlimited donation sliders and stopped converting empty legacy sync targets. +- Removed the obsolete resolution-list patch and improved local universal macOS packaging. + +## 1.1.4 + +### Features + +- Added Ctrl+F coordinate search and automatic opening of the Gifts bulk-claim flyout. +- Added a build option to preserve the game's original loading background. + +### Fixes + +- Restored slot sync and updated bindings for client 1.000.50296. +- Hardened shortcut parsing and allowed recall and repair while a viewer popup is open, preserving scan priority. +- Honored patch switches in release builds and made the GameServer initialization sync hook optional. +- Fixed macOS zoom-range limits and loading-screen assets across scene transitions. + +## 1.1.2 + +### Features + +- Added zoom scaling and camera controls, custom embedded loading artwork, and loading-logo fade-in. +- Added the notification foundation and battle text, plus `ALL` logging selection. +- Added compressed update artifacts for the macOS launcher and improved updater diagnostics and packaging. + +### Fixes + +- Fixed sync parser crashes and the changed macOS BuffService parser signature. +- Fixed chained Xsolla patch updates and loading-texture resets. +- Removed the remaining system-view border and required the same fleet key for double-tap locate. + ## 1.1.0 ### Features diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 435811c5c..33539c5cf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -111,6 +111,11 @@ git diff --check `fmt` requires `clang-format` on `PATH`. It formats C++ under `src` and `tests`, plus the Zig build files. It skips Objective-C++ `.mm` files. +In VS Code, install the workspace-recommended Zig and clangd extensions. Workspace settings enable +formatting on save for C++ and Zig, using `.clang-format` and `zig fmt` respectively. +Use **Tasks: Run Task → Format project** to run `zig build fmt` across the project. +The task requires `zig` and `clang-format` on `PATH`; Objective-C++ format on save is disabled. + Choose the relevant native tests: | Command | Coverage | diff --git a/README.md b/README.md index 95c4fce80..92f6708cd 100644 --- a/README.md +++ b/README.md @@ -16,25 +16,30 @@ It adds adjustable UI scaling, camera controls, keyboard shortcuts, cargo previe | Find or change a shortcut | [Keyboard shortcuts](docs/KEYMAPPING.md) | | See what the mod can do | [Features](docs/FEATURES.md) | | Build or contribute code | [Contributing](CONTRIBUTING.md) | +| Example configuration files | [Example settings](docs/EXAMPLE_SETTINGS.md) | Download the [latest release](https://github.com/STFC-Mod/mod/releases/latest/). + For test builds, use the [release list](https://github.com/STFC-Mod/mod/releases/). + If a game update breaks the mod, check **#info** in the [STFC Community Mod Discord](https://discord.gg/PrpHgs7Vjs) for hotfixes. ## Get help -Use the [Discord server](https://discord.gg/PrpHgs7Vjs) for support. -Include your operating system, game version, mod version, and the relevant lines from `community_patch.log`. -The [installation guide](docs/INSTALL.md#fix-installation-problems) covers common problems. +- Use the [Discord server](https://discord.gg/PrpHgs7Vjs) for support. + +- Include your operating system, game version, mod version, and the relevant lines from `community_patch.log`. + +- The [installation guide](docs/INSTALL.md#fix-installation-problems) covers common problems. ## Project details The project accepts [code contributions](CONTRIBUTING.md) and [sponsorship](https://github.com/sponsors/netniV). + See the [changelog](CHANGELOG.md) for recorded releases. -The mod uses the [GPLv3 license](LICENSE). -[Third-party notices](docs/THIRD_PARTY.md) and +The mod uses the [GPLv3 license](LICENSE). [Third-party notices](docs/THIRD_PARTY.md) and [Windows DLL verification](docs/WINDOWS_DLL_PROVENANCE.md) have their own references. There is no account-safety guarantee for features added outside this repository. diff --git a/docs/EXAMPLE_SETTINGS.md b/docs/EXAMPLE_SETTINGS.md new file mode 100644 index 000000000..4ed67ed0a --- /dev/null +++ b/docs/EXAMPLE_SETTINGS.md @@ -0,0 +1,22 @@ +# Example settings + +

+ STFC Community Mod +

+ +Choose an example in your preferred language and save a copy as `community_patch_settings.toml` +in your [settings folder](INSTALL.md#change-settings). Back up an existing settings file before replacing it. + +The English example tracks the current code. Translations may lag behind; setting names remain the same in every language. + +| Language | Example settings | +| --- | --- | +| 🇬🇧 English | [English example](configuration/example_community_patch_settings_en.toml) | +| 🇩🇪 Deutsch | [Deutsches Beispiel](configuration/example_community_patch_settings_de.toml) | +| 🇳🇱 Nederlands | [Nederlands voorbeeld](configuration/example_community_patch_settings_nl.toml) | +| 🇫🇷 Français | [Exemple français](configuration/example_community_patch_settings_fr.toml) | +| 🇪🇸 Español | [Ejemplo en español](configuration/example_community_patch_settings_es.toml) | +| 🇷🇺 Русский | [Пример на русском](configuration/example_community_patch_settings_ru.toml) | +| 🇩🇰 Dansk | [Dansk eksempel](configuration/example_community_patch_settings_da.toml) | + +Save your settings file to reload changes. Settings under `[patches]` require a full game restart. diff --git a/docs/FEATURES.md b/docs/FEATURES.md index 6f83750f3..ecf743d41 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -1,5 +1,9 @@ # Features +

+ STFC Community Mod +

+ The mod adds controls and display options to the desktop game. Change them in `community_patch_settings.toml`; the [English example](configuration/example_community_patch_settings_en.toml) lists the settings and defaults. diff --git a/docs/IL2CPP.md b/docs/IL2CPP.md index 626a03e9e..34df30c75 100644 --- a/docs/IL2CPP.md +++ b/docs/IL2CPP.md @@ -1,5 +1,9 @@ # IL2CPP binding reference +

+ STFC Community Mod +

+ The mod calls generated IL2CPP code through typed C++ bindings. Bindings resolve members on first use, check metadata types, and cache the result for the process. Runtime initialization must happen before resolution. diff --git a/docs/IL2CPP_SHUTDOWN_VALIDATION.md b/docs/IL2CPP_SHUTDOWN_VALIDATION.md index be2ab6aeb..c47cf2188 100644 --- a/docs/IL2CPP_SHUTDOWN_VALIDATION.md +++ b/docs/IL2CPP_SHUTDOWN_VALIDATION.md @@ -1,5 +1,9 @@ # macOS runtime shutdown hook validation +

+ STFC Community Mod +

+ Client: `1.000.53284` (`100053284`), inspected 14 November 2026. GameAssembly.dylib SHA-256: `a17be3929bc7545b2537093586d971ad800fe9ef4fe15a22063936b731491108`. diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 3b0fcee81..186b8e5c6 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -70,28 +70,25 @@ Edit **`community_patch_settings.toml`**. The other files are outputs. | `community_patch.log` | Startup, settings errors, and diagnostics. | By default, these files are beside `prime.exe` on Windows and Wine. -On macOS, they are in: -```text +#### MacOS +```zsh ~/Library/Preferences/com.stfcmod.startrekpatch ``` +#### Windows +```cmd +C:\Games\Star Trek Fleet Command\Star Trek Fleet Command\default\game +``` + For commented settings, copy an example to that folder and name it `community_patch_settings.toml`. -Back up an existing settings file before replacing it. +Back up an existing settings file before replacing it. The English example tracks the current code, and translated versions may lag behind but in most cases should be current. -| Language | Example | -| --- | --- | -| English | [Current settings reference](configuration/example_community_patch_settings_en.toml) | -| German | [German example](configuration/example_community_patch_settings_de.toml) | -| French | [French example](configuration/example_community_patch_settings_fr.toml) | -| Dutch | [Dutch example](configuration/example_community_patch_settings_nl.toml) | +See [Example settings](EXAMPLE_SETTINGS.md). -The English example tracks the current code. Translations can lag behind. +Settings reload after you save the file. To reload manually, press `CTRL-SHIFT-F6`. Changes under `[patches]` require a full game restart. -Settings reload after you save the file. To reload manually, press `CTRL-SHIFT-F6`. -Changes under `[patches]` require a game restart. -Shortcuts that adjust settings during play do not save those changes to your TOML file. -The one exception is Shift+click pinning in the ship dock, which rewrites only the `pinned_ships` line under `[ui]`. +It should be noted that currently no settings modified in game, save those changes to your TOML file. The one exception is Shift+Click pinning on the ship dock, which rewrites only the `pinned_ships` line under `[ui]`. ## Fix installation problems @@ -119,9 +116,6 @@ In Finder, press `Command-Shift-G` and enter: ~/Library/Preferences/com.stfcmod.startrekpatch ``` -This works even when Finder hides `Library`. -If the launcher shows **Game not installed** and game version `00`, it cannot read the game's install path or version. -Reinstall the game with the Xsolla launcher, then open the Community Mod launcher again. -You do not need to reinstall the mod launcher. +This works even when Finder hides `Library`. If the launcher shows **Game not installed** and game version `00`, it cannot read the game's install path or version. Reinstall the game with the official Scopely launcher, then open the Community Mod launcher again. You do not need to reinstall the mod launcher. For further help, use the [Discord server](https://discord.gg/PrpHgs7Vjs). diff --git a/docs/KEYMAPPING.md b/docs/KEYMAPPING.md index 6fee778ed..964ecaab4 100644 --- a/docs/KEYMAPPING.md +++ b/docs/KEYMAPPING.md @@ -1,5 +1,9 @@ # Keyboard shortcuts +

+ STFC Community Mod +

+ Set bindings under `[shortcuts]` in `community_patch_settings.toml`. Names are case-insensitive. The mod writes the parsed bindings and their source to `[shortcuts]` and `[shortcuts_source]` in `community_patch_runtime.vars`. diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 6e81ac448..b05379bc4 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -1,5 +1,9 @@ # Create a release +

+ STFC Community Mod +

+ This checkout has a `reference-transaction` hook installed from `scripts/release-tag-hook.sh`. It rejects creation or movement of `v*` tags unless the checked-out branch matches the version policy and contains the target commit. Deleting a mistaken tag is still allowed. This also covers GUI tools that use Git and honor its hooks. diff --git a/docs/THIRD_PARTY.md b/docs/THIRD_PARTY.md index 12b0113ce..d486ea03a 100644 --- a/docs/THIRD_PARTY.md +++ b/docs/THIRD_PARTY.md @@ -1,5 +1,9 @@ # Third-party dependencies +

+ STFC Community Mod +

+ `build.zig.zon` pins fetched libraries by immutable URL and Zig content hash. Zig fetches a `protoc` executable only for the build host. Preserve upstream licenses and notices when distributing source or binaries. diff --git a/docs/VERSION_SUBSTITUTION.md b/docs/VERSION_SUBSTITUTION.md index ebe108896..a4394162c 100644 --- a/docs/VERSION_SUBSTITUTION.md +++ b/docs/VERSION_SUBSTITUTION.md @@ -1,5 +1,9 @@ # Check the macOS launcher version +

+ STFC Community Mod +

+ After `zig build launcher`, run: ```sh diff --git a/docs/WINDOWS_DLL_PROVENANCE.md b/docs/WINDOWS_DLL_PROVENANCE.md index 71908fc8c..76ebc4563 100644 --- a/docs/WINDOWS_DLL_PROVENANCE.md +++ b/docs/WINDOWS_DLL_PROVENANCE.md @@ -1,5 +1,9 @@ # Verify a Windows DLL +

+ STFC Community Mod +

+ A DLL's identity marker is self-declared. It identifies a build but proves no authenticity. An artifact attestation binds exact file bytes to a workflow and source commit. diff --git a/docs/archive/2026-10-21-kirshara-queue-fixes.md b/docs/archive/2026-10-21-kirshara-queue-fixes.md deleted file mode 100644 index 438b42d9e..000000000 --- a/docs/archive/2026-10-21-kirshara-queue-fixes.md +++ /dev/null @@ -1,189 +0,0 @@ -# Kir'Shara queue fixes: design notes (2026-10-21) - -Archived from the per-fix guides that accompanied #287, #313 and the address guard. The live user-facing summary is in [FEATURES.md](../FEATURES.md); the code is `src/mod/features/action_queue.cc` and its tests are `tests/action_queue.cc` (`zig build test-mod`). - -Since these notes were written, the fixes moved onto typed bindings: method signatures and member types are checked when they resolve, and no field offsets are pinned. Startup no longer logs `ready=` lines; a missing member is reported by the binding library instead. #339 then enabled recovery and thin protection on macOS; its qualification notes are at the end. - -## Faster Queue Recovery - -When a queued target disappears while a course request is outstanding, the game can remove that target before its failed response arrives. Native failure handling then attempts the removal again. Since it did not remove the front entry this time, it can leave the next target waiting for the watchdog. - -Recovery is enabled by default as part of the combined Kir'Shara fixes: - -```toml -[control] -kirshara_fixes = true -``` - -Following #313, default-enabled `[patches].actionqueuerecoveryhooks` independently controls installation. Changing that installation switch requires a restart. Installed callbacks check the current `control.kirshara_fixes` and `control.queue_enabled` preferences; changing TOML still requires reload/restart. - -The feature also respects `control.queue_enabled`. Hooks are supported on Windows x64 when the required method signatures and queue layout are compatible. Other platforms do not install these hooks; incompatible Windows layouts log an unavailable message and retain native behavior. - -The previous `faster_queue_recovery`, `thin_queue_protection`, `queue_address_guard` -and `advanced.queue.thin_queue_protection` settings no longer control these features. -Use the single `kirshara_fixes` switch; its default is true. A legacy-only configuration -logs this replacement at startup. No existing config file is rewritten automatically. - -Toggling queue entry off invalidates only the mod's pending recovery tracking. It -does not clear native target queues or stop their native processing. Forgetting the -tracking prevents an old course response from authorizing a later recovery after -the queue is toggled back on. - -### Behavior - -The adapter records the latest engagement attempt for up to eight fleets, using weak queue identities and full 64-bit target IDs. A failed, non-recall course response may request native planning only when: - -- The response belongs to the same queue and latest target/attempt, observed within 30 seconds. -- The queue was engaging on entry to the response and native processing cleared that flag. -- A different front target remains, and the failed target is absent from every inspected queue. -- The native retry decision was false. Ordinary retries are unchanged. - -The request record is consumed once. The native planner selects and validates the next target. The mod does not force ship state, clear engagement flags, change retry counts, or remove targets. If another fleet still queues the target, the native cross-fleet removal path remains responsible. - -Queue storage is bounded and validated. Unknown layouts/content are ineligible. Expired/replaced requests release their weak handles; native session cleanup clears all records. Engage, Retry and Course discard pending recovery records when they observe disabled behavior. Both Toggle Queue transitions also clear them, so an off/on toggle cannot reuse authorization from before the toggle. A native attempt returning skip/stop cancels only its own record, preserving newer reentrant attempts. - -There is no watchdog hook, frame scan, timer, background worker, or per-engagement logging. Queue inspection occurs in existing callbacks; all-queue inspection runs only for a potentially eligible failed response. Response matching is not a server-issued request ID, so delayed same-target responses remain an interoperability limitation. - -### Native integration - -One detour owns each method. Methods are resolved through their complete managed signatures. Installation validates the event and queue field layouts and the engagement result's integer representation. SPUD builds the trampolines using its existing instruction decoder. Addresses and relocation-dependent instruction bytes are not pinned to a client release. - -The hooked methods are `TryPlanPathAndEngageTarget`, `ShouldRetryFailedSetCourse`, `OnSetCourseResponseEventHandler` and `StopWatchdogAndClearAllQueues`. These checks establish binding compatibility; changes to the native retry/planner behavior still require update review and runtime testing. - -The course event is a 24-byte value type, with fleet ID at 0, success/recall at 8/9 and boxed target at 16. Metadata field offsets include the boxed object header. The native retry handler is called synchronously inside the course handler; returning true selects its existing planner branch. - -The older off-screen Kir'Shara combat-completion repair was fixed by Scopely. That workaround and its `kirshara_queue_repair` setting have already been removed; neither is a prerequisite for Faster Queue Recovery. This feature addresses only the separate unavailable-target/course-response race described above. - -### Validation - -Run `zig build test-mod`.cc` with a C++23 compiler and `-Isrc/mod`. Tests use the production policy and request store with fake weak handles. They cover one-shot recovery, reordered/still-present targets, cross-fleet rejection, stale attempts, replaced/collected queues, expiry, reentrant cancellation, bounded capacity and cleanup. They do not model game ABI or network scheduling. - -The prototype produced two observed handoffs with the next target attempted 1–2 ms later and successful responses within 388–532 ms. Those timings are observations, not a latency guarantee. The final adapter requires its own smoke test: normal queued combat; removal of the outstanding target; removal before the first successful course response; queue clear/rebuild; recall; and session restart. Group-wave behavior needs additional coverage when available. - -## Thin Queue Protection - -Restores the active guard from `v2.1.0-guffa.10` alongside Faster Queue Recovery. -This is separate from the retired Kir'shara combat-completion repair. - -```toml -[control] -kirshara_fixes = true -``` - -Enabled by default on Windows x64 as part of `control.kirshara_fixes`. Also respects -`control.queue_enabled`. The old separate feature settings, including -`advanced.queue.thin_queue_protection`, are retired; use `kirshara_fixes = false` -to disable the combined fixes. Default-enabled `[patches].thinqueueprotectionhooks` -controls installation independently. Installed callbacks check the current feature and queue -preferences. Changing the installation switch requires restart; TOML changes require -reload/restart. - -The native planner (`DoPlanPathAndEngageTarget`) and watchdog (`HandleStall`) run -first. If they removed an exact prefix of targets, left a nonempty unchanged -suffix, and left the same fleet idle without an active engagement, the guard -rechecks that state and asks the native `TryPlanPathAndEngageTarget` to resume. -Pending/last-target latches must be absent or refer only to removed targets. -Reordering, replacement, truncation, or a latch naming a surviving target rejects -recovery. An unchanged queue is never enough evidence to retry. - -On disposal, a fleet must be explicitly destroyed with removal reason `Destroyed` -(1). If native handling leaves that target at an inactive queue head, the guard -rechecks it and calls native `ProcessQueue(target, false)`. It does not force -immediate selection, remove arbitrary targets, or edit queue/engagement state. - -Faster Queue Recovery still owns the failed-course-response path. The restored -guard uses three different detours and calls the existing native engage entry, -so Faster Queue Recovery can observe those requests normally. The nested planner -and watchdog paths cannot replay a successfully engaged target because the outer -guard sees the resulting active engagement. Queue identity is checked again after -native calls. All three guard hooks must install before any guard action is enabled. - -Methods, field offsets/types and enum return representations are checked before -installation; incompatible layouts keep native behavior. This port installs on -Windows x64 and, since #339, on macOS; see the macOS notes at the end. - -Successful actions log `[ThinQueueProtection] resume` or -`[ThinQueueProtection] process-destroyed-head`; startup logs `ready=true` or an -unavailable warning. There is no per-frame scan or background polling. - -Run `zig build test-mod`. The restored -release tests cover destroyed-head filtering, prefix removal, multiple removed -targets, latch safety, queue replacement/reordering and postcondition changes. -They do not establish game ABI or live wave behavior. Runtime verification still -requires a new build to be deployed and a wave test after restart. - -## Kir'Shara queue address guard - -Moving or recalling another ship in a different system can temporarily make a -deployed ship's native player address point at its starbase. A subsequent native -player-state event then treats that ship's same-system queued targets as foreign -and clears its queue. This failure was also reproduced by a tester with the mod -DLL disabled. - -The default-on guard substitutes the ship's current owned deployment address only -inside the native queue address comparison during a player-state event. It requires -a validated nonempty queue belonging to that ship and slot, a local deployment -whose fleet ID matches, no recall or removal, and an active non-warping ship state. -The reported address must be a planet in another system, and the current target -must match the deployment's full galaxy/system/planet/instance address. - -The native comparison still checks every target. A missing target, a genuinely -foreign address, or unknown metadata retains native behavior. The guard writes no -fleet fields or queue contents and retains no address between events. Explicit -clearing, recalling the queued ship itself, and genuine system changes remain -native. This is enabled together with Faster Queue Recovery and Thin Queue Protection -through `control.kirshara_fixes`. - -`[control] kirshara_fixes = false` disables the combined fixes, including address correction. The separate -default-on `[patches] queueaddressguardhooks` switch controls hook installation; -changing it requires a restart. Disabling the queue also disables correction. - -The implementation is shared by Windows and macOS and contains no capture logger, -polling loop, or diagnostic hooks. It owns four native methods: the player-state -event handler, the queue address predicate, the player address getter, and the -deployment lookup. Their Windows x64 client 271 native overwrite windows were -measured against the matching installed client. Current Mac native hook fit and -gameplay validation have not been established; successful builds alone do not -establish those properties. - -Run `zig build test-mod`. Gameplay validation -must use the clean build: queue A's same-system hostiles, move/recall B in another -system, and allow A to engage its next target. Then recall A and check its queue -clears normally. The prior instrumented build passed both controls, and reproduced -the raw address fault even with fleet observation polling disabled. - -## macOS (#339) - -Faster Queue Recovery and Thin Queue Protection use their existing implementation -on Apple Silicon and Intel. Queue Address Guard already supported macOS. The -shared `[control] kirshara_fixes` option controls the fixes on every platform; -#339 added no settings and changed no queue policy or defaults. - -Historical Mac client 199 (`1.000.52486`) inspection found the same 24-byte course -response layout: fleet at 0, success at 8, recall at 9, target at 16. Its aggregate -argument is indirect on Apple Silicon and stack-passed on Intel, matching the host -C++ ABI. The seven detour targets exceeded the architecture-specific SPUD overwrite -windows in those binaries. That historical evidence does not establish native -hook fit for a newer client. Runtime metadata checks reject incompatible managed -layouts; they do not validate native method extent. - -Current Mac build, native-fit and exact-artifact runtime results must be recorded -separately for each tested architecture and game version. - -Focused smoke test: - -1. Set `[control] queue_enabled = true` and `kirshara_fixes = true`. Leave - `[patches] actionqueuerecoveryhooks`, `thinqueueprotectionhooks` and - `queueaddressguardhooks` enabled; restart after changing hook switches. -2. Confirm the startup log reports `+ Patching` for `ActionQueueRecovery`, - `ThinQueueProtection` and `QueueAddressGuard`. Preserve any `! Not installed` - line and the binding errors logged before it. -3. Queue same-system hostiles on ship A. Move or recall ship B from another - system; A's queue should survive and continue normally. -4. Recall A itself, then separately clear its queue manually. Both should clear. -5. Let another player remove A's queued head before engagement. Check progression - to the next eligible target, then repeat with respawns and two ships. Watch for - duplicate engagements, stalled courses, unexpected clearing or crashes. -6. Compare `kirshara_fixes` off/on by editing the TOML key; the settings file is - reloaded when it changes. Record commit, artifact hash, architecture, game version, - exact steps and logs. Disable an affected hook switch and restart if needed. diff --git a/docs/configuration/example_community_patch_settings.toml b/docs/configuration/example_community_patch_settings.toml deleted file mode 100644 index 6ae7868b6..000000000 --- a/docs/configuration/example_community_patch_settings.toml +++ /dev/null @@ -1,16 +0,0 @@ -# Localized example configuration files are generated from the languages -# supported by https://modconfig.pages.dev: -# -# English (en): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_en.toml -# Deutsch (de): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_de.toml -# Nederlands (nl): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_nl.toml -# Français (fr): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_fr.toml -# Español (es): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_es.toml -# Русский (ru): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_ru.toml -# Dansk (da): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_da.toml -# tlhIngan Hol (tlh): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_tlh.toml -# Minionese (en-x-minionese): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_en-x-minionese.toml -# Cockney (en-GB-x-cockney): https://github.com/STFC-Mod/mod/blob/dev/docs/configuration/example_community_patch_settings_en-GB-x-cockney.toml -# -# Choose the example for your preferred language and save a copy as -# community_patch_settings.toml in the appropriate settings folder. diff --git a/docs/configuration/example_community_patch_settings_en.toml b/docs/configuration/example_community_patch_settings_en.toml index cf692d3a3..02487b13e 100644 --- a/docs/configuration/example_community_patch_settings_en.toml +++ b/docs/configuration/example_community_patch_settings_en.toml @@ -118,6 +118,10 @@ queue_enabled = true # If you prefer to use Scopely's hotkeys set this to true use_scopely_hotkeys = false +# macOS: translate app-local Back/Forward swipe gestures (including mouse-driver gestures) to MOUSE3/MOUSE4. +# Also applies to horizontal trackpad swipes. Wheel click remains MOUSE2. Requires mod hotkeys to be enabled. +macos_navigation_mouse = false + # Subgroup: Options # ----------------- diff --git a/src/libs/il2cpp/include/il2cpp/il2cpp.h b/src/libs/il2cpp/include/il2cpp/il2cpp.h index 474f7c016..81ddcf114 100644 --- a/src/libs/il2cpp/include/il2cpp/il2cpp.h +++ b/src/libs/il2cpp/include/il2cpp/il2cpp.h @@ -722,7 +722,7 @@ class GcHandle : handle_(handle) { } - Il2CppGCHandle handle_ = nullptr; + Il2CppGCHandle handle_ = nullptr; inline static std::atomic_bool shutdown_{false}; }; diff --git a/src/libs/il2cpp/src/api.cc b/src/libs/il2cpp/src/api.cc index fddbc6448..a71eb3931 100644 --- a/src/libs/il2cpp/src/api.cc +++ b/src/libs/il2cpp/src/api.cc @@ -1,7 +1,7 @@ // Binds the IL2CPP exports from the loaded GameAssembly image on macOS. Windows links them through GameAssembly.lib. -#include #include +#include #include diff --git a/src/libs/unity/include/unity/input.h b/src/libs/unity/include/unity/input.h index ce33ccf94..2bdee6092 100644 --- a/src/libs/unity/include/unity/input.h +++ b/src/libs/unity/include/unity/input.h @@ -427,6 +427,11 @@ namespace Key // frame and reads before it see the previous frame. Cheap after the first call in a frame. void Poll(); + // App-local navigation gestures have no held state. Queue a one-frame Mouse3/Mouse4 pulse for the next Poll; + // repeated reads in that frame see the same pulse. Other buttons are rejected. Game thread only. + void QueueNavigationMouse(int32_t button); + void ClearNavigationMouse(); + // Held during this frame. bool Pressed(KeyCode key); // Went down this frame. diff --git a/src/libs/unity/src/input.cc b/src/libs/unity/src/input.cc index 895476850..292a04fcd 100644 --- a/src/libs/unity/src/input.cc +++ b/src/libs/unity/src/input.cc @@ -13,6 +13,7 @@ namespace unity { namespace { + std::array pending_navigation_mouse{}; // On an idle frame anyKey is false and no key is asked about at all; otherwise each key is one internal call. // The optional members cache a read for the rest of the frame. struct Frame { @@ -21,11 +22,15 @@ namespace bool any_down = false; std::optional focused; std::optional modified; + std::array navigation_mouse{}; // Indexed [down][key]. std::array, std::to_underlying(KeyCode::Max)>, 2> keys{}; bool Read(KeyCode key, bool down) { + const auto button = std::to_underlying(key) - std::to_underlying(KeyCode::Mouse3); + if (button >= 0 && button < 2 && navigation_mouse[button]) + return true; if (!(down ? any_down : any_held)) return false; auto& value = keys[down][std::to_underlying(key)]; @@ -51,7 +56,20 @@ namespace Key const int32_t number = Time::frameCount(); if (number < 0 || number == frame.number) return; - frame = {.number = number, .any_held = Input::anyKey(), .any_down = Input::anyKeyDown()}; + frame = {.number = number, .any_held = Input::anyKey(), .any_down = Input::anyKeyDown()}; + frame.navigation_mouse = std::exchange(pending_navigation_mouse, {}); + } + + void QueueNavigationMouse(int32_t button) + { + if (button == 3 || button == 4) + pending_navigation_mouse[button - 3] = true; + } + + void ClearNavigationMouse() + { + pending_navigation_mouse = {}; + frame.navigation_mouse = {}; } bool Pressed(KeyCode key) diff --git a/src/mod/config.cc b/src/mod/config.cc index f445b2c84..8e4df4531 100644 --- a/src/mod/config.cc +++ b/src/mod/config.cc @@ -586,6 +586,7 @@ void Config::Read(const toml::table& file, toml::table& effective, bool log_valu r.Read("control", "hotkeys_enabled", control.hotkeys_enabled); r.Read("control", "hotkeys_extended", control.hotkeys_extended); r.Read("control", "use_scopely_hotkeys", control.use_scopely_hotkeys); + r.Read("control", "macos_navigation_mouse", control.macos_navigation_mouse); r.Read("control", "select_timer", control.select_timer); r.Read("control", "enable_experimental", control.enable_experimental); diff --git a/src/mod/config.h b/src/mod/config.h index c1177cd4f..572881870 100644 --- a/src/mod/config.h +++ b/src/mod/config.h @@ -194,6 +194,7 @@ class Config final bool hotkeys_enabled = true; bool hotkeys_extended = true; bool use_scopely_hotkeys = false; + bool macos_navigation_mouse = false; // Milliseconds within which pressing a ship's number again flies the camera to it. int select_timer = 500; bool enable_experimental = false; diff --git a/src/mod/features/camera.cc b/src/mod/features/camera.cc index 0bd61210a..c49ee10e2 100644 --- a/src/mod/features/camera.cc +++ b/src/mod/features/camera.cc @@ -29,7 +29,7 @@ namespace struct ZoomEntryState { il2cpp::GcHandle controller; - ZoomEntry::Gate gate; + ZoomEntry::Gate gate; }; std::unordered_map zoom_entries; diff --git a/src/mod/features/chat.cc b/src/mod/features/chat.cc index ddd3ba68e..fbf2d7215 100644 --- a/src/mod/features/chat.cc +++ b/src/mod/features/chat.cc @@ -195,16 +195,16 @@ void ChatPreviewController_OnRegionalMessageReceived_Hook(auto original, ChatPre struct ChatTitleLayout { il2cpp::GcHandle element; - bool original_ignore = false; + bool original_ignore = false; }; std::unordered_map chat_title_layouts; void RestoreChatTitleLayout(UserProfileWidget* profile) { - auto* title = profile ? profile->playerTitleWidget() : nullptr; - auto* container = title ? title->container() : nullptr; - auto* element = container ? container->GetComponent() : nullptr; - const auto saved = chat_title_layouts.find(element); + auto* title = profile ? profile->playerTitleWidget() : nullptr; + auto* container = title ? title->container() : nullptr; + auto* element = container ? container->GetComponent() : nullptr; + const auto saved = chat_title_layouts.find(element); if (saved == chat_title_layouts.end()) return; if (saved->second.element.Get() == element) @@ -216,7 +216,7 @@ void HideChatTitle(UserProfileWidget* profile) { auto* title = profile ? profile->playerTitleWidget() : nullptr; auto* transform = title ? profile->transform() : nullptr; - auto* row = transform ? transform->FindInParents() : nullptr; + auto* row = transform ? transform->FindInParents() : nullptr; if (!row) { RestoreChatTitleLayout(profile); return; diff --git a/src/mod/features/features.h b/src/mod/features/features.h index af46ba677..8c43de8e6 100644 --- a/src/mod/features/features.h +++ b/src/mod/features/features.h @@ -200,3 +200,8 @@ float WindowDpiScale(bool refresh = false); // sync/sync.cc extern const Feature kSync; + +#if __APPLE__ +// mouse_navigation_mac.mm +extern const Feature kMacNavigationMouse; +#endif diff --git a/src/mod/features/mouse_navigation.h b/src/mod/features/mouse_navigation.h new file mode 100644 index 000000000..f368ed581 --- /dev/null +++ b/src/mod/features/mouse_navigation.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include + +namespace MouseNavigation +{ +enum class Phase { kDiscrete, kBegan, kChanged, kEnded, kCancelled }; + +// AppKit/WebKit convention: positive horizontal delta is Back, negative is Forward. Ignore vertical gestures. +inline int32_t Button(double x, double y) +{ + if (!std::isfinite(x) || !std::isfinite(y) || std::abs(x) <= std::abs(y)) + return -1; + return x > 0 ? 3 : 4; +} + +struct Swipe { + int32_t pending = -1; + + int32_t Observe(int32_t button, Phase phase) + { + if (phase == Phase::kCancelled) { + pending = -1; + return -1; + } + if (phase == Phase::kDiscrete) { + pending = -1; + return button; + } + if (phase == Phase::kBegan) + pending = -1; + if (button >= 0) + pending = button; + if (phase != Phase::kEnded) + return -1; + const auto result = pending; + pending = -1; + return result; + } +}; +} // namespace MouseNavigation diff --git a/src/mod/features/mouse_navigation_mac.mm b/src/mod/features/mouse_navigation_mac.mm new file mode 100644 index 000000000..6c15bc4d5 --- /dev/null +++ b/src/mod/features/mouse_navigation_mac.mm @@ -0,0 +1,77 @@ +// [control] macos_navigation_mouse: app-local Back/Forward swipe events feed the existing MOUSE3/MOUSE4 bindings. + +#include "config.h" +#include "features/features.h" +#include "features/mouse_navigation.h" +#include "mod.h" + +#include +#include + +#import + +namespace +{ +id navigation_mouse_monitor = nil; +MouseNavigation::Swipe navigation_mouse_swipe; + +void ResetMacNavigationMouse() +{ + navigation_mouse_swipe = {}; + unity::Key::ClearNavigationMouse(); +} + +bool NavigationMouseEnabled() +{ + const auto& config = Config::Get(); + return config.control.macos_navigation_mouse && config.control.hotkeys_enabled + && !config.control.use_scopely_hotkeys && !ModReloading() && NSApp.active; +} + +NSEvent* NavigationMouseEvent(NSEvent* event) +{ + if (!NavigationMouseEnabled()) { + ResetMacNavigationMouse(); + return event; + } + using MouseNavigation::Phase; + const auto native_phase = event.phase; + const auto phase = (native_phase & NSEventPhaseCancelled) ? Phase::kCancelled + : (native_phase & NSEventPhaseEnded) ? Phase::kEnded + : (native_phase & NSEventPhaseBegan) ? Phase::kBegan + : (native_phase & NSEventPhaseChanged) ? Phase::kChanged : Phase::kDiscrete; + const auto direction = MouseNavigation::Button(event.deltaX, event.deltaY); + const auto button = navigation_mouse_swipe.Observe(direction, phase); + if (button >= 0) { + unity::Key::QueueNavigationMouse(button); + static bool navigation_mouse_reported[2] = {}; + if (!navigation_mouse_reported[button - 3]) { + navigation_mouse_reported[button - 3] = true; + spdlog::info("[MacNavigationMouse] {} gesture received; mapped to MOUSE{}", button == 3 ? "Back" : "Forward", button); + } + } + return direction >= 0 || button >= 0 ? nil : event; +} + +bool InstallMacNavigationMouse() +{ + // A local monitor only sees events delivered to this application and needs no global input-monitoring grant. + navigation_mouse_monitor = [[NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskSwipe + handler:^NSEvent*(NSEvent* event) { return NavigationMouseEvent(event); }] retain]; + if (!navigation_mouse_monitor) { + spdlog::warn("[MacNavigationMouse] could not install the app-local event monitor"); + return false; + } + // Kept for the process lifetime: no callbacks or AppKit messages from native static destructors at exit. + return true; +} + +void MacNavigationMouseFrame() +{ + if (!NavigationMouseEnabled()) + ResetMacNavigationMouse(); +} +} // namespace + +const Feature kMacNavigationMouse{"MacNavigationMouse", &Config::Patches::hotkeyhooks, InstallMacNavigationMouse, + MacNavigationMouseFrame, ResetMacNavigationMouse}; diff --git a/src/mod/mod.cc b/src/mod/mod.cc index e6850d5ac..f198ce910 100644 --- a/src/mod/mod.cc +++ b/src/mod/mod.cc @@ -105,6 +105,10 @@ void LogBanner() // in features.h. No feature depends on another being installed first; the object tracker leads only so that every // tracked class is hooked before anything else is. constexpr const Feature* kFeatures[] = { +#if __APPLE__ + // mouse_navigation_mac.mm + &kMacNavigationMouse, +#endif // tracked_objects.cc &kObjectTracker, // action_queue.cc diff --git a/tests/il2cpp_bindings.cc b/tests/il2cpp_bindings.cc index bcfbec87a..973e9b155 100644 --- a/tests/il2cpp_bindings.cc +++ b/tests/il2cpp_bindings.cc @@ -64,6 +64,33 @@ void KeyboardSnapshot() Key::Poll(); Require(!Key::Pressed(KeyCode::A) && !Key::Down(KeyCode::A), "return to idle clears held keys"); Require(held_reads == 3 && down_reads == 3, "idle frame stays query-free"); + + // Navigation gestures have no Unity anyKey/anyKeyDown signal. They must survive an event arriving after the + // current frame was polled, appear for one complete frame, and never turn the wheel click into a thumb button. + Key::QueueNavigationMouse(3); + Require(!Key::Down(KeyCode::Mouse3), "queued gesture waits for the next frame"); + ++input_frame; + Key::Poll(); + Require(Key::Down(KeyCode::Mouse3) && Key::Pressed(KeyCode::Mouse3), "Back pulse bypasses the Unity idle gate"); + Key::Poll(); + Require(Key::Down(KeyCode::Mouse3), "polling twice preserves the frame pulse"); + Require(!Key::Down(KeyCode::Mouse4) && !Key::Down(KeyCode::Mouse2), "Back does not affect Forward or wheel click"); + ++input_frame; + Key::Poll(); + Require(!Key::Down(KeyCode::Mouse3) && !Key::Pressed(KeyCode::Mouse3), "gesture releases on the next frame"); + Key::QueueNavigationMouse(4); + ++input_frame; + Key::Poll(); + Require(Key::Down(KeyCode::Mouse4) && !Key::Down(KeyCode::Mouse3), "Forward is Mouse4"); + Key::ClearNavigationMouse(); + Require(!Key::Down(KeyCode::Mouse4), "disabling or reloading clears an already-polled pulse"); + Key::QueueNavigationMouse(3); + Key::ClearNavigationMouse(); + Key::QueueNavigationMouse(2); + ++input_frame; + Key::Poll(); + Require(!Key::Down(KeyCode::Mouse3) && !Key::Down(KeyCode::Mouse2), + "clear drops queued input and rejects wheel click"); } struct FakeClass { diff --git a/tests/il2cpp_gc.cc b/tests/il2cpp_gc.cc index 653baac53..82211911d 100644 --- a/tests/il2cpp_gc.cc +++ b/tests/il2cpp_gc.cc @@ -80,7 +80,7 @@ int main() } Require(frees == 3 && targets.empty()); { - auto root = il2cpp::GcHandle::Strong(&object); + auto root = il2cpp::GcHandle::Strong(&object); auto weak_root = il2cpp::GcHandle::Weak(&other); il2cpp::GcHandle::StopRuntime(); targets.clear(); // The runtime destroys its own handle table before native static destructors run. diff --git a/tests/mod_logic.cc b/tests/mod_logic.cc index 22debea73..02aec812e 100644 --- a/tests/mod_logic.cc +++ b/tests/mod_logic.cc @@ -1,6 +1,7 @@ // Settings parsing and shortcut matching, run against production code with Unity input replaced by a fake. #include "config.h" #include "features/chat_startup.h" +#include "features/mouse_navigation.h" #include "features/notification_audio.h" #include "features/ship_shortcut_hint.h" #include "features/toast_text.h" @@ -551,7 +552,24 @@ void ReloadGate() Check(!gate.Tick(true, 43) && !gate.Tick(true, 45.9) && gate.Tick(true, 46), "nested teardown notifications restart the settling period"); } - +void MouseNavigationGestures() +{ + { + using namespace MouseNavigation; + Check(Button(1, 0) == 3 && Button(-1, 0) == 4, "macOS Back and Forward map to Mouse3 and Mouse4"); + Check(Button(0, 1) == -1 && Button(0.1, 1) == -1 && Button(0, 0) == -1, + "vertical gestures are not mouse navigation"); + Swipe swipe; + Check(swipe.Observe(3, Phase::kDiscrete) == 3, "discrete Back gesture"); + Check(swipe.Observe(4, Phase::kBegan) == -1 && swipe.Observe(4, Phase::kChanged) == -1, + "phased gesture waits for completion"); + Check(swipe.Observe(-1, Phase::kEnded) == 4 && swipe.Observe(-1, Phase::kEnded) == -1, + "completed gesture emits once even when its final delta is zero"); + swipe.Observe(3, Phase::kBegan); + Check(swipe.Observe(-1, Phase::kCancelled) == -1 && swipe.Observe(-1, Phase::kEnded) == -1, + "cancelled gesture does not become a command"); + } +} int main() { ShipHints(); @@ -572,6 +590,7 @@ int main() Matching(); ChatStartupGate(); ReloadGate(); + MouseNavigationGestures(); if (failures) return EXIT_FAILURE; std::cout << "mod logic tests passed\n"; From 02c1df7f76ae6993824af9e14121d460d9fb265d Mon Sep 17 00:00:00 2001 From: netniV Date: Sun, 15 Nov 2026 13:13:24 +0000 Subject: [PATCH 2/3] Add some GitHub templates --- .github/ISSUE_TEMPLATE/bug_report.md | 66 ++++++++++++++++++++++++++++ .github/pull_request_template.md | 13 ++++++ 2 files changed, 79 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..3109d11f4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,66 @@ +--- +name: Bug report +about: Report a problem with the mod, installation, or settings. +title: '' +labels: '' +assignees: '' +--- + +## Checks before reporting + + + +- [ ] I checked existing issues for the same problem. +- [ ] I read the [installation and troubleshooting guide](https://github.com/STFC-Mod/mod/blob/dev/docs/INSTALL.md#fix-installation-problems). +- [ ] I checked the latest release and Discord **#info** for a hotfix, especially after a game update. +- [ ] I checked `community_patch.log` for startup, settings, or hook errors. +- [ ] For settings problems, I checked the section, spelling, and value type against the example and compared `community_patch_runtime.vars`. +- [ ] After changing a `[patches]` setting, I fully restarted the game. + +## Platform checks + + + +- [ ] Windows: `version.dll` is beside the running game's `prime.exe`, not in the official launcher's folder; I checked **Properties > General > Unblock** on the DLL. +- [ ] macOS: I started the game through **STFC Community Mod** and accepted any entitlement repair prompt. +- [ ] Wine: the `version` DLL override is set to **native, then builtin** (`n,b`). + +## Platform and versions + +- Platform: +- Operating system and version: +- Processor architecture: +- Game version/build: +- Mod version: +- Mod download/build source: +- Community Mod launcher version, if using macOS: +- Wine/CrossOver/Proton version and runner, if applicable: + +## What happened + + + +## Steps to reproduce + +1. +2. +3. + + + +## Logs and settings + + + +```text +Paste relevant log lines here. +``` + +```toml +# Paste relevant settings here. +``` diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..05889584f --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,13 @@ + + +## What changed and why + + + +## Validation + + + +## Settings and platforms + + From eae116abf8949fa7970ffca41a66630e92cc64ba Mon Sep 17 00:00:00 2001 From: netniV Date: Sun, 15 Nov 2026 14:19:06 +0000 Subject: [PATCH 3/3] Cancel merged PR actions --- .github/workflows/cancel-merged-pr.yaml | 43 +++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/cancel-merged-pr.yaml diff --git a/.github/workflows/cancel-merged-pr.yaml b/.github/workflows/cancel-merged-pr.yaml new file mode 100644 index 000000000..eb08e9510 --- /dev/null +++ b/.github/workflows/cancel-merged-pr.yaml @@ -0,0 +1,43 @@ +name: Cancel merged PR runs + +on: + pull_request_target: + types: [closed] + +permissions: + actions: write + +jobs: + cancel: + if: github.event.pull_request.merged == true + runs-on: ubuntu-24.04 + steps: + # Only trusted inline code runs here; never check out the PR with this token. + - name: Cancel unfinished PR workflows + uses: actions/github-script@v9 + with: + script: | + const number = context.payload.pull_request.number; + const runs = await github.paginate(github.rest.actions.listWorkflowRunsForRepo, { + ...context.repo, + event: 'pull_request', + created: `>=${context.payload.pull_request.created_at}`, + per_page: 100, + }); + for (const run of runs) { + if (run.status === 'completed' || + !run.pull_requests.some(pr => pr.number === number)) { + continue; + } + try { + await github.rest.actions.cancelWorkflowRun({ + ...context.repo, + run_id: run.id, + }); + core.info(`Requested cancellation of ${run.name} (${run.id}) for PR #${number}`); + } catch (error) { + // A run can finish between listing it and requesting cancellation. + if (error.status !== 409) throw error; + core.info(`Run ${run.id} is no longer cancellable`); + } + }