Add SenrenCxCrypt

This commit is contained in:
2026-04-08 15:32:11 +08:00
parent 36ee257776
commit a8ed40db2c
7 changed files with 417 additions and 52 deletions

View File

@@ -124,6 +124,12 @@ enum CryptType {
},
FlyingShineCrypt,
CxEncryption(CxSchema),
#[serde(rename_all = "PascalCase")]
SenrenCxCrypt {
#[serde(flatten)]
cx: CxSchema,
names_section_id: String,
},
}
#[derive(Clone, Debug, Deserialize)]
@@ -159,6 +165,15 @@ impl Schema {
CryptType::CxEncryption(schema) => {
Box::new(cx::CxEncryption::new(self.base.clone(), &schema, filename)?)
}
CryptType::SenrenCxCrypt {
cx,
names_section_id,
} => Box::new(cx::SenrenCxCrypt::new(
self.base.clone(),
cx,
filename,
names_section_id.clone(),
)?),
})
}
}
@@ -601,9 +616,6 @@ impl<R: Read> Read for FlyingShineCryptReader<R> {
}
}
// extended in cx.rs
seek_reader_key_impl!(CxEncryptionReader<T>, (u32, Arc<cx::CxEncryption>));
#[test]
fn test_deserialize_crypt() {
for (key, schema) in CRYPT_SCHEMA.iter() {