View Single Post
Old 27 October 2012, 19:18   #11
modrobert
old bearded fool

modrobert's Avatar
 
Join Date: Jan 2010
Location: Bangkok
Age: 53
Posts: 530
Post

Quote:
Originally Posted by vxm View Post
and Debian.

Hello

At least, the following keys:
ralt,
rcommand,
rctrl
and arrow
are not usable within the emulation.

In the configuration file, sdl.map_raw_keys and kbd_lang are activated unlike x11.map_raw_key.

Is there a solution?

Thank you
For cursor keys in E-UAE, try adding these lines to your .uaerc file:

Code:
input.1.keyboard.0.button.111=KEY_CURSOR_UP.0 
input.1.keyboard.0.button.113=KEY_CURSOR_LEFT.0 
input.1.keyboard.0.button.114=KEY_CURSOR_RIGHT.0 
input.1.keyboard.0.button.116=KEY_CURSOR_DOWN.0
If these key codes fail (111,113,114,116), you can check SDL key codes (for your keyboard/country) by compiling this C source code:

Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>    
#include "SDL/SDL.h"

    /* Function Prototypes */
    void PrintKeyInfo( SDL_KeyboardEvent *key );
    void PrintModifiers( SDLMod mod );

    /* main */
    int main( int argc, char *argv[] ){
        
        SDL_Event event;
        int quit = 0;
        
        /* Initialise SDL */
        if( SDL_Init( SDL_INIT_VIDEO ) < 0){
            fprintf( stderr, "Could not initialise SDL: %s\n", SDL_GetError() );
            exit( -1 );
        }

        /* Set a video mode */
        if( !SDL_SetVideoMode( 320, 200, 0, 0 ) ){
            fprintf( stderr, "Could not set video mode: %s\n", SDL_GetError() );
            SDL_Quit();
            exit( -1 );
        }

        /* Enable Unicode translation */
        SDL_EnableUNICODE( 1 );

        /* Loop until an SDL_QUIT event is found */
        while( !quit ){

            /* Wait for event */
            if( SDL_WaitEvent( &event ) ){                
                switch( event.type ){
                    /* Keyboard event */
                    /* Pass the event data onto PrintKeyInfo() */
                    case SDL_KEYDOWN:
                    case SDL_KEYUP:
                        PrintKeyInfo( &event.key );
                        break;

                    /* SDL_QUIT event (window close) */
                    case SDL_QUIT:
                        quit = 1;
                        break;

                    default:
                        break;
                }

            }

        }

        /* Clean up */
        SDL_Quit();
        exit( 0 );
    }

    /* Print all information about a key event */
    void PrintKeyInfo( SDL_KeyboardEvent *key ){
        /* Is it a release or a press? */
        if( key->type == SDL_KEYUP )
            printf( "Release:- " );
        else
            printf( "Press:- " );

        /* Print the hardware scancode first */
        printf( "Scancode: 0x%02X (%u)", key->keysym.scancode, key->keysym.scancode );
        /* Print the name of the key */
        printf( ", Name: %s", SDL_GetKeyName( key->keysym.sym ) );
        /* We want to print the unicode info, but we need to make */
        /* sure its a press event first (remember, release events */
        /* don't have unicode info                                */
        if( key->type == SDL_KEYDOWN ){
            /* If the Unicode value is less than 0x80 then the    */
            /* unicode value can be used to get a printable       */
            /* representation of the key, using (char)unicode.    */
            printf(", Unicode: " );
            if( key->keysym.unicode < 0x80 && key->keysym.unicode > 0 ){
                printf( "%c (0x%04X)", (char)key->keysym.unicode,
                        key->keysym.unicode );
            }
            else{
                printf( "? (0x%04X)", key->keysym.unicode );
            }
        }
        printf( "\n" );
        /* Print modifier info */
        PrintModifiers( key->keysym.mod );
    }

    /* Print modifier info */
    void PrintModifiers( SDLMod mod ){
        printf( "Modifiers: " );

        /* If there are none then say so and return */
        if( mod == KMOD_NONE ){
            printf( "None\n" );
            return;
        }

        /* Check for the presence of each SDLMod value */
        /* This looks messy, but there really isn't    */
        /* a clearer way.                              */
        if( mod & KMOD_NUM ) printf( "NUMLOCK " );
        if( mod & KMOD_CAPS ) printf( "CAPSLOCK " );
        if( mod & KMOD_LCTRL ) printf( "LCTRL " );
        if( mod & KMOD_RCTRL ) printf( "RCTRL " );
        if( mod & KMOD_RSHIFT ) printf( "RSHIFT " );
        if( mod & KMOD_LSHIFT ) printf( "LSHIFT " );
        if( mod & KMOD_RALT ) printf( "RALT " );
        if( mod & KMOD_LALT ) printf( "LALT " );
        if( mod & KMOD_CTRL ) printf( "CTRL " );
        if( mod & KMOD_SHIFT ) printf( "SHIFT " );
        if( mod & KMOD_ALT ) printf( "ALT " );
        printf( "\n" );
    }
Use this command to compile:

Code:
gcc sdl_test_key.c -o sdl_test_key -lSDL
Run ./sdl_test_key and click on the window that opens, the output from your key presses will look like this example:

Code:
Press:- Scancode: 0x6F (111), Name: up, Unicode: ? (0x0000)
The decimal code in this case is 111 for the cursor "up" key, so that means the line should be like this in .uaerc:

Code:
input.1.keyboard.0.button.111=KEY_CURSOR_UP.0
You can figure out the rest of the "missing keys" the same way, and map them to the corresponding E-UAE input event name by checking this file:

http://www.eurasia.nu/images/submitt...events_def.txt

Last edited by modrobert; 29 October 2012 at 16:17. Reason: Fixed C source, now using CPU friendly SDL_WaitEvent() instead of SDL_PollEvent().
modrobert is offline  
 
Page generated in 0.04630 seconds with 11 queries