Quote:
Originally Posted by SimplyPerfection
Why do you define the question and answer as smallbyte? It's obviously strings
|
It's one of the ways you can use pointers to write strings to the packets.
I forget what source this is from but yah, as someone mentioned it's wrong.
Example of sbyte from hybrids new source.
Code:
public unsafe struct AuthResponsePacket
{
public ushort Size;
public ushort Type;
public uint Key2;
public uint Key1;
private fixed sbyte szIPAddress[16];
public uint Port;
public unsafe string IPAddress
{
get { fixed (sbyte* bp = szIPAddress) { return new string(bp); } }
set
{
string ip = value;
fixed (sbyte* bp = szIPAddress)
{
for (int i = 0; i < ip.Length; i++)
bp[i] = (sbyte)ip[i];
}
}
}
public static AuthResponsePacket Create()
{
AuthResponsePacket retn = new AuthResponsePacket();
retn.Size = 0x20;
retn.Type = 0x41F;
return retn;
}
}
It IS a string it's just a way of storing a string in such a way that it can be read/written simply using pointers.
It's basically saying in that packet that you are allocating 16 bytes for the string packet in the structure. That way it essentially holds the same structure in memory as it does in a packet and can be easily converted without using messy writers like many public sources use.
Ps: I'm sure you know it but 16 bytes is the length for any non specified string length that tq uses.