From 986e02f182c1f8f30101568a8246cd5f30785378 Mon Sep 17 00:00:00 2001 From: xhacker-zzz <959220793@qq.com> Date: Thu, 24 Nov 2022 04:54:48 +0800 Subject: [PATCH] Update qmccache cpp code --- src/QmcWasm/qmc.hpp | 5 +---- src/decrypt/qmccache.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/QmcWasm/qmc.hpp b/src/QmcWasm/qmc.hpp index 9bfb5e1..d585946 100644 --- a/src/QmcWasm/qmc.hpp +++ b/src/QmcWasm/qmc.hpp @@ -192,10 +192,7 @@ void QmcDecode::DecodeCache() { for (size_t i = 0; i < blobData.size(); i++) { blobData[i] ^= 0xf4; - if (blobData[i] <= 0x3f) blobData[i] = blobData[i] * 4; - else if (blobData[i] <= 0x7f) blobData[i] = (blobData[i] - 0x40) * 4 + 1; - else if (blobData[i] <= 0xbf) blobData[i] = (blobData[i] - 0x80) * 4 + 2; - else blobData[i] = (blobData[i] - 0xc0) * 4 + 3; + blobData[i] = ((blobData[i] & 0b0011_1111) << 2) | (blobData[i] >> 6); // rol 2 } } diff --git a/src/decrypt/qmccache.ts b/src/decrypt/qmccache.ts index 9935ef1..6a57a94 100644 --- a/src/decrypt/qmccache.ts +++ b/src/decrypt/qmccache.ts @@ -22,7 +22,7 @@ export async function Decrypt(file: Blob, raw_filename: string, raw_ext: string) console.log('qmc: using wasm decoder'); const qmcDecrypted = await DecryptQmcWasm(buffer, raw_ext); - // 若 wasm 失败,降级到 js 再尝试一次 + // 若 wasm 失败,使用 js 再尝试一次 if (qmcDecrypted.success) { musicDecoded = qmcDecrypted.data; console.log('qmc wasm decoder suceeded');