1
0
mirror of synced 2024-12-01 02:27:25 +01:00

Merge pull request #1 from JamesLewisLiu/Refactor

Fix missing keys
This commit is contained in:
esuo1198 2023-12-25 20:46:39 +09:00 committed by GitHub
commit 055825da2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 87 additions and 20 deletions

12
dist/keyconfig.toml vendored
View File

@ -21,11 +21,15 @@ P2_LEFT_RED = []
P2_RIGHT_RED = []
P2_RIGHT_BLUE = []
# F1 through F12
# NUM0 through NUM9
# QWERTYUIOPASDFGHJKLZXCVBNM
# ESCAPE F1 through F12
# ` 1 through 0 -= BACKSPACE
# TAB QWERTYUIOP [ ] BACKSLASH
# CAPS_LOCK ASDFGHJKL ;' ENTER
# SHIFT ZXCVBNM , . SLASH
# CONTROL L_WIN ALT SPACE R_WIN MENU
# SCROLL_LOCK PAUSE INSERT DELETE HOME END PAGE_UP PAGE_DOWN
# UPARROW LEFTARROW DOWNARROW RIGHTARROW
# ENTER SPACE CONTROL SHIFT TAB
# NUM0 through NUM9 NUM_LOCK DIVIDE MULTIPLY SUBTRACT ADD DECIMAL
# SCROLL_UP SCROLL_DOWN
# SDL_A SDL_B SDL_X SDL_Y
# SDL_BACK SDL_GUIDE SDL_START

View File

@ -6,6 +6,10 @@ struct {
const char *string;
uint8_t keycode;
} ConfigKeyboardButtons[] = {
//Reference:https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
//Wayback Machine:https://web.archive.org/web/20231223135232/https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
//Row 1
{"ESCAPE", VK_ESCAPE},
{"F1", VK_F1},
{"F2", VK_F2},
{"F3", VK_F3},
@ -18,16 +22,25 @@ struct {
{"F10", VK_F10},
{"F11", VK_F11},
{"F12", VK_F12},
{"NUM1", '1'},
{"NUM2", '2'},
{"NUM3", '3'},
{"NUM4", '4'},
{"NUM5", '5'},
{"NUM6", '6'},
{"NUM7", '7'},
{"NUM8", '8'},
{"NUM9", '9'},
{"NUM0", '0'},
//Row 2
{"`", VK_OEM_3},
{"1", '1'},
{"2", '2'},
{"3", '3'},
{"4", '4'},
{"5", '5'},
{"6", '6'},
{"7", '7'},
{"8", '8'},
{"9", '9'},
{"0", '0'},
{"-", VK_OEM_MINUS},
{"=", VK_OEM_PLUS},
{"BACKSPACE", VK_BACK},
//Row 3
{"TAB", VK_TAB},
{"Q", 'Q'},
{"W", 'W'},
{"E", 'E'},
@ -38,6 +51,12 @@ struct {
{"I", 'I'},
{"O", 'O'},
{"P", 'P'},
{"[", VK_OEM_4},
{"]", VK_OEM_6},
{"BACKSLASH", VK_OEM_5},
//Row 4
{"CAPS_LOCK", VK_CAPITAL},
{"A", 'A'},
{"S", 'S'},
{"D", 'D'},
@ -47,6 +66,12 @@ struct {
{"J", 'J'},
{"K", 'K'},
{"L", 'L'},
{";", VK_OEM_1},
{"'", VK_OEM_7},
{"ENTER", VK_RETURN},
//Row 5
{"SHIFT", VK_SHIFT},
{"Z", 'Z'},
{"X", 'X'},
{"C", 'C'},
@ -54,16 +79,54 @@ struct {
{"B", 'B'},
{"N", 'N'},
{"M", 'M'},
{",", VK_OEM_COMMA},
{".", VK_OEM_PERIOD},
{"SLASH", VK_OEM_2},
//Row 6
{"CONTROL", VK_CONTROL},
{"L_WIN", VK_LWIN},
{"ALT", VK_MENU},
{"SPACE", VK_SPACE},
{"R_WIN", VK_RWIN},
{"MENU", VK_APPS},
//Other Keys
//PrtSc is more important when making snapshots, therefore comment it as reserved
//{"PRINT_SCREEN", VK_SNAPSHOT},
{"SCROLL_LOCK", VK_SCROLL},
{"PAUSE", VK_PAUSE},
{"INSERT", VK_INSERT},
{"DELETE", VK_DELETE},
{"HOME", VK_HOME},
{"END", VK_END},
{"PAGE_UP", VK_PRIOR},
{"PAGE_DOWN", VK_NEXT},
//Arrow Keys
{"UPARROW", VK_UP},
{"LEFTARROW", VK_LEFT},
{"DOWNARROW", VK_DOWN},
{"RIGHTARROW", VK_RIGHT},
{"ENTER", VK_RETURN},
{"SPACE", VK_SPACE},
{"CONTROL", VK_CONTROL},
{"SHIFT", VK_SHIFT},
{"TAB", VK_TAB},
{"ESCAPE", VK_ESCAPE},
//NUMPAD Keys
{"NUM_LOCK", VK_NUMLOCK},
{"DIVIDE", VK_DIVIDE},
{"MULTIPLY", VK_MULTIPLY},
{"SUBTRACT", VK_SUBTRACT},
{"NUM7", VK_NUMPAD7},
{"NUM8", VK_NUMPAD8},
{"NUM9", VK_NUMPAD9},
{"ADD", VK_ADD},
{"NUM4", VK_NUMPAD4},
{"NUM5", VK_NUMPAD5},
{"NUM6", VK_NUMPAD6},
{"NUM1", VK_NUMPAD1},
{"NUM2", VK_NUMPAD2},
{"NUM3", VK_NUMPAD3},
{"NUM0", VK_NUMPAD0},
{"DECIMAL", VK_DECIMAL},
};
struct {