OUYA Notes

From OHRRPGCE-Wiki
Jump to navigation Jump to search

The OUYA is Android based, so the Android port of the OHRRPGCE runs on it. See Compiling for Android for more info.

There are a few special considerations for running on android

Controls[edit]

The on-screen gamepad buttons should be disabled and hidden on OUYA. We have freebasic function for toggling them, but need to be able to detect whether or not the currently running Android device is an OUYA.

From upstream, sdl-android just re-uses the scancodes from RedefinedKeysScreenKb (plus 2 from RedefinedKeys) and applies them to the real gamepad. Unfortunately this makes it impossible to get a good mapping for both the virtual gamepad and the real gamepad at the same time via this method

Generic Java Gamepad OUYA Controller Key key in AndroidAppSettings.cfg index
D-PAD D-PAD Arrow Keys
A O RedefinedKeysScreenKb Third
X U RedefinedKeysScreenKb First
Y Y RedefinedKeysScreenKb Second
B A RedefinedKeysScreenKb Fourth
Back ᴗ(system) RedefinedKeys Fifth
L1 L1 RedefinedKeysScreenKb Sixth
R1 R1 RedefinedKeysScreenKb Fifth
L2 L2 RedefinedKeys First (XXX)
R2 R2 RShift
Left Analog Stick Left Analog Stick Arrow Keys
Right Analog Stick Right Analog Stick
LThumb L3(analog click) Space
RThumb R3(analog click) Enter

Since this scheme is not suitable for our needs, the plan is to use the RedefinedKeysScreenKb and RedefinedKeys only to set up reasonable defaults for the virtual gamepad, and to add a new function to sdl-android for remapping the gamepad buttons. That function is SDL_ANDROID_set_java_gamepad_keymap()

RedefinedKeysScreenKb[edit]

# Suitable for standard OHRRPGCE games with touch-screen virtual keyboard
RedefinedKeysScreenKb="RETURN ESCAPE"
RedefinedKeysScreenKbNames="Confirm Cancel"
RedefinedKeys="NO_REMAP RETURN NO_REMAP NO_REMAP ESCAPE ESCAPE"

SDL_ANDROID_set_java_gamepad_keymap[edit]

I added a function to sdl-android that remaps the gamepad buttons without having any effect on the virtual gamepad. The arguments are SDL scancodes in the following order:

A, B, C, X, Y, Z, L1, R1, L2, R2

Here are the defaults I am using

SDL_ANDROID_set_java_gamepad_keymap(SDLK_RETURN, SDLK_ESCAPE, 0, SDLK_ESCAPE, SDLK_ESCAPE, 0, SDLK_PAGEUP, SDLK_PAGEDOWN, SDLK_HOME, SDLK_END)

SDLK_ESCAPE appears more than once because it makes sense for both "menu" and "cancel". PAGEUP and PAGEDOWN are useful when scrolling through the inventory or long menus. HOME and END are arbitrary. I left C and Z alone, because it seems few controllers even have them. the OUYA does not.

SDL_ANDROID_set_ouya_gamepad_keymap[edit]

I also added SDL_ANDROID_set_ouya_gamepad_keymap() for mapping buttons for the second, third and fourth players. This is tested and working in Don't Eat Soap

In-App Purchases[edit]

Moved to Plan for In-App-Purchase Support