Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Sys-botbase Switch: Difference between revisions

From GameBrew
(Created page with "{{Infobox Switch Homebrews |title=Sys-botbase |image=sysbotbaseswitch.png |description=The purpose of this sys-module is to allow users to remote control their switch via wifi connection as well as to read and write to a games memory. |author=olliz0r |lastupdated=2023/04/03 |type=System Tools |version=2.3 |license=GPL-3.0 |download=https://dlhb.gamebrew.org/switchhomebrews/sysbotbaseswitch.7z |website=https://github.com/olliz0r/sys-botbase |source=https://github.com/olli...")
 
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Infobox Switch Homebrews
{{Infobox Switch Homebrews
|title=Sys-botbase
|title=sys-botbase
|image=sysbotbaseswitch.png
|image=sysbotbasenx.png
|description=The purpose of this sys-module is to allow users to remote control their switch via wifi connection as well as to read and write to a games memory.
|description=Sysmodule for simulating input and read/write memory over the network.
|author=olliz0r
|author=olliz0r
|lastupdated=2023/04/03
|lastupdated=2024/10/15
|type=System Tools
|type=Sysmodules
|version=2.3
|version=2.4
|license=GPL-3.0
|license=GPL-3.0
|download=https://dlhb.gamebrew.org/switchhomebrews/sysbotbaseswitch.7z
|download=https://dlhb.gamebrew.org/switchhomebrews/sysbotbasenx.7z
|website=https://github.com/olliz0r/sys-botbase
|website=https://github.com/olliz0r/sys-botbase
|source=https://github.com/olliz0r/sys-botbase
|source=https://github.com/olliz0r/sys-botbase
|donation=  
|donation=  
}}
}}{{lowercase title}}
{{#seo:
A Nintendo Switch (CFW) sys-module that allows users to remote control their Switch via sockets as well as read and write to a games memory. This can be used to create bots for games and other fun automation projects.
|title=Switch Homebrew Apps (System Tools) - GameBrew
 
|title_mode=append
'''Note:''' This project was created for the purpose of development for bot automation. Using a hacked Switch online can get you banned. The creators and maintainers of this project are not liable for any damages caused or bans received. Use at your own risk.
|image=sysbotbaseswitch.png
|image_alt=Sys-botbase
}}
Sys-botbase is a sys-module for Nintendo Switch (CFW) that enables users to remotely control their Switch through sockets, in addition to reading and writing to the game's memory. This functionality can be utilized to develop game bots and other exciting automation projects.


== Features ==
== Features ==
=== Remote Control ===
* Remote Control:
* Set controller state
** Set controller state.
* Simulate buttons press, hold, and release
** Simulate buttons press, hold, and release.
* Simulate touch screen drawing
** Simulate touch screen drawing.
=== Memory Reading and Writing ===
* Memory Reading and Writing:
* Read/write x amount bytes of consecutive memory from RAM based on:
** Read/write x amount bytes of consecutive memory from RAM based on:
*# Absolute memory address
*** i. Absolute memory address.
*# Address relative to main nso base
*** ii. Address relative to main nso base.
*# Address relative to heap base
*** iii. Address relative to heap base.
=== Screen Capture ===
* Screen Capture:
* Capture current screen and return as JPG
** Capture current screen and return as JPG.
 
==Installation==
Download [https://github.com/olliz0r/sys-botbase/releases/latest latest release] and extract into your Nintendo Switch SD card. Restart your Switch.


== Installation ==
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.
Download [https://github.com/olliz0r/sys-botbase/releases/latest latest release] and extract into your Nintendo Switch SD card. Restart your switch.


==Media==
==Media==
'''LiveHeX ( ͡° ͜ʖ ͡°) We live injecting now bois (powered by sys-botbase) - ([https://www.youtube.com/watch?v=xZL81r7QvNg Archit Date])'''<br>
'''LiveHeX ( ͡° ͜ʖ ͡°) We live injecting now bois (powered by sys-botbase) ([https://www.youtube.com/watch?v=xZL81r7QvNg Archit Date])'''<br>
<youtube>xZL81r7QvNg</youtube>
<youtube>xZL81r7QvNg</youtube>
==Known issues==
https://github.com/olliz0r/sys-botbase/issues


==Changelog==
==Changelog==
'''v.2.3'''
'''v2.4 2024/10/15'''
* All single-stream peek commands no longer require you to "chunk" the data as the sysmodule will do this to send large data quickly in one command. GetInfo() is now used to get the heap base to reduce overhead on all peek and poke commands.
*This is built with the changes to switch-tools that came with the latest version of the switch firmware.
* getTitleVersion was added courtesy of @6A-Realm
'''v2.31 2023/05/17'''
* Various info commands were added courtesy of @amel-am
* The amount of heapmem allocated is now 3.2MB down from 12MB. This may cause issues for some users with huge freezepools, but should not affect 99.9% of users.
* Smaller fixes were provided by @Lincoln-LM and @ELY3M
* Issues with ToTK mods and Tesla overlays should no longer be present.
'''v2.3 2023/04/03'''
* All single-stream peek commands no longer require you to "chunk" the data as the sysmodule will do this to send large data quickly in one command. <code>GetInfo()</code> is now used to get the heap base to reduce overhead on all peek and poke commands.
* <code>getTitleVersion</code> was added courtesy of @6A-Realm.
* Various info commands were added courtesy of @amel-am.
* Smaller fixes were provided by @Lincoln-LM and @ELY3M.
* Other smaller fixes are also included in this release.
* Other smaller fixes are also included in this release.
* Thank you to all the contributors.
* Thank you to all the contributors.
'''v.2.2'''
'''v2.2 2022/04/10'''
* Sys-botbase no longer inits fs or mounts the sd card. If you run a fork or adapt from sys-botbase then please make sure to yield the fs service once you're done with it to avoid hitting the too many sessions panic.
* Sys-botbase no longer inits fs or mounts the sd card. If you run a fork or adapt from sys-botbase then please make sure to yield the fs service once you're done with it to avoid hitting the too many sessions panic.
* screenOn and screenOff once again turn on/off the backlight. Many thanks to SciresM for yielding atmosphère's lbl service session until required such that we can do the same here. Note that this only works with Atmosphère 1.3.1 onwards.
* screenOn and screenOff once again turn on/off the backlight. Many thanks to SciresM for yielding atmosphère's lbl service session until required such that we can do the same here. Note that this only works with Atmosphère 1.3.1 onwards.
'''v.2.1.1'''
'''v2.1.1 2022/03/26'''
*This is an interim update until a stable 14.0.0 libnx is available, however it should work fine for the vast majority of cases.
*This is an interim update until a stable 14.0.0 libnx is available, however it should work fine for the vast majority of cases.
*All lbl sessions are allocated and as such screenOn/screenOff will no longer turn the backlight on/off.
*All lbl sessions are allocated and as such screenOn/screenOff will no longer turn the backlight on/off.
'''v.2.1'''
'''v2.1 2022/02/07'''
* This should fix an issue with certain virtual controllers not connecting correctly.
* This should fix an issue with certain virtual controllers not connecting correctly.
* isProgramRunning requires the entire identifier, so to check if the keyboard is open you would send isProgramRunning 0x0100000000001008\r\n
* <code>isProgramRunning</code> requires the entire identifier, so to check if the keyboard is open you would send <code>isProgramRunning 0x0100000000001008\r\n</code>
'''v.2.0'''
'''v2.0 2021/11/22'''
*The following commands were added:
*The following commands were added:
**Functionality:
**Functionality:
Line 65: Line 71:
*** peekAbsoluteMulti
*** peekAbsoluteMulti
*** controllerType
*** controllerType
*Multi commands are the same as their non-multi counterparts, and have the added benefit of accepting an array of addresses and sizes split by spaces, and return a sequential concat stream of bytes of all data that was looked up.
*<code>Multi</code> commands are the same as their non-multi counterparts, and have the added benefit of accepting an array of addresses and sizes split by spaces, and return a sequential concat stream of bytes of all data that was looked up.
*controllerType allows configuration of the controller from the default pro controller to other controllers, such as a single joy-con, ring-con, etc. Useful if you're writing a bot for something that requires a different controller, such as an LGPE bot. This must be configured to a HidDeviceType
*controllerType allows configuration of the controller from the default pro controller to other controllers, such as a single joy-con, ring-con, etc. Useful if you're writing a bot for something that requires a different controller, such as an LGPE bot. This must be configured to a HidDeviceType
*The amount of memory allocated by sys-botbase is now also reduced, and the backlight will now turn off when using the screenOff command.
*The amount of memory allocated by sys-botbase is now also reduced, and the backlight will now turn off when using the screenOff command.
'''v.1.9'''
'''v1.9 2021/09/20'''
*In addition to the title, this build has the pointerRelative command if you want a pointer solved with the value returned relative to the heap.
*In addition to the title, this build has the <code>pointerRelative</code> command if you want a pointer solved with the value returned relative to the heap.
'''v.1.8'''
'''v1.8 2021/04/19'''
*The home button will now glow if docked to your switch on startup to notify you sys-botbase is ready to accept requests.
*The home button will now glow if docked to your switch on startup to notify you sys-botbase is ready to accept requests.
*Additionally, it has the following new commands:
*Additionally, it has the following new commands:
Line 80: Line 86:
** screenOn
** screenOn
** charge
** charge
*Both screenOff and screenOn change the screen's IsScanning state. They are especially useful if you are running always-on bots that would benefit from slightly less power use.
*Both <code>screenOff</code> and <code>screenOn</code> change the screen's IsScanning state. They are especially useful if you are running always-on bots that would benefit from slightly less power use.
*Charge will return the current battery charge percentage as an integer between 0-100.
*<code>Charge</code> will return the current battery charge percentage as an integer between 0-100.
'''v.1.7'''
'''v1.7 2021/02/24'''
*Thanks to olli for giving me free rein to add cool new stuff and thanks to Red for the keyboard emulation research & implementation
*Thanks to olli for giving me free rein to add cool new stuff and thanks to Red for the keyboard emulation research & implementation
*Newly added commands with this version are below. If you are not using any of this functionality then feel free to stick with 1.6.
*Newly added commands with this version are below. If you are not using any of this functionality then feel free to stick with 1.6.
Line 108: Line 114:
** configure freezeRate <freezeRate (default is 3ms)>
** configure freezeRate <freezeRate (default is 3ms)>
*Most of the defaults are based on minimum pollrates for system applets. Both keySleepTime & pollRate should be set to a higher number if using an in-game keyboard as these are usually tied to framerate.
*Most of the defaults are based on minimum pollrates for system applets. Both keySleepTime & pollRate should be set to a higher number if using an in-game keyboard as these are usually tied to framerate.
'''v.1.6'''
'''v1.6 2020/11/01'''
* RTNX brought to my attention a nasty little bug that would randomly cause RAM pokes to go bad and corrupt, injecting the wrong data or potentially crashing the console.
* RTNX brought to my attention a nasty little bug that would randomly cause RAM pokes to go bad and corrupt, injecting the wrong data or potentially crashing the console.
* This release fixes that issue and should hopefully be the most stable version of sys-botbase to date.
* This release fixes that issue and should hopefully be the most stable version of sys-botbase to date.
* Thanks to Anubis and the army of testers for stress-testing!
* Thanks to Anubis and the army of testers for stress-testing.
'''v.1.5'''
'''v1.5 2020/06/11'''
*Switching back from dmntcht again. Version 1.4 creates a lot of issues when reading/writing, so this version is mainly to replace the old broken version.
*Switching back from dmntcht again. Version 1.4 creates a lot of issues when reading/writing, so this version is mainly to replace the old broken version.
'''v.1.4'''
'''v1.4 2020/03/06'''
* Switched back to dmntcht, stability issues should be solved.  
* Switched back to dmntcht, stability issues should be solved.  
* New commands:
* New commands:
** getTitleID - returns the titleid of the current open application
** getTitleID - returns the titleid of the current open application.
** getSystemLanguage - returns the consoles language setting, see
** getSystemLanguage - returns the consoles language setting, see.
** https://github.com/switchbrew/libnx/blob/86a5aa446695573ddea594199357185488a08f19/nx/include/switch/services/set.h#L25 for a mapping
** https://github.com/switchbrew/libnx/blob/86a5aa446695573ddea594199357185488a08f19/nx/include/switch/services/set.h#L25 for a mapping
** getHeapBase - returns the base address of the heap
** getHeapBase - returns the base address of the heap.
** pokeAbsolute/PeekAbsolute - same as peek/poke, but with a absolute
** pokeAbsolute/PeekAbsolute - same as peek/poke, but with a absolute.
** address instead of a heap offset
** address instead of a heap offset.
'''v.1.3'''
'''v1.3 2020/02/11'''
* New release includes the option to echo back any command you send to the sysmodule.
* New release includes the option to echo back any command you send to the sysmodule.
* Send "configure echoCommands 1" to enable.
* Send "configure echoCommands 1" to enable.
* The zip file contents can be copied onto the sd card and include all files/folders necessary to run the sysmodule.
* The zip file contents can be copied onto the sd card and include all files/folders necessary to run the sysmodule.
'''v.1.2'''
'''v1.2 2020/02/02'''
* Replaced dmntcht with old implementation to freeze the process during ram reads/writes
* Replaced dmntcht with old implementation to freeze the process during ram reads/writes.
* Changes to socket read function to be able to work with bigger write requests
* Changes to socket read function to be able to work with bigger write requests.
* Made sleep timing on the main loop and button click command configurable. Default values are 0ms for the main loop and 50ms for the click command.
* Made sleep timing on the main loop and button click command configurable. Default values are 0ms for the main loop and 50ms for the click command.
'''v.1.1.1'''
'''v1.1.1 2020/02/01'''
* I intended to change the sysmodule to sleep for 50ms instead of 100ms after every command, but accidentally changed it to 500ms instead.
* I intended to change the sysmodule to sleep for 50ms instead of 100ms after every command, but accidentally changed it to 500ms instead.
* Thanks to archit for telling me.
* Thanks to archit for telling me.
'''v.1.1'''
'''v1.1 2020/01/31'''
* Uses dmntcht now instead of the old svcdebug method of reading/writing RAM. This should make it more reliable when working with other applets or switching games.
* Uses dmntcht now instead of the old svcdebug method of reading/writing RAM. This should make it more reliable when working with other applets or switching games.
* The sysmodule is now able to accept several socket connections at the same time, as well as allowing to reconnect to the bot after a disconnect without having to restart the whole switch.
* The sysmodule is now able to accept several socket connections at the same time, as well as allowing to reconnect to the bot after a disconnect without having to restart the whole switch.
'''v.1.0'''
'''v1.0 2020/01/26'''
* First Release.
* First Release.


Line 144: Line 150:
* Thanks to RTNX on discord for bringing to my attention a nasty little bug that would very randomly cause RAM poking to go bad and the switch (sometimes) crashing as a result.
* Thanks to RTNX on discord for bringing to my attention a nasty little bug that would very randomly cause RAM poking to go bad and the switch (sometimes) crashing as a result.
* Thanks to Anubis for stress testing!
* Thanks to Anubis for stress testing!
== Disclaimer ==
This project was created for the purpose of development for bot automation. The creators and maintainers of this project are not liable for any damages caused or bans received. Use at your own risk.


== External links ==
== External links ==
* Github - https://github.com/olliz0r/sys-botbase
* GitHub - https://github.com/olliz0r/sys-botbase

Latest revision as of 14:15, 19 October 2024

sys-botbase
Sysbotbasenx.png
General
Authorolliz0r
TypeSysmodules
Version2.4
LicenseGPL-3.0
Last Updated2024/10/15
Links
Download
Website
Source

A Nintendo Switch (CFW) sys-module that allows users to remote control their Switch via sockets as well as read and write to a games memory. This can be used to create bots for games and other fun automation projects.

Note: This project was created for the purpose of development for bot automation. Using a hacked Switch online can get you banned. The creators and maintainers of this project are not liable for any damages caused or bans received. Use at your own risk.

Features

  • Remote Control:
    • Set controller state.
    • Simulate buttons press, hold, and release.
    • Simulate touch screen drawing.
  • Memory Reading and Writing:
    • Read/write x amount bytes of consecutive memory from RAM based on:
      • i. Absolute memory address.
      • ii. Address relative to main nso base.
      • iii. Address relative to heap base.
  • Screen Capture:
    • Capture current screen and return as JPG.

Installation

Download latest release and extract into your Nintendo Switch SD card. Restart your Switch.

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.

Media

LiveHeX ( ͡° ͜ʖ ͡°) We live injecting now bois (powered by sys-botbase) (Archit Date)

Known issues

https://github.com/olliz0r/sys-botbase/issues

Changelog

v2.4 2024/10/15

  • This is built with the changes to switch-tools that came with the latest version of the switch firmware.

v2.31 2023/05/17

  • The amount of heapmem allocated is now 3.2MB down from 12MB. This may cause issues for some users with huge freezepools, but should not affect 99.9% of users.
  • Issues with ToTK mods and Tesla overlays should no longer be present.

v2.3 2023/04/03

  • All single-stream peek commands no longer require you to "chunk" the data as the sysmodule will do this to send large data quickly in one command. GetInfo() is now used to get the heap base to reduce overhead on all peek and poke commands.
  • getTitleVersion was added courtesy of @6A-Realm.
  • Various info commands were added courtesy of @amel-am.
  • Smaller fixes were provided by @Lincoln-LM and @ELY3M.
  • Other smaller fixes are also included in this release.
  • Thank you to all the contributors.

v2.2 2022/04/10

  • Sys-botbase no longer inits fs or mounts the sd card. If you run a fork or adapt from sys-botbase then please make sure to yield the fs service once you're done with it to avoid hitting the too many sessions panic.
  • screenOn and screenOff once again turn on/off the backlight. Many thanks to SciresM for yielding atmosphère's lbl service session until required such that we can do the same here. Note that this only works with Atmosphère 1.3.1 onwards.

v2.1.1 2022/03/26

  • This is an interim update until a stable 14.0.0 libnx is available, however it should work fine for the vast majority of cases.
  • All lbl sessions are allocated and as such screenOn/screenOff will no longer turn the backlight on/off.

v2.1 2022/02/07

  • This should fix an issue with certain virtual controllers not connecting correctly.
  • isProgramRunning requires the entire identifier, so to check if the keyboard is open you would send isProgramRunning 0x0100000000001008\r\n

v2.0 2021/11/22

  • The following commands were added:
    • Functionality:
      • peekMulti
      • peekMainMulti
      • peekAbsoluteMulti
      • controllerType
  • Multi commands are the same as their non-multi counterparts, and have the added benefit of accepting an array of addresses and sizes split by spaces, and return a sequential concat stream of bytes of all data that was looked up.
  • controllerType allows configuration of the controller from the default pro controller to other controllers, such as a single joy-con, ring-con, etc. Useful if you're writing a bot for something that requires a different controller, such as an LGPE bot. This must be configured to a HidDeviceType
  • The amount of memory allocated by sys-botbase is now also reduced, and the backlight will now turn off when using the screenOff command.

v1.9 2021/09/20

  • In addition to the title, this build has the pointerRelative command if you want a pointer solved with the value returned relative to the heap.

v1.8 2021/04/19

  • The home button will now glow if docked to your switch on startup to notify you sys-botbase is ready to accept requests.
  • Additionally, it has the following new commands:
  • Functionality:
    • clickSeq <sequence> eg clickSeq A,W1000,B,W200,DUP,W500,DD,W350,%5000,1500,W2650,%0,0 (some params don't parse correctly, such as DDOWN so use the alt)
    • clickCancel
    • touchCancel
    • screenOff
    • screenOn
    • charge
  • Both screenOff and screenOn change the screen's IsScanning state. They are especially useful if you are running always-on bots that would benefit from slightly less power use.
  • Charge will return the current battery charge percentage as an integer between 0-100.

v1.7 2021/02/24

  • Thanks to olli for giving me free rein to add cool new stuff and thanks to Red for the keyboard emulation research & implementation
  • Newly added commands with this version are below. If you are not using any of this functionality then feel free to stick with 1.6.
  • Functionality:
    • pointer <first (main) jump> <additional jumps> !!do not add the last jump in pointerexpr here, add it yourself!! (returns the pointer at the end nb: return value is in little endian)
    • pointerAll <first (main) jump> <additional jumps> <final jump in pointerexpr> (as above)
    • pointerPeek <amount of bytes in hex or dec> <first (main) jump> <additional jumps> <final jump in pointerexpr>
    • pointerPoke <first (main) jump> <additional jumps> <final jump in pointerexpr>
    • freeze <offset>
    • unFreeze <offset>
    • freezeCount (returns the amount of freeze slots use by the sysmodule, max is 255)
    • freezeClear (removes all freezes)
    • freezePause
    • freezeUnpause
    • touch followed by arrayof: <x in the range 0-1280> <y in the range 0-720>. Array is sequential taps, not different fingers.
    • touchHold <x in the range 0-1280> <y in the range 0-720>
    • touchDraw followed by arrayof: <x in the range 0-1280> <y in the range 0-720>. Array is vectors of where finger moves to, then removes the finger.
    • key followed by arrayof: <HidKeyboardKey> to be pressed in sequential order
    • keyMod followed by arrayof: <HidKeyboardKey> <HidKeyboardModifier>(without the bitfield shift) to be pressed in sequential order
    • keyMulti followed by arrayof: <HidKeyboardKey> to be pressed at the same time.
  • Config:
    • configure keySleepTime
    • configure fingerDiameter <finger diameter in the range 0-150 (default is 50)>
    • configure pollRate <pollrate wait time to be used by the touch and key commands (default is 17ms)>
    • configure freezeRate <freezeRate (default is 3ms)>
  • Most of the defaults are based on minimum pollrates for system applets. Both keySleepTime & pollRate should be set to a higher number if using an in-game keyboard as these are usually tied to framerate.

v1.6 2020/11/01

  • RTNX brought to my attention a nasty little bug that would randomly cause RAM pokes to go bad and corrupt, injecting the wrong data or potentially crashing the console.
  • This release fixes that issue and should hopefully be the most stable version of sys-botbase to date.
  • Thanks to Anubis and the army of testers for stress-testing.

v1.5 2020/06/11

  • Switching back from dmntcht again. Version 1.4 creates a lot of issues when reading/writing, so this version is mainly to replace the old broken version.

v1.4 2020/03/06

v1.3 2020/02/11

  • New release includes the option to echo back any command you send to the sysmodule.
  • Send "configure echoCommands 1" to enable.
  • The zip file contents can be copied onto the sd card and include all files/folders necessary to run the sysmodule.

v1.2 2020/02/02

  • Replaced dmntcht with old implementation to freeze the process during ram reads/writes.
  • Changes to socket read function to be able to work with bigger write requests.
  • Made sleep timing on the main loop and button click command configurable. Default values are 0ms for the main loop and 50ms for the click command.

v1.1.1 2020/02/01

  • I intended to change the sysmodule to sleep for 50ms instead of 100ms after every command, but accidentally changed it to 500ms instead.
  • Thanks to archit for telling me.

v1.1 2020/01/31

  • Uses dmntcht now instead of the old svcdebug method of reading/writing RAM. This should make it more reliable when working with other applets or switching games.
  • The sysmodule is now able to accept several socket connections at the same time, as well as allowing to reconnect to the bot after a disconnect without having to restart the whole switch.

v1.0 2020/01/26

  • First Release.

Credits

  • Big thank you to jakibaki for a great sysmodule base to learn and work with, as well as being helpful on the Reswitched discord!
  • Thanks to RTNX on discord for bringing to my attention a nasty little bug that would very randomly cause RAM poking to go bad and the switch (sometimes) crashing as a result.
  • Thanks to Anubis for stress testing!

External links

Advertising: