aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-08-31 16:50:50 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-08-31 16:50:50 +0200
commit1d3ba3e72efcb92b96fe8a8dbfeb839bb738f2c9 (patch)
tree248da45e3e75b068e0f65e1d26ecc75877aa2011 /src/frontend/qt_sdl
parent3fbcfeeb4b80e6c068aa9497e00d54878b791e3f (diff)
more fiddling
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r--src/frontend/qt_sdl/LocalMP.cpp29
1 files changed, 14 insertions, 15 deletions
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