jakcron / nstool

General purpose read/extract tool for Nintendo Switch file formats.
MIT License
449 stars 43 forks source link

"Root sRomfsDirEntry corrupted" error when extracting patch NCA #115

Open thonkinator opened 5 months ago

thonkinator commented 5 months ago

Here's the error/warning I get when trying to extract the patch program NCA with the base NCA set to the base program NCA.

$ nstool --tik ../base/0100800015926000000000000000000b.tik --tik 01008000159268000000000000000010.tik --basenca ../base/1a71b5f44572da51fa84023287b7b336.nca -x 9c53271e684dbf9d14acafafb5723b76 9c53271e684dbf9d14acafafb5723b76.nca
[NCA Header]
  Format Type:     NCA3
  Dist. Type:      Download
  Content Type:    Program
  Key Generation:  16
  Sig. Generation: 0
  Kaek Index:      Application (0)
  Size:            0xc30c800
  ProgID:          0x0100800015926000
  Content Index:   0
  SdkAddon Ver.:   16.2.8 (v268568576)
  RightsId:        01008000159268000000000000000010
[WARNING] NCA Partition 1 not readable. (Root sRomfsDirEntry corrupted.)
[ContentArchive/Extract]
Saving 9c53271e684dbf9d14acafafb5723b76/0/main...
Saving 9c53271e684dbf9d14acafafb5723b76/0/main.npdm...
Saving 9c53271e684dbf9d14acafafb5723b76/0/rtld...
Saving 9c53271e684dbf9d14acafafb5723b76/0/sdk...
Saving 9c53271e684dbf9d14acafafb5723b76/0/subsdk0...

I know the patch isn't actually corrupted, as it also runs just fine with emulation. This used to work with an older patch, but I don't know what changed.

jakcron commented 3 months ago

Interesting, sadly the cause isn't obvious to me. If the Root sRomfsDirEntry is corrupted, it could be a decryption error or an issue with processing the patch.

Idk if I can help without having the patch & base NCA to investigate. But tbh my time to work on this has reduced a lot recently.