aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/frontend/qt_sdl/LocalMP.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/frontend/qt_sdl/LocalMP.cpp b/src/frontend/qt_sdl/LocalMP.cpp
index 18d1b65..b90ff05 100644
--- a/src/frontend/qt_sdl/LocalMP.cpp
+++ b/src/frontend/qt_sdl/LocalMP.cpp
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
#ifdef __WIN32__
#include <windows.h>
@@ -246,9 +247,9 @@ void SemReset(int num)
bool Init()
{
- pcap_t* handle = pcap_open_dead(DLT_NULL, 1 << 16);
+ pcap_t* handle = pcap_open_dead(DLT_USER0, 1 << 16);
char filename[80];
- snprintf(filename, 79, "melon_instance_%d.pcap", InstanceID);
+ snprintf(filename, 79, "melon_%lu.pcap", time(NULL));
dumper = pcap_dump_open(handle, filename);
MPQueue = new QSharedMemory("melonNIFI");
@@ -397,6 +398,12 @@ void FIFORead(int fifo, void* buf, int len)
if (fifo == 0) PacketReadOffset = offset;
else ReplyReadOffset = offset;
+
+ struct pcap_pkthdr p;
+ p.len = len;
+ p.caplen = len;
+ gettimeofday(&p.ts, NULL);
+ pcap_dump((u_char*) dumper, &p, (u_char*) buf);
}
void FIFOWrite(int fifo, void* buf, int len)
@@ -433,6 +440,12 @@ void FIFOWrite(int fifo, void* buf, int len)
if (fifo == 0) header->PacketWriteOffset = offset;
else header->ReplyWriteOffset = offset;
+
+ struct pcap_pkthdr p;
+ p.len = len;
+ p.caplen = len;
+ gettimeofday(&p.ts, NULL);
+ pcap_dump((u_char*) dumper, &p, (u_char*) buf);
}
int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp)
@@ -488,12 +501,6 @@ int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp)
}
}
- struct pcap_pkthdr p;
- p.len = len;
- p.caplen = len;
- gettimeofday(&p.ts, NULL);
- pcap_dump((u_char*) dumper, &p, packet);
-
return len;
}
@@ -545,12 +552,6 @@ int RecvPacketGeneric(u8* packet, bool block, u64* timestamp)
if (timestamp) *timestamp = pktheader.Timestamp;
MPQueue->unlock();
- struct pcap_pkthdr p;
- p.len = pktheader.Length;
- p.caplen = pktheader.Length;
- gettimeofday(&p.ts, NULL);
- pcap_dump((u_char*) dumper, &p, packet);
-
return pktheader.Length;
}
}