quick hack to make games that require arrow keys playable

Subforum for discussion and help with ScummVM's iPhone port

Moderator: ScummVM Team

Post Reply
donkthemagicllama
Posts: 3
Joined: Wed Nov 15, 2017 9:13 pm

quick hack to make games that require arrow keys playable

Post by donkthemagicllama » Thu Nov 23, 2017 8:56 pm

If you want to play a game like Black Cauldron that absolutely needs arrow keys (e.g. to select inventory items), here's a quick and dirty hack.

I don't have time to submit a PR right now, but maybe this can help someone..

It remaps the following keys to be a set of arrow keys (if you look at the layout of these keys on the iPhone keyboard, you'll see its roughly equivalent to WASD):

] = UP
\ = DOWN
_ = LEFT
| = RIGHT

you can't press and hold, but it's good enough for my situation, hopefully yours too... I left the ascii set to F1 in there, as it doesn't seem to work otherwise... there's probably a good reason for this, and a better way to do it, but I haven't messed with it that much yet.

in the file backends/platform/ios7/ios7_osys_events.cpp
add the following cases to the switch statement at line 388:

Code: Select all

    case 93:
        keyPressed = Common::KEYCODE_UP;
        ascii = Common::ASCII_F1;
        break;
    case 92:
        keyPressed = Common::KEYCODE_DOWN;
        ascii = Common::ASCII_F1;
        break;
    case 95:
        keyPressed = Common::KEYCODE_LEFT;
        ascii = Common::ASCII_F1;
        break;
    case 124:
        keyPressed = Common::KEYCODE_RIGHT;
        ascii = Common::ASCII_F1;
        break;

Post Reply