mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Restore legacy FourCC reversal in LOGON_CHALLENGE
This commit is contained in:
parent
fd0da4486d
commit
7e5fc0ed51
1 changed files with 11 additions and 10 deletions
|
|
@ -25,13 +25,14 @@ network::Packet LogonChallengePacket::build(const std::string& account, const Cl
|
|||
// Payload size
|
||||
packet.writeUInt16(payloadSize);
|
||||
|
||||
// Write a 4-byte ASCII field (FourCC-ish): bytes are sent in-order and null-padded.
|
||||
// Auth servers expect literal "x86\0", "Win\0", "enUS", etc (not reversed).
|
||||
auto writeFourCC = [&packet](const std::string& str) {
|
||||
// Write a FourCC-like 4-byte ASCII field in the legacy login wire format:
|
||||
// reverse the characters and null-pad to 4 bytes.
|
||||
// Example (1.12.1): platform "x86" is sent as bytes "68x\\0"; os "Win" as "niW\\0"; locale "enGB" as "BGne".
|
||||
auto writeFourCCLE = [&packet](const std::string& str) {
|
||||
uint8_t buf[4] = {0, 0, 0, 0};
|
||||
size_t len = std::min<size_t>(4, str.length());
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
buf[i] = static_cast<uint8_t>(str[i]);
|
||||
buf[i] = static_cast<uint8_t>(str[len - 1 - i]);
|
||||
}
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
packet.writeUInt8(buf[i]);
|
||||
|
|
@ -58,14 +59,14 @@ network::Packet LogonChallengePacket::build(const std::string& account, const Cl
|
|||
// Build (2 bytes)
|
||||
packet.writeUInt16(info.build);
|
||||
|
||||
// Platform (4 bytes)
|
||||
writeFourCC(info.platform);
|
||||
// Platform (4 bytes, legacy reversed encoding)
|
||||
writeFourCCLE(info.platform);
|
||||
|
||||
// OS (4 bytes)
|
||||
writeFourCC(info.os);
|
||||
// OS (4 bytes, legacy reversed encoding)
|
||||
writeFourCCLE(info.os);
|
||||
|
||||
// Locale (4 bytes)
|
||||
writeFourCC(info.locale);
|
||||
// Locale (4 bytes, legacy reversed encoding)
|
||||
writeFourCCLE(info.locale);
|
||||
|
||||
// Timezone
|
||||
packet.writeUInt32(info.timezone);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue