Repository navigation
nvn: repair MGS4 rendering, launch handoff and FMV audio - #2665
Open
cosmin-cucu wants to merge 6 commits into
Open
cosmin-cucu wants to merge 6 commits into
cosmin-cucu wants to merge 6 commits into
Conversation
Recognize the validated VPAK header and reuse the existing adjacent code/control reader. Scan length-prefixed records in main without accepting unrelated unprefixed bytes. Found on MGS4: the audited set contains 998 unique shaders, including movie shaders missing from the aligned scan.
Return the always-open local user once after a valid previous-program handoff, preserving HOME fallback, capacity handling and invalid-handle validation. MGS4 consumes the inherited handle directly after collection launch.
Do not reject a valid draw because its declared stream limit extends beyond the memory pool. Track safe fetch spans, revalidate cached bindings for larger spans, and follow fully covering ordered index uploads to unchanged CPU sources. Preserve conservative handling of unknown GPU writes and sparse aliases.
Metal does not restart triangle lists at the game's separator indices. Expand complete triangles between separators into one indexed draw, preserving base vertex, instancing and continuous primitive IDs. Use verified upload sources or synchronize unknown GPU-written indices before reading.
Bink primes stopped voices across several updates before starting them together. Synchronous catch-up renders released those buffers too early and left movies silent. Retain effect capacity from open and only apply the effect-initialization safeguard to renderers that can have effects.
cosmin-cucu
force-pushed
the
fix/mgs4-runtime-repairs
branch
from
November 14, 2026 10:59
70f4606 to
bdd62ce
Compare
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.
What and why
MGS4 could not complete the collection-to-game handoff, then lost HUD/character/particle draws, joined unrelated triangles into cyan streaks, and played FMVs without sound. This PR collects the five repairs found during that bring-up, each in its own commit, plus a test-fixture follow-up:
Findings are recorded in shaders, services, rendering, and audio.
The game's provisional profiles, launch configuration, English text overlay, engine FPS setting, pipeline cache and MetalFX configuration are local and are not part of this PR. No game assets are included.
Checked
python -m unittest discover -s dm/tools/tests -p 'test_split_*.py': 89 tests passed, including five synthetic VPAK/embedded-record tests.make -C dm/host/tests GAME=0100D0B01C4F4002 account audren-work audren-layout: passed. Includes handoff/capacity/repeated-pop/invalid-handle checks, twenty rapid zero-effect updates, and SDK 4/5/6/16/21 audio layouts.git diff --checkpassed.make -k -C dm/gfx/tests GAME=0100D0B01C4F4002 run. Three fixtures (t_render_counter_overlap,t_render_enable_queue,t_wait_event) initially faulted on tracked upload pages. They now install the production dirty-page fault handler, as doest_mdx_prescan; all affected targets passed when rerun. All other suite targets passed in the complete run. Final reruns: prescan six cases, counter overlap 37 checks in both modes, render enable 62 checks in both modes, event wait 106 checks. No product source changed after the full run.Manual play on the tested pre-rebase build: MGS4 program
0100D0B01C4F4002, update v393216 / 1.4.4; collection program0100D0B01C4F4000successfully handed off to it. Practice scene and opening story/FMVs were exercised over repeated diagnostic runs. The player confirmed intact limbs, correct grenade/RPG explosions, disappearance of cyan streaks, and audible FMV sound. Later street gameplay had correct geometry. With separate local configuration changes, the player also confirmed normal-speed, smooth 60 fps gameplay at docked 1080p with MetalFX spatial upscaling to 1440p. Those FPS/resolution settings are not a source-code performance claim. Full progression and save/load progression were not exercised.After rebasing onto
4b10c73ffb26, the checks above were rerun. The rebase retained upstream's new sparse-texture helpers and only reconciled a relocated forward declaration. Gameplay was not repeated on the rebased build.Static regression against current main (
4b10c73ffb26), candidate081a0e80fa02(before the test-only fault-handler follow-up),scripts/regress.py check --no-smoke:0100D0B01C4F40000100D0B01C4F40010100D0B01C4F40020100D0B01C4F4003Only these four local collection programs were available; this is static shader validation, not four-game gameplay coverage. No smoke routes were available for the provisional profiles. Impact analysis also identifies BOTW, Pokémon Scarlet and TOTK, plus broad shared-host exposure; those games were not available for regression play. Other games using zero-effect audio renderers, iOS, database/flashback gameplay, return-to-launcher and cloud save synchronization remain unverified. Copy-source protection can introduce CPU write faults; long-session frame pacing remains unmeasured.
Docs
dm/tools/docs_symptoms.pywas run.