Remove Win32 byte types from texture packets

This commit is contained in:
notmatthewbeshay
2026-03-10 01:17:32 +11:00
parent 6026f078ac
commit 474d8b2896
4 changed files with 19 additions and 19 deletions

View File

@@ -9,7 +9,7 @@
TexturePacket::TexturePacket()
{
this->textureName = L"";
this->dwBytes = 0;
this->dataBytes = 0;
this->pbData = NULL;
}
@@ -22,11 +22,11 @@ TexturePacket::~TexturePacket()
// }
}
TexturePacket::TexturePacket(const std::wstring &textureName, PBYTE pbData, DWORD dwBytes)
TexturePacket::TexturePacket(const std::wstring &textureName, std::uint8_t *pbData, std::uint32_t dataBytes)
{
this->textureName = textureName;
this->pbData = pbData;
this->dwBytes = dwBytes;
this->dataBytes = dataBytes;
}
void TexturePacket::handle(PacketListener *listener)
@@ -37,13 +37,13 @@ void TexturePacket::handle(PacketListener *listener)
void TexturePacket::read(DataInputStream *dis) //throws IOException
{
textureName = dis->readUTF();
dwBytes = (DWORD)dis->readShort();
dataBytes = (std::uint32_t)dis->readShort();
if(dwBytes>0)
if(dataBytes>0)
{
this->pbData= new BYTE [dwBytes];
this->pbData= new std::uint8_t [dataBytes];
for(DWORD i=0;i<dwBytes;i++)
for(std::uint32_t i=0;i<dataBytes;i++)
{
this->pbData[i] = dis->readByte();
}
@@ -53,8 +53,8 @@ void TexturePacket::read(DataInputStream *dis) //throws IOException
void TexturePacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeUTF(textureName);
dos->writeShort((short)dwBytes);
for(DWORD i=0;i<dwBytes;i++)
dos->writeShort((short)dataBytes);
for(std::uint32_t i=0;i<dataBytes;i++)
{
dos->writeByte(this->pbData[i]);
}