From 44487b2614a949a185c59a96d1c225f9aabd9f04 Mon Sep 17 00:00:00 2001 From: Arch Blackmann Date: Thu, 5 Nov 2009 19:25:41 +0000 Subject: [PATCH] Generate modifier table. Generate extended scancode table X. Generate extended scancode table Y. svn path=/trunk/; revision=43977 --- reactos/tools/kbdtool/output.c | 75 ++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/reactos/tools/kbdtool/output.c b/reactos/tools/kbdtool/output.c index c4f1dcb4c18..743436e02aa 100644 --- a/reactos/tools/kbdtool/output.c +++ b/reactos/tools/kbdtool/output.c @@ -388,6 +388,10 @@ kbd_c(IN ULONG StateCount, { CHAR OutputFile[13]; FILE *FileHandle; + ULONG States[8]; + ULONG i; + ULONG HighestState; + PVKNAME Entry; /* Build the keyboard name and internal name */ strcpy(OutputFile, gKBDName); @@ -528,7 +532,28 @@ kbd_c(IN ULONG StateCount, /* Key name table header */ fprintf(FileHandle, "static ALLOC_SECTION_LDATA VSC_VK aE0VscToVk[] = {\n"); - /* FIXME: Key names */ + /* Loop 110-key table */ + for (i = 0; i < 110; i++) + { + /* Check for non-extended keys */ + if ((Layout->Entry[i].ScanCode & 0xFF00) == 0xE000) + { + /* Which are valid */ + if (Layout->Entry[i].ScanCode != 0xFF) + { + /* And mapped */ + if (Layout->Entry[i].VirtualKey != 0xFF) + { + /* Output them */ + fprintf(FileHandle, + " { 0x%02X, X%02X | KBDEXT }, // %s\n", + Layout->Entry[i].ScanCode, + Layout->Entry[i].ScanCode, + Layout->Entry[i].Name); + } + } + } + } /* Key name table finish */ fprintf(FileHandle, " { 0, 0 }\n};\n\n"); @@ -536,7 +561,28 @@ kbd_c(IN ULONG StateCount, /* Extended key name table header */ fprintf(FileHandle, "static ALLOC_SECTION_LDATA VSC_VK aE1VscToVk[] = {\n"); - /* FIXME: Extended scancodes */ + /* Loop 110-key table */ + for (i = 0; i < 110; i++) + { + /* Check for extended keys */ + if ((Layout->Entry[i].ScanCode & 0xFF00) == 0xE100) + { + /* Which are valid */ + if (Layout->Entry[i].ScanCode != 0xFF) + { + /* And mapped */ + if (Layout->Entry[i].VirtualKey != 0xFF) + { + /* Output them */ + fprintf(FileHandle, + " { 0x%02X, Y%02X | KBDEXT }, // %s\n", + Layout->Entry[i].ScanCode, + Layout->Entry[i].ScanCode, + Layout->Entry[i].Name); + } + } + } + } /* Extended key name table finish */ fprintf(FileHandle, @@ -559,7 +605,20 @@ kbd_c(IN ULONG StateCount, /* Modifier table header */ fprintf(FileHandle, "static ALLOC_SECTION_LDATA VK_TO_BIT aVkToBits[] = {\n"); - /* FIXME: Key modifiers */ + /* Loop modifier table */ + i = 0; + Entry = &Modifiers[0]; + while (Entry->VirtualKey) + { + /* Print out entry */ + fprintf(FileHandle, + " { %-12s, %-12s },\n", + getVKName(Entry->VirtualKey, 1), + Entry->Name); + + /* Move to the next one */ + Entry = &Modifiers[++i]; + } /* Modifier table finish */ fprintf(FileHandle, " { 0, 0 }\n};\n\n"); @@ -573,6 +632,16 @@ kbd_c(IN ULONG StateCount, "*\n" "\\***************************************************************************/\n\n"); + /* Zero out local state data */ + for (i = 0; i < 8; i++) States[i] = -1; + + /* Find the highest set state */ + for (HighestState = 1, i = 0; i < 8 && ShiftStates[i] > -1; i++) + { + States[ShiftStates[i]] = i; + if (ShiftStates[i] > HighestState) HighestState = ShiftStates[i]; + } + /* Modifier conversion table header */ fprintf(FileHandle, "static ALLOC_SECTION_LDATA MODIFIERS CharModifiers = {\n"