Skip to content

Call a dump encrypted with the original key encrypted - #2

Merged
fearkov merged 1 commit into
fearkov:mainfrom
Invictus-potens:encrypted-original-key
Nov 5, 2026
Merged

fearkov merged 1 commit into
fearkov:mainfrom
Invictus-potens:encrypted-original-key

Conversation

@Invictus-potens

Copy link
Copy Markdown
Contributor

A dump encrypted with the original key (crypto method flags[3] == 0, NoCrypto clear) passes the encryption check in Title::load. Most retail games are encrypted this way. Such a dump then fails with the ExeFS has no .code, which doesn't tell the user what's wrong. We hit this in smt4-recomp (Invictus-potens/smt4-recomp#15).

The check treated flags[3] == 0 as "never encrypted". A title that was never encrypted has NoCrypto set, though. Method 0 without NoCrypto is the original key, or a dump that was decrypted but kept its old flags.

Change: nothing new is turned away, because the second case reads fine and still has to load. Only the error for a missing .code changes: when NoCrypto is clear, it says the dump is encrypted, it has to be decrypted first (the ExeFS has no .code). The early check for the 7.x/9.x methods is unchanged.

Test: rom::tests::an_encrypted_dump_says_so, built on the existing rom() fixture. It checks three cases:

  • crypto method 0, no NoCrypto, readable ExeFS: loads;
  • the same with garbage in the ExeFS: "encrypted";
  • NoCrypto set, no .code: the old message.

It fails without the change. cargo test --release --all-features passes on Windows (x86_64-pc-windows-gnu): 63 + 1.

…ExeFS has no .code

Crypto method 0 without NoCrypto is the original key, the one most games are
encrypted with, so such a dump got through the check and failed later with
"the ExeFS has no .code". It can also be a dump decrypted with its flags left
as they were, which reads fine, so it still isn't turned away up front: only
the message for a missing .code now says the dump is encrypted when NoCrypto
is clear.
@fearkov
fearkov merged commit df82e6e into fearkov:main Nov 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants