Skip to content

Engine fixes in vendored files are reverted by the next sync #29

Closed

Description

@v0lumehi

While working on the Mac launcher (#27, #28) I read scripts/sync_upstream.py to make sure my changes survive a sync, and found something that affects engine fixes merged here in general. Sharing it as a suggestion; it's your call how the fork should work.

What the sync does with engine files

The sync takes the vendored paths (dm/, scripts/, docs/, AGENTS.md, ref/) from upstream file by file. Two kinds of files keep the fork's changes:

  • the fork's own files (OURS: the RomFS archive layer, the BC decoder), and
  • the nine patch carriers (PATCHED), whose patchers re-apply the fork's changes; the patcher-drift check fails when a carrier was edited without its patcher.

Any other engine file is simply replaced by upstream's version the next time upstream changes it. A fix merged here into such a file is then gone, without a warning.

An example

#26 added CreateWithAdjustableSystemClock to dm/host/hle_time.c (and a test in dm/host/tests/t_time.c). Upstream doesn't have it (seedds/nxnative has no AdjustableSystemClock), and neither file is in OURS or PATCHED. The next time seedds touches hle_time.c, the sync will drop the fix, and what needed it breaks again.

My own #27 had the same problem: it changed settings.py, pack_app.py, build_ipa_from_nsp.py and shader_split.py. Carried here, the last two would have failed the drift check (or been reverted). I took those parts out of #27 and proposed them upstream instead (seedds/nxnative#352). #27 now touches no file under dm/, docs/ or scripts/.

Suggestion

Keep the fork's own layer to what it adds around the engine (the GUIs, the packaging and releases, the RomFS archive), and send engine fixes upstream first, so they come back with the sync. For a fix upstream doesn't take, the existing PATCHED mechanism is the safe place, with a patcher, so the drift check guards it.

A small CI check could make this automatic: fail a PR that edits a vendored file outside OURS and without a patcher entry, with a note to send the change upstream or add a patcher. That would have caught #26 and my #27.

I know upstream closes many PRs, so this isn't always easy. Happy to help, e.g. by porting #26 upstream.

Activity

  1. LNPANDY commented on Oct 27, 2026

    @LNPANDY
    Owner

    Confirmed and fixed — and thank you for reading the sync script closely enough to find this. It is the most useful kind of issue report: one that improves the mechanism rather than one instance of it.

    The confirmation: you are exactly right. hle_time.c and its test were in neither OURS nor PATCHED, so the next time seedds touched hle_time.c, the sync would have replaced the files and dropped the adjustable-clock entry — and nothing would have warned about it. The patcher-drift check only guards carriers, by design.

    Both parts of your suggestion are in (bcb2e0ea):

    1. hle_time.c and t_time.c joined OURS, with a comment saying why they are fork-only and that they leave the list if upstream takes the change. The fix is protected now, and the exit path is explicit.
    2. A pr-scope workflow fails a PR that edits a vendored file outside OURS/PATCHED and outside the fork-only paths (frontend/, frontend-qt/, .github/workflows/), with the at-risk file list and the two ways out written into the error. It reads OURS and PATCHED from sync_upstream.py itself rather than a copy, so the check cannot drift from the lists it enforces — the failure mode you found came from exactly that kind of drift between what a contributor assumes and what the sync does.

    On your framing, one refinement I would push back on gently: "keep the fork's layer to what it adds around the engine" is the right default, but not an absolute rule. Some engine fixes land here first because a game needs them and the upstream queue is long — the iOS-specific pieces (hle_profile.h's DM_PROFILE, the iOS boot paths) are fork-shaped by nature and may never belong upstream. The rule I would write instead: every engine change needs a home that survives the sync — upstream, OURS, or a carrier patcher — and the PR-scope check now enforces that at the door. Your three categories are exactly the choices.

    On porting #26 upstream: yes please — that is the cleanest end state, and once seedds merges it I will remove both files from OURS so the fix comes back with the sync instead of being held here. If it stalls, the OURS entry is the durable home and nothing breaks either way.

    The workflow will run on the next PR that touches dm/ or scripts/; if it misfires on a legitimate case, I would rather see that here than discover a silent revert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions