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

CTROLLER for Android 3DS: Difference between revisions

From GameBrew
No edit summary
No edit summary
Line 9: Line 9:
| website = https://labs.xda-developers.com/store/app/tk.superl2.ctroller
| website = https://labs.xda-developers.com/store/app/tk.superl2.ctroller
| download = https://dlhb.gamebrew.org/3dshomebrew/CTROLLER-for-Android.rar
| download = https://dlhb.gamebrew.org/3dshomebrew/CTROLLER-for-Android.rar
| source = https://dlhb.gamebrew.org/3dshomebrew/CTROLLER-for-Android.rar
| source = https://github.com/hacker1024/ctroller-android
}}
}}
''Ctroller-android'' lets you use your 3DS as an input device for your <s>Linux</s> Android system via the uinput kernel module. It consists of a client that runs on your 3DS, continously streaming the 3DS input data to a server on your Android device. The server exposes a virtual device to your system, interpretes the data it receives and writes it to a event node under <code>/dev/input/event*</code> or similar. The kernel gamepad input documentation can be found here: https://www.kernel.org/doc/Documentation/input/gamepad.txt


Use your Nindendo 3DS as a game controller for android!<br />
== Prerequisites ==
<br />
Your phone must be rooted with a uinput enabled kernel. ARM(64) only.<br />
If enough people say they'd like it, I'll look into Android TV support.<br />
<br />
Instructions to set up on the 3DS are found in my README here: https://github.com/hacker1024/ctroller-android<br />
<br />
Source code is here: https://github.com/hacker1024/ctroller-android-app<br />
and here: https://github.com/hacker1024/ctroller-android<br />
<br />


You will need [https://sourceforge.net/projects/devkitpro/files/devkitARM/ DevkitARM] and the [https://github.com/smealum/ctrulib ctrulib] to build the 3DS component.
Building the 3DS CIA requires [https://github.com/Steveice10/bannertool bannertool] and [https://github.com/profi200/Project_CTR/tree/master/makerom makerom] to be in your <code>$PATH</code>.
To run the server, the <code>uinput</code> kernel module needs to be loaded:
<source lang="bash">$ modprobe uinput</source>
== Building ==
To build the 3DS app, run <code>make</code> in the “3DS” directory.
To build the android binary, run <code>CC=path/to/th/android/cross/compiler make</code>. replace the path with the patch to your android cross compiler (the gcc binary).
== Installation ==
<ol style="list-style-type: decimal;">
<li><p>Download and run the ELF binary manually or use my android app: https://github.com/hacker1024/ctroller-android-app</p></li>
<li><p>Download the [https://github.com/phijor/ctroller/releases/latest latest release of the 3DS binaries].</p>
<p>Or you can build them yourself:</p>
<source lang="bash">$ cd 3DS
$ make release</source></li>
<li><p>Install <code>ctroller.cia</code> with the CIA-manager of your choice.</p>
<p>If you want to install the 3DSX-executable:</p>
<p>Copy <code>ctroller.{3dsx,smdh}</code> to <code>/3ds/ctroller/</code> on your SD card. You can also directly upload the application to your 3DS using [[./3DS/upload.sh|upload.sh]] (do not blindly execute unknown scrips, I’m not responsible if this accidentally deletes your SD card or unfreezes your fridge). To do so, start a FTP server (such as [https://github.com/mtheall/ftpd ftpd]) on your 3DS on port 5000, then run:</p>
<source lang="bash">$ cd 3DS
$ make upload DSIP=<IP of your 3DS here></source>
<p>This requires <code>ftp</code> to be installed on your system.</p></li>
<li><p>Create a directory <code>ctroller</code> in the root of your SD card</p></li>
<li><p>'''Place [[./3DS/ctroller.cfg|3DS/ctroller.cfg]] in there and replace the IP with the one of your PC.''' (The config file should now be at <code>sdmc:/ctroller/ctroller.cfg</code>)</p></li></ol>
== Running ==
Run the ELF binary manually or use my android app: https://github.com/hacker1024/ctroller-android-app
Start the ELF binary manually by copying to a executable location (like /data/local/tmp/) and running:
<source lang="bash">$ ./ctroller</source>
Flags if you manually run the binary:
<pre>  -d  --daemonize              execute in background
  -h  --help                  print this help text
  -p  --port=&lt;num&gt;            listen on port 'num' (defaults to 15708)
  -u  --uinput-device=&lt;path&gt;  uinput character device (defaults to /dev/uinput)
  -k  --keymap                use a keymap file (if not set, ctroller will use the default keymap)</pre>
Then launch the ''ctroller.3dsx'' or ''ctroller.cia'' application on your 3DS using a homebrew launcher of your choice.
For development purposes, the 3DS-Makefile includes a <code>run</code> target that uses <code>3dslink</code> to upload and run the application using the Homebrew Menu NetLoader.
== Creating your own keymap file ==
To remap the buttons in a way you want, you need to create a file with a button label on each line. The default mapping is this:
* A
* B
* X
* Y
* START
* SELECT
* L
* R
* ZL
* ZR
To modify it, copy the above into a file, and swap keys around. The order is very important; any key in your custom keymap will override the default one on the same line.
To use this keymap with ctroller-android, use the -k option (see above).
For example, I prefer my layout to be more like an xbox, for better compatibility with games. To do this, I swap <code>A</code> and <code>B</code>; <code>X</code> and <code>Y</code>; <code>R</code> and <code>ZR</code>; and <code>L</code> and <code>ZL</code>. Here’s my keymap file:
* B
* A
* Y
* X
* START
* SELECT
* ZL
* ZR
* L
* R
== Notes ==
This program is intended to be used in a private network. For simplicity, the server right now accepts any connection on it’s port, which might pose a security risk if others can send data to it. This will be changed in future releases. For now, you probably shouldn’t be using this in a public network.
==changelogs==
Version 0.1.3 on 12.27.2017 Alpha 3.1 MB  
Version 0.1.3 on 12.27.2017 Alpha 3.1 MB  
Changes:
Changes:
- Add about page - Check if the native binary is already running on app launch, and if so, give an option to stop it
* Add about page - Check if the native binary is already running on app launch, and if so, give an option to stop it
 
* Update native binary to release android-0.1.2 (buttons are now mapped like an xbox controller, fixed error logging) Known bugs (same as old releases):
- Update native binary to release android-0.1.2 (buttons are now mapped like an xbox controller, fixed error logging) Known bugs (same as old releases):
* C-stick may not work, please tell me
 
* DPAD may not work, please tell me I need feedback! Please tell me if the app works for you or not. I especially need feedback from people with 32-bit devices.
- C-stick may not work, please tell me


- DPAD may not work, please tell me I need feedback! Please tell me if the app works for you or not. I especially need feedback from people with 32-bit devices.
==External Links==
* Source code is here: https://github.com/hacker1024/ctroller-android-app
* and here: https://github.com/hacker1024/ctroller-android

Revision as of 05:45, 12 September 2021

Template:Infobox-3DS-Homebrews Ctroller-android lets you use your 3DS as an input device for your Linux Android system via the uinput kernel module. It consists of a client that runs on your 3DS, continously streaming the 3DS input data to a server on your Android device. The server exposes a virtual device to your system, interpretes the data it receives and writes it to a event node under /dev/input/event* or similar. The kernel gamepad input documentation can be found here: https://www.kernel.org/doc/Documentation/input/gamepad.txt

Prerequisites

You will need DevkitARM and the ctrulib to build the 3DS component.

Building the 3DS CIA requires bannertool and makerom to be in your $PATH.

To run the server, the uinput kernel module needs to be loaded:

$ modprobe uinput

Building

To build the 3DS app, run make in the “3DS” directory.

To build the android binary, run CC=path/to/th/android/cross/compiler make. replace the path with the patch to your android cross compiler (the gcc binary).

Installation

  1. Download and run the ELF binary manually or use my android app: https://github.com/hacker1024/ctroller-android-app

  2. Download the latest release of the 3DS binaries.

    Or you can build them yourself:

    $ cd 3DS
    $ make release
  3. Install ctroller.cia with the CIA-manager of your choice.

    If you want to install the 3DSX-executable:

    Copy ctroller.{3dsx,smdh} to /3ds/ctroller/ on your SD card. You can also directly upload the application to your 3DS using [[./3DS/upload.sh|upload.sh]] (do not blindly execute unknown scrips, I’m not responsible if this accidentally deletes your SD card or unfreezes your fridge). To do so, start a FTP server (such as ftpd) on your 3DS on port 5000, then run:

    $ cd 3DS
    $ make upload DSIP=<IP of your 3DS here>

    This requires ftp to be installed on your system.

  4. Create a directory ctroller in the root of your SD card

  5. Place [[./3DS/ctroller.cfg|3DS/ctroller.cfg]] in there and replace the IP with the one of your PC. (The config file should now be at sdmc:/ctroller/ctroller.cfg)

Running

Run the ELF binary manually or use my android app: https://github.com/hacker1024/ctroller-android-app

Start the ELF binary manually by copying to a executable location (like /data/local/tmp/) and running:

$ ./ctroller

Flags if you manually run the binary:

  -d  --daemonize              execute in background
  -h  --help                   print this help text
  -p  --port=<num>             listen on port 'num' (defaults to 15708)
  -u  --uinput-device=<path>   uinput character device (defaults to /dev/uinput)
  -k  --keymap                 use a keymap file (if not set, ctroller will use the default keymap)

Then launch the ctroller.3dsx or ctroller.cia application on your 3DS using a homebrew launcher of your choice.

For development purposes, the 3DS-Makefile includes a run target that uses 3dslink to upload and run the application using the Homebrew Menu NetLoader.

Creating your own keymap file

To remap the buttons in a way you want, you need to create a file with a button label on each line. The default mapping is this:

  • A
  • B
  • X
  • Y
  • START
  • SELECT
  • L
  • R
  • ZL
  • ZR

To modify it, copy the above into a file, and swap keys around. The order is very important; any key in your custom keymap will override the default one on the same line.

To use this keymap with ctroller-android, use the -k option (see above).

For example, I prefer my layout to be more like an xbox, for better compatibility with games. To do this, I swap A and B; X and Y; R and ZR; and L and ZL. Here’s my keymap file:

  • B
  • A
  • Y
  • X
  • START
  • SELECT
  • ZL
  • ZR
  • L
  • R

Notes

This program is intended to be used in a private network. For simplicity, the server right now accepts any connection on it’s port, which might pose a security risk if others can send data to it. This will be changed in future releases. For now, you probably shouldn’t be using this in a public network.

changelogs

Version 0.1.3 on 12.27.2017 Alpha 3.1 MB Changes:

  • Add about page - Check if the native binary is already running on app launch, and if so, give an option to stop it
  • Update native binary to release android-0.1.2 (buttons are now mapped like an xbox controller, fixed error logging) Known bugs (same as old releases):
  • C-stick may not work, please tell me
  • DPAD may not work, please tell me I need feedback! Please tell me if the app works for you or not. I especially need feedback from people with 32-bit devices.

External Links

Advertising: