From 441c49d31a1f9b4e181e8701a6f6ae22f5bf573f Mon Sep 17 00:00:00 2001 From: neru Date: Mon, 13 Apr 2026 01:09:21 -0300 Subject: [PATCH] style: run clang-format --- src/unlocker/dbdcrypt.cpp | 39 +++++++++++++++++++++++++++------------ src/unlocker/spoofing.h | 2 +- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/unlocker/dbdcrypt.cpp b/src/unlocker/dbdcrypt.cpp index 6718fba..e58cc7d 100644 --- a/src/unlocker/dbdcrypt.cpp +++ b/src/unlocker/dbdcrypt.cpp @@ -53,7 +53,6 @@ std::string DBDCrypt::encrypt(const std::string& data, const std::string& access return "DbdDAQEB" + b64Enc(fullPayload); } - if (type == TYPE_2) { auto transformedKey = transformCDNKey(CDN_KEY_BASE64); @@ -183,13 +182,11 @@ std::string DBDCrypt::decType3(const std::string& data, const std::string& key, for (char& c : decrypted) c = (char)((unsigned char)c + 1); - if (decrypted.length() >= 2 && decrypted.at(1) == '\0') - decrypted = utf16ToUtf8(decrypted); + if (decrypted.length() >= 2 && decrypted.at(1) == '\0') decrypted = utf16ToUtf8(decrypted); decrypted.erase(std::remove(decrypted.begin(), decrypted.end(), (char)0x01), decrypted.end()); decrypted.erase(std::remove(decrypted.begin(), decrypted.end(), (char)0x00), decrypted.end()); - for (size_t offset : {0ULL, 4ULL}) { if (offset + 1 < decrypted.size() && (unsigned char)decrypted[offset] == 0x78) @@ -430,19 +427,38 @@ std::string DBDCrypt::utf8ToUtf16(const std::string& utf8) { if (utf8.empty()) return ""; std::string utf16; - for (size_t i = 0; i < utf8.length(); ) + for (size_t i = 0; i < utf8.length();) { uint32_t cp = 0; unsigned char c = utf8[i]; - if (c < 0x80) { cp = c; i += 1; } - else if (c < 0xE0) { cp = ((c & 0x1F) << 6) | (utf8[i + 1] & 0x3F); i += 2; } - else if (c < 0xF0) { cp = ((c & 0x0F) << 12) | ((utf8[i + 1] & 0x3F) << 6) | (utf8[i + 2] & 0x3F); i += 3; } - else { cp = ((c & 0x07) << 18) | ((utf8[i + 1] & 0x3F) << 12) | ((utf8[i + 2] & 0x3F) << 6) | (utf8[i + 3] & 0x3F); i += 4; } + if (c < 0x80) + { + cp = c; + i += 1; + } + else if (c < 0xE0) + { + cp = ((c & 0x1F) << 6) | (utf8[i + 1] & 0x3F); + i += 2; + } + else if (c < 0xF0) + { + cp = ((c & 0x0F) << 12) | ((utf8[i + 1] & 0x3F) << 6) | (utf8[i + 2] & 0x3F); + i += 3; + } + else + { + cp = ((c & 0x07) << 18) | ((utf8[i + 1] & 0x3F) << 12) | ((utf8[i + 2] & 0x3F) << 6) | (utf8[i + 3] & 0x3F); + i += 4; + } - if (cp < 0x10000) { + if (cp < 0x10000) + { utf16.push_back((char)(cp & 0xFF)); utf16.push_back((char)(cp >> 8)); - } else { + } + else + { cp -= 0x10000; uint16_t high = (uint16_t)(0xD800 | (cp >> 10)); uint16_t low = (uint16_t)(0xDC00 | (cp & 0x3FF)); @@ -455,4 +471,3 @@ std::string DBDCrypt::utf8ToUtf16(const std::string& utf8) } return utf16; } - diff --git a/src/unlocker/spoofing.h b/src/unlocker/spoofing.h index 4113798..067a717 100644 --- a/src/unlocker/spoofing.h +++ b/src/unlocker/spoofing.h @@ -46,7 +46,7 @@ class Spoofer void onBloodweb(std::string& body, std::string& respHeaders); void onGameConfigs(std::string& body); void onUpdateEntitlements(const std::string& url, std::string& body); - + void onGetAllClient(std::string& body); void onBloodwebClient(std::string& body); void onUpdateEntitlementsClient(const std::string& url, std::string& body);