diff --git a/lib/bc b/lib/bc index 46e7af7..5a8d147 160000 --- a/lib/bc +++ b/lib/bc @@ -1 +1 @@ -Subproject commit 46e7af7c589a75b2c47b79ecef2146a22ebb3202 +Subproject commit 5a8d14766308be0746368d169b3b1ee834d91e4a diff --git a/lib/common b/lib/common index 846f154..92a540a 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 846f1548923f7ce4264fde94c62153abb38819bc +Subproject commit 92a540a549c6882b6ebd87593ed97174865100c9 diff --git a/lib/squall b/lib/squall index adc8cb6..a96d127 160000 --- a/lib/squall +++ b/lib/squall @@ -1 +1 @@ -Subproject commit adc8cb6200425e30f4a3cf18c3cb96e8883f7ec0 +Subproject commit a96d1270d4a1f5d6fa6756c30696a13f87b08a0a diff --git a/lib/typhoon b/lib/typhoon index 981dd25..f191151 160000 --- a/lib/typhoon +++ b/lib/typhoon @@ -1 +1 @@ -Subproject commit 981dd251f801036bb7dd76f220de4a52229849d9 +Subproject commit f191151f1694ae471396c0cad6b89811fb6fa6ca diff --git a/src/gx/font/FontFace.cpp b/src/gx/font/FontFace.cpp index 1a610ce..0c49615 100644 --- a/src/gx/font/FontFace.cpp +++ b/src/gx/font/FontFace.cpp @@ -29,7 +29,7 @@ FT_Face FontFaceGetFace(HFACE handle) { const char* FontFaceGetFontName(HFACE handle) { STORM_ASSERT(handle); - return reinterpret_cast(handle)->m_key.m_str; + return reinterpret_cast(handle)->m_key.GetString(); } HFACE FontFaceGetHandle(const char* fileName, FT_Library library) { diff --git a/src/gx/gll/CGxDeviceGLL.cpp b/src/gx/gll/CGxDeviceGLL.cpp index 888fac8..9a822cf 100644 --- a/src/gx/gll/CGxDeviceGLL.cpp +++ b/src/gx/gll/CGxDeviceGLL.cpp @@ -792,7 +792,7 @@ void CGxDeviceGLL::IShaderCreatePixel(CGxShader* ps) { GLShader::ShaderType::ePixelShader, codeStr, codeLen, - ps->m_key.m_str + ps->m_key.GetString() ); glShader->Compile(nullptr); @@ -818,7 +818,7 @@ void CGxDeviceGLL::IShaderCreateVertex(CGxShader* vs) { GLShader::ShaderType::eVertexShader, code, codeLen, - vs->m_key.m_str + vs->m_key.GetString() ); glShader->Compile(nullptr); diff --git a/src/net/connection/NetClient.cpp b/src/net/connection/NetClient.cpp index e60e6ec..c8060fc 100644 --- a/src/net/connection/NetClient.cpp +++ b/src/net/connection/NetClient.cpp @@ -210,11 +210,7 @@ int32_t NetClient::HandleConnect() { int32_t NetClient::HandleData(uint32_t timeReceived, void* data, int32_t size) { // TODO push obj mgr - CDataStore msg; - msg.m_data = static_cast(data); - msg.m_size = size; - msg.m_alloc = -1; - msg.m_read = 0; + CDataStore msg = CDataStore(static_cast(data), size); this->ProcessMessage(timeReceived, &msg, 0); @@ -295,7 +291,7 @@ void NetClient::Send(CDataStore* msg) { return; } - auto v4 = msg->m_size - msg->m_read; + auto v4 = msg->Size() - msg->Tell(); if (!v4) { return; @@ -358,12 +354,12 @@ void NetClient::WCDisconnected(WowConnection* conn, uint32_t timeStamp, NETCONNA void NetClient::WCMessageReady(WowConnection* conn, uint32_t timeStamp, CDataStore* msg) { uint8_t* data; - msg->GetDataInSitu(reinterpret_cast(data), msg->m_size); + msg->GetDataInSitu(reinterpret_cast(data), msg->Size()); // TODO increment byte counter // SInterlockedExchangeAdd(this->m_bytesReceived, msg->m_size); - msg->m_read = 0; + msg->Seek(0); uint16_t msgId; msg->Get(msgId); @@ -381,8 +377,8 @@ void NetClient::WCMessageReady(WowConnection* conn, uint32_t timeStamp, CDataSto } if (conn == this->m_serverConnection && !this->m_suspended) { - msg->m_read = msg->m_size; - this->m_netEventQueue->AddEvent(EVENT_ID_NET_DATA, conn, this, data, msg->m_size); + msg->Seek(msg->Size()); + this->m_netEventQueue->AddEvent(EVENT_ID_NET_DATA, conn, this, data, msg->Size()); } else { conn->Disconnect(); } diff --git a/src/net/connection/RealmConnection.cpp b/src/net/connection/RealmConnection.cpp index 64d5c48..a099b55 100644 --- a/src/net/connection/RealmConnection.cpp +++ b/src/net/connection/RealmConnection.cpp @@ -171,7 +171,7 @@ int32_t RealmConnection::HandleAuthResponse(uint32_t msgId, uint32_t time, CData this->m_authenticated = 1; } - if (msg->Size() - msg->m_read >= 10 + (authResult == 27 ? 5 : 0)) { + if (msg->Size() - msg->Tell() >= 10 + (authResult == 27 ? 5 : 0)) { msg->Get(this->m_billingTimeRemaining); msg->Get(this->m_billingFlags); msg->Get(this->m_billingTimeRested); diff --git a/src/net/connection/WowConnection.cpp b/src/net/connection/WowConnection.cpp index 85a9c50..ceea964 100644 --- a/src/net/connection/WowConnection.cpp +++ b/src/net/connection/WowConnection.cpp @@ -478,11 +478,7 @@ void WowConnection::DoMessageReads() { this->m_readBytes += bytesRead; if (size >= 0 && this->m_readBytes >= size) { - CDataStore msg; - msg.m_data = &this->m_readBuffer[headerSize]; - msg.m_alloc = -1; - msg.m_size = size - headerSize; - msg.m_read = 0; + CDataStore msg = CDataStore(&this->m_readBuffer[headerSize], size - headerSize); this->AcquireResponseRef(); diff --git a/src/net/grunt/ClientLink.cpp b/src/net/grunt/ClientLink.cpp index a0182dc..f0596a5 100644 --- a/src/net/grunt/ClientLink.cpp +++ b/src/net/grunt/ClientLink.cpp @@ -47,7 +47,7 @@ void Grunt::ClientLink::Call() { } int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) { - if (msg.m_read > msg.m_size || msg.m_size - msg.m_read < 2) { + if (msg.Tell() > msg.Size() || msg.Size() - msg.Tell() < 2) { return 0; } @@ -63,7 +63,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) { // Auth failure (success == 0) if (result != 0) { - if (msg.m_read > msg.m_size) { + if (msg.Tell() > msg.Size()) { return 1; } @@ -78,11 +78,11 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) { return 2; } - if (msg.m_read > msg.m_size) { + if (msg.Tell() > msg.Size()) { return 0; } - if (msg.m_size - msg.m_read < 33) { + if (msg.Size() - msg.Tell() < 33) { return 0; } @@ -177,7 +177,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) { msg.Get(tokenRequired); } - if (msg.m_read > msg.m_size) { + if (msg.Tell() > msg.Size()) { return 1; } @@ -204,7 +204,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) { } int32_t Grunt::ClientLink::CmdAuthLogonProof(CDataStore& msg) { - if (msg.m_read >= msg.m_size) { + if (msg.Tell() >= msg.Size()) { return 0; } @@ -217,7 +217,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonProof(CDataStore& msg) { // TODO } - if (msg.m_read > msg.m_size) { + if (msg.Tell() > msg.Size()) { return 1; } @@ -233,7 +233,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonProof(CDataStore& msg) { } // Authentication success - if (msg.m_read <= msg.m_size && msg.m_size - msg.m_read >= 24) { + if (msg.Tell() <= msg.Size() && msg.Size() - msg.Tell() >= 24) { void* serverProof; msg.GetDataInSitu(serverProof, 20); @@ -243,11 +243,11 @@ int32_t Grunt::ClientLink::CmdAuthLogonProof(CDataStore& msg) { uint32_t surveyID; msg.Get(surveyID); - if (msg.m_read <= msg.m_size && msg.m_size - msg.m_read >= 2) { + if (msg.Tell() <= msg.Size() && msg.Size() - msg.Tell() >= 2) { uint16_t logonFlags = 0x0; msg.Get(logonFlags); - if (msg.m_read <= msg.m_size) { + if (msg.Tell() <= msg.Size()) { if (this->m_srpClient.VerifyServerProof(static_cast(serverProof), 20)) { this->SetState(2); this->m_clientResponse->LogonResult(Grunt::GRUNT_RESULT_11, nullptr, 0, 0); @@ -282,28 +282,28 @@ int32_t Grunt::ClientLink::CmdAuthReconnectProof(CDataStore& msg) { } int32_t Grunt::ClientLink::CmdRealmList(CDataStore& msg) { - if (msg.m_read > msg.m_size || msg.m_size - msg.m_read < 2) { + if (msg.Tell() > msg.Size() || msg.Size() - msg.Tell() < 2) { return 0; } uint16_t size; msg.Get(size); - if (msg.m_read > msg.m_size || msg.m_size - msg.m_read < size) { + if (msg.Tell() > msg.Size() || msg.Size() - msg.Tell() < size) { return 0; } - uint32_t startData = msg.m_read; + uint32_t startData = msg.Tell(); uint32_t padding; msg.Get(padding); - uint32_t startList = msg.m_read; + uint32_t startList = msg.Tell(); uint16_t count; msg.Get(count); - for (uint32_t i = 0; i < count && msg.m_read < msg.m_size; i++) { + for (uint32_t i = 0; i < count && msg.Tell() < msg.Size(); i++) { uint8_t realmType; msg.Get(realmType); @@ -350,13 +350,13 @@ int32_t Grunt::ClientLink::CmdRealmList(CDataStore& msg) { uint16_t padding2; msg.Get(padding2); - if (msg.m_read <= msg.m_size && msg.m_read - startData == size) { - uint32_t endData = msg.m_read; - msg.m_read = startList; + if (msg.Tell() <= msg.Size() && msg.Tell() - startData == size) { + uint32_t endData = msg.Tell(); + msg.Seek(startList); this->m_clientResponse->RealmListResult(&msg); - msg.m_read = endData; + msg.Seek(endData); return 2; } @@ -457,7 +457,7 @@ void Grunt::ClientLink::LogonNewSession(const Grunt::ClientLink::Logon& logon) { } void Grunt::ClientLink::PackLogon(CDataStore& msg, const Logon& logon) { - uint32_t startPos = msg.m_size; + uint32_t startPos = msg.Size(); uint16_t tmpSize = 0; msg.Put(tmpSize); @@ -477,7 +477,7 @@ void Grunt::ClientLink::PackLogon(CDataStore& msg, const Logon& logon) { msg.Put(accountNameLen); msg.PutData(this->m_accountName, accountNameLen); - msg.Set(startPos, msg.m_size - startPos - 2); + msg.Set(startPos, msg.Size() - startPos - 2); } void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) { @@ -522,9 +522,9 @@ void Grunt::ClientLink::Send(CDataStore& msg) { if (this->m_connection) { void* data; - msg.GetDataInSitu(data, msg.m_size); + msg.GetDataInSitu(data, msg.Size()); - this->m_connection->SendRaw(static_cast(data), msg.m_size, false); + this->m_connection->SendRaw(static_cast(data), msg.Size(), false); } this->m_critSect.Leave(); @@ -565,15 +565,15 @@ void Grunt::ClientLink::WCDataReady(WowConnection* conn, uint32_t timeStamp, uin uint32_t pos = 0; if (Grunt::Command::Process(this->m_datastore1B0, Grunt::s_clientCommands, 7u, *this, pos)) { - auto remainingBytes = this->m_datastore1B0.m_size - pos; - this->m_datastore1B0.m_read = pos; + auto remainingBytes = this->m_datastore1B0.Size() - pos; + this->m_datastore1B0.Seek(pos); void* remainingData; this->m_datastore1B0.GetDataInSitu(remainingData, remainingBytes); - this->m_datastore1B0.m_read = -1; + this->m_datastore1B0.Seek(-1); this->m_datastore1B0.Reset(); this->m_datastore1B0.PutData(remainingData, remainingBytes); } else { - this->m_datastore1B0.m_read = -1; + this->m_datastore1B0.Seek(-1); this->m_datastore1B0.Reset(); this->Disconnect(); } diff --git a/src/net/grunt/Command.hpp b/src/net/grunt/Command.hpp index 2fe2e86..9280824 100644 --- a/src/net/grunt/Command.hpp +++ b/src/net/grunt/Command.hpp @@ -50,7 +50,7 @@ int32_t Grunt::Command::Process(CDataStore& msg, Command* commands, uint32 } if (result == 2) { - pos = msg.m_read; + pos = msg.Tell(); } } diff --git a/src/net/login/LoginResponse.cpp b/src/net/login/LoginResponse.cpp index cc6251b..b4ba0b6 100644 --- a/src/net/login/LoginResponse.cpp +++ b/src/net/login/LoginResponse.cpp @@ -57,7 +57,7 @@ void LoginResponse::HandleRealmData(uint32_t a2, CDataStore* msg) { realm.revision = 0; } - if (msg->m_read > msg->m_size) { + if (msg->Tell() > msg->Size()) { break; } @@ -78,7 +78,7 @@ void LoginResponse::HandleRealmData(uint32_t a2, CDataStore* msg) { msg->Get(reinterpret_cast(this->uint10)); // Overrun or underrun - if (msg->m_read > msg->m_size || !msg->IsRead()) { + if (msg->Tell() > msg->Size() || !msg->IsRead()) { this->m_realmList.Clear(); this->RealmEnumCallback(4); } diff --git a/src/ui/CSimpleFont.cpp b/src/ui/CSimpleFont.cpp index 2f614b2..4aca031 100644 --- a/src/ui/CSimpleFont.cpp +++ b/src/ui/CSimpleFont.cpp @@ -44,7 +44,7 @@ CSimpleFont* CSimpleFont::GetFont(const char* name, int32_t a2) { font->UnregisterScriptObject(font->m_name); } - font->m_name = hashed->m_key.m_str; + font->m_name = hashed->m_key.GetString(); if (font->m_name) { font->RegisterScriptObject(font->m_name); diff --git a/src/ui/FrameScript.cpp b/src/ui/FrameScript.cpp index 558c517..b812b2f 100644 --- a/src/ui/FrameScript.cpp +++ b/src/ui/FrameScript.cpp @@ -94,7 +94,7 @@ str.join = strjoin str.replace = strreplace)"; const char* FrameScript_EventObject::GetName() { - return this->m_key.m_str; + return this->m_key.GetString(); } int64_t OsGetAsyncClocksPerSecond() {