diff --git a/msg_tool_xp3data/crypt.json b/msg_tool_xp3data/crypt.json index 3b5256b..6c18e26 100644 --- a/msg_tool_xp3data/crypt.json +++ b/msg_tool_xp3data/crypt.json @@ -989,6 +989,10 @@ "Key": 205, "Title": "神頼みしすぎて俺の未来がヤバい。 | 求神太多我的未来糟糕了 | 太依赖咒术的我未来堪忧。" }, + "Kaminarikko Chuuihou!": { + "$type": "HighRunningCrypt", + "Title": "カミナリっ娘注意報!~未来の予報はヨメのちハラみ!?~" + }, "Kanae to Meguri to no Sonogo ga Icha Love Sugite Yabai.": { "$type": "SourireCrypt", "Title": "叶とメグリとのその後がイチャらぶすぎてヤバい。 | 与叶和爱莉之后的故事太过亲密糟糕了" @@ -1157,6 +1161,10 @@ "Title": "光輪の町、ラベンダーの少女", "StartupTjsNotEncrypted": true }, + "Kozukuri Onsen ~Ippai Tsukutte Ichizoku Hanei~": { + "$type": "HighRunningCrypt", + "Title": "こづくり温泉~いっぱいつくって一族繁栄!?~" + }, "Kurano-kunchi no Futago Jijou": { "$type": "SourireCrypt", "Title": "倉野くんちのふたご事情 | 仓野家的双胞胎故事" diff --git a/src/scripts/kirikiri/archive/xp3/crypt/mod.rs b/src/scripts/kirikiri/archive/xp3/crypt/mod.rs index c3ffc26..37fdebf 100644 --- a/src/scripts/kirikiri/archive/xp3/crypt/mod.rs +++ b/src/scripts/kirikiri/archive/xp3/crypt/mod.rs @@ -188,6 +188,7 @@ enum CryptType { zero_xor: u8, }, YuzuCrypt, + HighRunningCrypt, } #[derive(Clone, Debug, Deserialize)] @@ -301,6 +302,7 @@ impl Schema { *zero_xor, )), CryptType::YuzuCrypt => Box::new(YuzuCrypt::new(self.base.clone())), + CryptType::HighRunningCrypt => Box::new(HighRunningCrypt::new(self.base.clone())), }) } } @@ -1324,6 +1326,25 @@ impl Read for YuzuCryptReader { } } +seek_crypt_filehash_key_u8_impl!(HighRunningCrypt, HighRunningCryptReader); + +impl Read for HighRunningCryptReader { + fn read(&mut self, buf: &mut [u8]) -> std::io::Result { + let readed = self.inner.read(buf)?; + let key = self.key as u64; + if key != 0 { + for (i, t) in (&mut buf[..readed]).iter_mut().enumerate() { + let offset = self.seg_start + self.pos + i as u64; + if offset % key != 0 { + *t ^= self.key; + } + } + } + self.pos += readed as u64; + Ok(readed) + } +} + #[test] fn test_deserialize_crypt() { for (key, schema) in CRYPT_SCHEMA.iter() {