Support defining joystick buttons and input checking

for #239