Skip to content

Core State and Domain

Isllan Toso edited this page Nov 21, 2026 · 1 revision

Core State and Domain (bullet-core)

bullet-core is the zero-dependency foundation of the workspace (#![forbid(unsafe_code)]). It defines every domain type, phase transition, and validation rule so illegal states are unrepresentable at compile time.

Immutable State Publishing (AppState)

  • Single Source of Truth: AppState is published via tokio::sync::watch::Sender<AppState> (StateSender) and read by subscribers through StateReceiver.
  • Named Transitions Only: External modules never mutate AppState fields directly. Every mutation goes through explicit transition functions in bullet_core::state:
    • set_lcu_connected
    • set_phase
    • set_overlay_target
    • set_injection_status
    • set_party_status
    • clear_for_new_game
  • Exclusive Selection Origin: SelectionOrigin is an enum (User, History, Random, Preset) rather than independent booleans, preventing conflicting selection sources.

Game Phase Machine (GamePhase)

GamePhase maps League Client lifecycle phases into deterministic behavior:

  • Between matches: None, WaitingForStats, PreEndOfGame, EndOfGame, FailedToLaunch, TerminatedInError.
  • Pre-match selection: Lobby (including Swiftplay/Brawl/TFT queues), Matchmaking, ReadyCheck, ChampSelect, Finalization.
  • Active match: GameStart, InProgress, Reconnect.

QueueInfo distinguishes standard Summoner's Rift/ARAM queues from Swiftplay/Quickplay (where picks happen in lobby before matchmaking) and TFT queues (QueueInfo::is_tft).

Identity Customization & Sanitization (IdentityLoadout)

IdentityLoadout models profile customization across 5 categories:

  • Summoner Icons
  • Ranked/Prestige Borders
  • Challenge Tokens
  • Profile Titles
  • Lobby Banners

Every incoming or persisted IdentityLoadout field is validated against:

  • XSS / HTML injection
  • CSS injection
  • Path traversal (.., /, \)
  • Oversized payloads

Only sanitized values are persisted to state/identity.json or broadcast to Party Mode peers.

Overlay & Mod Slot Model

  • ModSlot: Categorizes custom mods into Skin, Map, Font, Announcer, and Other so users can stack multiple non-conflicting mods cleanly.
  • OverlayCommand: Typed command channel bridging the UI (desktop window or In-Client UI) with OverlaySession (SelectSkin, SelectRandom, PinPreset, SetMods, SetIdentity, JoinLobbyParty, OpenPanel, Minimize, Hide).

Clone this wiki locally