Skip to content

feat: Anniversary graphics with 3-4 players in Halo CE and Halo 2; Halo 2 Anniversary 2P views fill their halves - #44

Merged
megabitt01 merged 7 commits into
megabitt01:master-chieffrom
kirklandsig:upstream/06-anniversary
Nov 19, 2026
Merged

megabitt01 merged 7 commits into
megabitt01:master-chieffrom
kirklandsig:upstream/06-anniversary

Conversation

@kirklandsig

Copy link
Copy Markdown

Anniversary graphics, PR 6 of the series: Halo CE and Halo 2 in Anniversary graphics with 3-4 players, as a saved choice that's off by default, and a fix for Halo 2 Anniversary with 2 players, whose views each came out a quarter of the screen tall.

What players get

  • A checkbox in Dev Tools, under the split-screen layout combo: "Anniversary graphics with 3-4 players (Halo CE, Halo 2; experimental)". It's off by default and takes effect at the next mission start.
  • The pairs take turns. Both Anniversary renderers only ever draw two views, so players 1 and 2 are drawn on one frame and players 3 and 4 on the next: each view updates at half the frame rate.
    • With three players, Halo CE uses quarters (the fourth stays black) and Halo 2 gives player 1 the wide top half, as its own grid does.
  • Halo 2 with four players runs at 60 fps on the test box, instead of 30. While the mode runs, its split render targets are made a quarter of the screen.
  • Halo 2 Anniversary with 2 players: each view fills its half. On master-chief each view came out squeezed into half of its half: one in the top quarter, one in the bottom quarter, with a black band between. Fix/halo2 black screen #23's composite clip sets the viewport to the player's half, but the game's quad already places the image in that half, so the image is shrunk twice. Each view is now drawn into its half by the same small shader the 3-4 player mode uses, and the game's quad isn't drawn, so the clip (which only takes DrawIndexed) doesn't act. This one doesn't depend on the checkbox. One and 3-4 players don't go through it. Until our shaders are made for the device, the game's own composite runs under Fix/halo2 black screen #23's clip as before, and a view with no image is left to the game's composite too.

How it works

  • Halo CE (module/entry/halo1/anniversary.cpp, Saber3D):
    • Cameras for views 3 and 4 are made with the renderer's own AddCamera when split screen starts, and given quarter viewports.
    • Quarter-size children are swapped into every split render target for the frame. Each view is copied into its quadrant of an image of ours, which goes to the screen before the HUD. The classic HUD pass draws each view's HUD in its quadrant, and each view's screen effects stay in it.
    • On the game side, players 3 and 4's cameras are handed over inside the game's own hand-over (they'd be a frame stale otherwise). Their units are hidden only in their own views, and they get first-person models of their own: the first-person sync's slot check is widened from 1 to 3 once the mode runs, after its bytes are checked, and put back when the module unloads.
    • The quarter-size children are made as the game makes its split targets, and only while the mode is chosen. The texture manager's delete is hooked, so nothing of ours outlives the game's textures through a resize.
    • Three players lay their windows out as four through splitscreen.cpp's window hook, so the feature requires the split-screen hooks' feature (Feature::Requires).
  • Halo 2 (module/entry/halo2/anniversary.cpp, CellShaders.h):
    • The game's glue splits the screen only for exactly two players. At its six "== 2" sites (told apart by return address), the local player count answers 2 while the mode runs. The count's 12-byte leaf goes through PreservingThunk.
    • Players 3 and 4 get copies of our cameras, handed over after view 1. Each camera takes its player's cell in Halo 2's own grid, and the pair rides in the camera list's flags to the frame that draws it.
    • The _split render targets are remade half as wide while the mode runs and put back after. Texture deletion is hooked, so none is kept past the engine's delete.
    • The game's composite quad leaves no pixels with more than two players, so it's collapsed to a point and each view's image is drawn into its cell by CellShaders.h. The other pair's cells are kept in a texture of ours and put back before the HUD.
    • On the game side, each window's visible objects, the own-unit test and the first-person models follow the pair. Players 3 and 4's exposure adapts to their own picture; it used to follow player 1's.
  • The saved choice: SplitscreenConfigStore keeps it as -1.anniversary_quad in alpha_ring_splitscreen.cfg, beside the layout, in an atomic as the layout preference is. ClassicGraphicsScope reads it as a Halo CE or Halo 2 mission starts. Nothing else is written.
  • Offsets: 57 new ones for Halo CE and 32 for Halo 2, all DefOffset with byte patterns (gen_patterns.py). Each game's mode is a feature of all of them: on an MCC build missing one, the checkbox does nothing for that game and its missions start in Classic as before. check_gates.py passes.

Known limits

  • Each view updates at half the frame rate while 3-4 players are in Anniversary graphics (the pairs take turns).
  • With three players in Halo CE, the fourth quarter is black.
  • Not exercised: a resolution change in the middle of a 3-4 player mission. The texture-lifetime handling above is there for it, but it didn't run on the box.
  • Seen twice on the box: after Back, one pad's view didn't turn for a moment (a different pad each time). It looked like our virtual-pad harness's timing and didn't happen in quad mode.

Testing (MCC 1.3528, Steam under Proton on Batocera, with virtual pads; not on Windows)

  • Build: clean on current master-chief (0335fe3, after feat: split screen side by side in every game, plus 3-4 player fixes (Halo CE, 2, ODST, 4) #40). check_gates.py passes. The rebase onto feat: split screen side by side in every game, plus 3-4 player fixes (Halo CE, 2, ODST, 4) #40's squash brought no line changes; the tree matches what was tested below.
  • Box, on this branch's earlier base (before MenuChange, with your files):
    • Halo CE, 3 players, checkbox on: the mode is logged as the mission starts, and three quadrants draw. Pads 1 and 2 each move only their own view.
    • Halo CE, 3 players, checkbox off: Classic start, and no quarter-size render targets are made.
    • Halo CE, 4 players, checkbox on: four quadrants.
    • Halo 2, 4 players, checkbox on: four quadrants, with the 48 split render targets cell-sized. Back to Classic and back again works.
  • Box, on MenuChange (master-chief 2c66a60 plus this series), Halo 2 Anniversary at 2 players:
    • Before the 2-player fix, master-chief alone and this branch both drew the quarter-tall views.
    • After it, each view fills its half.
    • 4 players still use quad mode, unchanged.
  • Since then: no box run. The test box isn't available now, so the rebase onto feat: split screen side by side in every game, plus 3-4 player fixes (Halo CE, 2, ODST, 4) #40 and the last commit (from review, below) were only built. Please give it a run on Windows: Halo 2 Anniversary at 2 players with the checkbox off is the quick check, since it changes the stock path.
  • Codex adversarial review:
    • The 3-4 player mode was approved after three rounds. Round 1 found the Halo CE texture lifetime (the fix is the last Halo CE commit), and round 2 found a smaller follow-up.
    • The 2-player fix was reviewed on its own and approved in round 3. Rounds 1 and 2 found the cases in the last commit: shaders not made yet, a view with no image, and quad mode's target still being prepared for such a view.

Doesn't depend on any open PR. #43 (per-player HUD) also builds on #40 and adds lines at the same spots in offset_halo1.h, offset_halo2.h and patterns_halo1/2.inc. Whichever of the two merges second needs a small rebase (keep both blocks), and I'll do it as soon as the first is in.

🤖 Generated with Claude Code

kirklandsig and others added 7 commits November 19, 2026 11:49
The addresses the next commits use, as DefOffsets with their byte
patterns (gen_patterns.py; values and patterns as in the kirklandsig
fork, same 1.3528 build):
- Halo CE's Anniversary (Saber3D) split screen: its cameras and camera
  list, the split render targets' children, the frame and its composite,
  the classic HUD pass and each view's screen effects, and the game side
  of the frame - the views' hand-over, the object and first-person sync,
  and who is hidden in which view (56);
- Halo 2's: the views' hand-over and the local player count's other
  "== 2" test sites, the camera list, the frame, its composite and HDR
  pass, the render targets and texture deletion, and the per-view
  visible objects, own-unit test and first-person sync (32).

COVER pins down the first-person sync's slot check (cmp r15d, 1 / ja)
whose limit the CE mode widens; COVER_BEFORE starts the pattern of the
CE overlay rect's mid-function hook 0x32 bytes earlier, over the
registers its detour rewrites.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Halo CE's Anniversary (Saber3D) renderer draws split screen as exactly
two stacked views, with two cameras, two-slot per-view state and render
targets whose split children are half the screen. The mode keeps that
two-view frame and alternates what is in it: players 1 and 2 on one
frame, 3 and 4 on the next, so each view updates at half the frame rate.
module/entry/halo1/anniversary.cpp, ported from the kirklandsig fork
(v1.9-v2.0.1):
- cameras for views 3 and 4 made with the renderer's AddCamera as split
  screen starts and kept past its camera count; quarter viewports;
- quarter-size children swapped into every split render target for the
  frame, each view copied into its quadrant of an image of ours, copied
  to the screen before the HUD; the classic HUD pass draws each view's
  HUD in its quadrant, and each view's screen effects stay in it;
- game side, players 3 and 4's cameras handed over inside the game's own
  hand-over (a frame stale otherwise), their units hidden only in their
  own views, and first-person models of their own (slots 2-3: the slot
  check in the first-person sync is widened from 1 to 3 once the mode
  runs, after its bytes are checked, and put back as the module unloads).

Three players get quarters (the fourth black): splitscreen.cpp's window
hook lays their windows out as four, so the feature requires the split
screen hooks' (Feature::Requires) - on a build missing one of them none
of these hooks go in.

The quarter-size children are made the first time the mode draws after
the game made its split targets (the fork made them alongside, mode or
not), so nothing is allocated for a game that never runs it.

halo1.h declares what the two files share: the split-screen hooks'
feature, their Classic check (now Splitscreen::ClassicShown, which the
mode reads too) and the mode's Quad.

It runs only in a mission that started with it chosen
(Splitscreen::AnniversaryQuadActive); nothing starts one yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Halo 2 Anniversary's renderer draws split screen for exactly two local
players. As in Halo CE the frame keeps its two views and the pairs take
turns. module/entry/halo2/anniversary.cpp and CellShaders.h, ported from
the kirklandsig fork (v1.9-v2.0.1):
- the game's glue splits the screen only for exactly two players: at its
  six "== 2" sites (by return address) the local player count answers 2
  while the mode runs - the count's 12-byte leaf goes through
  PreservingThunk and reads the count as the leaf does;
- players 3 and 4 get camera copies of ours, handed over after view 1;
  each listed camera takes its player's cell in Halo 2's own grid (with
  three players, player 1 keeps the wide top half), and the pair rides in
  the list's flags to the frame that draws it;
- the views are drawn a quarter of the screen in size: the renderer's
  "_split" render targets are remade half as wide while the mode runs
  and put back after (texture deletion is hooked so none is kept past
  the engine's delete) - 60 fps instead of 30 with four players on the
  test box;
- the game's composite quad leaves no pixels with more than two players,
  so it's collapsed to a point and each view's image is drawn into its
  cell by a small shader of ours (CellShaders.h); the other pair's cells
  are kept in a texture of ours and put back before the HUD;
- game side, each window's visible objects, the own-unit test and the
  first-person models follow the pair, and players 3 and 4's frames
  adapt their exposure to their own picture (they followed player 1's).

Two players aren't touched: the game's composite runs as it does, under
the D3D11 composite clip of megabitt01#23 (render/d3d11/Hook.cpp). The fork drew
two players with the same shader for the same black screen; that branch
isn't ported. The clip only takes a 6-index draw whose image is one
player's share of the screen tall, and the mode's images are half the
screen tall with 3-4 players, so the two don't meet.

halo2.h declares what the mode reads from its neighbours: the split
screen's Splitscreen::ClassicShown and players.cpp's Handle and Player.

Like Halo CE's, it runs only in a mission that started with it chosen;
nothing starts one yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Everyone's choice, off by default: SplitscreenConfigStore keeps it as
-1.anniversary_quad in alpha_ring_splitscreen.cfg, beside the layout
(the key the kirklandsig fork uses), loaded with the rest of the file
and kept in an atomic, as the layout preference is. Nothing else is
written.

ClassicGraphicsScope takes it as a Halo CE or Halo 2 mission starts.
Chosen, and with every offset of that game's mode in the build, the
mission runs the mode whenever it shows Anniversary graphics with 3-4
players - Back switches between Classic and Anniversary in the middle
of it, side by side included - and with 3-4 players it keeps
Anniversary at the start instead of Classic (side by side still starts
in Classic). Off, missions start as before and run none of it.

Dev Tools gets a checkbox under the split-screen layout combo.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
The parents and children CE's 3-4 player mode kept (and its full-screen
image) outlived the game's textures: a render target set let go on a
resize (0x20B000 -> 0x1F6BF0) left the frame's swap writing through
freed parents, and the children made on the first quad frame could be
made against a parent freed meanwhile.

- The quarter-size children are made as the game makes its split ones,
  while their parent is alive, and only while the mode is chosen or the
  mission runs in it (a choice taken off in a mission holds until the
  next one, as the rest of the mode does), so a game that never runs it
  doesn't get them.
- The texture manager's delete (0x1F6BF0, a new offset with patterns)
  is hooked: an entry whose parent goes is dropped, the game's own
  children put back in first if ours are in it (the frame), and a child
  of ours or the image that goes is forgotten.
- A mission starts in the mode only when every split render target the
  module made has ours beside it; a choice made after Halo CE made its
  render targets takes effect the next time it loads.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
With two players in Halo 2 Anniversary graphics, the game's composite
runs under the D3D11 composite clip from megabitt01#23. The clip sets the viewport
to the player's slot, but the game's quad already places the image in
that half, so each view came out squeezed into half of its half: the
top quarter and the bottom quarter, with a black band between (seen on
master-chief alone, MCC 1.3528 under Proton). Each view is now drawn
into its half by the cell shaders the 3-4 player mode uses, and the
game's quad isn't drawn, so the clip (DrawIndexed only) doesn't act.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… are made

Two cases from review of the two-player composite:
- If our cell shaders can't be made for the device (first frame, or a
  device recreated), the game's quad was already collapsed and nothing
  replaced it, so the half stayed black. The shaders are now made first,
  and without them the game's quad runs under megabitt01#23's clip, as before.
- With no image, the game's composite returns at once and binds nothing,
  so the view picked up whatever was still bound at t0 and stretched it
  over its half. With two players a null texture now goes straight to the
  game's composite. In quad mode the frame's target is still prepared as
  before, but that view's leftover t0 isn't drawn and its cell isn't
  marked, so the player's kept picture is put back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@megabitt01
megabitt01 merged commit 525dd85 into megabitt01:master-chief Nov 19, 2026
1 check passed
megabitt01 pushed a commit that referenced this pull request Nov 20, 2026
…Halo CE, 2, 3, ODST), a menu per player on the D-pad (#46)

* fix: restore the Halo CE and Halo 2 HUD offsets lost merging #43

Merging master-chief into #43 (after #44) resolved the conflicts in the
Halo CE and Halo 2 offset headers by keeping #44's side only, so the
per-player HUD's offsets and byte patterns there were dropped while the
code using them stayed: master-chief stopped compiling (C2065
'OFFSET_HALO2_PF_HUD_ASPECT_LOCK' in CModule.cpp, and the HUD files).

Both blocks are kept now, as the two PRs had them:
- offset_halo1.h / patterns_halo1.inc: hud_calculate_point, the HUD
  viewport bounds and the drawing player (3);
- offset_halo2.h / patterns_halo2.inc: the "HUD anchor: Centered" je and
  global, the drawing player, the HUD view bounds and the offset unit
  scale (5).
Only lines are added; the values and patterns are #43's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(offsets): spawning addresses for Halo CE, 2, 3 and ODST

The addresses the spawn menus use, as DefOffsets with their byte
patterns (gen_patterns.py; values and patterns as in the kirklandsig
fork, same 1.3528 build):
- Halo CE (11): the console-script compiler the commands come in
  through, the players array, tag iteration and lookup, object placement,
  creation, origin and lookup, actor_customize_unit and ai_attach_free;
- Halo 2 (14): the console-script compiler, the tag table and names, the
  map's and the shared map's tag bases, the object headers and memory,
  object placement, creation and origin, ai_place and the living count;
- Halo 3 (4): the tag base, the scenario, ai_place and the loaded-tag
  test (its tags header and object functions were already here);
- ODST (9): the same as Halo 3's.

Halo 2's ai_living_count (0x619B10) is a 13-byte thunk no pattern can
find again, so the fork left it to the known build. The offset is now
the function it jumps to (0x6198E0), which the spawn code calls with the
thunk's own arguments (0, null, null).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* feat(spawn): spawning in Halo CE, 2, 3 and ODST, and the Spawn window

Vehicles, weapons, equipment and AI characters (their own side, ally or
enemy, with a chosen weapon) in front of any player, ported from the
kirklandsig fork (src/mcc/spawn):
- Command: spawning calls into the game, so it runs on the game's thread
  through two fixed verbs registered in code, spawn_list and spawn,
  posted only by AlphaRing's menus. Halo 3 and ODST run them on their
  World tick (the task queue in module/entry/halo3/world.cpp and
  halo3odst/world.cpp, which only get a registration; one task a tick, as
  before). Halo CE and Halo 2 get them through MCC's execute_command
  ("HS: @ar ...") at their console-script compiler, which is hooked
  (module/entry/halo1/console.cpp, halo2/console.cpp): text starting with
  "@ar " goes to the registered handlers, anything else to the game
  unchanged. A task is dropped once another map has loaded
  (CGameManager::load_generation, counted from MCC's Loading state), and
  a handler's temporary edits to game data are put back if the game
  faults in one of its calls.
- Backends: objects with each engine's object_placement_data_new and
  object_new. Halo CE characters are a unit armed by
  actor_customize_unit and given a free actor (ai_attach_free); Halo 2,
  3 and ODST place a character by pointing the nearest starting location
  of an empty mission squad at the player for one ai_place, armed from
  the scenario's weapon palette, then putting it back.
- The Spawn window, in the debug overlay's menu bar beside Splitscreen
  and HUD: player, page, search, side and weapon. It writes no file, its
  place in imgui.ini included (ImGuiWindowFlags_NoSavedSettings).

Each game's spawning is an AlphaRing::Feature of every offset it uses,
with the hook that runs its commands: the World hook's offset for Halo 3
and ODST; for Halo CE and Halo 2 the console hook is an EntryFeature
that requires the spawning feature, so it goes in only with all of it.
On an MCC build missing one of them the game offers no spawning. Halo
2's characters also need ai_place and the living count; without them
objects still spawn. check_gates.py reviews gen3.cpp's features, which
are built from each game's table of offsets, as in the fork.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* feat(spawn): each player's own spawn menu, in their part of the screen

In a campaign mission each player presses D-pad Down on their own
controller and drives a menu in their own view while their Spartan
holds still: LB / RB for the page (vehicles, weapons, equipment,
characters, their HUD), up / down to choose, A to spawn in front of
them, Y to refresh, B to close; on characters left / right picks the
side and LT / RT the weapon. Ported from the kirklandsig fork
(PlayerMenu.cpp), with what this tree needs:
- Controllers: with AlphaRing's split screen on, get_key_state hands the
  menu the pad it has just read for that player (get_controller, the
  dashboard's assignment) and zeroes it while the menu has it, the press
  that opened it and the buttons held as it closes included. With one
  player MCC reads the pads itself, so player 1's menu reads the
  dashboard's player 1 controller (GetXInputGetState) and the game gets
  no input from player 1 while it's open. The keyboard-and-mouse player
  has no menu (the Spawn window is theirs). No menu opens while the
  debug overlay or the dashboard is up.
- The button is spawn_menu_controller in alpha_ring_menu.cfg (a button
  or combo, NONE turns the menus off; DPAD_DOWN by default). It's only
  read: the default file MenuConfig writes is unchanged.
- Drawing: ImGui also runs a frame while a menu is open and the overlays
  are hidden, with no cursor and no input fed to it (Window.cpp is
  unchanged), and RenderPlayerMenus draws on the foreground list. The
  menus use the dashboard's bundled Segoe UI at 34 px.
- The HUD page (area, size, colour, reset) edits the player's settings
  through Hud::Settings / SetSettings, so like the HUD window's edits
  they last until MCC closes. Hud gets Supported() and kAreaNames. The
  fork's page also had SPLIT, ANNIV 3-4P and SPECIES rows; they're left
  out, as they save to alpha_ring_splitscreen.cfg or to the player's
  profile (the first two are in Dev Tools). Where the HUD page has no
  rows (Halo 4, or a build without the HUD's offsets) it isn't offered,
  and with no spawning either (Halo 4) the menu doesn't open.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* feat(spawn): Halo CE Anniversary's three players get their menus in quarters

With Anniversary graphics for 3-4 players, Halo CE draws three players
in quarters, the fourth left black, where the menus were laid out for
the Classic three-player layout (player 1 on the top half). The menus
now follow what CE draws: Splitscreen::AnniversaryQuartersShown asks the
CE module whether its quad mode drew at the last sync (QuadShown, false
once the module unloads). Halo 2's mode keeps its own grid, player 1 on
the top half, so its menus stay where they are. As in the kirklandsig
fork's v2.0.1.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* fix(spawn): don't lend a Halo 3 / ODST squad again before it's put back

Halo 3 and ODST put a squad lent to a character spawn back 60 ticks
later, as the engine reads its spawn point again while it finishes
placing the actor. A second spawn in that time could pick the same
squad - it still counts as empty while its actor is being placed, or
when the placement failed - and save the first spawn's changes as the
squad's own: the first restore put the original back, then the second
put the changes back over it, and the mission's own squad kept the
player's position, character, team and no objective for the rest of
the map. A squad isn't lent again until its restore has run (the list
starts over with each map, whose pending restores are dropped).

The kirklandsig fork has the same gap; Halo 2 puts its squad back right
after ai_place, so it doesn't.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* fix(spawn): put Halo 3 / ODST squads back by ticks, not queued tasks

A squad lent to a character spawn was put back by a task that queued
itself 60 times. The kirklandsig fork's World queue ran every task due
on a tick, so that was 61 ticks; this tree's queue runs one task a tick,
so each restore step waited behind every other queued task: four spawns
in a row kept each squad lent for about 244 ticks, and any other command
stretched it further - the squad's borrowed definition stayed live to
the mission's AI, and lent squads stayed out of later spawns, for that
long.

Command gets ScheduleAfter(game, ticks, task) and Tick(game): the World
hooks call Tick at the start of each tick (one line each in
module/entry/halo3/world.cpp and halo3odst/world.cpp), which counts
ticks and runs every task due, beside the queue, which still runs one
ordinary task a tick. A task is dropped if another map loads first, as
queued ones are. The restore now runs on the 61st tick after the
spawn's, as in the fork, however many commands are queued.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* fix(spawn): keep each input held as a spawn menu closes, triggers too

As a menu closed, the pad stayed with it while any of its buttons was
held, and the triggers weren't counted: hold RT choosing a character's
weapon, close with B, let go of B with RT still down, and RT reached the
game at once (a shot; LT a grenade). It also held back every input,
movement included, while any button at all was down, even one pressed
after the menu closed.

Now the menu records what's held as it closes, the triggers past
XInput's threshold included, and takes each of those out of the pad the
game gets until that input is released; everything else goes through.
HandlePlayerInput edits the pad in place for that. With one player MCC
reads the pad itself, so player 1 gets no input while anything is held
back, as before but for the kept inputs only.

The kirklandsig fork has the same trigger leak (its gate checks
wButtons only).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* fix(spawn): the debug overlay and the dashboard close open spawn menus

A spawn menu couldn't open while the debug overlay or the dashboard was
up, but one already open stayed open when either came up: with the
dashboard, the menu kept taking that player's controller, so navigating
the dashboard also moved through the menu and could spawn from it; with
the debug overlay (which stops the game's input poll), the menu kept
acting on the last pad it had seen, a held direction scrolling on.

Now either overlay closes every open menu, on the input thread
(HandlePlayerInput) and before the menus act in a frame
(RenderPlayerMenus), whichever sees it first. What's held then stays
out of the game until released, as with B. A menu opened again starts
from the pad as it is: its press, a held direction and a held trigger
aren't actions until released (the weapon turn's edge is set as the
list's already was).

The kirklandsig fork has the debug overlay half of this (an open menu
acts on its last pad while the overlay is up); it has no dashboard.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* fix(spawn): read what's held at a menu's close from the next pad

A closing menu recorded what was held from the last pad it had seen:
the previous poll's when an overlay closed it on the input thread, and
on the render thread one poll old or more - a whole debug overlay's
worth, as the overlay stops the game's input polls. A trigger first
pulled in between wasn't recorded, so holding it through the close
fired, or threw a grenade, with no new press.

Closing now only marks the menu, and the first pad polled after it
(HandlePlayerInput) gives what's held: no input has reached the game
since the close, so that's everything held as it closed, plus at most
what was pressed in the same poll. Each is kept from the game until
released, as before.

The kirklandsig fork doesn't record inputs at a close (its gate holds
the whole pad while any button is down, and leaks triggers: the
previous fix).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* fix(spawn): only spawn from the catalog of the map that's loaded

The catalog was dropped when a new map loaded only once a menu asked
for a refresh, and the Spawn window asked at the end of its frame,
after reading the catalog and posting a pick. Its first frame after
another map of the same game had loaded (with the window hidden
meanwhile) could still list the last map's items and spawn one: the
reads checked the game, not the map, and the command, posted in the new
map, passed the scheduler's map check - a tag or palette index of the
last map's, so another object or character, or a tag the engine can't
take. Halo CE and Halo 2 had no map check on their commands at all.

- The catalog keeps the map load it was listed in, and Read, Size, Get
  and Spawn only use it in that map (Fresh).
- Catalog::Spawn takes the item's index and looks the item and the
  weapon up under one lock, then posts the catalog's map with the
  command; CmdSpawn drops a command from another map ("Not spawned: the
  map changed"), in every game.
- The Spawn window and the players' menus refresh before they read or
  pick anything in a frame.

The kirklandsig fork has this in its Spawn window (its players' menus
refresh before picking), and no map check on Halo CE and Halo 2
commands.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

* fix(spawn): find a local user's player through the game's own mapping

A spawn menu belongs to a local user - the controller slot MCC polls -
and every backend used that slot as an index into the players array,
which only holds while the game hands out players in slot order. With
any other mapping (a network co-op guest, a slot freed and refilled) a
spawn went in front of another player, or found no player at all. Each
backend now asks the game:
- Halo 3 and ODST: their player mapping, through its input user ->
  player getter (OFFSET_HALO3_PF_PLAYER_OF_INPUT_USER 0xEE0D4,
  OFFSET_HALO3ODST_PF_PLAYER_OF_INPUT_USER 0x108EA8, new, with
  patterns). The mapping lives behind thread-local slot +0x110 (ODST
  +0x108): input user -> player int[4] at +0x4, player -> input user at
  +0x74, set together at 0xEDF70 (0x108D44), output users (views) from
  +0xB4 - the count the split-screen player count reads.
- Halo CE: the same mapping, kept in its players globals
  (OFFSET_HALO1_PV_LOCAL_PLAYERS, already patterned): input user ->
  player at +0x4, set at 0xAE43FC with the unit at +0x14.
- Halo 2: its handle per local player (Players::Handle, players globals
  +0xC, written by user index at 0x69E53A), OFFSET_HALO2_PV_RESPAWN
  joining the spawning feature.
A user without a player spawns nothing, and each new offset is in the
feature that gates its game's spawning, so a build without it offers
none rather than falling back to the slot.

The kirklandsig fork has the same assumption in all four games.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@kirklandsig
kirklandsig deleted the upstream/06-anniversary branch November 20, 2026 16:25
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