.apping the Controls:
(This section was made before the Virtual Gamepad section, so this will be a bit outdated)
If you can connect your control/joystick/gamepad and played Undertale without mapping anything, then you finished the tutorial! Just play the game and have fun!
If you connected your controller/joystick/gamepad and it didn't respond to any keys, then you ~are going to have a bad time~ need to remap the keys so Undertale can accept your inputs.
To do this, you will need to download Tincore Keymapper, you don't need root, however, if your SELinux state is enforcing, then you need to root your device (just a tip: if you don't have root and you aren't planning in rooting your device, I don't recommend you to root your device just to use a very hacky port that needs a controller just to play it)
After downloading Tincore, open it, a lot of messages will appear, close everything until you get this:
http://i.imgur.com/xjq1wAZ.png If you get this screen, connect your controller/gamepad/joystick to your phone (a little curiosity: you can play the game with your power buttons/volume buttons, if you are willing to test it (except that you will need 6 buttons: 4 for walking and 2 for Z and X).
After connecting, try pressing the buttons on your controller, if will start appearing in the list the keys you pressed, now it is time to configure those keys!
Click on the entry on the list for the key you want to configure, set it to "Click button joy 0", click on "Mode/Config" and change the Key to something useful:
Here is the useful keys you need to set:
DPAD_UP
DPAD_DOWN
DPAD_LEFT
DPAD_RIGHT
BTN_SELECT (This is the Z button on PC)
BTN_START (This is the X button on PC)
After mapping the keys, close the program (click the three dots buttons and click to Exit, when the popup appears, click to "Minimize") and open Undertale on your phone, if everything is configured correctly, the game will allow your inputs and then you can play Undertale on your phone, have fun!