hrydgard/ppsspp — pull request #1925 by daniel-dressler (2013-05-26 04:36:56+00:00)
Title: Add keymap configuration screen under android + question @ ector

Hello Ector.

I have reached a stumbling block in my quest to add key map configuration. I want to show what I have so you might see the issue.

In summery two extra things must be done to have key mapping:
0. Translate raw platform key codes into KeyMap.h's semi-raw keys.
1. Translate the semi-raw keys into buttons with KeyMap.cpp
2. Give the configuration screen the semi-raw keys

The confounding issue is that key presses are translated inside native before they hit MenuUI or the emulator.

I talked with [Unknown] and bounced some ideas off him. The best solution I could come up with is to:
1. Move KeyMap's large enum of standard keyboard keys into native
2. Have native translate raw keys into these semi-raw keys
3. Still have native translate to xbox gamepad as it does now but also add a field to input_state with the semi-raw key.

This idea would also allow the immediate UI layer to support text entry.

A massive limitation is multiple key presses become harder to handle. struct input_state is meant to define the entire key state so the button field uses bit flags. If there is going to be a flag for every keyboard key this implies a 128 bit field.

The worst aspect of this approach is it requires the app to check 128 places to find which key was pressed.

Since we only need to support full psp key roll over [http://en.wikipedia.org/wiki/Rollover_%28key%29] we can instead use a byte array with PSP_BUTTON_COUNT elements. This keeps checking cheap but adds complexity to native.

Another solution would be to move keymap into native but keymap uses ppsspp's config system.

So ector, what are you thinking? Have I gotten you confused yet? Have an opinion?