Repository navigation
shader_split: read encrypted legacy Unreal paks with the key from main - #1646
Closed
Haseenesss wants to merge 1 commit into
Closed
Haseenesss wants to merge 1 commit into
Haseenesss wants to merge 1 commit into
Conversation
Little Nightmares II keeps its shaders inline in the cooked packages of Helios-Switch.pak, a version 8 pak whose index and entries are AES-encrypted. ue_legacy_jobs opened it without a key, so the index did not parse, the pak was left out, and the shader split found no shaders. ue_legacy_jobs now looks for the key in the game's mains (base and update) with uepak.find_key when the footer says the index is encrypted, and passes it with each job, so ue_legacy_shaders decrypts the entries too. A key found once is tried first on the next pak. With no key in main the pak is reported in red and skipped, as before. The rebuilt game finds 20,170 shaders and reaches the title screen on the Mac, where it plays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 of 6 tasks
thehobbit85
pushed a commit
to LNPANDY/NX2Apple
that referenced
this pull request
Nov 7, 2026
Little Nightmares II keeps its shaders inline in an encrypted version 8 pak, and the shader split found none. Patch 0089 makes ue_legacy_jobs take the key from main, as the paks with shader code archives already do. Forwarded as seedds/nxnative#1646. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
seedds
added a commit
that referenced
this pull request
Nov 7, 2026
… encrypted, with the key from main: Little Nightmares II's shaders are found (PR #1646) Little Nightmares II keeps its shaders inline in the cooked packages of Helios-Switch.pak, a version 8 pak whose index and entries are AES-encrypted. ue_legacy_jobs opened legacy paks without a key, so the split said the pak cannot be read and found no shaders. uepak.Keys is now the one key finder for a game's paks: no key for a pak whose index is in the clear, else the key find_key finds in the first main (base game, then update) that opens it; each main is loaded once, and a key found is tried first on the next pak. ue_legacy_jobs passes the key with each job, so ue_legacy_shaders decrypts the entries too; uepak.job (the shader code archives) and uepak.py list use it in place of their own lookups. find_key tries the known keys before code_keys, which reads all of main's code. Little Nightmares II (1.4): 20,170 shaders from 57 files; it reaches the title screen and plays on the Mac. OCTOPATH TRAVELER 0's uepak.job output is byte-identical to before. Co-authored-by: Haseenesss <18624035+Haseenesss@users.noreply.github.com>
1 task done
Owner
|
Landed as 050580d with you credited as co-author. Thanks for the clear diagnosis and the tests. Changes on top of yours:
OCTOPATH TRAVELER 0's |
gnosticgeek
pushed a commit
to gnosticgeek/nxforge
that referenced
this pull request
Nov 7, 2026
… encrypted, with the key from main: Little Nightmares II's shaders are found (PR seedds#1646) Little Nightmares II keeps its shaders inline in the cooked packages of Helios-Switch.pak, a version 8 pak whose index and entries are AES-encrypted. ue_legacy_jobs opened legacy paks without a key, so the split said the pak cannot be read and found no shaders. uepak.Keys is now the one key finder for a game's paks: no key for a pak whose index is in the clear, else the key find_key finds in the first main (base game, then update) that opens it; each main is loaded once, and a key found is tried first on the next pak. ue_legacy_jobs passes the key with each job, so ue_legacy_shaders decrypts the entries too; uepak.job (the shader code archives) and uepak.py list use it in place of their own lookups. find_key tries the known keys before code_keys, which reads all of main's code. Little Nightmares II (1.4): 20,170 shaders from 57 files; it reaches the title screen and plays on the Mac. OCTOPATH TRAVELER 0's uepak.job output is byte-identical to before. Co-authored-by: Haseenesss <18624035+Haseenesss@users.noreply.github.com> (cherry picked from commit 050580d)
gnosticgeek
pushed a commit
to gnosticgeek/nxforge
that referenced
this pull request
Nov 7, 2026
…ue from upstream seedds#1646) Pyright cannot see the length of the tuple behind self.imgs, so the star call into find_key(img, lo, hi, pak) failed lint-python on release-0.14.0. Same call, named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qteK6QbhFrzr2Vop9t34k
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
… encrypted, with the key from main: Little Nightmares II's shaders are found (PR seedds#1646) Little Nightmares II keeps its shaders inline in the cooked packages of Helios-Switch.pak, a version 8 pak whose index and entries are AES-encrypted. ue_legacy_jobs opened legacy paks without a key, so the split said the pak cannot be read and found no shaders. uepak.Keys is now the one key finder for a game's paks: no key for a pak whose index is in the clear, else the key find_key finds in the first main (base game, then update) that opens it; each main is loaded once, and a key found is tried first on the next pak. ue_legacy_jobs passes the key with each job, so ue_legacy_shaders decrypts the entries too; uepak.job (the shader code archives) and uepak.py list use it in place of their own lookups. find_key tries the known keys before code_keys, which reads all of main's code. Little Nightmares II (1.4): 20,170 shaders from 57 files; it reaches the title screen and plays on the Mac. OCTOPATH TRAVELER 0's uepak.job output is byte-identical to before. Co-authored-by: Haseenesss <18624035+Haseenesss@users.noreply.github.com>
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
Little Nightmares II stopped at
[RED] the shader split found no shaders in main or the RomFS. Its shaders are inline in the cooked packages of one legacy pak (version 8), as in Unreal Engine 4.18, but the pak's index and entries are AES-encrypted.ue_legacy_jobsopened legacy paks without a key, so the index did not parse and the pak was left out. The paks with shader code archives already took their key frommainwithuepak.find_key; the inline path did not.The change:
ue_legacy_jobs(files, mains=...): when a pak's footer says the index is encrypted, it tries eachmainthe split is given withuepak.find_key, and each job carries the key, soue_legacy_shadersdecrypts the entries too. With no key in anymainthe pak is reported in red and skipped, as other unreadable paks are.uepak.find_key(..., first=()): keys found earlier are tried beforecode_keysand the windows, so a second pak of the same game does not search again.docs/reference/shaders.md: the entry "An encrypted legacy Unreal pak with the shaders inline";docs/agents/symptoms.mdregenerated.Reported in LNPANDY/NX2Apple#877, where this is carried as a patch until it lands here.
Checked
python3 -m unittest dm.tools.tests.test_uepak_legacy_key(new, 4 tests: a synthetic encrypted version 4 pak andmain, no game files; the jobs carry the key, the nextmainis tried, no key gives the red line and skips the pak, a job reads the encrypted files) passes, and so dotest_uepak_key,test_uepak_iostore,test_uepak_v8,test_split_unreadable,test_split_narc,test_split_viper,test_nsp_incremental,test_nsp_experimental_builder,test_romfs_readandtest_docs.010097100EDD6000, 1.4 (v262144), Mac app with a provisional profile. Before: the split found 0 shaders. After:✓ [5/8] shader split (9:38): 20,170 shadersfrom 57 files, and all 20,170 Mac shaders built. The game reaches the title screen at about 30 fps (1,064 draws per frame, every shader key in the shader map, no errors in the log), and it was played into the first chapter for a while with nothing wrong seen.regress.py check(full,--runs 2) on Little Nightmares II010097100EDD6000, the game I have whose pak takes this path (a pak without encryption gets the same jobs as before, and the chain and host are unchanged). The provisional profile has nosmoke.tsv, so a local route was used for this check only (fresh save, no presses, the title screen; not committed). The REGRESSION is one run's frame p99 (51.05 ms in candidate run 2; 36.2 to 36.9 ms in the other three) while fps, screenshots, shaders, MSL, interface and[RED]lines are unchanged and both revisions run the same host and chain: load noise from other work on the Mac (prebuild 44 to 124 s from run to run). An earlier one-run check was discarded because stray key presses moved the baseline past the title screen.report.md
regress.py check (full): REGRESSION
Baseline
d99a161b6af312f9bac12673b5bf94edf81c1861^d777f0a, candidated99a161b6af312f9bac12673b5bf94edf81c1861d99a161; Apple M2, macOS 27.2, Xcode 27.2; 726.6 s010097100EDD6000Little Nightmares II
010097100EDD6000: REGRESSIONDocs
docs/reference/<subsystem>.mdentry, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index)dmsh_chain.py --headerwas run anddm/gfx/nvn/dmsh_chain.his part of the change (no chain change)🤖 Generated with Claude Code