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;

rcreasi
Posts: 1
Joined: Mon Mar 18, 2019 1:49 am

Re: quick hack to make games that require arrow keys playable

Post by rcreasi » Mon Mar 18, 2019 2:26 am

Thanks! This was super helpful. I was stuck on Space Quest II (at one point you have to crawl across a log with the right arrow and trying to swipe precisely right would invariably make you fall to your death). I recompiled with your key codes and they work wonderfully!

I also tried to add my own key code for TAB (in King's Quest I, that's the only way to see your inventory). For some reason that one didn't work, though. :/

digitall
ScummVM Developer
Posts: 1000
Joined: Thu Aug 02, 2012 1:40 pm

Re: quick hack to make games that require arrow keys playable

Post by digitall » Tue Mar 19, 2019 1:05 am

donkthemagicllama: Have opened this as https://github.com/scummvm/scummvm/pull/1540 ... If there are no major objections, will merge in a week or so.

Thanks for your code contribution.

Post Reply