diff --git a/msg_tool_xp3data/crypt.json b/msg_tool_xp3data/crypt.json index b1d22cf..2d91fa1 100644 --- a/msg_tool_xp3data/crypt.json +++ b/msg_tool_xp3data/crypt.json @@ -2497,6 +2497,14 @@ "$type": "HaikuoCrypt", "Title": "よつのは | 四叶草" }, + "Youjoku no Onna Kishi": { + "$type": "HybridCrypt", + "Title": "孕辱の女騎士、オーガの苗床に堕つ" + }, + "Youjoku no Ouhi to Sono Himegimi": { + "$type": "HybridCrypt", + "Title": "孕辱の王妃とその姫君" + }, "your diary + H": { "$type": "SourireCrypt" }, diff --git a/src/scripts/kirikiri/archive/xp3/crypt/mod.rs b/src/scripts/kirikiri/archive/xp3/crypt/mod.rs index ab9c14b..0656e5d 100644 --- a/src/scripts/kirikiri/archive/xp3/crypt/mod.rs +++ b/src/scripts/kirikiri/archive/xp3/crypt/mod.rs @@ -245,6 +245,7 @@ enum CryptType { }, FestivalCrypt, PinPointCrypt, + HybridCrypt, } #[derive(Clone, Debug, Deserialize)] @@ -383,6 +384,7 @@ impl Schema { } CryptType::FestivalCrypt => Box::new(FestivalCrypt::new(self.base.clone())), CryptType::PinPointCrypt => Box::new(PinPointCrypt::new(self.base.clone())), + CryptType::HybridCrypt => Box::new(HybridCrypt::new(self.base.clone())), }) } } @@ -1908,6 +1910,20 @@ impl Read for PinPointCryptReader { } } +seek_crypt_filehash_key_impl!(HybridCrypt, HybridCryptReader); + +impl Read for HybridCryptReader { + fn read(&mut self, buf: &mut [u8]) -> std::io::Result { + let readed = self.inner.read(buf)?; + let key = (self.key >> 5) as u8; + for t in (&mut buf[..readed]).iter_mut() { + *t ^= key; + } + self.pos += readed as u64; + Ok(readed) + } +} + #[test] fn test_deserialize_crypt() { for (key, schema) in CRYPT_SCHEMA.iter() {