0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-22 03:05:16 +00:00

I'm going to commit war crimes

This commit is contained in:
Sanae 2022-04-27 14:17:02 -06:00
parent df2e976782
commit 605be3947f
3 changed files with 6 additions and 7 deletions

View file

@ -41,15 +41,14 @@ public class Client : IDisposable {
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
Logger.Info($"Pre-header {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}");
try {
PacketHeader header = new PacketHeader {
Server.FillPacket(new PacketHeader {
Id = sender?.Id ?? Id,
Type = packetAttribute.Type,
PacketSize = packet.Size
};
Server.FillPacket(header, packet, memory.Memory);
}, packet, memory.Memory);
}
catch (Exception e) {
Logger.Error($"I will lose my shit {e}");
Logger.Error($"I will lose my shit {e} {memory.Memory.Span[..Constants.HeaderSize].Length} {memory.Memory.Span[Constants.HeaderSize..].Length} {packet.Size}");
}
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)

View file

@ -12,9 +12,9 @@ public struct GamePacket : IPacket {
public GamePacket() { }
public short Size => 0x3A;
public short Size => 0x3C;
public void Serialize(Span<byte> data) {
MemoryMarshal.Write(data[..0], ref Is2d);
MemoryMarshal.Write(data, ref Is2d);
MemoryMarshal.Write(data[1..], ref ScenarioNum);
Encoding.UTF8.GetBytes(Stage).CopyTo(data[2..(2 + StageSize)]);
}