3dscontroller-ng/DataDebug.py

43 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python
# Compatible with both Python 2.7.6 and 3.4.3
from __future__ import print_function
import socket, struct, time
##########################################################
# CONFIGURABLE REGION START - Don't touch anything above #
##########################################################
port = 42020
########################################################
# CONFIGURABLE REGION END - Don't touch anything below #
########################################################
def pprint(obj):
import pprint
pprint.PrettyPrinter().pprint(obj)
class x: pass
command = x()
command.CONNECT = 0
command.KEYS = 1
command.SCREENSHOT = 2
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("", port))
while True:
rawdata, addr = sock.recvfrom(4092)
rawdata = bytearray(rawdata)
print("received message", rawdata)
if rawdata[0]==command.CONNECT:
print("Connected with 3DS at address",addr)
pass # CONNECT packets are empty
#pprint(data)
if rawdata[0]==command.SCREENSHOT:
pass # unused by both 3DS and PC applications