Repository navigation
feat: split screen side by side in every game, plus 3-4 player fixes (Halo CE, 2, ODST, 4) - #40
Merged
megabitt01 merged 17 commits intoNov 17, 2026
Conversation
PreservingThunk.h, for the split-screen hooks that follow: - PreservingThunk / PreservedEntry: the detour of a small leaf function whose callers keep values in volatile registers across the call (Halo 3 keeps the screen height in r10 across its title-safe box function, Halo 4 an xmm register across its ultrawide helpers). The thunk saves every volatile register but rax and xmm0 around a C++ detour, which also gets the caller's return address. - MidFunctionThunk: the detour of a point inside a function, called with the function's stack pointer there (its locals), resuming through the hook's trampoline. EntrySet::on_remove runs a callback as a module's hooks are removed, for state that points into the module (a byte a hook patched, say). check_gates.py counts a PreservedEntry's target as gated, like the other Entry macros'. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
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 and Halo 2's view grid, windows and dividers, and whether Classic graphics are on screen; - the Gen3 games' screen size, player count, divider painter and render-target pool, and Halo 3 / ODST's HUD layout records; - each view's title-safe box (Halo 3, ODST, Halo 4); - Halo 4's HUD layout picker, its ultrawide UI helpers and the first-person camera's aspect divide; - where Halo CE and Halo 2 take a mission's game options. COVER pins down the whole divss the Halo 4 gun fix patches; COVER_BEFORE starts the Halo CE scope hook's pattern 0x45 bytes earlier, over the locals its detour rewrites. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
src/mcc/splitscreen/LeftRight takes XiaoDanny's saved layout choice (SplitscreenConfigStore's TwoPlayerLayout) to the other games. It does what his Reach port showed the layout takes - the table's regions, the black bars, the half-screen render target and the HUD's shape - for the Gen3 games, which share Reach's table and render-target pool (each says where those live in a LeftRight::Gen3), and keeps the choice for Halo CE and Halo 2, which take it as a mission starts. Reach keeps its own implementation. - Active() is the choice with 2 or 3 players on screen. Reach's own gate (LeftRightAvailable: every Reach hook that draws it) stays on Reach's paths, so it doesn't hold the other games back. - Choose() saves the choice and puts it on screen in whichever game is running, re-applying Reach's enabled patches over the stock entries on Top / Bottom. - The store makes LayoutEntry public and gives each slot's Left/Right region (LeftRightRegion). Load() now runs as any game module loads: the render targets are built for the saved choice. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Halo 3's Left/Right split screen (LeftRight::Gen3): - before each frame the table's 2- and 3-player entries are kept on the Left/Right regions; going back to Top / Bottom puts the entries they replaced back, black-bar patches included; - the divider painter draws a band down the middle (and one across the right half for 3 players) instead of the black bars; - the variant-3 render target, the full-height halves' surface, is made half the screen wide and full height, from the pool's descriptor and only when that reproduces the pool's own size; a live switch rebuilds the pool with the engine's own release/init pair; - a full-height half's HUD takes the quarter layout with its canvas as tall as the view, so the motion tracker sits at the bottom. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
ODST's Left/Right split screen, as Halo 3's (LeftRight::Gen3). ODST never shipped four-player split screen: its quarter HUD layouts carry only the ammo panel - no compass, health or grenades. Quarters and full-height halves use the full-screen layouts instead (Gen3::whole_quarter_hud), in both layouts: with Top / Bottom too, for 3-4 players. CModule now installs ODST's hooks. render.cpp's render hook did nothing, and its target is the split-screen render hook's, so it goes. This also installs ODST's existing engine and world hooks (native info, task queue), as Halo 3's are. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Halo 4's Left/Right split screen, as Halo 3's (LeftRight::Gen3), through Halo 4's own places: its bar painter sets up the render state before drawing, and it sizes a pool target's view variant in a helper, which is asked again for the unshrunk size of the halves' surface. Halo 4 lays each view's HUD out from the view's table variant, the full-height halves (3) taking the two-player layout, as wide as a top/bottom half: in a Left/Right half the weapon panel ran off the right edge. The halves take the quarter layout, exactly their width. The split-screen hooks get an entry set of their own (Halo4SplitscreenEntrySet), which CModule installs; the old Halo 4 hooks (engine, render, world) stay off. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
A full-height half is 960x1080 for the quarter layout's 640x360 HUD units, and the layout sits in the view's corner, so the HUD kept to the top half of the view with the motion tracker at mid-height. Halo 4 already fits its 1280x720 layout to screens of another shape (ultrawide) through four helpers - wider or not, the aspect over 16:9's, the extra width or height either side. While a half's HUD is updated or drawn they now answer for that view and its layout (leaves whose callers keep values in registers: PreservingThunk), the half's edge-anchored elements follow its edges, and the crosshair group is moved back to the view's centre. Every other view (Top / Bottom, quarters) gets the game's own answers, as before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
0x34EC44 builds the first-person camera from the view's: its field of view times the screen's aspect over the view's (mulss / divss at 0x34ED92 / 0x34ED96). Stock split-screen views are wider than tall, and that keeps the gun's framing; a 960x1080 Left/Right half doubled it, so both arms and the whole gun came into frame, drawn big. While Left/Right is on screen the divide's register byte is switched (divss xmm5, xmm0 -> xmm1, the screen's aspect: E8 -> E9 at 0x34ED99), so the gun is framed like the world, as Halo 3 and Reach draw it. It is switched in the render hook before each frame, on the thread that draws it, put back otherwise, and put back as the module unloads (EntrySet::on_remove). CPatch::apply now flushes the instruction cache after a write, since the bytes may be code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
A Halo 4 campaign mission that starts with players 3-4 stays black in every view, but the engine brings late joiners in beside a teammate, like a controller signing in mid-game. get_xbox_user_id now reports two local players in Halo 4 until 3 s after the game state goes Running, then all of them. The clock is cleared at the end of each session (game_restart, which MCC runs after the exit states): dropping players while the engine shuts down can hang it, and the next session asks for its players before its own loading state. The log says "Splitscreen: exposing N local players" whenever the count changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
…s or side by side Halo CE's and Halo 2's Anniversary renderers only ever draw two views, stacked: with 3-4 players the others were missing, and side by side is a Classic layout. Bit 0 of the first game-options byte selects Anniversary visuals in both engines. As a mission starts (Halo CE's game_start, Halo 2's copy_game_options) ClassicGraphicsScope clears it while the engine copies the options, so MCC's own setting is left alone, and tells LeftRight whether the mission runs side by side - which Halo CE and Halo 2 take only there. Back still switches to Anniversary graphics in the middle of a mission. CModule now installs Halo CE's hooks; its render hook did nothing, so it goes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Halo CE lays its views out on a grid that always grows by rows first: two players get it turned into two columns; with three, player 1's window is built as a two-player half and players 2 and 3's as the right quarters of the four-player grid. The divider painter draws a band down the middle (and one across the right half for 3) instead of across the screen. A zoomed view's scope effect (pistol, sniper) re-samples the view's part of the screen with factors MCC works out for the stock grid - how many views the screen is wide and tall, and the view's place in them - which put a side-by-side player's zoomed view in the wrong part of the screen, squeezed. A mid-function hook (MidFunctionThunk) sets the same factors from the view's own window; for the stock layouts they come out as MCC's. Side by side is Classic's layout: while Anniversary graphics are on screen (Back) the game's own layout is used. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Halo 2 lays its views out on a grid it grows by rows or by columns, by a mode MCC's build always passes as 1 (rows: Top / Bottom); any other mode grows columns first, and with three players gives player 1 the full-height left half. While side by side is on screen the grid and cell calls get mode 2, and so does the divider painter, which reads the frame's mode from a global and already has a side-by-side branch. Side by side is Classic's layout: while Anniversary graphics are on screen (Back) the game's own layout is used. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Halo 3, ODST, Halo 4 and Reach clip every split-screen view by the whole screen's title-safe box (5% in from each edge). A view's HUD is laid out in that box and its crosshair and aim sit at its centre, so they were pulled toward the middle of the screen: 48 px in a 1080p quarter, and onto the seam of a screen spanning two monitors. Each view now gets its own box, the same size, 5% in from its own edges (LeftRight::ViewSafeBox), with 2-4 players in both layouts; a lone view keeps the game's box. - Halo 3 / ODST: the view setup asks a leaf for the screen's box and clips the view by it. The leaf answers the view setup's call (by its return address, inside a ViewSetup scope) with the view's own box. The view setup keeps the screen height in r10 across that call, hence PreservedEntry. - Halo 4 / Reach: a leaf works a view and its box out together (LeftRight::ViewportRect); the box is replaced after it. Reach's is haloreach/view_safe.cpp, beside XiaoDanny's hooks. - Halo 3 / ODST also clamp each HUD frame to a share of the whole screen (the HUD layout record's safe frame), which trimmed a quarter on its outer sides only and sat its HUD ~34 px toward the middle. Split views get a copy of the record with it zeroed, which the game skips. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Dev Tools' "Two-player layout" combo sat in Reach's tab and set Reach's table only. It moves above the game tabs as "Split-screen layout" and goes through LeftRight::Choose: saved as before, switched at once in Halo 3, ODST, Halo 4 and Reach, and at the next mission start in Halo CE and Halo 2. Going back to Top / Bottom still re-applies Reach's enabled black-bar patches over the stock entries. Halo 3, ODST and Halo 4's black-bar checkboxes are disabled while Left / Right is chosen, as Reach's are: Left / Right owns the same table entries and puts back the ones it found when Top / Bottom returns, so a patch toggled meanwhile would be undone. docs/REVERSE_ENGINEERING.md names the combo's new place, and LeftRight::Active as the other games' active-layout check. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Halo 4's Left/Right hooks and its HUD fit (hud_fit.cpp) were separate features: on an MCC update where one of the fit's offsets is missing, the table, targets and quarter HUD layout still went to Left/Right while the HUD kept to the top half of each view, the motion tracker at mid-height. A feature can now require another (Feature::Requires, Offset.h): Halo 4's Left/Right feature requires the HUD fit's, so without it none of its hooks go in and Halo 4 keeps its stock split. No change on 1.3528. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Compute gave a Left/Right half either extra width or extra height, by which side of the layout's aspect the half was on. Halo 4's UI root translation adds both (ExtraWidth at 0x3D61EB, ExtraHeight at 0x3D61FF, independently), and a half of a screen wider than 16:9 has room either side of its layout as well as above and below it: at 32:9 a half is 1280x720 HUD units for the quarter layout's 640x360, which wants 320 each side and 180 above and below, not 180 alone. Each extra is now its own axis's. On 16:9 the half is exactly the layout's width, so nothing changes there; not tried on an ultrawide screen. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
Giving a Left/Right half both extras centres its HUD on a screen wider than 16:9 through the UI's root translation, which adds both (0x3D61EB, 0x3D61FF) - but the world-marker projection (0x3F2783-0x3F27C5) cancels only the extra that Wide() picks, so nametags and waypoints would land 320 HUD units off at 32:9 (and 160 with the bars removed at 4:3). Back to one extra until that path cancels the other axis too: on screens wider than 16:9 a half's HUD stays uncentred horizontally, as before. Nothing changes at 16:9 either way. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPJBucDk2kQ8oms9Kf7NLs
JCorcho
pushed a commit
to JCorcho/AlphaRing
that referenced
this pull request
Nov 3, 2026
…phics; campaign color note The Anniversary renderers of Halo CE and Halo 2 draw two views only: with three players, player 2's view filled the bottom half and player 3 had none (both HUDs over it). From kirklandsig's upstream PR megabitt01#40, without its side-by-side layout: a mission with 3-4 players can start in Classic graphics, where every view is laid out - bit 0 of the first game-options byte, cleared only while the engine copies the options (Halo 2's copy_game_options, Halo CE's game_start; offsets and patterns from the PR). Off by default: F1 -> Splitscreen -> Options. Halo CE's hook set is now installed (its render hook did nothing and goes). README: Halo 2's campaign never shows player colors. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gt378zyZWqKFkyBtAuBoBn
This was referenced Nov 19, 2026
41 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split screen, PR 5 of the series: side by side (Left / Right) in every game, not only Reach, plus the fixes 3 and 4 players need in Halo CE, Halo 2, ODST and Halo 4. It builds on XiaoDanny's saved layout choice from his Reach port, and on #38's offsets: every new address is a
DefOffsetwith byte patterns, and each game's hooks are grouped into features, so a build where something is missing keeps that game's stock split.What players get
get_xbox_user_idnow reports two local players until 3 s after the game state goes Running, and then the engine brings the others in beside a teammate, as it does with a controller signing in mid-game.How it works
mcc/splitscreen/LeftRight,entry/<game>/splitscreen.cpp). They share Reach's split-screen table and render-target pool, so it's what XiaoDanny's Reach port does:halo4/hud_fit.cpp). Halo 4's four helpers that fit its layout to other screen shapes answer for each half, so the half's HUD follows its edges and the crosshair stays centred.Changes to existing code
CModulenow installs entry sets for Halo CE, ODST and Halo 4 (they werenullptr):Halo4SplitscreenEntrySet); its old engine, render and world hooks stay off.SplitscreenConfigStore::Load()runs as any game module loads, not only Reach, so the render targets are built for the saved choice.PreservingThunk.h(PreservedEntry,MidFunctionThunk) for detours of small leaves whose callers keep values in volatile registers, and of points inside a function.EntrySet::on_remove, to undo a byte a hook patched as the module unloads.Feature::Requires: Halo 4's Left / Right needs its HUD fit, so without the fit none of it goes in.CPatch::applynow flushes the instruction cache after a write, since the bytes may be code.Known limits
Testing (MCC 1.3528, Steam under Proton on Batocera, with virtual pads; not on Windows)
master-chief(3c5520b, after feat: offsets that survive MCC updates (byte patterns, per-feature gating, tools, CI) #38 and fix: Halo 3 and ODST split screen - bodies stay drawn when they pile up #39).check_gates.pypasses. The rebase brought no line changes, only context.Doesn't depend on any open PR. PR 6 (Anniversary graphics with 3-4 players) and PR 7 (per-player HUD) build on this one.
🤖 Generated with Claude Code