4.1 KiB
4.1 KiB
Architecture
Ehwrj is split into small modules so that local API access, state derivation, rendering, and platform integration stay separate.
Data Flow
War Thunder local API
-> Ehwrj.Core.Services.WarThunderClient
-> Ehwrj.App.Services.LiveMapService
-> Ehwrj.App.Models.LiveSnapshot
-> MainWindow / OverlayWindow
-> MapCanvas / OverlayCanvas
Modules
Ehwrj.Core
WarThunderClientis the only module allowed to perform network requests.- Its base address is fixed to
http://127.0.0.1:8111/. ProcessProbechecks whetheraces.exeis present.MapInfoparses/map_info.json.MapObjectparses/map_obj.json.FlightStateparses optional/statetelemetry such asTAS, km/h,IAS, km/h,Vy, m/s, andH, m.BattleMessagenormalizes optional/hudmsgand/gamechatmessages.MapObjectKindclassifies player, ally, squad, enemy, objective, and unknown objects.ObjectTrackerestimates motion from consecutive object positions.CoordinateProjectorconverts map coordinates into viewport coordinates.
Ehwrj.Core targets plain net8.0 and has no UI dependency.
Parser tolerance is intentionally concentrated in Ehwrj.Core:
- numeric JSON strings are parsed with invariant culture and comma decimal fallback
- map bounds can come from scalar min/max fields,
map_min/map_maxarrays,bounds, orgrid_size - object position can come from scalar
x/ystyle fields orpos/positionstyle arrays - object direction can come from scalar
dx/dystyle fields ordir/direction/velocitystyle arrays
Ehwrj.App
LiveMapServiceowns the polling loop and converts endpoint responses into immutable UI snapshots.SettingsStorepersists user settings under%LOCALAPPDATA%\Ehwrj.OverlaySettingsholds user-adjustable overlay controls.UiTextandLanguageOptionprovide the clean-room English/Korean UI language layer.LiveSnapshotis the single render input for both the main map and overlay.MainViewModelcoordinates commands and live state for the Avalonia UI.
Rendering
MapCanvasdraws the main map preview, including player-relative rotation of the map plane and projected tactical objects.OverlayCanvasdraws the transparent overlay surface.- Rendering code receives a
LiveSnapshotandOverlaySettings; it does not perform I/O. - Overlay setting changes invalidate the drawing surface directly, so UI sliders and text settings are reflected without restarting the polling loop.
Overlay Controls
The overlay settings mirror the benign controls identified in the analyzed live map resource:
- minimap visibility, aircraft scale, and Mach threshold
- spot radar visibility, detection range, spread, vertical scale, and vertical offset
- marker opacity, arrow scale, arrow outline, and colors
- distance, Mach, and closure speed label toggles
- per-label font size, outline width, color, and opacity
Platform Integration
Win32.MakeOverlayClickThroughis the only Windows interop hook.- It applies click-through and no-activate extended styles to the optional overlay window.
- It is guarded with
OperatingSystem.IsWindows().
Developer Tooling
Ehwrj.Tools.LocalApiStubserves deterministic/map_info.json,/map_obj.json, and/map.imgresponses on loopback.- It also serves optional
/state,/hudmsg, and/gamechatresponses for player info and battle log development. - The stub lets contributors exercise the UI without running War Thunder.
- The generated map image is produced in memory and the moving aircraft data is deterministic.
Ehwrj.Tools.Capturecaptures real local API responses into fixture directories.- It writes
capture-report.txtso captured fixtures can be checked for parser coverage, raw object field frequency, unknown object samples, replay readiness, and tuning gaps. LocalApiStub --fixture-dirreplays captured fixtures before falling back to generated responses.
Safety Rules
The project intentionally has no module for clipboard monitoring, startup persistence, ZIP mutation, PE resource updates, or external network communication. New features should preserve these boundaries.