aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-08-19 16:31:54 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-08-19 16:31:54 +0200
commit3fbcfeeb4b80e6c068aa9497e00d54878b791e3f (patch)
tree342322e3aeb4d51fd97aff90dd7238f920b188b9 /src/frontend
parent30de08bbf3be9011b56f9dc3d2322f492d6ec5c8 (diff)
more successful message fiddling
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/qt_sdl/LocalMP.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/frontend/qt_sdl/LocalMP.cpp b/src/frontend/qt_sdl/LocalMP.cpp
index 906f4d4..0ca5921 100644
--- a/src/frontend/qt_sdl/LocalMP.cpp
+++ b/src/frontend/qt_sdl/LocalMP.cpp
@@ -463,10 +463,6 @@ int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp)
pktheader.Length = len;
pktheader.Timestamp = timestamp;
-#ifdef VSR_MESSAGE_FIDDLING
- static int package_idx = 0;
-#endif
-
type &= 0xFFFF;
int nfifo = (type == 2) ? 1 : 0;
// NOTE: this is the ni-fi packet header, altering this header in any way
@@ -481,24 +477,30 @@ int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp)
#ifdef VSR_MESSAGE_FIDDLING
// if message packet (has size 222 w/o ni-fi header)
if (fiddle && len == 222) {
- // if fresh message (do not count resends)
- if (packet[0x02] == 0x02) {
- // corrupt all pixels in every nth package
- package_idx = (package_idx + 1) % 10;
+ 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
+ u16 content_offset = *(u16*)(packet + 0x32);
+ if (content_offset == 0) {
+ safe = 0x24; // don't touch the first 0x24 bytes
}
- if (true || package_idx == 0) {
- // 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;
+ 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