Skip to content

feat(arena): inject skins for randomly assigned champions - #386

Open
minzinccs wants to merge 5 commits into
Alban1911:mainfrom
minzinccs:feat/arena-random-champ-skins-pr
Open

minzinccs wants to merge 5 commits into
Alban1911:mainfrom
minzinccs:feat/arena-random-champ-skins-pr

Conversation

@minzinccs

@minzinccs minzinccs commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What

Arena "random champion" only reveals the champion once the game starts, so the
normal champ-select injection has no champion to work with. This adds a late
resolver that watches the gameflow, reads the champion from the live session and
injects the skin right after the game process is created.

Order of preference:

  1. the historic skin for that champion (numeric skin/chroma id);
  2. a downloaded local skin (Arena only);
  3. nothing - no skin, the match is never touched.

How

  • threads/utilities/late_champion_resolver.py: resolve/inject/dedupe.
  • phase_handler + websocket_event_handler: trigger on GameStart, and on
    InProgress only when the previous phase was ChampSelect / FINALIZATION /
    GameStart (so a Rose started mid-match never injects into a running game).
  • loadout_ticker + injection_manager.prepare_late_injection(): for an Arena
    game with an unknown champion, start the monitor/patcher at the loadout
    countdown, so the game process is frozen the moment it is created. mkoverlay
    then finishes in under a second instead of racing the loading screen.
  • game_monitor: retry a transient AccessDenied (10 x 50 ms) instead of
    giving up; the monitor keeps sweeping while the game is starting.
  • Every no-injection path releases the game and the patcher, and a 6 s cap
    releases the game if the champion cannot be resolved.

The resolver never mutates the shared state and dedupes by gameId, so a
reconnect or a second InProgress event cannot inject twice.

Config ([Debug] in config.ini)

  • arena_late_injection (default on)
  • arena_late_fallback_local_skin (default on)
  • arena_late_skin_selection = newest (default) | random
  • arena_late_preferred_skins = comma-separated skin ids

Verification

  • End-to-end in a real Arena game (queue 1740): the game was frozen at launch,
    the champion resolved in 195 ms, mkoverlay took 0.62 s, the DLL logged
    overlay verified 2 wad(s) and redirected wad: DATA/FINAL/Champions/Gangplank.wad.client - no "joined too late"; at game end
    the overlay was wiped and the injection completed.
  • python -m pytest -q --ignore=pengu/tests/test_activation_warning.py
    -> 407 passed, 91 subtests.

The 11:22 Arena game resolved champion 134 and picked a local skin, but the monitor only started after the game process existed. The fresh process refused the suspend handle (ACCESS DENIED), the game kept loading through the 4.7s mkoverlay and the LTK DLL reported 'joined too late', so no skin applied.

- loadout_ticker: for an Arena game with an unknown champion, start the monitor and keep the patcher at the countdown instead of discarding it at T-0 (prepare_late_injection).

- game_monitor: retry suspend 10 x 50ms on AccessDenied and keep the monitor alive so the next sweep retries.

- late_champion_resolver: expects_late_injection(), release the game/patcher on every no-injection path, give up after 6s while the game is frozen, and release on game-end phases. Queue 1740 is Arena.

Tests: 48 resolver tests (+8), suspend retry and ticker keep-patcher tests; 387 passed.
The local library holds one skin-swap mod per skin, so a random pick could land on a 2010 skin (Sailor Gangplank) while PROJECT: Gangplank sat unused.

- arena_late_skin_selection: newest (default, highest skin id) or random

- arena_late_preferred_skins: comma-separated ids that win when local

- log the selection source: falling back to local skin 41033 (newest)

Tests: 55 resolver tests (+7); 394 passed.
@minzinccs
minzinccs force-pushed the feat/arena-random-champ-skins-pr branch from 898fef9 to f60e1d6 Compare October 21, 2026 06:38
@minzinccs minzinccs changed the title feat(arena): inject the champion's skin when it is revealed late feat(arena): inject skins for randomly assigned champions Oct 21, 2026
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