mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Allow per-expansion login header fields + fix challenge FourCC encoding
This commit is contained in:
parent
58ad69d939
commit
fd468ce793
5 changed files with 32 additions and 11 deletions
|
|
@ -25,14 +25,13 @@ network::Packet LogonChallengePacket::build(const std::string& account, const Cl
|
|||
// Payload size
|
||||
packet.writeUInt16(payloadSize);
|
||||
|
||||
// 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) {
|
||||
// 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"/"enGB", etc.
|
||||
auto writeFourCC = [&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[len - 1 - i]);
|
||||
buf[i] = static_cast<uint8_t>(str[i]);
|
||||
}
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
packet.writeUInt8(buf[i]);
|
||||
|
|
@ -59,14 +58,14 @@ network::Packet LogonChallengePacket::build(const std::string& account, const Cl
|
|||
// Build (2 bytes)
|
||||
packet.writeUInt16(info.build);
|
||||
|
||||
// Platform (4 bytes, legacy reversed encoding)
|
||||
writeFourCCLE(info.platform);
|
||||
// Platform (4 bytes)
|
||||
writeFourCC(info.platform);
|
||||
|
||||
// OS (4 bytes, legacy reversed encoding)
|
||||
writeFourCCLE(info.os);
|
||||
// OS (4 bytes)
|
||||
writeFourCC(info.os);
|
||||
|
||||
// Locale (4 bytes, legacy reversed encoding)
|
||||
writeFourCCLE(info.locale);
|
||||
// Locale (4 bytes)
|
||||
writeFourCC(info.locale);
|
||||
|
||||
// Timezone
|
||||
packet.writeUInt32(info.timezone);
|
||||
|
|
|
|||
|
|
@ -166,6 +166,15 @@ bool ExpansionRegistry::loadProfile(const std::string& jsonPath, const std::stri
|
|||
|
||||
p.build = static_cast<uint16_t>(jsonInt(json, "build"));
|
||||
p.protocolVersion = static_cast<uint8_t>(jsonInt(json, "protocolVersion"));
|
||||
// Optional client header fields (LOGON_CHALLENGE)
|
||||
{
|
||||
std::string v;
|
||||
v = jsonValue(json, "game"); if (!v.empty()) p.game = v;
|
||||
v = jsonValue(json, "platform"); if (!v.empty()) p.platform = v;
|
||||
v = jsonValue(json, "os"); if (!v.empty()) p.os = v;
|
||||
v = jsonValue(json, "locale"); if (!v.empty()) p.locale = v;
|
||||
p.timezone = static_cast<uint32_t>(jsonInt(json, "timezone", static_cast<int>(p.timezone)));
|
||||
}
|
||||
p.maxLevel = static_cast<uint32_t>(jsonInt(json, "maxLevel", 60));
|
||||
p.races = jsonUintArray(json, "races");
|
||||
p.classes = jsonUintArray(json, "classes");
|
||||
|
|
|
|||
|
|
@ -509,6 +509,11 @@ void AuthScreen::attemptAuth(auth::AuthHandler& authHandler) {
|
|||
info.patchVersion = profile->patchVersion;
|
||||
info.build = profile->build;
|
||||
info.protocolVersion = profile->protocolVersion;
|
||||
info.game = profile->game;
|
||||
info.platform = profile->platform;
|
||||
info.os = profile->os;
|
||||
info.locale = profile->locale;
|
||||
info.timezone = profile->timezone;
|
||||
authHandler.setClientInfo(info);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue