Skip to content

Commit b8d852b

Browse files
committed
Update ReadMe, Include Example, Changes to port and titleid to not mess with original sys-netcheat
1 parent 5ef8f67 commit b8d852b

File tree

6 files changed

+96
-6
lines changed

6 files changed

+96
-6
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
._*
33
build
44
*.kip
5-
*.elf
5+
*.elf
6+
*.nso
7+
*.nsp
8+
*.npdm

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,15 @@ Don't even think of blaming me if anything goes wrong with you using this. It's
2626
### screen capture:
2727
- [ ] capture current screen and send it
2828

29+
# Installation
30+
I've only tried this on Atmosphere (0.10.2), so if you are using a different cfw your experience might vary.
31+
32+
Copy the sys-botbase.nsp file to sdmc://atmosphere/contents/430000000000000B and rename it to exefs.nsp.
33+
Create a new folder in sdmc://atmosphere/contents/430000000000000B names "flags".
34+
Create a empty file called boot2.flag inside this folder.
35+
Restart your switch.
36+
37+
The sysmodule opens a socket connection on port 6000. See the python example on how to talk to the sysmodule and what commands are available.
38+
2939

3040
# big thank you to jakibaki for a great sysmodule base to learn and work with, as well as being helpful on the Reswitched discord!

example_PokemonSwSh_SurpriseTrade.py

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#Simple example on how to connect to and send commands to the sys module.
2+
#The example is for Pokemon Sword/Shield, it reads a .ek8 file from a certain file path, injects it into box1slot1
3+
#and starts a surprise trade with the given pokemon. It waits a certain amount of time (hoping the trade has completed)
4+
#before retrieving the new pokemon. Finally it extracts the pokemons .ek8 data from the game and saves it to the hard drive.
5+
#The script assumes the game is set up in a way that the character is not currently in any menus and that the cursor of the
6+
#pokebox is on box1slot1.
7+
8+
#The script isn't exactly robust, there are many ways to make it better (for example one could compare the box1slot1 data in
9+
#RAM with that of the pokemon sent to see if a trade has been found and if not back out of the menu to search for another 10
10+
#seconds or so instead of waiting a fixed 45 seconds), but it is rather meant as a showcase of the functionalites of the
11+
#sysmodule anyway.
12+
13+
#Commands:
14+
#make sure to append \r\n to the end of the command string or the switch args parser might not work
15+
#responses end with a \n (only poke has a response atm)
16+
17+
#click A/B/X/Y/LSTICK/RSTICK/L/R/ZL/ZR/PLUS/MINUS/DLEFT/DUP/DDOWN/DRIGHT/HOME/CAPTURE
18+
#press A/B/X/Y/LSTICK/RSTICK/L/R/ZL/ZR/PLUS/MINUS/DLEFT/DUP/DDOWN/DRIGHT/HOME/CAPTURE
19+
#release A/B/X/Y/LSTICK/RSTICK/L/R/ZL/ZR/PLUS/MINUS/DLEFT/DUP/DDOWN/DRIGHT/HOME/CAPTURE
20+
21+
#peek <address in hex, prefaced by 0x> <amount of bytes, dec or hex with 0x>
22+
#poke <address in hex, prefaced by 0x> <data, if in hex prefaced with 0x>
23+
24+
#setStick LEFT/RIGHT <xVal from -0x8000 to 0x7FFF> <yVal from -0x8000 to 0x7FFF
25+
26+
27+
import socket
28+
import time
29+
import binascii
30+
31+
32+
def sendCommand(s, content):
33+
content += '\r\n' #important for the parser on the switch side
34+
s.sendall(content.encode())
35+
36+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
37+
s.connect(("192.168.178.25", 6000))
38+
39+
fileIn = open("C:/temp/toInject.ek8", "rb")
40+
pokemonToInject = fileIn.read(344)
41+
pokemonToInject = str(binascii.hexlify(pokemonToInject), "utf-8")
42+
43+
time.sleep(2)
44+
while True:
45+
sendCommand(s, f"poke 0x4293D8B0 0x{pokemonToInject}") #read pokemon from file and inject it into box1slot1 for trade
46+
47+
48+
sendCommand(s, "click Y")
49+
time.sleep(1)
50+
sendCommand(s, "click DDOWN")
51+
time.sleep(0.5)
52+
sendCommand(s, "click A")
53+
time.sleep(4)
54+
sendCommand(s, "click A")
55+
time.sleep(0.7)
56+
sendCommand(s, "click A")
57+
time.sleep(8)
58+
59+
sendCommand(s, "click A")
60+
time.sleep(0.7)
61+
sendCommand(s, "click A")
62+
time.sleep(0.7)
63+
sendCommand(s, "click A")
64+
time.sleep(0.7)
65+
66+
time.sleep(45) #Time we wait for a trade
67+
sendCommand(s, "click Y")
68+
time.sleep(0.7)
69+
time.sleep(30) #probably needs to be longer for trade evolutions
70+
71+
sendCommand(s, "peek 0x4293D8B0 344") #get pokemon from box1slot1
72+
time.sleep(0.5) #give time to answer
73+
pokemonBytes = s.recv(689)
74+
pokemonBytes = pokemonBytes[0:-1] #cut off \n at the end
75+
fileOut = open("C:/temp/lastReceived.ek8", "wb")
76+
fileOut.write(binascii.unhexlify(pokemonBytes))
77+
fileOut.close()

source/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "args.h"
1212
#include "util.h"
1313

14-
#define TITLE_ID 0x420000000000000F
14+
#define TITLE_ID 0x430000000000000B
1515
#define HEAP_SIZE 0x000540000
1616

1717
// we aren't an applet

source/util.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int setupServerSocket()
1616
lissock = socket(AF_INET, SOCK_STREAM, 0);
1717
server.sin_family = AF_INET;
1818
server.sin_addr.s_addr = INADDR_ANY;
19-
server.sin_port = htons(5555);
19+
server.sin_port = htons(6000);
2020

2121
while (bind(lissock, (struct sockaddr *)&server, sizeof(server)) < 0)
2222
{

sys-botbase.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "sys-botbase",
3-
"title_id": "0x430000000000000A",
4-
"title_id_range_min": "0x430000000000000A",
5-
"title_id_range_max": "0x430000000000000A",
3+
"title_id": "0x430000000000000B",
4+
"title_id_range_min": "0x430000000000000B",
5+
"title_id_range_max": "0x430000000000000B",
66
"main_thread_stack_size": "0x00024000",
77
"main_thread_priority": 49,
88
"default_cpu_id": 3,

0 commit comments

Comments
 (0)