jakcron / nstool

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

Extraction failed - NCA Partition 1 not readable. (Indirect storage not ascending ordered.) #104

Open NeoKat75 opened 1 year ago

NeoKat75 commented 1 year ago

Trying to extract the 1.3.0 update NCA for Sonic Frontiers and failing miserably because of this error which I've no clue what to do about.

>nstool -v -y -x "../Sonic Frontiers/GAME/patch" --titlekey 26B285006A0260150DEFC0F2DE515336 --basenca "../Sonic Frontiers/GAME/raw/48494a74aade50fac84d1a049823bcef.nca" "../Sonic Frontiers/GAME/patch/2b035deffd1fc67261bb36e27ba9cae7.nca"
[NCA Content Key]
  AES-CTR Key: 13E3945E2056BCCC37CAF44EC62513BF
stream properties: canRead()  = true
stream properties: canWrite() = false
stream properties: canSeek()  = true
[WARNING] NCA Header Main Signature: FAIL
[WARNING] ACID Signature: FAIL (Failed to verify Access Control Info Desc)
[NCA Header]
  Format Type:     NCA3
  Dist. Type:      Download
  Content Type:    Program
  Key Generation:  14
  Sig. Generation: 0
  Kaek Index:      Application (0)
  Size:            0x4ffa4200
  ProgID:          0x01004ad014bf0000
  Content Index:   0
  SdkAddon Ver.:   13.3.2 (v218300928)
  RightsId:        01004AD014BF0800000000000000000E
  Partitions:
    0:
      Offset:      0x4e1c8200
      Size:        0x1ddc000
      Format Type: PartitionFs
      Hash Type:   HierarchicalSha256
      Enc. Type:   AesCtr
      AesCtr Counter:
        00000001000000040000000004E1C820
      HierarchicalSha256 Header:
        Master Hash:
          46240DC3F67DEEDF5E231160A1F3B4D6
          4E4301051886585D6A6E8CBD6C62A7DF
        HashBlockSize:     0x8000
        Hash Layer 0:
          Offset:          0x0
          Size:            0x7760
        Data Layer:
          Offset:          0x8000
          Size:            0x1dd1db0
    1:
      Offset:      0x4000
      Size:        0x4e1c4200
      Format Type: RomFs
      Hash Type:   HierarchicalIntegrity
      Enc. Type:   AesCtrEx
      HierarchicalIntegrity Header:
        Hash Layer 0:
          Offset:          0x0
          Size:            0x4000
          BlockSize:       0x4000
        Hash Layer 1:
          Offset:          0x4000
          Size:            0x4000
          BlockSize:       0x4000
        Hash Layer 2:
          Offset:          0x8000
          Size:            0x4000
          BlockSize:       0x4000
        Hash Layer 3:
          Offset:          0xc000
          Size:            0xc000
          BlockSize:       0x4000
        Hash Layer 4:
          Offset:          0x18000
          Size:            0x15e0000
          BlockSize:       0x4000
        Data Layer:
          Offset:          0x15f8000
          Size:            0x2bbbc1794
          BlockSize:       0x4000
        Master Hash 0:
          BFB6F3EE50BC0DD063DA3FBBAED5B748
          99886960091668A410F950BB50388041
[WARNING] NCA Partition 1 not readable. (Indirect storage not ascending ordered.)
[ContentArchive/Extract]
Saving ..\Sonic Frontiers\GAME\patch\0\main...
Saving ..\Sonic Frontiers\GAME\patch\0\main.npdm...
Saving ..\Sonic Frontiers\GAME\patch\0\rtld...
Saving ..\Sonic Frontiers\GAME\patch\0\sdk...

Alternatively, I can use a plaintext version of the base NCA (decrypted with hactool), though that just makes nstool output just the AES-CTR key and nothing else happens.

>nstool -v -y -x "../Sonic Frontiers/GAME/patch" --titlekey 26B285006A0260150DEFC0F2DE515336 --basenca "../Sonic Frontiers/GAME/raw/plaintext.nca" "../Sonic Frontiers/GAME/patch/2b035deffd1fc67261bb36e27ba9cae7.nca"
[NCA Content Key]
  AES-CTR Key: 13E3945E2056BCCC37CAF44EC62513BF
Slluxx commented 1 year ago

Same thing for the new RDR 1.0.2 patch.

jakcron commented 3 months ago

Hi @NeoKat75 @Slluxx, thanks to @sagumamugas, this may have been fixed in https://github.com/jakcron/nstool/releases/tag/v1.9.1

Can you re-try with this version?