aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl/LocalMP.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/qt_sdl/LocalMP.cpp')
-rw-r--r--src/frontend/qt_sdl/LocalMP.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/frontend/qt_sdl/LocalMP.cpp b/src/frontend/qt_sdl/LocalMP.cpp
index 7fe4f64..32f08c8 100644
--- a/src/frontend/qt_sdl/LocalMP.cpp
+++ b/src/frontend/qt_sdl/LocalMP.cpp
@@ -49,8 +49,10 @@ pcap_dumper_t* dumper;
#endif
#ifdef VSR_MESSAGE_FIDDLING
+#include "Window.h"
#include <time.h>
-unsigned long test_start = time(NULL);
+extern MainWindow* mainWindow;
+bool fiddle = false;
#endif
using namespace melonDS;
@@ -457,19 +459,6 @@ int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp)
u16 mask = header->ConnectedBitmask;
-#ifdef VSR_MESSAGE_FIDDLING
- // fiddle the packets after 20 seconds
- unsigned long now = time(NULL);
- static bool first = true;
- bool fiddle = false;
- if (now - test_start > 20 && InstanceID == 0) {
- if (first == true)
- printf("[INSTANCE %d] started fiddling!\n", InstanceID);
- first = false;
- fiddle = true;
- }
-#endif
-
// TODO: check if the FIFO is full!
MPPacketHeader pktheader;
@@ -479,8 +468,8 @@ int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp)
pktheader.Length = len;
pktheader.Timestamp = timestamp;
-#ifdef VSR_DUMP_MESSAGES
- std::vector<uint8_t> buf;
+#ifdef VSR_MESSAGE_FIDDLING
+ static int package_idx = 0;
#endif
type &= 0xFFFF;
@@ -489,21 +478,32 @@ int SendPacketGeneric(u32 type, u8* packet, int len, u64 timestamp)
// seems to consistently trigger PACKET FIFO OVERFLOW errors
FIFOWrite(nfifo, &pktheader, sizeof(pktheader));
#ifdef VSR_DUMP_MESSAGES
+ std::vector<uint8_t> buf;
buf.insert(buf.end(), (uint8_t*) &pktheader, (uint8_t*) &pktheader + sizeof(pktheader));
#endif
if (len)
{
#ifdef VSR_MESSAGE_FIDDLING
- if (fiddle && len == 0xde) {
- // NOTE: packet indexes are after NIFI header!
- packet[0x80] = 0x11;
- packet[0x81] = 0x11;
- packet[0x82] = 0x11;
- packet[0x83] = 0x11;
- packet[0x84] = 0x11;
- packet[0x85] = 0x11;
- packet[0x86] = 0x11;
- packet[0x87] = 0x11;
+ // 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;
+ }
+
+ 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;
+ }
}
#endif