fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ibmpc: Update the 'key' monitor command

If a key name is not prefixed by either a '+' or a '-' then
the key is pressed and released.

+16 -13
+16 -13
src/arch/ibmpc/cmd.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/arch/ibmpc/cmd.c * 7 7 * Created: 2010-09-21 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2010-2024 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2010-2025 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 886 886 static 887 887 void pc_cmd_key (cmd_t *cmd, ibmpc_t *pc) 888 888 { 889 - unsigned i; 890 - unsigned event; 891 - pce_key_t key; 892 - char str[256]; 889 + unsigned i; 890 + unsigned mask; 891 + pce_key_t key; 892 + char str[256]; 893 893 894 894 while (cmd_match_str (cmd, str, 256)) { 895 895 i = 0; 896 896 897 - event = PCE_KEY_EVENT_DOWN; 898 - 899 897 if (str[0] == '+') { 898 + mask = 1; 900 899 i += 1; 901 900 } 902 901 else if (str[0] == '-') { 902 + mask = 2; 903 903 i += 1; 904 - event = PCE_KEY_EVENT_UP; 904 + } 905 + else { 906 + mask = 3; 905 907 } 906 908 907 909 key = pce_key_from_string (str + i); ··· 910 912 pce_printf ("unknown key: %s\n", str); 911 913 } 912 914 else { 913 - pce_printf ("key: %s%s\n", 914 - (event == PCE_KEY_EVENT_DOWN) ? "+" : "-", 915 - str + i 916 - ); 915 + if (mask & 1) { 916 + pc_kbd_set_key (&pc->kbd, PCE_KEY_EVENT_DOWN, key); 917 + } 917 918 918 - pc_kbd_set_key (&pc->kbd, event, key); 919 + if (mask & 2) { 920 + pc_kbd_set_key (&pc->kbd, PCE_KEY_EVENT_UP, key); 921 + } 919 922 } 920 923 } 921 924