diff options
| author | Tianhao Wang <shrik3@mailbox.org> | 2024-05-29 01:32:02 +0200 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:17:10 +0200 |
| commit | 590d29c3e44fc06bc79c2624fc94273434505b9d (patch) | |
| tree | 6b0c2487dd79f84612b95a250bc75c307aa579b7 | |
| parent | a63831551c2875adc4ec6d780b11f7615361bbbf (diff) | |
keyboard: pad key translation table
some keys such as the Win key has larger scancode, causing out-of-bound
read in the translation table. As a temp fix pad the tables with 0 up to
100 chars.
Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
| -rw-r--r-- | src/machine/key.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/machine/key.rs b/src/machine/key.rs index 48e98b2..d591c93 100644 --- a/src/machine/key.rs +++ b/src/machine/key.rs @@ -106,24 +106,25 @@ pub enum Scan { // Decoding tables ... this shit is so ugly, thanks to rust's strong typing system!!! // Also, this is a german layout keyboard // oh btw, the code translation is done by ChatGPT if it's wrong complain to the AI! -pub const NORMAL_TAB: [c_uchar; 89] = [ +pub const NORMAL_TAB: [c_uchar; 100] = [ 0, 0, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 225, 39, 8, 0, 113, 119, 101, 114, 116, 122, 117, 105, 111, 112, 129, 43, 10, 0, 97, 115, 100, 102, 103, 104, 106, 107, 108, 148, 132, 94, 0, 35, 121, 120, 99, 118, 98, 110, 109, 44, 46, 45, 0, 42, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 45, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, + 0, 0, 0, 0, 45, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; -pub const SHIFT_TAB: [c_uchar; 89] = [ +pub const SHIFT_TAB: [c_uchar; 100] = [ 0, 0, 33, 34, 21, 36, 37, 38, 47, 40, 41, 61, 63, 96, 0, 0, 81, 87, 69, 82, 84, 90, 85, 73, 79, 80, 154, 42, 0, 0, 65, 83, 68, 70, 71, 72, 74, 75, 76, 153, 142, 248, 0, 39, 89, 88, 67, 86, 66, 78, 77, 59, 58, 95, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; -pub const ALT_TAB: [c_uchar; 89] = [ +pub const ALT_TAB: [c_uchar; 100] = [ 0, 0, 0, 253, 0, 0, 0, 0, 123, 91, 93, 125, 92, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; pub const ASC_NUM_TAB: [c_uchar; 13] = [55, 56, 57, 45, 52, 53, 54, 43, 49, 50, 51, 48, 44]; |
