From: kub Date: Mon, 13 Jan 2025 17:52:13 +0000 (+0100) Subject: core, generalise keyboard handling X-Git-Tag: v2.04~84 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20c9a3bac92b921874a3a87df9b9024dd957614d;p=picodrive.git core, generalise keyboard handling --- diff --git a/pico/pico.h b/pico/pico.h index b2c8a367..c8f89050 100644 --- a/pico/pico.h +++ b/pico/pico.h @@ -134,7 +134,7 @@ typedef struct PicoInterface void (*mcdTrayOpen)(void); void (*mcdTrayClose)(void); - unsigned int ps2; // PS/2 peripherals, e.g. Pico Keyboard + unsigned int kbd; // PS/2 peripherals, e.g. Pico Keyboard } PicoInterface; extern PicoInterface PicoIn; diff --git a/pico/pico/memory.c b/pico/pico/memory.c index 116990ec..a008c8a4 100644 --- a/pico/pico/memory.c +++ b/pico/pico/memory.c @@ -139,8 +139,8 @@ static u32 PicoRead8_pico_kb(u32 a) PicoPicohw.kb.has_read = 1; - u32 key_shift = (PicoIn.ps2 & 0xff00) >> 8; - u32 key = (PicoIn.ps2 & 0x00ff); + u32 key_shift = (PicoIn.kbd & 0xff00) >> 8; + u32 key = (PicoIn.kbd & 0x00ff); // The Shift key requires 2 key up events to be registered: // SHIFT_UP_HELD_DOWN to allow the game to register the key down event @@ -148,14 +148,14 @@ static u32 PicoRead8_pico_kb(u32 a) // is no longer held down. // // For the second key up event, we need to - // override the parsed key code with PEVB_PICO_PS2_LSHIFT, + // override the parsed key code with PEVB_KBD_SHIFT, // otherwise it will be zero and the game won't clear its Shift key state. u32 key_code = (key_shift && !key && PicoPicohw.kb.key_state != KEY_UP && PicoPicohw.kb.shift_state != SHIFT_UP_HELD_DOWN) ? key_shift - : PicoPicohw.kb.shift_state == SHIFT_UP ? PEVB_PICO_PS2_LSHIFT : key; + : PicoPicohw.kb.shift_state == SHIFT_UP ? PEVB_KBD_SHIFT : key; u32 key_code_7654 = (key_code & 0xf0) >> 4; u32 key_code_3210 = (key_code & 0x0f); switch(PicoPicohw.kb.i) { @@ -175,7 +175,7 @@ static u32 PicoRead8_pico_kb(u32 a) break; case 0x7: // cap/num/scr if (PicoPicohw.kb.active) { - if (key == PEVB_PICO_PS2_CAPSLOCK && PicoPicohw.kb.has_caps_lock == 1) { + if (key == PEVB_KBD_CAPSLOCK && PicoPicohw.kb.has_caps_lock == 1) { PicoPicohw.kb.caps_lock = PicoPicohw.kb.caps_lock == 4 ? 0 : 4; PicoPicohw.kb.has_caps_lock = 0; } @@ -216,8 +216,8 @@ static u32 PicoRead8_pico_kb(u32 a) PicoPicohw.kb.time_keydown = get_ticks() - PicoPicohw.kb.start_time_keydown; if (PicoPicohw.kb.time_keydown > 350 // Modifier keys don't have typematic - && key_code != PEVB_PICO_PS2_CAPSLOCK - && key_code != PEVB_PICO_PS2_LSHIFT) { + && key_code != PEVB_KBD_CAPSLOCK + && key_code != PEVB_KBD_SHIFT) { d |= 8; // Send key down a.k.a. make if (PicoPicohw.kb.key_state == KEY_DOWN) elprintf(EL_PICOHW, "PicoPicohw.kb.key_state: KEY DOWN\n"); diff --git a/pico/sms.c b/pico/sms.c index a9f9aacd..0608d784 100644 --- a/pico/sms.c +++ b/pico/sms.c @@ -140,92 +140,92 @@ static u8 vdp_hcounter(int cycles) // row 1: q w e r t y u // row 2: a s d f g h j // row 3: z x c v b n m -// row 4: ED SP CL DL -// row 5: , . / PI v < > -// row 6: k l ; : ] CR ^ +// row 4: ED SP CL DL kana space clear/home del/ins +// row 5: , . / PI v < > pi +// row 6: k l ; : ] CR ^ enter // row 7: i o p @ [ // port B @0xdd: -// row 8: 8 9 0 - ^ YN BR -// row 9: GR -// row 10: CTL -// row 11: FN SFT +// row 8: 8 9 0 - ^ YN BR yen break +// row 9: GR graph +// row 10: CTL control +// row 11: FN SFT func shift static unsigned char kbd_matrix[12]; // row | col static unsigned char kbd_map[] = { - [PEVB_PICO_PS2_1] = 0x00, - [PEVB_PICO_PS2_2] = 0x01, - [PEVB_PICO_PS2_3] = 0x02, - [PEVB_PICO_PS2_4] = 0x03, - [PEVB_PICO_PS2_5] = 0x04, - [PEVB_PICO_PS2_6] = 0x05, - [PEVB_PICO_PS2_7] = 0x06, - [PEVB_PICO_PS2_8] = 0x80, - [PEVB_PICO_PS2_9] = 0x81, - [PEVB_PICO_PS2_0] = 0x82, - [PEVB_PICO_PS2_MINUS] = 0x83, - [PEVB_PICO_PS2_CARET] = 0x84, - [PEVB_PICO_PS2_YEN] = 0x85, - [PEVB_PICO_PS2_ESCAPE] = 0x86, // break - - [PEVB_PICO_PS2_q] = 0x10, - [PEVB_PICO_PS2_w] = 0x11, - [PEVB_PICO_PS2_e] = 0x12, - [PEVB_PICO_PS2_r] = 0x13, - [PEVB_PICO_PS2_t] = 0x14, - [PEVB_PICO_PS2_y] = 0x15, - [PEVB_PICO_PS2_u] = 0x16, - [PEVB_PICO_PS2_i] = 0x70, - [PEVB_PICO_PS2_o] = 0x71, - [PEVB_PICO_PS2_p] = 0x72, - [PEVB_PICO_PS2_AT] = 0x73, - [PEVB_PICO_PS2_LEFTBRACKET] = 0x74, - - [PEVB_PICO_PS2_a] = 0x20, - [PEVB_PICO_PS2_s] = 0x21, - [PEVB_PICO_PS2_d] = 0x22, - [PEVB_PICO_PS2_f] = 0x23, - [PEVB_PICO_PS2_g] = 0x24, - [PEVB_PICO_PS2_h] = 0x25, - [PEVB_PICO_PS2_j] = 0x26, - [PEVB_PICO_PS2_k] = 0x60, - [PEVB_PICO_PS2_l] = 0x61, - [PEVB_PICO_PS2_SEMICOLON] = 0x62, - [PEVB_PICO_PS2_COLON] = 0x63, - [PEVB_PICO_PS2_RIGHTBRACKET] = 0x64, - [PEVB_PICO_PS2_RETURN] = 0x65, - [PEVB_PICO_PS2_UP] = 0x66, // up - - [PEVB_PICO_PS2_z] = 0x30, - [PEVB_PICO_PS2_x] = 0x31, - [PEVB_PICO_PS2_c] = 0x32, - [PEVB_PICO_PS2_v] = 0x33, - [PEVB_PICO_PS2_b] = 0x34, - [PEVB_PICO_PS2_n] = 0x35, - [PEVB_PICO_PS2_m] = 0x36, - [PEVB_PICO_PS2_COMMA] = 0x50, - [PEVB_PICO_PS2_PERIOD] = 0x51, - [PEVB_PICO_PS2_SLASH] = 0x52, - [PEVB_PICO_PS2_RO] = 0x53, // pi - [PEVB_PICO_PS2_DOWN] = 0x54, // down - [PEVB_PICO_PS2_LEFT] = 0x55, // left - [PEVB_PICO_PS2_RIGHT] = 0x56, // right - - [PEVB_PICO_PS2_CJK] = 0x40, // kana - [PEVB_PICO_PS2_SPACE] = 0x41, // space - [PEVB_PICO_PS2_HOME] = 0x42, // clear/home - [PEVB_PICO_PS2_BACKSPACE] = 0x43, // del/ins - - [PEVB_PICO_PS2_SOUND] = 0x96, // graph - [PEVB_PICO_PS2_CTRL] = 0xa6, // ctrl - [PEVB_PICO_PS2_CAPSLOCK] = 0xb5, // func - [PEVB_PICO_PS2_LSHIFT] = 0xb6, // shift + [PEVB_KBD_1] = 0x00, + [PEVB_KBD_2] = 0x01, + [PEVB_KBD_3] = 0x02, + [PEVB_KBD_4] = 0x03, + [PEVB_KBD_5] = 0x04, + [PEVB_KBD_6] = 0x05, + [PEVB_KBD_7] = 0x06, + [PEVB_KBD_8] = 0x80, + [PEVB_KBD_9] = 0x81, + [PEVB_KBD_0] = 0x82, + [PEVB_KBD_MINUS] = 0x83, + [PEVB_KBD_CARET] = 0x84, + [PEVB_KBD_YEN] = 0x85, + [PEVB_KBD_ESCAPE] = 0x86, // break + + [PEVB_KBD_q] = 0x10, + [PEVB_KBD_w] = 0x11, + [PEVB_KBD_e] = 0x12, + [PEVB_KBD_r] = 0x13, + [PEVB_KBD_t] = 0x14, + [PEVB_KBD_y] = 0x15, + [PEVB_KBD_u] = 0x16, + [PEVB_KBD_i] = 0x70, + [PEVB_KBD_o] = 0x71, + [PEVB_KBD_p] = 0x72, + [PEVB_KBD_AT] = 0x73, + [PEVB_KBD_LEFTBRACKET] = 0x74, + + [PEVB_KBD_a] = 0x20, + [PEVB_KBD_s] = 0x21, + [PEVB_KBD_d] = 0x22, + [PEVB_KBD_f] = 0x23, + [PEVB_KBD_g] = 0x24, + [PEVB_KBD_h] = 0x25, + [PEVB_KBD_j] = 0x26, + [PEVB_KBD_k] = 0x60, + [PEVB_KBD_l] = 0x61, + [PEVB_KBD_SEMICOLON] = 0x62, + [PEVB_KBD_COLON] = 0x63, + [PEVB_KBD_RIGHTBRACKET] = 0x64, + [PEVB_KBD_RETURN] = 0x65, + [PEVB_KBD_UP] = 0x66, // up + + [PEVB_KBD_z] = 0x30, + [PEVB_KBD_x] = 0x31, + [PEVB_KBD_c] = 0x32, + [PEVB_KBD_v] = 0x33, + [PEVB_KBD_b] = 0x34, + [PEVB_KBD_n] = 0x35, + [PEVB_KBD_m] = 0x36, + [PEVB_KBD_COMMA] = 0x50, + [PEVB_KBD_PERIOD] = 0x51, + [PEVB_KBD_SLASH] = 0x52, + [PEVB_KBD_RO] = 0x53, // pi + [PEVB_KBD_DOWN] = 0x54, // down + [PEVB_KBD_LEFT] = 0x55, // left + [PEVB_KBD_RIGHT] = 0x56, // right + + [PEVB_KBD_CJK] = 0x40, // kana + [PEVB_KBD_SPACE] = 0x41, // space + [PEVB_KBD_HOME] = 0x42, // clear/home + [PEVB_KBD_BACKSPACE] = 0x43, // del/ins + + [PEVB_KBD_SOUND] = 0x96, // graph + [PEVB_KBD_CAPSLOCK] = 0xa6, // ctrl + [PEVB_KBD_FUNC] = 0xb5, // func + [PEVB_KBD_SHIFT] = 0xb6, // shift }; static void kbd_update(void) { - u32 key = (PicoIn.ps2 & 0x00ff); - u32 sft = (PicoIn.ps2 & 0xff00) >> 8; + u32 key = (PicoIn.kbd & 0x00ff); + u32 sft = (PicoIn.kbd & 0xff00) >> 8; memset(kbd_matrix, 0, sizeof(kbd_matrix)); if (/*PicoPicohw.kb.active &&*/ sft) { diff --git a/platform/common/config_file.c b/platform/common/config_file.c index e08a4751..577f4433 100644 --- a/platform/common/config_file.c +++ b/platform/common/config_file.c @@ -53,7 +53,7 @@ static int seek_sect(FILE *f, const char *section) return 0; } -static void keys_write(FILE *fn, int dev_id, const int *binds, const int *ps2_binds) +static void keys_write(FILE *fn, int dev_id, const int *binds, const int *kbd_binds) { char act[48]; int key_count = 0, k, i; @@ -107,8 +107,8 @@ static void keys_write(FILE *fn, int dev_id, const int *binds, const int *ps2_bi for (k = 0; k < key_count; k++) { const char *name = in_get_key_name(dev_id, k); if (strcmp(name, "#") == 0) name = "\\x23"; // replace comment sign - if (ps2_binds[k]) - fprintf(fn, "bind %s = key%02x" NL, name, ps2_binds[k]); + if (kbd_binds[k]) + fprintf(fn, "bind %s = key%02x" NL, name, kbd_binds[k]); } } @@ -178,7 +178,7 @@ write_line: fprintf(fn, "binddev = %s" NL, name); in_get_config(t, IN_CFG_BIND_COUNT, &count); - keys_write(fn, t, binds, in_get_dev_ps2_binds(t)); + keys_write(fn, t, binds, in_get_dev_kbd_binds(t)); } fprintf(fn, "Sound Volume = %i" NL, currentConfig.volume); @@ -393,7 +393,7 @@ static int parse_bind_val(const char *val, int *type) if (strncasecmp(val, "key", 3) == 0) { - *type = IN_BINDTYPE_PICO_PS2; + *type = IN_BINDTYPE_KEYBOARD; return strtol(val + 3, NULL, 16); } @@ -455,8 +455,8 @@ static void keys_parse_all(FILE *f) } mystrip(var + 5); - if (type == IN_BINDTYPE_PICO_PS2) - in_config_bind_ps2_key(dev_id, var + 5, acts); + if (type == IN_BINDTYPE_KEYBOARD) + in_config_bind_kbd_key(dev_id, var + 5, acts); else in_config_bind_key(dev_id, var + 5, acts, type); } diff --git a/platform/common/emu.c b/platform/common/emu.c index 35434dbb..a7cae06a 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -1295,20 +1295,21 @@ void emu_update_input(void) { static int prev_events = 0; int actions[IN_BINDTYPE_COUNT] = { 0, }; - int actions_pico_ps2[IN_BIND_LAST] = { 0, }; + int actions_kbd[IN_BIND_LAST] = { 0, }; int pl_actions[4]; int events; in_update(actions); - in_update_pico_ps2(actions_pico_ps2); - PicoIn.ps2 = 0; + in_update_kbd(actions_kbd); + PicoIn.kbd = 0; for (int i = 0; i < IN_BIND_LAST; i++) { - if (actions_pico_ps2[i]) { - unsigned int action = actions_pico_ps2[i]; - if ((action & 0xff) == PEVB_PICO_PS2_LSHIFT) { - PicoIn.ps2 = (PicoIn.ps2 & 0x00ff) | (action << 8); + if (actions_kbd[i]) { + unsigned int action = actions_kbd[i]; + unsigned int key = (action & 0xff); + if (key == PEVB_KBD_SHIFT || key == PEVB_KBD_CTRL || key == PEVB_KBD_FUNC) { + PicoIn.kbd = (PicoIn.kbd & 0x00ff) | (action << 8); } else { - PicoIn.ps2 = (PicoIn.ps2 & 0xff00) | action; + PicoIn.kbd = (PicoIn.kbd & 0xff00) | action; } } } diff --git a/platform/common/input_pico.h b/platform/common/input_pico.h index b1b09f84..0ecbee0e 100644 --- a/platform/common/input_pico.h +++ b/platform/common/input_pico.h @@ -53,100 +53,87 @@ /* Keyboard Pico */ // Blue buttons -#define PEVB_PICO_PS2_SPACE 0x29 -#define PEVB_PICO_PS2_EXCLAIM 0 -#define PEVB_PICO_PS2_QUOTEDBL 0 -#define PEVB_PICO_PS2_HASH 0 -#define PEVB_PICO_PS2_DOLLAR 0 -#define PEVB_PICO_PS2_AMPERSAND 0 -#define PEVB_PICO_PS2_LEFTPAREN 0 -#define PEVB_PICO_PS2_RIGHTPAREN 0 -#define PEVB_PICO_PS2_ASTERISK 0 //x7c on kp ?? -#define PEVB_PICO_PS2_PLUS 0 //x79 on kp ?? -#define PEVB_PICO_PS2_MINUS 0x4e -#define PEVB_PICO_PS2_COMMA 0x41 -#define PEVB_PICO_PS2_PERIOD 0x49 -#define PEVB_PICO_PS2_SLASH 0x4a -#define PEVB_PICO_PS2_1 0x16 -#define PEVB_PICO_PS2_2 0x1e -#define PEVB_PICO_PS2_3 0x26 -#define PEVB_PICO_PS2_4 0x25 -#define PEVB_PICO_PS2_5 0x2e -#define PEVB_PICO_PS2_6 0x36 -#define PEVB_PICO_PS2_7 0x3d -#define PEVB_PICO_PS2_8 0x3e -#define PEVB_PICO_PS2_9 0x46 -#define PEVB_PICO_PS2_0 0x45 -#define PEVB_PICO_PS2_COLON 0x52 -#define PEVB_PICO_PS2_SEMICOLON 0x4c -#define PEVB_PICO_PS2_LESS 0 -#define PEVB_PICO_PS2_EQUALS 0 //x55 ?? -#define PEVB_PICO_PS2_GREATER 0 -#define PEVB_PICO_PS2_QUESTION 0 -#define PEVB_PICO_PS2_AT 0x54 // ?? -#define PEVB_PICO_PS2_DAKUTEN 0 //x54 // ゛ -#define PEVB_PICO_PS2_LEFTBRACKET 0x5b -#define PEVB_PICO_PS2_RIGHTBRACKET 0x5d -#define PEVB_PICO_PS2_CARET 0x55 // ?? -#define PEVB_PICO_PS2_UNDERSCORE 0 -#define PEVB_PICO_PS2_YEN 0x6a // ¥ -#define PEVB_PICO_PS2_RO 0x51 // ろ -#define PEVB_PICO_PS2_KE 0 //x52 ?? // け - -#define PEVB_PICO_PS2_a 0x1c -#define PEVB_PICO_PS2_b 0x32 -#define PEVB_PICO_PS2_c 0x21 -#define PEVB_PICO_PS2_d 0x23 -#define PEVB_PICO_PS2_e 0x24 -#define PEVB_PICO_PS2_f 0x2b -#define PEVB_PICO_PS2_g 0x34 -#define PEVB_PICO_PS2_h 0x33 -#define PEVB_PICO_PS2_i 0x43 -#define PEVB_PICO_PS2_j 0x3b -#define PEVB_PICO_PS2_k 0x42 -#define PEVB_PICO_PS2_l 0x4b -#define PEVB_PICO_PS2_m 0x3a -#define PEVB_PICO_PS2_n 0x31 -#define PEVB_PICO_PS2_o 0x44 -#define PEVB_PICO_PS2_p 0x4d -#define PEVB_PICO_PS2_q 0x15 -#define PEVB_PICO_PS2_r 0x2d -#define PEVB_PICO_PS2_s 0x1b -#define PEVB_PICO_PS2_t 0x2c -#define PEVB_PICO_PS2_u 0x3c -#define PEVB_PICO_PS2_v 0x2a -#define PEVB_PICO_PS2_w 0x1d -#define PEVB_PICO_PS2_x 0x22 -#define PEVB_PICO_PS2_y 0x35 -#define PEVB_PICO_PS2_z 0x1a +#define PEVB_KBD_1 0x16 +#define PEVB_KBD_2 0x1e +#define PEVB_KBD_3 0x26 +#define PEVB_KBD_4 0x25 +#define PEVB_KBD_5 0x2e +#define PEVB_KBD_6 0x36 +#define PEVB_KBD_7 0x3d +#define PEVB_KBD_8 0x3e +#define PEVB_KBD_9 0x46 +#define PEVB_KBD_0 0x45 +#define PEVB_KBD_MINUS 0x4e +#define PEVB_KBD_CARET 0x55 +#define PEVB_KBD_YEN 0x6a // ¥ + +#define PEVB_KBD_q 0x15 +#define PEVB_KBD_w 0x1d +#define PEVB_KBD_e 0x24 +#define PEVB_KBD_r 0x2d +#define PEVB_KBD_t 0x2c +#define PEVB_KBD_y 0x35 +#define PEVB_KBD_u 0x3c +#define PEVB_KBD_i 0x43 +#define PEVB_KBD_o 0x44 +#define PEVB_KBD_p 0x4d +#define PEVB_KBD_AT 0x54 +#define PEVB_KBD_LEFTBRACKET 0x5b + +#define PEVB_KBD_a 0x1c +#define PEVB_KBD_s 0x1b +#define PEVB_KBD_d 0x23 +#define PEVB_KBD_f 0x2b +#define PEVB_KBD_g 0x34 +#define PEVB_KBD_h 0x33 +#define PEVB_KBD_j 0x3b +#define PEVB_KBD_k 0x42 +#define PEVB_KBD_l 0x4b +#define PEVB_KBD_SEMICOLON 0x4c +#define PEVB_KBD_COLON 0x52 +#define PEVB_KBD_RIGHTBRACKET 0x5d + +#define PEVB_KBD_z 0x1a +#define PEVB_KBD_x 0x22 +#define PEVB_KBD_c 0x21 +#define PEVB_KBD_v 0x2a +#define PEVB_KBD_b 0x32 +#define PEVB_KBD_n 0x31 +#define PEVB_KBD_m 0x3a +#define PEVB_KBD_COMMA 0x41 +#define PEVB_KBD_PERIOD 0x49 +#define PEVB_KBD_SLASH 0x4a +#define PEVB_KBD_RO 0x51 // ろ + +#define PEVB_KBD_SPACE 0x29 // Green button on top-left -#define PEVB_PICO_PS2_ESCAPE 0x76 +#define PEVB_KBD_ESCAPE 0x76 // Orange buttons on left -#define PEVB_PICO_PS2_CAPSLOCK 0x58 -#define PEVB_PICO_PS2_LSHIFT 0x12 +#define PEVB_KBD_CAPSLOCK 0x58 +#define PEVB_KBD_SHIFT 0x12 // left shift // Green buttons on right -#define PEVB_PICO_PS2_BACKSPACE 0x66 -#define PEVB_PICO_PS2_INSERT 0x81 -#define PEVB_PICO_PS2_DELETE 0x85 +#define PEVB_KBD_BACKSPACE 0x66 +#define PEVB_KBD_INSERT 0x81 +#define PEVB_KBD_DELETE 0x85 // Red button on bottom-right -#define PEVB_PICO_PS2_RETURN 0x5a +#define PEVB_KBD_RETURN 0x5a // Orange buttons on bottom -#define PEVB_PICO_PS2_SOUND 0x67 -#define PEVB_PICO_PS2_HOME 0x64 -#define PEVB_PICO_PS2_CJK 0x13 -#define PEVB_PICO_PS2_ROMAJI 0x17 - -// Other buttons, for SC-3000 -#define PEVB_PICO_PS2_CTRL 0x14 -#define PEVB_PICO_PS2_ALT 0x11 -#define PEVB_PICO_PS2_UP 0x75 -#define PEVB_PICO_PS2_DOWN 0x72 -#define PEVB_PICO_PS2_LEFT 0x6b -#define PEVB_PICO_PS2_RIGHT 0x74 +#define PEVB_KBD_SOUND 0x67 // muhenkan (graph) +#define PEVB_KBD_HOME 0x64 // henkan (clr/home) +#define PEVB_KBD_CJK 0x13 // kana/kanji +#define PEVB_KBD_ROMAJI 0x17 + +// Other buttons for SC-3000 +#define PEVB_KBD_CTRL 0x14 +#define PEVB_KBD_FUNC 0x11 +#define PEVB_KBD_UP 0x75 +#define PEVB_KBD_DOWN 0x72 +#define PEVB_KBD_LEFT 0x6b +#define PEVB_KBD_RIGHT 0x74 #endif /* INCLUDE_c48097f3ff2a6a9af1cce8fd7a9b3f0c */ diff --git a/platform/common/inputmap_kbd.c b/platform/common/inputmap_kbd.c index 9271967f..eaefc2dd 100644 --- a/platform/common/inputmap_kbd.c +++ b/platform/common/inputmap_kbd.c @@ -37,101 +37,94 @@ const struct in_default_bind _in_sdl_defbinds[] = { { 0, 0, 0 } }; -const struct in_default_bind in_sdl_pico_ps2_map[] = { +// use something close to a US keyboard as default, swapping some keys around +// to feel more natural (if that's possible at all :-/) +// TODO should backquote and backslash be swapped on "yen" and "at"? +const struct in_default_bind in_sdl_kbd_map[] = { // Blue buttons - { SDLK_SPACE, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_SPACE }, - { SDLK_EXCLAIM, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_EXCLAIM }, - { SDLK_QUOTEDBL, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_QUOTEDBL }, - { SDLK_HASH, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_HASH }, - { SDLK_DOLLAR, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_DOLLAR }, - { SDLK_AMPERSAND, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_AMPERSAND }, - { SDLK_LEFTPAREN, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_LEFTPAREN }, - { SDLK_RIGHTPAREN, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_RIGHTPAREN }, - { SDLK_ASTERISK, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_ASTERISK }, - { SDLK_PLUS, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_PLUS }, - { SDLK_COMMA, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_COMMA }, - { SDLK_MINUS, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_MINUS }, - { SDLK_PERIOD, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_PERIOD }, - { SDLK_SLASH, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_SLASH }, - { SDLK_0, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_0 }, - { SDLK_1, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_1 }, - { SDLK_2, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_2 }, - { SDLK_3, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_3 }, - { SDLK_4, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_4 }, - { SDLK_5, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_5 }, - { SDLK_6, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_6 }, - { SDLK_7, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_7 }, - { SDLK_8, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_8 }, - { SDLK_9, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_9 }, - { SDLK_COLON, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_COLON }, - { SDLK_SEMICOLON, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_SEMICOLON }, - { SDLK_LESS, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_LESS }, - { SDLK_EQUALS, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_EQUALS }, - { SDLK_GREATER, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_GREATER }, - { SDLK_QUESTION, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_QUESTION }, - { SDLK_AT, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_AT }, - { SDLK_BACKSLASH, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_DAKUTEN }, - { SDLK_LEFTBRACKET, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_LEFTBRACKET }, - { SDLK_RIGHTBRACKET, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_RIGHTBRACKET }, - { SDLK_CARET, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_CARET }, - { SDLK_UNDERSCORE, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_UNDERSCORE }, - { SDLK_BACKQUOTE, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_YEN }, - { SDLK_a, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_a }, - { SDLK_b, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_b }, - { SDLK_c, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_c }, - { SDLK_d, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_d }, - { SDLK_e, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_e }, - { SDLK_f, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_f }, - { SDLK_g, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_g }, - { SDLK_h, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_h }, - { SDLK_i, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_i }, - { SDLK_j, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_j }, - { SDLK_k, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_k }, - { SDLK_l, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_l }, - { SDLK_m, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_m }, - { SDLK_n, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_n }, - { SDLK_o, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_o }, - { SDLK_p, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_p }, - { SDLK_q, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_q }, - { SDLK_r, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_r }, - { SDLK_s, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_s }, - { SDLK_t, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_t }, - { SDLK_u, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_u }, - { SDLK_v, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_v }, - { SDLK_w, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_w }, - { SDLK_x, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_x }, - { SDLK_y, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_y }, - { SDLK_z, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_z }, - { SDLK_QUOTE, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_KE }, - { SDLK_RSHIFT, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_RO }, + { SDLK_1, IN_BINDTYPE_KEYBOARD, PEVB_KBD_1 }, + { SDLK_2, IN_BINDTYPE_KEYBOARD, PEVB_KBD_2 }, + { SDLK_3, IN_BINDTYPE_KEYBOARD, PEVB_KBD_3 }, + { SDLK_4, IN_BINDTYPE_KEYBOARD, PEVB_KBD_4 }, + { SDLK_5, IN_BINDTYPE_KEYBOARD, PEVB_KBD_5 }, + { SDLK_6, IN_BINDTYPE_KEYBOARD, PEVB_KBD_6 }, + { SDLK_7, IN_BINDTYPE_KEYBOARD, PEVB_KBD_7 }, + { SDLK_8, IN_BINDTYPE_KEYBOARD, PEVB_KBD_8 }, + { SDLK_9, IN_BINDTYPE_KEYBOARD, PEVB_KBD_9 }, + { SDLK_0, IN_BINDTYPE_KEYBOARD, PEVB_KBD_0 }, + { SDLK_MINUS, IN_BINDTYPE_KEYBOARD, PEVB_KBD_MINUS }, + { SDLK_EQUALS, IN_BINDTYPE_KEYBOARD, PEVB_KBD_CARET }, + { SDLK_BACKQUOTE, IN_BINDTYPE_KEYBOARD, PEVB_KBD_YEN }, + + { SDLK_q, IN_BINDTYPE_KEYBOARD, PEVB_KBD_q }, + { SDLK_w, IN_BINDTYPE_KEYBOARD, PEVB_KBD_w }, + { SDLK_e, IN_BINDTYPE_KEYBOARD, PEVB_KBD_e }, + { SDLK_r, IN_BINDTYPE_KEYBOARD, PEVB_KBD_r }, + { SDLK_t, IN_BINDTYPE_KEYBOARD, PEVB_KBD_t }, + { SDLK_y, IN_BINDTYPE_KEYBOARD, PEVB_KBD_y }, + { SDLK_u, IN_BINDTYPE_KEYBOARD, PEVB_KBD_u }, + { SDLK_i, IN_BINDTYPE_KEYBOARD, PEVB_KBD_i }, + { SDLK_o, IN_BINDTYPE_KEYBOARD, PEVB_KBD_o }, + { SDLK_p, IN_BINDTYPE_KEYBOARD, PEVB_KBD_p }, + { SDLK_BACKSLASH, IN_BINDTYPE_KEYBOARD, PEVB_KBD_AT }, + { SDLK_LEFTBRACKET, IN_BINDTYPE_KEYBOARD, PEVB_KBD_LEFTBRACKET }, + + { SDLK_a, IN_BINDTYPE_KEYBOARD, PEVB_KBD_a }, + { SDLK_s, IN_BINDTYPE_KEYBOARD, PEVB_KBD_s }, + { SDLK_d, IN_BINDTYPE_KEYBOARD, PEVB_KBD_d }, + { SDLK_f, IN_BINDTYPE_KEYBOARD, PEVB_KBD_f }, + { SDLK_g, IN_BINDTYPE_KEYBOARD, PEVB_KBD_g }, + { SDLK_h, IN_BINDTYPE_KEYBOARD, PEVB_KBD_h }, + { SDLK_j, IN_BINDTYPE_KEYBOARD, PEVB_KBD_j }, + { SDLK_k, IN_BINDTYPE_KEYBOARD, PEVB_KBD_k }, + { SDLK_l, IN_BINDTYPE_KEYBOARD, PEVB_KBD_l }, + { SDLK_SEMICOLON, IN_BINDTYPE_KEYBOARD, PEVB_KBD_SEMICOLON }, + { SDLK_QUOTE, IN_BINDTYPE_KEYBOARD, PEVB_KBD_COLON }, + { SDLK_RIGHTBRACKET, IN_BINDTYPE_KEYBOARD, PEVB_KBD_RIGHTBRACKET }, + + { SDLK_z, IN_BINDTYPE_KEYBOARD, PEVB_KBD_z }, + { SDLK_x, IN_BINDTYPE_KEYBOARD, PEVB_KBD_x }, + { SDLK_c, IN_BINDTYPE_KEYBOARD, PEVB_KBD_c }, + { SDLK_v, IN_BINDTYPE_KEYBOARD, PEVB_KBD_v }, + { SDLK_b, IN_BINDTYPE_KEYBOARD, PEVB_KBD_b }, + { SDLK_n, IN_BINDTYPE_KEYBOARD, PEVB_KBD_n }, + { SDLK_m, IN_BINDTYPE_KEYBOARD, PEVB_KBD_m }, + { SDLK_COMMA, IN_BINDTYPE_KEYBOARD, PEVB_KBD_COMMA }, + { SDLK_PERIOD, IN_BINDTYPE_KEYBOARD, PEVB_KBD_PERIOD }, + { SDLK_SLASH, IN_BINDTYPE_KEYBOARD, PEVB_KBD_SLASH }, + { SDLK_RSHIFT, IN_BINDTYPE_KEYBOARD, PEVB_KBD_RO }, + + { SDLK_SPACE, IN_BINDTYPE_KEYBOARD, PEVB_KBD_SPACE }, // Green button on top-left - { SDLK_ESCAPE, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_ESCAPE }, + { SDLK_ESCAPE, IN_BINDTYPE_KEYBOARD, PEVB_KBD_ESCAPE }, // Orange buttons on left - { SDLK_LCTRL, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_CAPSLOCK }, // Also switches english input - { SDLK_LSHIFT, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_LSHIFT }, + // NB caps lock generates only a pulse on most keyboards, even if the + // button is kept pressed. Using ctrl key for complete up/down handling. + { SDLK_LCTRL, IN_BINDTYPE_KEYBOARD, PEVB_KBD_CAPSLOCK }, // Also switches english input + { SDLK_LSHIFT, IN_BINDTYPE_KEYBOARD, PEVB_KBD_SHIFT }, // Green buttons on right - { SDLK_BACKSPACE, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_BACKSPACE }, - { SDLK_INSERT, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_INSERT }, - { SDLK_DELETE, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_DELETE }, + { SDLK_BACKSPACE, IN_BINDTYPE_KEYBOARD, PEVB_KBD_BACKSPACE }, + { SDLK_INSERT, IN_BINDTYPE_KEYBOARD, PEVB_KBD_INSERT }, + { SDLK_DELETE, IN_BINDTYPE_KEYBOARD, PEVB_KBD_DELETE }, // Red button on bottom-right - { SDLK_RETURN, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_RETURN }, + { SDLK_RETURN, IN_BINDTYPE_KEYBOARD, PEVB_KBD_RETURN }, // Orange buttons on bottom - { SDLK_END, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_SOUND }, - { SDLK_HOME, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_HOME }, - { SDLK_PAGEUP, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_CJK }, // CJK Scripts: Hiragana / Katakana / Kanji (Keyboard Pico); Hangul (Kibodeu Piko) - { SDLK_PAGEDOWN, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_ROMAJI }, // English Script - - // Others - { SDLK_LALT, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_ALT }, - { SDLK_UP, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_UP }, - { SDLK_DOWN, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_DOWN }, - { SDLK_LEFT, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_LEFT }, - { SDLK_RIGHT, IN_BINDTYPE_PICO_PS2, PEVB_PICO_PS2_RIGHT }, + { SDLK_END, IN_BINDTYPE_KEYBOARD, PEVB_KBD_SOUND }, + { SDLK_HOME, IN_BINDTYPE_KEYBOARD, PEVB_KBD_HOME }, + { SDLK_PAGEUP, IN_BINDTYPE_KEYBOARD, PEVB_KBD_CJK }, // CJK Scripts: Hiragana / Katakana / Kanji (Keyboard Pico); Hangul (Kibodeu Piko) + { SDLK_PAGEDOWN, IN_BINDTYPE_KEYBOARD, PEVB_KBD_ROMAJI }, // English Script + + // Others for SC-3000 + { SDLK_LALT, IN_BINDTYPE_KEYBOARD, PEVB_KBD_FUNC }, + { SDLK_UP, IN_BINDTYPE_KEYBOARD, PEVB_KBD_UP }, + { SDLK_DOWN, IN_BINDTYPE_KEYBOARD, PEVB_KBD_DOWN }, + { SDLK_LEFT, IN_BINDTYPE_KEYBOARD, PEVB_KBD_LEFT }, + { SDLK_RIGHT, IN_BINDTYPE_KEYBOARD, PEVB_KBD_RIGHT }, { 0, 0, 0 } }; diff --git a/platform/common/menu_pico.c b/platform/common/menu_pico.c index f7da2e49..01b2d97e 100644 --- a/platform/common/menu_pico.c +++ b/platform/common/menu_pico.c @@ -428,78 +428,78 @@ struct key { //pico struct key pico_row1[] = { - { 0, "esc", "esc", PEVB_PICO_PS2_ESCAPE }, - { 4, "1", "!", PEVB_PICO_PS2_1 }, - { 7, "2", "\"", PEVB_PICO_PS2_2 }, - { 10, "3", "#", PEVB_PICO_PS2_3 }, - { 13, "4", "$", PEVB_PICO_PS2_4 }, - { 16, "5", "%", PEVB_PICO_PS2_5 }, - { 19, "6", "&", PEVB_PICO_PS2_6 }, - { 22, "7", "'", PEVB_PICO_PS2_7 }, - { 25, "8", "(", PEVB_PICO_PS2_8 }, - { 28, "9", ")", PEVB_PICO_PS2_9 }, - { 31, "0", "0", PEVB_PICO_PS2_0 }, - { 34, "-", "=", PEVB_PICO_PS2_MINUS }, - { 37, "^", "~", PEVB_PICO_PS2_CARET }, - { 40, "Y", "|", PEVB_PICO_PS2_YEN }, - { 43, "bs", "bs", PEVB_PICO_PS2_BACKSPACE }, + { 0, "esc", "esc", PEVB_KBD_ESCAPE }, + { 4, "1", "!", PEVB_KBD_1 }, + { 7, "2", "\"", PEVB_KBD_2 }, + { 10, "3", "#", PEVB_KBD_3 }, + { 13, "4", "$", PEVB_KBD_4 }, + { 16, "5", "%", PEVB_KBD_5 }, + { 19, "6", "&", PEVB_KBD_6 }, + { 22, "7", "'", PEVB_KBD_7 }, + { 25, "8", "(", PEVB_KBD_8 }, + { 28, "9", ")", PEVB_KBD_9 }, + { 31, "0", "0", PEVB_KBD_0 }, + { 34, "-", "=", PEVB_KBD_MINUS }, + { 37, "^", "~", PEVB_KBD_CARET }, + { 40, "Y", "|", PEVB_KBD_YEN }, + { 43, "bs", "bs", PEVB_KBD_BACKSPACE }, { 0 }, }; struct key pico_row2[] = { - { 5, "q", "Q", PEVB_PICO_PS2_q }, - { 8, "w", "W", PEVB_PICO_PS2_w }, - { 11, "e", "E", PEVB_PICO_PS2_e }, - { 14, "r", "R", PEVB_PICO_PS2_r }, - { 17, "t", "T", PEVB_PICO_PS2_t }, - { 20, "y", "Y", PEVB_PICO_PS2_y }, - { 23, "u", "U", PEVB_PICO_PS2_u }, - { 26, "i", "I", PEVB_PICO_PS2_i }, - { 29, "o", "O", PEVB_PICO_PS2_o }, - { 32, "p", "P", PEVB_PICO_PS2_p }, - { 35, "@", "`", PEVB_PICO_PS2_AT }, - { 38, "[", "{", PEVB_PICO_PS2_LEFTBRACKET }, - { 43, "ins", "ins", PEVB_PICO_PS2_INSERT }, + { 5, "q", "Q", PEVB_KBD_q }, + { 8, "w", "W", PEVB_KBD_w }, + { 11, "e", "E", PEVB_KBD_e }, + { 14, "r", "R", PEVB_KBD_r }, + { 17, "t", "T", PEVB_KBD_t }, + { 20, "y", "Y", PEVB_KBD_y }, + { 23, "u", "U", PEVB_KBD_u }, + { 26, "i", "I", PEVB_KBD_i }, + { 29, "o", "O", PEVB_KBD_o }, + { 32, "p", "P", PEVB_KBD_p }, + { 35, "@", "`", PEVB_KBD_AT }, + { 38, "[", "{", PEVB_KBD_LEFTBRACKET }, + { 43, "ins", "ins", PEVB_KBD_INSERT }, { 0 }, }; struct key pico_row3[] = { - { 0, "caps", "caps", PEVB_PICO_PS2_CAPSLOCK }, - { 6, "a", "A", PEVB_PICO_PS2_a }, - { 9, "s", "S", PEVB_PICO_PS2_s }, - { 12, "d", "D", PEVB_PICO_PS2_d }, - { 15, "f", "F", PEVB_PICO_PS2_f }, - { 18, "g", "G", PEVB_PICO_PS2_g }, - { 21, "h", "H", PEVB_PICO_PS2_h }, - { 24, "j", "J", PEVB_PICO_PS2_j }, - { 27, "k", "K", PEVB_PICO_PS2_k }, - { 30, "l", "L", PEVB_PICO_PS2_l }, - { 33, ";", "+", PEVB_PICO_PS2_SEMICOLON }, - { 36, ":", "*", PEVB_PICO_PS2_COLON }, - { 39, "]", "}", PEVB_PICO_PS2_RIGHTBRACKET }, - { 43, "del", "del", PEVB_PICO_PS2_DELETE }, + { 0, "caps", "caps", PEVB_KBD_CAPSLOCK }, + { 6, "a", "A", PEVB_KBD_a }, + { 9, "s", "S", PEVB_KBD_s }, + { 12, "d", "D", PEVB_KBD_d }, + { 15, "f", "F", PEVB_KBD_f }, + { 18, "g", "G", PEVB_KBD_g }, + { 21, "h", "H", PEVB_KBD_h }, + { 24, "j", "J", PEVB_KBD_j }, + { 27, "k", "K", PEVB_KBD_k }, + { 30, "l", "L", PEVB_KBD_l }, + { 33, ";", "+", PEVB_KBD_SEMICOLON }, + { 36, ":", "*", PEVB_KBD_COLON }, + { 39, "]", "}", PEVB_KBD_RIGHTBRACKET }, + { 43, "del", "del", PEVB_KBD_DELETE }, { 0 }, }; struct key pico_row4[] = { - { 0, "shift", "shift", PEVB_PICO_PS2_LSHIFT }, - { 7, "z", "Z", PEVB_PICO_PS2_z }, - { 10, "x", "X", PEVB_PICO_PS2_x }, - { 13, "c", "C", PEVB_PICO_PS2_c }, - { 16, "v", "V", PEVB_PICO_PS2_v }, - { 19, "b", "B", PEVB_PICO_PS2_b }, - { 22, "n", "N", PEVB_PICO_PS2_n }, - { 25, "m", "M", PEVB_PICO_PS2_m }, - { 28, ",", "<", PEVB_PICO_PS2_COMMA }, - { 31, ".", ">", PEVB_PICO_PS2_PERIOD }, - { 34, "/", "?", PEVB_PICO_PS2_SLASH }, - { 37, "_", "_", PEVB_PICO_PS2_RO }, - { 41, "enter", "enter", PEVB_PICO_PS2_RETURN }, + { 0, "shift", "shift", PEVB_KBD_SHIFT }, + { 7, "z", "Z", PEVB_KBD_z }, + { 10, "x", "X", PEVB_KBD_x }, + { 13, "c", "C", PEVB_KBD_c }, + { 16, "v", "V", PEVB_KBD_v }, + { 19, "b", "B", PEVB_KBD_b }, + { 22, "n", "N", PEVB_KBD_n }, + { 25, "m", "M", PEVB_KBD_m }, + { 28, ",", "<", PEVB_KBD_COMMA }, + { 31, ".", ">", PEVB_KBD_PERIOD }, + { 34, "/", "?", PEVB_KBD_SLASH }, + { 37, "_", "_", PEVB_KBD_RO }, + { 41, "enter", "enter", PEVB_KBD_RETURN }, { 0 }, }; struct key pico_row5[] = { - { 0, "muhenkan", "muhenkan", PEVB_PICO_PS2_SOUND }, - { 13, "space", "space", PEVB_PICO_PS2_SPACE }, - { 22, "henkan", "henkan", PEVB_PICO_PS2_HOME }, - { 29, "kana", "kana", PEVB_PICO_PS2_CJK }, - { 34, "romaji", "romaji", PEVB_PICO_PS2_ROMAJI }, + { 0, "muhenkan", "muhenkan", PEVB_KBD_SOUND }, + { 13, "space", "space", PEVB_KBD_SPACE }, + { 22, "henkan", "henkan", PEVB_KBD_HOME }, + { 29, "kana", "kana", PEVB_KBD_CJK }, + { 34, "romaji", "romaji", PEVB_KBD_ROMAJI }, { 0 }, }; @@ -555,7 +555,7 @@ int key_config_kbd_loop(int id, int keys) for (;;) { key = &pico_kbd[keyy][keyx]; for (dev = 0; dev < IN_MAX_DEVS-1; dev++) - if ((binds = in_get_dev_ps2_binds(dev))) break; + if ((binds = in_get_dev_kbd_binds(dev))) break; in_get_config(dev, IN_CFG_BIND_COUNT, &bc); for (bc--; bc >= 0 && binds[bc] != key->key; bc--) ; @@ -601,8 +601,8 @@ int key_config_kbd_loop(int id, int keys) for (is_down = 1; is_down; ) kc = in_update_keycode(&bind_dev_id, &is_down, NULL, -1); - in_bind_ps2_key(bind_dev_id, bc, 0); /* ?? */ - in_bind_ps2_key(bind_dev_id, kc, pico_kbd[keyy][keyx].key); + in_bind_kbd_key(bind_dev_id, bc, 0); /* ?? */ + in_bind_kbd_key(bind_dev_id, kc, pico_kbd[keyy][keyx].key); } } diff --git a/platform/common/plat_sdl.c b/platform/common/plat_sdl.c index 7a9d6b92..94bcb7be 100644 --- a/platform/common/plat_sdl.c +++ b/platform/common/plat_sdl.c @@ -511,7 +511,7 @@ void plat_init(void) in_sdl_platform_data.jmap_size = in_sdl_joy_map_sz, in_sdl_platform_data.joy_map = in_sdl_joy_map, in_sdl_platform_data.key_names = in_sdl_key_names, - in_sdl_platform_data.pico_ps2_map = in_sdl_pico_ps2_map, + in_sdl_platform_data.kbd_map = in_sdl_kbd_map, in_sdl_init(&in_sdl_platform_data, plat_sdl_event_handler); in_probe(); diff --git a/platform/common/plat_sdl.h b/platform/common/plat_sdl.h index 13f7d0c4..6132ad99 100644 --- a/platform/common/plat_sdl.h +++ b/platform/common/plat_sdl.h @@ -6,6 +6,6 @@ extern const struct menu_keymap *in_sdl_joy_map; extern const int in_sdl_joy_map_sz; extern const char * const *in_sdl_key_names; extern const char *plat_device; -extern const struct in_default_bind in_sdl_pico_ps2_map[]; +extern const struct in_default_bind in_sdl_kbd_map[]; void linux_menu_init(void); diff --git a/platform/libpicofe b/platform/libpicofe index c68a2bca..4acbd7fe 160000 --- a/platform/libpicofe +++ b/platform/libpicofe @@ -1 +1 @@ -Subproject commit c68a2bcaa9fd16b9eaf4f4d124e3948faecf137e +Subproject commit 4acbd7fec908288d3ba134c3ee17e05d3b3adddc