Skip to content

Add local officer preset reordering - #260

Draft
Guffawaffle wants to merge 17 commits into
STFC-Mod:devfrom
Guffawaffle:feature/reorder-officer-presets
Draft

Guffawaffle wants to merge 17 commits into
STFC-Mod:devfrom
Guffawaffle:feature/reorder-officer-presets

Conversation

@Guffawaffle

@Guffawaffle Guffawaffle commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Adds opt-in local officer-preset ordering. Shift-click the pencil to move up; Ctrl-click moves down on Windows, and Command or Ctrl works on Mac. Normal clicks still rename. A separate display array preserves the canonical server slot/order IDs, and the chosen order persists through the existing shared mod-state component (#267).

[ui]
allow_officer_preset_reordering = true

The feature defaults to false. Hook installation is independently controlled by the default-true [patches].officerpresetreorderhooks switch. Callbacks read the current feature preference and retain native behavior when disabled or when the complete hook family cannot be installed.

Before native save and screen release, an owned custom view restores native presentations and the canonical scroller source, including any deferred source. This handles regeneration that returns without assigning its backing list. Restoration uses validated reflected fields, managed reference writes and identity readback; failed restoration suspends custom ordering. The boundary remains active after the feature is disabled. Reapplication checks that the same view is still bound.

Validation: exact-head Windows release build (32.656s), all 11 maintained TOML examples, eight temporal cases exercising the actual extracted save/release/restoration callbacks, and both modifier branches with fake input. The fixture substitutes managed APIs and metadata; it does not establish live IL2CPP behavior. All five Windows client270 detour windows fit measured native extents.

Current-artifact Windows smoke and Mac qualification remain open. Historical arm64 smoke covered 73f6285. For the current 251eac6e candidate, build each available Mac architecture and check normal rename, Shift up, Command/Ctrl down, scrolling, persistence, rename/save/overwrite and immediate close/reopen. Also verify source restoration through deferred/failed regeneration and feature-off lifecycle paths before promotion.

@Guffawaffle

Copy link
Copy Markdown
Contributor Author

Restacked on #267 and reduced the preset consumer to mod_state::Read/Update, removing 179 lines of duplicated persistence. Review then found and corrected future-schema handling in #267 plus a transient-bind path that could swallow a modified rename click. All three correction lanes now report no confirmed defect at 73f6285 (receipt 5d43793822e9). The PR remains draft for exact-client hook-fit and macOS runtime evidence.

@GingerNinja-STFC

Copy link
Copy Markdown
Contributor

@Guffawaffle Love it ❤️ A server sync would be extremely cool too but I get why it's out of scope, I really wouldn't want to take responsibility for messing with that 😅
It works great on macOS, I went through your validation checklist and it looks good to me. Let me know if you need me to verify anything else.


  • macOS 26.6.2 (25G83), Apple Silicon arm64 (Mac14,9), mod 1.1.7.1, branch feature/reorder-officer-presets @ 73f6285, releasedbg (_MODDBG) build via scripts/mac-build-test-debug.sh -m releasedbg run, [ui] allow_officer_preset_reordering = true
  • x86_64: not runtime-exercised (no Intel machine available) — CI mac builds pass both architectures; runtime evidence is arm64-only
Check Result
launch + hook installation ✅ + Patching 27 of 27 (OfficerPresetReorder) on every run; no layout-mismatch, duplicate-identity, or canonical-invariant errors across ~5 sessions
pencil-click rename ✅ normal; rename still worked immediately after modifier release
Shift-click up / Ctrl-click down ✅ both directions (also cross-session round trip of the same preset)
modifier release ✅ no reorder behavior left active
scroll stability ✅ no viewport jump after moves
persistence close/reopen + full restart ✅ three full restarts; loaded 31 persisted slot positions each time (30 → 31 after new slot unlock)
reorder + rename/save/overwrite ✅ reconciled presentation-only ordering after preset save; 31 rows before and after
save → instant close → reopen after callback ✅ reconcile landed, observed 31 canonical preset rows on reopen, no duplicated/missing rows
empty-slot → occupied-slot ✅ occupied preset moved across the newly unlocked empty slot, invariants held
profile isolation ✅ -ccm test_profile.toml → sibling test_profile.state.json (+ its .lock) written; default community_patch_state.json byte-untouched (mtime predates the custom run); both parse cleanly afterward
detour/lifecycle stability ✅ no crash reports from mod sessions; no SPUD duplicate-detour errors

Key log lines (default profile, community_patch.log):

10:27:19 [debug] [OfficerPresetReorder] observed 31 canonical preset rows
10:27:51 [info]  [OfficerPresetReorder] moved slot=2089166859667854754 up across slot=2036344068443035099 (persisted locally)
10:27:54 [info]  [OfficerPresetReorder] reconciled presentation-only ordering after preset save
10:29:48 [info]  [OfficerPresetReorder] reconciled presentation-only ordering after preset save
10:29:59 [debug] [OfficerPresetReorder] observed 31 canonical preset rows
10:30:23 [info]  [OfficerPresetReorder] moved slot=2282724033844040729 up across slot=2806856974804014494 (persisted locally)

@Guffawaffle

Guffawaffle commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Hook/feature alignment follow-up for #313

Follow-up to #313: keep hook installation independent of feature enablement, with default-enabled compatibility switches under [patches] and feature checks inside the installed hooks.

The patch registry currently uses [ui].allow_officer_preset_reordering as its installation switch. Add an independent default-enabled [patches] switch and check the existing feature setting inside the callbacks. Simply changing the registry is insufficient: callbacks currently do not read the feature setting. Preserve canonical restoration during save/release and native behavior when disabled. This branch depends on #267; keep the correction local to the reordering feature.

Updated at 251eac6: independent default-true installation, current default-off feature checks and complete typed hook family. Canonical source/presentations plus existing deferred data restore before native save/release, including feature-off ownership; failed restoration suspends customization. Mac accepts Command and previous Ctrl input. Exact Windows build, all examples and focused temporal/modifier checks pass; three independent review lanes clear of confirmed defects. Windows and both Mac CI builds are queued; no CI wait. Existing #267 dependency retained. Exact-artifact game/reflected-API smoke and Mac qualification remain open; historical arm64 smoke belongs to 73f6285.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants