From 48a8ada43ffdd691b6022e45a82fe8c03d120ce3 Mon Sep 17 00:00:00 2001 From: a Date: Fri, 22 Dec 2023 09:36:53 +0200 Subject: [PATCH] very minor refactoring to Auth_Data --- dll/auth.h | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/dll/auth.h b/dll/auth.h index 080e5192..3b5adbd2 100644 --- a/dll/auth.h +++ b/dll/auth.h @@ -321,28 +321,44 @@ struct Auth_Data { std::vector Serialize() { - std::vector buffer; - uint8_t* pBuffer; - + const uint64_t steam_id = id.ConvertToUint64(); + + PRINT_DEBUG( + "AUTH::Auth_Data::SER:\n" + " HasGC: %u\n" + " user steam_id: %I64u\n" + " number: %llu\n", + + (int)HasGC, + steam_id, + number + ); + std::vector tickedData = Ticket.Serialize(); - uint32_t size = tickedData.size() + 4; - std::vector GCData; + size_t size = tickedData.size() + 4; + std::vector GCData; if (HasGC) { GCData = GC.Serialize(); size += GCData.size() + 4; } - PRINT_DEBUG("Ticket Ser Size: %u\n", size); - buffer.resize(size+STEAM_APPTICKET_SIGLEN); - pBuffer = buffer.data(); + PRINT_DEBUG("AUTH::Auth_Data::SER final size = %zu\n", size); + + std::vector buffer; + buffer.resize(size + STEAM_APPTICKET_SIGLEN); + uint8_t* pBuffer = buffer.data(); + if (HasGC) { memcpy(pBuffer, GCData.data(), GCData.size()); pBuffer+= GCData.size(); - *reinterpret_cast(pBuffer) = (128+tickedData.size()+4); pBuffer += 4; + + *reinterpret_cast(pBuffer) = (128+tickedData.size()+4); + pBuffer += 4; } - *reinterpret_cast(pBuffer) = (tickedData.size()+4); pBuffer += 4; + *reinterpret_cast(pBuffer) = (tickedData.size()+4); + pBuffer += 4; memcpy(pBuffer, tickedData.data(), tickedData.size()); #ifndef EMU_RELEASE_BUILD