TwitchKeyboardAPI is an API that will monitor incoming commands from a Twitch chat and send them to a game emulator.
If you already have a development environment set up, you can skip this step. But for those who don't, you can use the setup.ps1
script to install the necessary dependencies. This script will install the following:
- Pyenv - Python 3.11.9
- Poetry
- Git
- GitHub CLI
Note: You wll run the script about 3 times total if you do not have any of the dependencies installed. This is because the terminal needs to be restarted after installing some of the dependencies.
- Python 3.11.9
- Poetry
- Windows 10 / Windows 11
Note: For the sake of this example, assume you are downloading a Nintendo DS game but the process is similar for other consoles.
- Download the RetroArch game emulator from the official website.
- Open the RetroArch emulator.
- Go to
Load Core
. - Select
Download a Core
. - Select the
Nintendo - Nintendo DS (melonDS)
core. - Download the
.nds
ROM of the game you want to play. You can find a list of games here. - Go to
Load Content
. - Select
Start Directory
. - Find and select the folder where the
.nds
ROM is located. - You should now be able to play the game using the emulator.
- Clone the repository
git clone [email protected]:open-octave/TwitchKeyboardAPI.git
- Run the API
./run.bat
- Go to the Twitch chat.
- It's recommended that you use the mod commands
/uniquechatoff
and/slowoff
in chat to allow viewers to send commands without being blocked by Twitch. - Type one of the commands listed in the Commands section.
- The API will receive the command and send it to the emulator.
On Start Example | Command Example |
---|---|
Note: The command mapping is designed based on the default key bindings of the RetroArch emulator.
Command | Description |
---|---|
up |
Simulates a up arrow key press |
down |
Simulates a down arrow key press |
left |
Simulates a left arrow key press |
right |
Simulates a right arrow key press |
a |
Simulates an X key press |
b |
Simulates a Z key press |
x |
Simulates an S key press |
y |
Simulates an A key press |
start |
Simulates an Enter key press |
select |
Simulates a Shift key press |
!hold <direction> or !move <direction> |
Holds the provided directional key until released |
!release or !stop |
Releases the held directional key |
!toggle-fast-forward or !tff |
Toggles RetroArch's fast forward mode on/off |
Command | Description |
---|---|
!mod-kill-api |
Kills the API process in case of an emergency |
How can I still use my computer while the API is running since the program focuses on RetroArch for every command?
You can run the API and RetroArch inside of VMWare or VirtualBox. I honestly recommend this method since it also gives the streamer an extra layer of security since the API does not have access to the files, folders, or applications on the streamer's computer. This should never be possible due to a few security measures in place but it is always better to be safe than sorry.
If you have any questions or need help, please open an issue in the repository or message me on discord:
Discord: Project Channel
Distributed under the GNU General Public License. See LICENSE
for more information.