Skip to content

Commit 91f05dd

Browse files
committed
Bug fix
1 parent 4234adc commit 91f05dd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,12 @@ fn parse_ncch(cia: &mut CiaReader, offs: u64, mut titleid: [u8; 8]) {
333333
}
334334

335335
let ncch_key_y = BigEndian::read_u128(header.signature[0..16].try_into().unwrap());
336+
let mut tid: [u8; 8] = header.titleid;
337+
tid.reverse();
336338

337339
debug!(" Product code: {}", std::str::from_utf8(&header.productcode).unwrap());
338340
debug!(" KeyY: {:032X}", ncch_key_y);
339-
debug!(" Title ID: {}", hex::encode(titleid).to_uppercase());
341+
debug!(" Title ID: {}", hex::encode(tid).to_uppercase());
340342
debug!(" Content ID: {:08X}\n", cia.content_id);
341343
debug!(" Format version: {}\n", header.formatversion);
342344

@@ -350,7 +352,7 @@ fn parse_ncch(cia: &mut CiaReader, offs: u64, mut titleid: [u8; 8]) {
350352
let mut encrypted: bool = true;
351353

352354
if flag_to_bool(header.flags[7] & 1) {
353-
if flag_to_bool(titleid[3] & 16) { fixed_crypto = 2 } else { fixed_crypto = 1 }
355+
if flag_to_bool(tid[3] & 16) { fixed_crypto = 2 } else { fixed_crypto = 1 }
354356
debug!(" Uses fixed-key crypto")
355357
}
356358

0 commit comments

Comments
 (0)