1.1 --- a/src/maple/kbd.c Mon Jan 28 02:38:09 2008 +0000
1.2 +++ b/src/maple/kbd.c Sun Jul 20 11:37:47 2008 +0000
1.6 #define KEYBOARD_IDENT { 0x00, 0x00, 0x00, 0x40, 0x02, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, \
1.7 - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x20, \
1.8 - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \
1.9 - 0x20, 0x20, 0x20, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x42, 0x79, 0x20, \
1.10 - 0x6f, 0x72, 0x20, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, \
1.11 - 0x20, 0x46, 0x72, 0x6f, 0x6d, 0x20, 0x53, 0x45, 0x47, 0x41, 0x20, 0x45, 0x4e, 0x54, 0x45, 0x52, \
1.12 - 0x50, 0x52, 0x49, 0x53, 0x45, 0x53, 0x2c, 0x4c, 0x54, 0x44, 0x2e, 0x20, 0x20, 0x20, 0x20, 0x20, \
1.13 - 0x2c, 0x01, 0x90, 0x01 }
1.14 + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x20, \
1.15 + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \
1.16 + 0x20, 0x20, 0x20, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x42, 0x79, 0x20, \
1.17 + 0x6f, 0x72, 0x20, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, \
1.18 + 0x20, 0x46, 0x72, 0x6f, 0x6d, 0x20, 0x53, 0x45, 0x47, 0x41, 0x20, 0x45, 0x4e, 0x54, 0x45, 0x52, \
1.19 + 0x50, 0x52, 0x49, 0x53, 0x45, 0x53, 0x2c, 0x4c, 0x54, 0x44, 0x2e, 0x20, 0x20, 0x20, 0x20, 0x20, \
1.20 + 0x2c, 0x01, 0x90, 0x01 }
1.22 #define KEYBOARD_VERSION {0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x2e, 0x30, 0x31, \
1.23 - 0x30, 0x2c, 0x31, 0x39, 0x39, 0x39, 0x2f, 0x30, 0x34, 0x2f, 0x32, 0x37, 0x2c, 0x33, 0x31, 0x35, \
1.24 - 0x2d, 0x36, 0x32, 0x31, 0x31, 0x2d, 0x41, 0x4d, 0x20, 0x20, 0x20, 0x2c, 0x4b, 0x65, 0x79, 0x20, \
1.25 - 0x53, 0x63, 0x61, 0x6e, 0x20, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x3a, 0x20, 0x54, 0x68, \
1.26 - 0x65, 0x20, 0x32, 0x6e, 0x64, 0x20, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x30, \
1.27 - 0x34, 0x2f, 0x32, 0x35 }
1.28 + 0x30, 0x2c, 0x31, 0x39, 0x39, 0x39, 0x2f, 0x30, 0x34, 0x2f, 0x32, 0x37, 0x2c, 0x33, 0x31, 0x35, \
1.29 + 0x2d, 0x36, 0x32, 0x31, 0x31, 0x2d, 0x41, 0x4d, 0x20, 0x20, 0x20, 0x2c, 0x4b, 0x65, 0x79, 0x20, \
1.30 + 0x53, 0x63, 0x61, 0x6e, 0x20, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x3a, 0x20, 0x54, 0x68, \
1.31 + 0x65, 0x20, 0x32, 0x6e, 0x64, 0x20, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x30, \
1.32 + 0x34, 0x2f, 0x32, 0x35 }
1.34 void keyboard_attach( maple_device_t dev );
1.35 void keyboard_detach( maple_device_t dev );
1.36 maple_device_t keyboard_clone( maple_device_t dev );
1.37 maple_device_t keyboard_new();
1.38 int keyboard_get_cond( maple_device_t dev, int function, unsigned char *outbuf,
1.39 - unsigned int *outlen );
1.40 + unsigned int *outlen );
1.42 typedef struct keyboard_device {
1.43 struct maple_device dev;
1.45 struct maple_device_class keyboard_class = { "Sega Keyboard", keyboard_new };
1.47 static struct keyboard_device base_keyboard = {
1.48 - { MAPLE_DEVICE_TAG, &keyboard_class, KEYBOARD_IDENT, KEYBOARD_VERSION,
1.49 - NULL, keyboard_attach, keyboard_detach, maple_default_destroy,
1.50 - keyboard_clone, NULL, NULL, keyboard_get_cond, NULL, NULL, NULL },
1.51 - {0,0,0,0,0,0,0,0},
1.52 + { MAPLE_DEVICE_TAG, &keyboard_class, KEYBOARD_IDENT, KEYBOARD_VERSION,
1.53 + NULL, keyboard_attach, keyboard_detach, maple_default_destroy,
1.54 + keyboard_clone, NULL, NULL, keyboard_get_cond, NULL, NULL, NULL },
1.55 + {0,0,0,0,0,0,0,0},
1.58 #define KEYBOARD(x) ((keyboard_device_t)(x))
1.62 for( i=2; i<8; i++ ) {
1.63 - if( dev->condition[i] == key ) {
1.64 - return; // key already down, missed event or repeat
1.65 - } else if( dev->condition[i] == 0 ) {
1.66 - dev->condition[i] = key;
1.69 + if( dev->condition[i] == key ) {
1.70 + return; // key already down, missed event or repeat
1.71 + } else if( dev->condition[i] == 0 ) {
1.72 + dev->condition[i] = key;
1.76 /* Key array is full - skip for the moment */
1.81 for( i=2; i<8; i++ ) {
1.82 - if( dev->condition[i] == key ) {
1.83 - for( ; i<7; i++ ) {
1.84 - dev->condition[i] = dev->condition[i+1];
1.86 - dev->condition[7] = 0;
1.89 + if( dev->condition[i] == key ) {
1.90 + for( ; i<7; i++ ) {
1.91 + dev->condition[i] = dev->condition[i+1];
1.93 + dev->condition[7] = 0;
1.99 @@ -110,26 +110,26 @@
1.100 keyboard_device_t dev = (keyboard_device_t)mdev;
1.101 uint16_t key = input_keycode_to_dckeysym( keycode );
1.103 - if( key >> 8 == 0xFF ) { // shift
1.104 - if( isKeyDown ) {
1.105 - dev->condition[0] |= (key&0xFF);
1.107 - dev->condition[0] &= ~(key&0xFF);
1.110 - if( isKeyDown ) {
1.111 - keyboard_key_down( dev, (uint8_t)key );
1.113 - keyboard_key_up( dev, (uint8_t)key );
1.116 + if( key >> 8 == 0xFF ) { // shift
1.117 + if( isKeyDown ) {
1.118 + dev->condition[0] |= (key&0xFF);
1.120 + dev->condition[0] &= ~(key&0xFF);
1.123 + if( isKeyDown ) {
1.124 + keyboard_key_down( dev, (uint8_t)key );
1.126 + keyboard_key_up( dev, (uint8_t)key );
1.131 fprintf( stderr, "Key cond: %02X %02X %02X %02X %02X %02X %02X %02X\n",
1.132 dev->condition[0], dev->condition[1], dev->condition[2],
1.133 dev->condition[3], dev->condition[4], dev->condition[5],
1.134 dev->condition[6], dev->condition[7] );
1.140 @@ -148,7 +148,7 @@
1.143 int keyboard_get_cond( maple_device_t mdev, int function, unsigned char *outbuf,
1.144 - unsigned int *outlen )
1.145 + unsigned int *outlen )
1.147 keyboard_device_t dev = (keyboard_device_t)mdev;
1.148 if( function == MAPLE_FUNC_KEYBOARD ) {