From 1d3ba3e72efcb92b96fe8a8dbfeb839bb738f2c9 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 31 Aug 2024 16:50:50 +0200 Subject: more fiddling --- captures.txt | 19 +++++++++++++++++++ src/frontend/qt_sdl/LocalMP.cpp | 29 ++++++++++++++--------------- src/vsr.h | 2 ++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/captures.txt b/captures.txt index 8028a8c..cc80674 100644 --- a/captures.txt +++ b/captures.txt @@ -8,3 +8,22 @@ melon_1714566548.pcap: 1 pixel vertical line, then 1 pixel horizontal line (chec melon_1714646100.pcap: used to count packet counts for various message sizes +melon_1724322848_instance_0.pcap: Three-way pictochat room +melon_1724322850_instance_1.pcap +melon_1724322852_instance_2.pcap + +melon_1724411902_MKDS_instance_0.pcap: Mario Kart DS capture (used for differentiating between other games and pictochat traffic) +melon_1724411904_MKDS_instance_1.pcap + +melon_1724421728_instance_0.pcap: Join room A, send message, B, msg, C, msg, D, msg +melon_1724421730_instance_1.pcap + +melon_1725101126_instance_0.pcap: Different message size experiments (new) +melon_1725101128_instance_1.pcap + +melon_1725101595_instance_0.pcap: (Almost) completely pink messages +melon_1725101597_instance_1.pcap + +melon_1725108450_instance_0.pcap: First decoded image +melon_1725108452_instance_1.pcap + diff --git a/src/frontend/qt_sdl/LocalMP.cpp b/src/frontend/qt_sdl/LocalMP.cpp index 0ca5921..27d1fd4 100644 --- a/src/frontend/qt_sdl/LocalMP.cpp +++ b/src/frontend/qt_sdl/LocalMP.cpp @@ -474,14 +474,24 @@ int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp) #endif if (len) { + u16 game_id = 0x0000; + if (len >= 26) game_id = *(u16*)(packet + 0x24); + bool pictochat = game_id == 0x03e6; + +#ifdef VSR_DROP_RESENDS + // resent messages can be dumped completely w/o affecting communication + u16 txhdr_new = *(u16*)(packet + 0x02); + if (type == 1 && pictochat && txhdr_new == 0) return len; +#endif + #ifdef VSR_MESSAGE_FIDDLING - // if message packet (has size 222 w/o ni-fi header) - if (fiddle && len == 222) { + u16 pcmeta_type = *(u16*)(packet + 0x2a); + if (fiddle && type == 1 && pictochat && pcmeta_type == 2) { // content type is message fragment const u8 fill = 0x33; // hot pink (#eb00eb) unsigned safe = 0; - // if content offset == 0 there is some very important info at the - // start of the message which must stay intact + // if content offset == 0 only fill from index 0x24 onward (first 8 + // bytes must stay intact, rest is padding) u16 content_offset = *(u16*)(packet + 0x32); if (content_offset == 0) { safe = 0x24; // don't touch the first 0x24 bytes @@ -490,17 +500,6 @@ int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp) for (size_t i = safe; i < 0xa0; i++) { packet[0x36 + i] = fill; } - - // // mainWindow->osdAddMessage(0x00ff00, "oops!"); - // // NOTE: packet indexes are after NIFI header! - // for (size_t i = 0; i < 0x80; i++) { - // packet[0x3e + i] = 0x11; - // } - // // packet[0x3e + 0x00] = 0x13; - // // packet[0x3e + 0x01] = 0x13; - - // // packet[0x3e + 0x02] = 0x33; - // // packet[0x3e + 0x04] = 0x33; } #endif diff --git a/src/vsr.h b/src/vsr.h index ec57f47..fce78c0 100644 --- a/src/vsr.h +++ b/src/vsr.h @@ -11,3 +11,5 @@ // add "Fiddle" menu bar item #define VSR_MESSAGE_FIDDLING +// drop non "new" frames (resends) +#define VSR_DROP_RESENDS -- cgit v1.2.3