remove whitespaces

This commit is contained in:
Fijxu 2025-01-30 01:41:14 -03:00
parent 28adbd583a
commit 39ad3a268a
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
4 changed files with 29 additions and 29 deletions

View file

@ -38,7 +38,7 @@ btn_map = {
} }
device = { device = {
# EV_ABS is for Absolute movement with static values, # EV_ABS is for Absolute movement with static values,
# like the sticks and the volume # like the sticks and the volume
e.EV_ABS: [ e.EV_ABS: [
(e.ABS_X, AbsInfo(0, -159, 159, 0, 10, 0)), (e.ABS_X, AbsInfo(0, -159, 159, 0, 10, 0)),
@ -134,7 +134,7 @@ keys.CDown = 1<<31 # circle pad
def press_key(key): def press_key(key):
ui.write(e.EV_KEY, key, 1) ui.write(e.EV_KEY, key, 1)
ui.syn() ui.syn()
def release_key(key): def release_key(key):
ui.write(e.EV_KEY,key, 0) ui.write(e.EV_KEY,key, 0)
ui.syn() ui.syn()
@ -152,11 +152,11 @@ while True:
rawdata, addr = sock.recvfrom(4092) rawdata, addr = sock.recvfrom(4092)
rawdata = bytearray(rawdata) rawdata = bytearray(rawdata)
# print("Received message", rawdata) # print("Received message", rawdata)
if rawdata[0]==command.CONNECT: if rawdata[0]==command.CONNECT:
print("Connected with 3DS at address", addr) print("Connected with 3DS at address", addr)
pass # CONNECT packets are empty pass # CONNECT packets are empty
if rawdata[0]==command.KEYS: if rawdata[0]==command.KEYS:
# Just to explain this fuckery of struct.unpack: # Just to explain this fuckery of struct.unpack:
# <bbxxIhhHHhhBxxxhhhxx: # <bbxxIhhHHhhBxxxhhhxx:
@ -165,7 +165,7 @@ while True:
# xx: Just 2 padding bytes, they are bytes without any data so with `xx` we skip them # xx: Just 2 padding bytes, they are bytes without any data so with `xx` we skip them
# I: A signed integer of 4 bytes, the `keys` pressed data is here # I: A signed integer of 4 bytes, the `keys` pressed data is here
# hh: 2 shorts which they are 2 bytes each one, 4 bytes on total, the X and Y data of the Circle Pad is here # hh: 2 shorts which they are 2 bytes each one, 4 bytes on total, the X and Y data of the Circle Pad is here
# HH: 2 shorts which they are 2 bytes each one, 4 bytes on total, the X and Y data of the Touch Pad is here # HH: 2 shorts which they are 2 bytes each one, 4 bytes on total, the X and Y data of the Touch Pad is here
# (where are you pressing in the screen, it could be useful somehow I guess.) # (where are you pressing in the screen, it could be useful somehow I guess.)
# hh: 2 shorts which they are 2 bytes each one, 4 bytes on total, the X and Y data of the C Stick Pad is here # hh: 2 shorts which they are 2 bytes each one, 4 bytes on total, the X and Y data of the C Stick Pad is here
# B: A unsigned char, just 1 byte and represents the value of the Volume Slider of the 3DS # B: A unsigned char, just 1 byte and represents the value of the Volume Slider of the 3DS
@ -175,7 +175,7 @@ while True:
# hhh: 3 shorts which they are 2 bytes each one, 6 bytes on total, the X, Y, Z data of the ACCELEROMETER is here # hhh: 3 shorts which they are 2 bytes each one, 6 bytes on total, the X, Y, Z data of the ACCELEROMETER is here
# xxx: And another 2 extra bytes of padding from the fucking nowhere # xxx: And another 2 extra bytes of padding from the fucking nowhere
fields = struct.unpack("<bbxxIhhHHhhBxxxhhhxxhhhxx", rawdata) fields = struct.unpack("<bbxxIhhHHhhBxxxhhhxxhhhxx", rawdata)
data = { data = {
"command": fields[0], "command": fields[0],
"keyboardActive": fields[1], "keyboardActive": fields[1],
@ -194,17 +194,17 @@ while True:
"accelY": fields[14], "accelY": fields[14],
"accelZ": fields[15] "accelZ": fields[15]
} }
if (debug): if (debug):
def pprint(obj): def pprint(obj):
import pprint import pprint
pprint.PrettyPrinter().pprint(obj) pprint.PrettyPrinter().pprint(obj)
pprint(data) pprint(data)
newkeys = data["keys"] & ~prevkeys newkeys = data["keys"] & ~prevkeys
oldkeys = ~data["keys"] & prevkeys oldkeys = ~data["keys"] & prevkeys
prevkeys = data["keys"] prevkeys = data["keys"]
for btnid in range(16): for btnid in range(16):
if newkeys & (1<<btnid): if newkeys & (1<<btnid):
press_key(btn_map[keynames[btnid]]) press_key(btn_map[keynames[btnid]])
@ -214,13 +214,13 @@ while True:
press_key(btn_map["Tap"]) press_key(btn_map["Tap"])
if oldkeys & keys.Tap: if oldkeys & keys.Tap:
release_key(btn_map["Tap"]) release_key(btn_map["Tap"])
ui.write(e.EV_ABS, e.ABS_X, data["circleX"]) ui.write(e.EV_ABS, e.ABS_X, data["circleX"])
ui.write(e.EV_ABS, e.ABS_Y, 0-data["circleY"]) ui.write(e.EV_ABS, e.ABS_Y, 0-data["circleY"])
ui.write(e.EV_ABS, e.ABS_RX, data["cstickX"]) ui.write(e.EV_ABS, e.ABS_RX, data["cstickX"])
ui.write(e.EV_ABS, e.ABS_RY, data["cstickY"]) ui.write(e.EV_ABS, e.ABS_RY, data["cstickY"])
ui.write(e.EV_ABS, e.ABS_VOLUME, data["vol"]) ui.write(e.EV_ABS, e.ABS_VOLUME, data["vol"])
ui.syn() ui.syn()
uiGyro.write(e.EV_ABS, e.ABS_X, data["accelX"]) uiGyro.write(e.EV_ABS, e.ABS_X, data["accelX"])
uiGyro.write(e.EV_ABS, e.ABS_Y, data["accelY"]) uiGyro.write(e.EV_ABS, e.ABS_Y, data["accelY"])

View file

@ -126,7 +126,7 @@ keys.GyroDown = 1<<35 # circle pad
def press_key(key): def press_key(key):
device.emit(key, 1) device.emit(key, 1)
def release_key(key): def release_key(key):
device.emit(key,0) device.emit(key,0)
@ -143,14 +143,14 @@ while True:
rawdata, addr = sock.recvfrom(4092) rawdata, addr = sock.recvfrom(4092)
rawdata = bytearray(rawdata) rawdata = bytearray(rawdata)
print("received message", rawdata, "from", addr) print("received message", rawdata, "from", addr)
if rawdata[0]==command.CONNECT: if rawdata[0]==command.CONNECT:
print("Connected with 3DS at address",addr) print("Connected with 3DS at address",addr)
pass # CONNECT packets are empty pass # CONNECT packets are empty
if rawdata[0]==command.KEYS: if rawdata[0]==command.KEYS:
fields = struct.unpack("<bbxxIhhHHhhBxxxhhhxx", rawdata) fields = struct.unpack("<bbxxIhhHHhhBxxxhhhxx", rawdata)
data = { data = {
"command": fields[0], "command": fields[0],
"keyboardActive": fields[1], "keyboardActive": fields[1],
@ -166,13 +166,13 @@ while True:
"gyroY": fields[11], "gyroY": fields[11],
"gyroZ": fields[12] "gyroZ": fields[12]
} }
pprint(data) pprint(data)
newkeys = data["keys"] & ~prevkeys newkeys = data["keys"] & ~prevkeys
oldkeys = ~data["keys"] & prevkeys oldkeys = ~data["keys"] & prevkeys
prevkeys = data["keys"] prevkeys = data["keys"]
for btnid in range(16): for btnid in range(16):
if newkeys & (1<<btnid): if newkeys & (1<<btnid):
press_key(btn_map[keynames[btnid]]) press_key(btn_map[keynames[btnid]])
@ -182,7 +182,7 @@ while True:
press_key(btn_map["Tap"]) press_key(btn_map["Tap"])
if oldkeys & keys.Tap: if oldkeys & keys.Tap:
release_key(btn_map["Tap"]) release_key(btn_map["Tap"])
device.emit(uinput.ABS_X, data["circleX"], syn=False) device.emit(uinput.ABS_X, data["circleX"], syn=False)
device.emit(uinput.ABS_Y, 0-data["circleY"]) device.emit(uinput.ABS_Y, 0-data["circleY"])

View file

@ -31,12 +31,12 @@ while True:
rawdata, addr = sock.recvfrom(4092) rawdata, addr = sock.recvfrom(4092)
rawdata = bytearray(rawdata) rawdata = bytearray(rawdata)
print("received message", rawdata) print("received message", rawdata)
if rawdata[0]==command.CONNECT: if rawdata[0]==command.CONNECT:
print("Connected with 3DS at address",addr) print("Connected with 3DS at address",addr)
pass # CONNECT packets are empty pass # CONNECT packets are empty
#pprint(data) #pprint(data)
if rawdata[0]==command.SCREENSHOT: if rawdata[0]==command.SCREENSHOT:
pass # unused by both 3DS and PC applications pass # unused by both 3DS and PC applications

View file

@ -17,19 +17,19 @@ Option:
MediaFootPadding : false # If true CCI files are created with padding MediaFootPadding : false # If true CCI files are created with padding
EnableCrypt : false # Enables encryption for NCCH and CIA EnableCrypt : false # Enables encryption for NCCH and CIA
EnableCompress : true # Compresses where applicable (currently only exefs:/.code) EnableCompress : true # Compresses where applicable (currently only exefs:/.code)
AccessControlInfo: AccessControlInfo:
CoreVersion : 2 CoreVersion : 2
# Exheader Format Version # Exheader Format Version
DescVersion : 2 DescVersion : 2
# Minimum Required Kernel Version (below is for 4.5.0) # Minimum Required Kernel Version (below is for 4.5.0)
ReleaseKernelMajor : "02" ReleaseKernelMajor : "02"
ReleaseKernelMinor : "33" ReleaseKernelMinor : "33"
# ExtData # ExtData
UseExtSaveData : false # enables ExtData UseExtSaveData : false # enables ExtData
#ExtSaveDataId : 0x300 # only set this when the ID is different to the UniqueId #ExtSaveDataId : 0x300 # only set this when the ID is different to the UniqueId
# FS:USER Archive Access Permissions # FS:USER Archive Access Permissions
@ -84,11 +84,11 @@ AccessControlInfo:
# Virtual Address Mappings # Virtual Address Mappings
IORegisterMapping: IORegisterMapping:
- 1ff00000-1ff7ffff # DSP memory - 1ff00000-1ff7ffff # DSP memory
MemoryMapping: MemoryMapping:
- 1f000000-1f5fffff:r # VRAM - 1f000000-1f5fffff:r # VRAM
# Accessible SVCs, <Name>:<ID> # Accessible SVCs, <Name>:<ID>
SystemCallAccess: SystemCallAccess:
ArbitrateAddress: 34 ArbitrateAddress: 34
Backdoor: 123 Backdoor: 123
Break: 60 Break: 60
@ -183,7 +183,7 @@ SystemControlInfo:
# Modules that run services listed above should be included below # Modules that run services listed above should be included below
# Maximum 48 dependencies # Maximum 48 dependencies
# <module name>:<module titleid> # <module name>:<module titleid>
Dependency: Dependency:
ac: 0x0004013000002402 ac: 0x0004013000002402
act: 0x0004013000003802 act: 0x0004013000003802
am: 0x0004013000001502 am: 0x0004013000001502