Skip to content
 

Implementing AntSnes with Qt part 4: using special keys

Support for green, red, menu, and camera keys:
Current S60 v. 5.0 phones really don’t have that much keys, so I decided to add support for all keys that I can find from the phone. This will require the SwEvent capability. The downside is that SwEvent requires signing by user. The signing can be made at Symbian signed website.
Here’s a trick how to catch these special button events from the phone.

CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
TRAPD(error,
    if (appUi) {
     // disable other green key functionality to be able to use it
     appUi->SetKeyEventFlags(CAknAppUi::EDisableSendKeyShort|CAknAppUi::EDisableSendKeyLong);
    }
//capturing menukeys, redkey (no), and camera keys
iMenuKeyHandle = CEikonEnv::Static()->RootWin().CaptureKeyUpAndDowns(EStdKeyApplication0, 0,0);
iNoKeyHandle = CEikonEnv::Static()->RootWin().CaptureKeyUpAndDowns(EStdKeyNo, 0, 0);
iNoKeyHandle2 = CEikonEnv::Static()->RootWin().CaptureKey( EKeyNo, 0, 0 );
iCameraKeyHandle = CEikonEnv::Static()->RootWin().CaptureKey( EKeyDevice7, 0, 0 );

There are limitations in these keys also. The green and red button are sending the  KeyUp events, even if I would hold the button down. So these keys shouldn’t be mapped into keys that require long key presses.
Adding support for multimedia buttons:
There’s are very good forum.nokia article about how to utilize multimedia keys: http://wiki.forum.nokia.com/index.php/TSS000432_-_Utilising_media_keys. I utilized the multimedia keys in similar ways, and after that I’ll make a KeyEvent with Qt’s Event:

QKeyEvent *event = NULL;
event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KPlayButtonPress, Qt::NoModifier,
 KPlayButtonPress, KPlayButtonPress,Qt::NoModifier);
QCoreApplication::postEvent (receiver, event);

These event’s can be sent to the receiver object, which can use the key events as any other normal keys. However multimedia keys also have some limitations 🙂 The play and stop keys are not sending the keyup events at all.  Therefore I had to set a initial time how much it takes until the keyup event is generated. Initially I set the timeout to 80ms.  It seems to be working quite well 🙂
Summary about button limitations:
For red/green keys the user must sign the application in symbian signed, or I have to buy a cert and get the applicaiton signed. I’m probably not going to do that,  so it’s more work for the user.
Currently there are four buttons that doesn’t support long key presses. I tested these only with my N97.  Other phones might behave differently.
green/red buttons: automatic keyup event after some time
play/stop button: automatic keyup event after 80ms.

23 Comments

  1. lpratas says:

    A NeoGeo Aes and Mvs, Capcom CPS-1 and CPS-2 emulator for the S60 v3, for the 600MHz devices and for the S60 v5 OMAP3 devices would be interesting and great if someone develop it. You pretend develop Antsnes only for the 5th edition or later you will keep to develop this emulator for 3rd edition in special for the 600MHz devices?

  2. lpratas says:

    Now Symbian it’s a open source and the developpers already can create 3rd part applications. What do you think of this Summeli?

  3. Lucas says:

    Hi, you have done a very nice work on this emulator. I’ve just noticed a kind of bug on the control. If you press a touch button and release it you can’t press it again until press another area of the screen.
    I’m testing it on 0.71.

  4. BooM says:

    Hi!
    I want to know how soon appear PSX4All for symbian S60 5th edition?
    I will be working on multitouch phone samsung i8910?

  5. zaca11 says:

    now that the code is open, will have much of a difference the emulators? will be faster?

  6. lpratas says:

    And for the 3rd edition, nothing? For the 600MHz devices that are more fast than the N97, 5800, 5530, 5230 and X6, the AntSnes would work better and more fast? Or on Symbian 3rd edition is slow and the emulation it is more complicated? The Sense Ui it’s more dificult and the alocation memory it’s worse than the 5th edition? It has problems with sound for cause of the 3rd edition operate system? But the laters devices since FP1 have good DSP. If you don’t mind give me a resumed explanation.

    • Summeli says:

      There’s really nothing wrong in the 3rd edition. I’m using the N97 myself, and I wan’t to develop the emulator with newer software. I’m really not going to continue developing with S60 and Avkon anymore. Moving to Qt is really a big relief for me. A general Qt UI is really the only way for me to get all the new emulators running on new phones in decent time. The Symbian^3 will give huge performance improvements to graphics, so those phones really should be able to run psx4all etc.
      The good news is that I have shared all my sources, so anyone can continue developing with it. I might compile the AntSnes for 3rd edition with newer GCCE, but I’m really not going to do any big updates.

  7. zaca11 says:

    now that the code is open, it would be possible to develop Linux to run on the nokia n95? sorry to divert the issue, but imagine the possibilities

  8. moe says:

    zaca11:
    Code, not drivers.
    Summeli:
    Can’t we just install Qt framework on our s60v5 devices and run your emulator?

    • Summeli says:

      Moe, sure you can. You just had to download 200Mb installer package to get the Qt_install.sis. However the newest Qt 4.6.2 already contains an installer, so I think that I could make a new release for testing pretty soon.
      I’m already making the gpsp port on top of the same UI, so it would be nice to get some feedback too.

  9. lasseo says:

    Hi,
    Where do you catch the key event in QT?
    After catching the keyevent as described, no key event at all reaches my Widget( QWidget::keyPressEvent() ) :-(.
    Some idea?
    Cheers,
    Lasseo

  10. Denis from Italy says:

    HI!…When you think you can finish the new antsnes for n97? thank u very much for your work!

  11. Thomas says:

    Hello,
    it´s a good question. When comes the new antsnes??? And works the new antsnes on symbian s60 v5 or only on the new symbian 3???
    Thomas

    • Summeli says:

      It’ll work just fine on the old S60 5th edition, but there’s not going to be multitouch in old the 5th edition. But enabling all special keys should help a lot, since you basically only need the d-pad as touch button, and you can use the rest of phone’s buttons for everything else. The multitouch will come with new Symbian^3, there’s really nothing that I could do for it.

  12. Thomas says:

    On Symbian s60 is multitouch useable with QT. Is this right summeli???
    Thomas

  13. Thomas says:

    ok i understand.

  14. averac says:

    only thanks for all your investigation
    working ok on 5530
    i m just waiting for the sound an i t will be perfect….

Leave a Reply

(required)