Skip to content

Add optional save and indexed cache seeds to Mac app builds - #555

Closed
victorwads wants to merge 3 commits into
LNPANDY:mainfrom
victorwads:feature/offline-save-cache-import
Closed

victorwads wants to merge 3 commits into
LNPANDY:mainfrom
victorwads:feature/offline-save-cache-import

Conversation

@victorwads

@victorwads victorwads commented Nov 3, 2026 •

Copy link
Copy Markdown

Fix or feature

  • Fix
  • Feature

Related: #553. Target milestone: v1.2.0; seed design remains subject to maintainer review.

What and why

Adds Save and offline data (optional) to the Mac build page, with separate Initial save and Indexed cache storage folder selectors. This packages an initial data seed, not a Switch installer or a downloader. No DBI, game-specific assets, account credentials or unlock logic are included.

How to use

  1. Select the base game, matching update and optional DLCs as usual. Choose This Mac.

  2. Optionally choose an Initial save folder. Select the extracted save contents (the folder directly holding the game's save files), not an NSP, encrypted console save container or an entire backup-tool directory.

  3. Optionally choose Indexed cache storage. Select the parent folder directly containing indexed directories such as:

    Cache Data/
      SD_Cache.0000/
      SD_Cache.0001/
    

    The equivalent names temp_cache0 and temp_cache1 are accepted. Indices are normalized; duplicate indices, symbolic links and out-of-range indices are rejected.

  4. Check the selected paths and file-size summary, then build. Empty selections retain the normal build behavior. Save-only and cache-only imports are supported.

  5. The new app carries the seed. On first launch it copies the data into separate writable storage under ~/Library/Application Support/nxnative/offline/<bundle identifier>/. Later launches reuse that storage and preserve progress; rebuilding does not overwrite an existing imported save. Cloud synchronization follows the existing launcher/environment choice; import no longer forces it off. Sharing or exporting the app shares its embedded save and offline data: do not distribute private saves.

Use your own extracted backup. Check free space both for the app seed and the writable first-launch copy; large caches can require tens of GB. Keep the source backup until you have verified the game. This is not a merge/import-over-existing-save tool, and there is no automatic overwrite of your normal save.

When is it useful?

  • Starting a Mac build from an existing compatible save rather than a fresh profile.
  • Carrying locally backed-up downloadable/cache content alongside a game whose runtime reads Horizon cache storage.
  • Reproducing a loading/content issue with a specific save and cache set while keeping normal saves separate.

It is not for installing NSP updates/DLCs into cache folders, supplying DBI, downloading missing songs, bypassing authentication/subscriptions/ownership, or making online-only features work without their services. A valid folder layout does not establish version compatibility or content completeness.

Which games can use it?

The packaging mechanism is generic, but runtime support is game-dependent: save formats, title/update version, cache indices, filesystem APIs, codecs and services must match. No supported-games list is implied.

Observed local example: Just Dance, title ID 0100BEE017FC0000, update v983040 / display 25.0.3. A manually integrated candidate mounted nine cache indices and read OfflineSaveNx.txt; the user reports that A Queda played normally and that language was changed through the in-game menu. This is one user-reported playback result, not full-catalog, motion-scoring, account or network-independent validation. The supplied catalog identifies itself as a third-party mod, so official-cache compatibility is not inferred.

Other games: compatible save seeds may be useful, and games using indexed cache storage may benefit, but no additional title has been validated through this feature. Do not treat building an app as proof of gameplay support.

Maintainer-requested changes (head 03d3fb1)

  • Rebased on current main, preserving the current Mac output finalizer and progress-first build layout.
  • All six language catalogs, translated validation/file summary and shared-save privacy notice.
  • Preserve engine-produced signing identity/metadata; honor cloud-sync choice; publish library marker.
  • Cancel large seed files between 1 MB chunks; track and stop signer process groups, including startup race.
  • Model tests cover finishOfflineApp success, signer failure and Stop with state cleanup.

Checked

  • Required pre-push checks passed for the published branch: patch queue, Qt/tool/triage suites, swift build and swift test. Mac app target: 923 tests, 34 skipped, zero failures.
  • Synthetic tests cover folder validation, cache normalization, staging, cancellation, unsafe identifiers, portable first-run initialization and repeated-launch save preservation.
  • Native English before/after screenshots below use synthetic paths only. Screenshot scope is English only as requested by the contributor; localization catalogs are still included/tested.
  • No real-game end-to-end build through the generic new UI is claimed. The Just Dance example used a manually integrated local candidate. AI-assisted implementation.

Review follow-up and remaining limits

  • Engine cache API companion: Support cache storage limits and existing indexed directories seedds/nxnative#1053 (issue LiveContainer unable to select game data and cloud save #1049). This UI alone does not fix that SDK crash.
  • Cached provisional update selection: Reject stale provisional profiles instead of silently ignoring updates seedds/nxnative#1055; not fixed by this UI PR.
  • Source mutation between inspection/copy and large-copy progress still need review before ready status. Picker inventory now runs on a background queue with an activity indicator and a request token that discards stale results after a newer selection or Clear. No automated UI-race or large-tree performance measurement is claimed. The private copied seed is now revalidated before publication, rejecting symlinks inserted after inventory; consistency of ordinary files changed during copying is not guaranteed.
  • Signing hardening is now published: preparation/signing use a separate app candidate; only verified output replaces the build, retaining a backup only for recovery on failure; successful publication removes it. A synthetic signer that partially mutates the candidate then fails cannot change the original app. Full Swift suite and required pre-push checks passed again. Publication recovery now restores a displaced backup only when the original path is absent. Failure-injection tests verify restoration and preservation of an unexpected concurrent destination, the retained backup and candidate. This is bounded recovery, not a crash-proof atomic transaction.

Screenshots

English Save and offline data interface, before and after. Uploaded through the user-owned fork because upstream attachment upload requires write permission.

Before: Mac build page without offline data selectors
After: Initial save and indexed cache storage selectors

Scope

@victorwads

Copy link
Copy Markdown
Author

Engine companion is now open as draft: seedds/nxnative#1053. It implements cache capacity from packaged application metadata and enumerates existing indexed cache directories, with native and Mac packing tests. Both PRs explicitly list remaining review limits; cached provisional update selection still needs its own fix.

@victorwads

Copy link
Copy Markdown
Author

The separate stale provisional update-selection safeguard is open as seedds/nxnative#1055: selects from actual inputs and rejects a stale profile with an actionable --profile-out message instead of silently packing an older base. Its full NSP group (241 tests) and pinned lint ratchet passed locally; remote Python lint passed, other engine jobs are queued. Cache support remains draft seedds/nxnative#1053.

@v0lumehi

v0lumehi commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks. I put this in v1.1.1 with #553. As for every outside feature, one maintainer tries the app that CI built and reviews the code. It is a large change (13 files), so it may take a while.

@victorwads
victorwads force-pushed the feature/offline-save-cache-import branch 2 times, most recently from d3d803b to 428571b Compare November 3, 2026 16:07
@victorwads

Copy link
Copy Markdown
Author

Maintenance update: rebased onto current upstream main and squashed to one commit, preserving both shell-move and offline-preparation cancellation paths. Added partial-copy failure cleanup: a failed app copy is now inside the candidate transaction cleanup; the regression injects out-of-space after creating partial output, verifies original preservation and candidate removal. Full pre-push checks passed without bypass: Swift suite 718 tests / 24 skipped / zero failures, plus Qt/tool checks and interaction budgets. Current head 428571b. Remaining concerns from the PR description (source mutation during copy, large-copy progress/picker cost and final-publication recovery) are still open; this is not a claim that those are fixed or that generic real-game UI import was validated. The current reported GitHub checks only include label success; local validation is not being represented as completed remote CI.

@victorwads
victorwads force-pushed the feature/offline-save-cache-import branch from 428571b to 15b782f Compare November 3, 2026 16:14
@victorwads

Copy link
Copy Markdown
Author

The current rebased head 15b782f passed all mandatory local pre-push checks. GitHub Actions tests (run 41672074314) and macOS app build (run 41672074155) both conclude action_required before tests execute. Could a repository maintainer inspect/approve those workflow runs if appropriate? I have read-only permissions on this upstream, so cannot authorize them. I will not treat the successful label check as full CI approval or bypass repository workflow policy. Remaining design/safety limitations are still documented in the PR body.

@victorwads
victorwads force-pushed the feature/offline-save-cache-import branch 7 times, most recently from 86c7f2f to 667112a Compare November 3, 2026 17:17
@victorwads

Copy link
Copy Markdown
Author

Local validation blocker isolated: the minimal pair LauncherControlWidthTests.testEveryRowControlOnTheRealPagesFitsInEveryLanguage followed by LibraryTests.testCompletedBuildAppearsAutomaticallyInCollection hangs on BOTH this branch and a clean detached upstream 8e1a26f checkout. The library test/class passes alone. macOS sample on pristine upstream reports Dispatch Thread Soft Limit: 70 reached, many AppKit NSAnimation _runBlocking workers, and main waiting in SystemProcessRunner.capture at ProcessRunner.swift:132 via Toolchain.dotnetRoot (LibraryTests.swift:617). A dedicated stderr-thread experiment moved the wait to build completion at line 624 but did not fix the full flow; it was reverted, as were unsuccessful window/spinner teardown experiments. No hooks were bypassed. Remote remains 667112a; the current-main rebase plus inventory-cancellation improvement are retained locally but unpublished until required validation passes. The independent GitHub workflow authorization barrier also remains. This documents a locally reproduced upstream/test-environment issue, not a claim about all machines or CI runners.

@v0lumehi

v0lumehi commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks @victorwads, I read the change in full. I move it from v1.1.1 to v1.2.0, and here is why.

Why not for v1.1.1. The cache half cannot work without seedds/nxnative#1053, and the PR says so itself. It changes how every Mac build with a chosen folder ends, it re-signs the app and it puts saves in a new place. That is a lot for a release candidate with no run on a real game yet. Before it can merge, @LNPANDY and I also need to agree how the launcher handles seeds of saves and caches at all. That is a decision about behaviour of the launcher, so it belongs in #553 first.

What I would change.

  • de.json holds French text for all ten offline.* rows, and it.json and sv.json have none. The project has six languages.
  • OfflineData.swift (ValidationError.errorDescription) and OfflineDataView.swift ("\(files) files, ") have English text in code.
  • replaceItemAt(..., .withoutDeletingBackupItem) leaves <App>.app.before-offline-<UUID> beside the app for good, a second copy of several GB. Nothing cleans it and no text says it.
  • The seed copies the player's saves into the app. A player who shares or exports the app shares the saves. A line in the UI should say so.
  • codesign --force --deep --sign - replaces a signature that --mac-sign set.
  • DM_SAVE_SYNC=0 is fixed in the launcher script, so it turns off the player's cloud saves setting without a choice.
  • The Mac build's marker file .nx2apple-library is not written in the new branch. The saves then do not follow the library folder.
  • A cancel shows an error text and does not stop the copy or codesign.
  • No test for finishOfflineApp or for cancel.

About the hang. LauncherControlWidthTests and then LibraryTests are not in your diff. If they hang on a clean checkout, that is a problem of main and I would like an issue for it with the macOS sample you took.

I do not approve the CI runs for now, because the PR is not going into the release candidate and the head changed between the comments. Please tell me when your branch is final.

@v0lumehi v0lumehi modified the milestones: v1.1.1, v1.2.0 Nov 4, 2026
@v0lumehi v0lumehi added the enhancement New feature or request label Nov 5, 2026
@v0lumehi v0lumehi modified the milestones: v1.3.0, v1.4.0 Nov 7, 2026
@v0lumehi

v0lumehi commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@victorwads thanks for the work. This branch conflicts with main. Please rebase onto main. The list from my Nov 4 comment is still open: the six language files, English text in code, the leftover .before-offline copy, the UI note about shared saves, the codesign and DM_SAVE_SYNC points, the library marker, cancel, and tests for finishOfflineApp and cancel.

@LNPANDY and I still need to agree on the seed behavior in #553. The cache part also needs seedds/nxnative#1053 merged. Please open an issue for the test hang in LauncherControlWidthTests and LibraryTests with your macOS sample.

@victorwads
victorwads force-pushed the feature/offline-save-cache-import branch from 667112a to 03d3fb1 Compare November 9, 2026 15:09
@victorwads

Copy link
Copy Markdown
Author

Review update: rebased onto current main and pushed head 03d3fb1. Mandatory hooks passed without bypass, including 923 Swift tests / 34 skipped / zero failures plus patch queue, Qt, tools and iOS shell checks. Changes address six-language coverage (including correcting German), localized validation/summary, explicit shared-app save privacy notice, removal of rollback copy after successful publication, preservation of the produced app signing identity and metadata, no forced DM_SAVE_SYNC override, .nx2apple-library marker on success, chunk-level copy cancellation and tracked signer cancellation (including startup race). Added finishOfflineApp model tests for success, signer failure and Stop, asserting state cleanup. Remaining work before claiming review complete: updated English screenshots/docs, separate historical test-hang issue with actual sample, and engine companion validation including the requested TotK run. The old contaminated default Swift cache was preserved and rebuilt rather than bypassing hooks. Remote label status is not being represented as full CI.

@victorwads

Copy link
Copy Markdown
Author

The requested separate historical hang report is #1054. It includes exact macOS sample excerpts recovered from diagnostic history; the original temporary full sample is no longer present, explicitly disclosed rather than reconstructed. It is not claimed reproducible on current main: the rebased branch passed the full hook suite. The English after screenshot and PR usage/privacy/cloud-sync documentation are updated. No game data or private save content is in the screenshot.

@victorwads

Copy link
Copy Markdown
Author

One final cancellation presentation correction is published in ab5d759: Stop now displays the normal localized stopped status, not an offline import error. The finishOfflineApp Stop model test asserts that status. Mandatory pre-push checks passed again without bypass. The review-response branch is now ready for your next review/CI authorization; #1054 contains the requested historical sample excerpts and is cross-linked to the existing closed #854 timeout report. Engine #1053 has also been rebased and is mergeable; requested TotK runtime validation remains explicitly outstanding.

@v0lumehi

v0lumehi commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Thank you for the implementation, tests and time you put into this.

We have decided not to embed save and indexed offline-cache seeds into generated applications. That creates an additional packaging and first-run storage lifecycle, with duplication, provenance and compatibility concerns. Explicit save import/export with backups remains the chosen workflow. The selected-update correctness problem in #553 is separate and remains in scope.

This is a product-scope decision, not a judgment on the effort behind the contribution. We are closing it rather than keeping it in a waiting state.

@v0lumehi v0lumehi closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request launcher The NX2Apple launcher app windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants