Skip to content

System view zoom and dynamic IL2CPP field offsets#34

Merged
MBurchard merged 7 commits intomainfrom
feat/system-view-zoom
Mar 31, 2026
Merged

System view zoom and dynamic IL2CPP field offsets#34
MBurchard merged 7 commits intomainfrom
feat/system-view-zoom

Conversation

@MBurchard
Copy link
Copy Markdown
Owner

@MBurchard MBurchard commented Mar 31, 2026

Summary

  • Replace all hardcoded IL2CPP field offsets with dynamic runtime resolution via il2cpp_class_get_field_from_name + il2cpp_field_get_offset, making the mod resilient to game updates
  • Add system view zoom feature with two configurable sliders: zoom distance (1000-3000) and ship name visibility range (1000-3000), using the game's own OverrideZoomLimits API
  • Move banner settings from game.ui to game.banners for cleaner TOML structure
  • Fix save() race condition where the debounced write thread could resolve the settings path after a test reset, corrupting the real settings file
  • Fix WebKit user-select for Tauri on macOS (requires -webkit- prefix on all elements)
  • Fix window flash on primary screen before restoring to saved position
  • Bump version to 0.5.0 and update README feature list

Test plan

  • Start game, enter a system: zoom should default to 1000
  • Move both sliders (System Zoom + Ship Names Visible): changes apply live without switching systems
  • Verify ship names stay visible up to the configured distance
  • Toggle toast banner suppression: verify banners are suppressed per type
  • Check settings.toml: banner settings should appear under [game.banners], not [game.ui]
  • Restart app: all settings must survive the round-trip
  • Verify text in the UI is not selectable (except error messages)

…position

- Start window invisible (visible: false in tauri.conf.json) and defer show() until the Moved
  event confirms that set_position has been applied
- On macOS, set_position dispatches async on the main queue, so calling show() immediately would
  display the window at the default position before the move completes
- Extract show_window() helper to deduplicate show + DevTools logic
- Add il2cpp_class_get_field_from_name and il2cpp_field_get_offset to the IL2CPP API bindings
  (api.rs, types.rs)
- Add resolve_field_offset() convenience wrapper in resolver.rs
- Add read_f32 helper to tracker.rs
- Migrate all 8 hardcoded offsets across 5 hook modules to dynamic IL2CPP reflection at install():
  - ui_scale: ScreenManager.m_canvasRootScaler, CanvasScaler.m_ScaleFactor
  - chat_frame: ChatPreviewController._focusedPanel
  - spacebar: _visibilityController, _state, _scanEngageButtonsWidget
  - job_queue: JobQueuePanelViewController._listCollapsed
  - toast_banner: Toast.<State>k__BackingField
- Each offset is cached in an AtomicUsize with graceful degradation (offset 0 = unresolved, hook
  logic skips safely)
- Offsets no longer break on game updates that change class layouts
- Hook SetViewParameters to extend zoom-out limit via OverrideZoomLimits API
- Two new settings sliders: System Zoom (100-3000) and Ship Names Visible (1000-3000)
- smax calculated from visibility setting using empirical formula (visibility - 200) / 0.4
- Live update via WebSocket: both sliders take effect without switching systems
- Guard against partial field resolution: skip OverrideZoomLimits if _minimum unresolved
- Move banner settings from game.ui to game.banners (disable_all, disabled_types)
- Raise system zoom minimum and default from 100/300 to 1000/1000
- Fix WebKit user-select: apply -webkit-user-select: none on all elements
- Fix save() race condition: capture settings path at call time, not in thread
- Align settings label width (12rem) so all sliders start at the same position
- Reorder GameUiSettings fields to match UI layout (sliders before toggles)
- Add system view zoom, job queue auto-expand, and toast banner suppression to feature list
- Add dynamic version badge from GitHub releases to both README headings
- Bump version to 0.5.0 in package.json, rust-mod/Cargo.toml, and backend/Cargo.toml
On Windows, set_position() is synchronous and the Moved event does not fire during setup() because
the event loop is not yet running.
The deferred-show mechanism introduced for macOS left the window permanently invisible.
Show the window directly on platforms where set_position() completes inline.
- SetViewParameters is inlined by MSVC on Windows (zero CALL references in GameAssembly.dll), so the
  hook never fires
- SetDepth is called from the inlined copies (9 live call sites)
- SetViewParameters delegates to SetDepth on all platforms, so this is the robuster hook target also
  on macOS
@MBurchard MBurchard merged commit 338079f into main Mar 31, 2026
1 check passed
@MBurchard MBurchard deleted the feat/system-view-zoom branch March 31, 2026 23:34
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.

1 participant