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 --- src/frontend/qt_sdl/LocalMP.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/frontend/qt_sdl') 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 -- cgit v1.2.3