diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index aad2fb1b2c7cbec07b06b76c492f7b11ee714141..38c0597ec337683556deea2d646fdbffd82f93f6 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
procedure g_Net_SaveBanList();
procedure g_Net_DumpStart();
-procedure g_Net_DumpSendBuffer();
+procedure g_Net_DumpSendBuffer(Buf: pTBuffer);
procedure g_Net_DumpRecvBuffer(Buf: penet_uint8; Len: LongWord);
procedure g_Net_DumpEnd();
else
enet_peer_send(Peer, Ch, P);
end;
+ if NetDump then g_Net_DumpSendBuffer(B);
e_Buffer_Clear(B);
end;
end;
ID := Byte(NetEvent.peer^.data^);
if ID > High(NetClients) then Exit;
TC := @NetClients[ID];
+ if NetDump then
+ g_Net_DumpRecvBuffer(NetEvent.packet^.data, NetEvent.packet^.dataLength);
g_Net_HostMsgHandler(TC, NetEvent.packet);
end;
case NetEvent.kind of
ENET_EVENT_TYPE_RECEIVE:
begin
+ if NetDump then
+ g_Net_DumpRecvBuffer(NetEvent.packet^.data, NetEvent.packet^.dataLength);
g_Net_ClientMsgHandler(NetEvent.packet);
end;
case NetEvent.kind of
ENET_EVENT_TYPE_RECEIVE:
begin
+ if NetDump then
+ g_Net_DumpRecvBuffer(NetEvent.packet^.data, NetEvent.packet^.dataLength);
g_Net_ClientLightMsgHandler(NetEvent.packet);
end;
OuterLoop: Boolean;
MID: Byte;
Ptr: Pointer;
+ Len: LongWord;
msgStream: TMemoryStream;
begin
FillChar(downloadEvent, SizeOf(downloadEvent), 0);
begin
if (downloadEvent.kind = ENET_EVENT_TYPE_RECEIVE) and (downloadEvent.packet^.dataLength > 2) then
begin
+ Len := PWord(downloadEvent.packet^.data)^;
+ if Len = 0 then break;
Ptr := downloadEvent.packet^.data + 2; // skip length
MID := Byte(Ptr^);
NetDumpFile := createDiskFile(NETDUMP_FILENAME + '_client');
end;
-procedure g_Net_DumpSendBuffer();
+procedure g_Net_DumpSendBuffer(Buf: pTBuffer);
begin
+ writeInt(NetDumpFile, Byte($BA));
+ writeInt(NetDumpFile, Byte($BE));
+ writeInt(NetDumpFile, Byte($FF));
writeInt(NetDumpFile, gTime);
- writeInt(NetDumpFile, LongWord(NetOut.WritePos));
- writeInt(NetDumpFile, Byte(1));
- NetDumpFile.WriteBuffer(NetOut.Data[0], NetOut.WritePos);
+ writeInt(NetDumpFile, Byte($FF));
+ writeInt(NetDumpFile, LongWord(Buf^.WritePos));
+ writeInt(NetDumpFile, Byte($FF));
+ NetDumpFile.WriteBuffer(Buf^.Data[0], Buf^.WritePos);
end;
procedure g_Net_DumpRecvBuffer(Buf: penet_uint8; Len: LongWord);
begin
if (Buf = nil) or (Len = 0) then Exit;
+ writeInt(NetDumpFile, Byte($B0));
+ writeInt(NetDumpFile, Byte($0B));
+ writeInt(NetDumpFile, Byte($FF));
writeInt(NetDumpFile, gTime);
+ writeInt(NetDumpFile, Byte($FF));
writeInt(NetDumpFile, Len);
- writeInt(NetDumpFile, Byte(0));
+ writeInt(NetDumpFile, Byte($FF));
NetDumpFile.WriteBuffer(Buf^, Len);
end;