From 08b87fafd0c55aa36e978286aada50472fec5728 Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 15 May 2013 20:03:32 +0000 Subject: [PATCH] Cleanup whitespace, indentation, header files, global declarations, and comments in the Win32-specific code to make this code easier to read and maintain. --- src/gsport.vcxproj | 1 + src/gsport.vcxproj.filters | 3 + src/win_console.c | 57 +++---- src/win_generic.c | 342 +++++++++---------------------------- src/win_keymap.h | 124 ++++++++++++++ 5 files changed, 228 insertions(+), 299 deletions(-) create mode 100644 src/win_keymap.h diff --git a/src/gsport.vcxproj b/src/gsport.vcxproj index 1ba11f9..5cfa30c 100644 --- a/src/gsport.vcxproj +++ b/src/gsport.vcxproj @@ -118,6 +118,7 @@ perl make_inst s 16 instable.h > 16inst_s.h 8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h false + diff --git a/src/gsport.vcxproj.filters b/src/gsport.vcxproj.filters index daba3b1..40311e0 100644 --- a/src/gsport.vcxproj.filters +++ b/src/gsport.vcxproj.filters @@ -108,6 +108,9 @@ Header Files + + Header Files + diff --git a/src/win_console.c b/src/win_console.c index c61cbc2..9980627 100644 --- a/src/win_console.c +++ b/src/win_console.c @@ -19,12 +19,11 @@ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define WIN32_LEAN_AND_MEAN /* Tell windows we want less header gunk */ +#define STRICT /* Tell Windows we want compile type checks */ + #include -#include #include -#include -#include -//#include #include "winresource.h" #include "defc.h" @@ -42,8 +41,6 @@ extern int g_win_fullscreen_state; int win_nonblock_read_stdin(int fd, char *bufptr, int len) { - - HANDLE oshandle; DWORD dwret; int ret; @@ -56,7 +53,6 @@ win_nonblock_read_stdin(int fd, char *bufptr, int len) ret = read(fd, bufptr, len); } return ret; - } void get_cwd(LPTSTR buffer, int size) @@ -114,11 +110,7 @@ void x_toggle_status_lines() } } -int WINAPI WinMain ( - HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nShowCmd) +int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { return main(0,0); } @@ -126,8 +118,6 @@ int WINAPI WinMain ( int main(int argc, char **argv) { -// InitCommonControls(); - WNDCLASS wndclass; SIZE size; RECT rect; @@ -139,7 +129,7 @@ main(int argc, char **argv) wndclass.hInstance = GetModuleHandle(NULL); wndclass.hIcon = LoadIcon(wndclass.hInstance, MAKEINTRESOURCE(IDC_GSPORT32)); wndclass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); - wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // OG Added cast + wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = "gsport"; @@ -172,10 +162,8 @@ main(int argc, char **argv) return ret; } -void -x_check_input_events() +void x_check_input_events() { - MSG msg; while(PeekMessage(&msg, g_hwnd_main, 0, 0, PM_NOREMOVE)) { @@ -189,8 +177,6 @@ x_check_input_events() } } - - void x_redraw_status_lines() { @@ -205,24 +191,25 @@ x_redraw_status_lines() margin = 0; if (g_win_status_debug) { - HDC localdc = GetDC(g_hwnd_main); // OG Use on the fly DC - oldtextcolor = SetTextColor(localdc, 0); - oldbkcolor = SetBkColor(localdc, 0xffffff); - for(line = 0; line < MAX_STATUS_LINES; line++) { - buf = g_status_ptrs[line]; - if(buf != 0) { - len = strlen(buf); - TextOut(localdc, 10, X_A2_WINDOW_HEIGHT + - height*line + margin, buf, len); + HDC localdc = GetDC(g_hwnd_main); + oldtextcolor = SetTextColor(localdc, 0); + oldbkcolor = SetBkColor(localdc, 0xffffff); + for(line = 0; line < MAX_STATUS_LINES; line++) { + buf = g_status_ptrs[line]; + if(buf != 0) { + len = strlen(buf); + TextOut(localdc, 10, X_A2_WINDOW_HEIGHT + + height*line + margin, buf, len); + } } - } - SetTextColor(localdc, oldtextcolor); - SetBkColor(localdc, oldbkcolor); - ReleaseDC(g_hwnd_main,localdc); + SetTextColor(localdc, oldtextcolor); + SetBkColor(localdc, oldbkcolor); + ReleaseDC(g_hwnd_main,localdc); } } -int x_calc_ratio(float ratiox,float ratioy) +int +x_calc_ratio(float ratiox,float ratioy) { return 0; // not stretched -} +} \ No newline at end of file diff --git a/src/win_generic.c b/src/win_generic.c index b0b7d57..5e6dd66 100644 --- a/src/win_generic.c +++ b/src/win_generic.c @@ -24,55 +24,39 @@ #include #include -#include -#include -#include #include #include "defc.h" #include "protos.h" #include "protos_windriver.h" +#include "win_keymap.h" extern int Verbose; - -extern int g_pause; // OG Added Pause - +extern int g_pause; extern int g_warp_pointer; extern int g_screen_depth; -int g_screen_mdepth = 0; - -// OG replaced g_quit_sim_now by quitEmulator -// extern int g_quit_sim_now; -extern void quitEmulator(); -extern void x_toggle_status_lines(); - -int g_use_shmem = 1; - extern Kimage g_mainwin_kimage; - -HDC g_main_cdc; - -int g_win_capslock_down = 0; - extern word32 g_palette_8to1624[256]; extern word32 g_a2palette_8to1624[256]; - -extern int g_lores_colors[]; - +extern int g_lores_colors[]; extern int g_installed_full_superhires_colormap; +extern int g_config_control_panel; +extern void quitEmulator(); +extern void x_toggle_status_lines(); +extern void x_check_input_events(); + +int g_win_capslock_down = 0; +int g_screen_mdepth = 0; +int g_num_a2_keycodes = 0; +int g_win_button_states = 0; +int g_use_shmem = 1; + +HDC g_main_cdc; HWND g_hwnd_main; BITMAPINFO *g_bmapinfo_ptr = 0; volatile BITMAPINFOHEADER *g_bmaphdr_ptr = 0; -int g_num_a2_keycodes = 0; - - -int g_win_button_states = 0; - -// OG Added calc_ratio -int x_calc_ratio(float ratiox, float ratioy); - // KEGS32 specific customisations int g_win_status_debug = 1; // Current visibility of status lines. int g_win_status_debug_request = 1; // Desired visibility of status lines. @@ -82,132 +66,8 @@ int g_win_fullscreen_state = 0; LPSTR g_clipboard; size_t g_clipboard_pos; -/* this table is used to search for the Windows VK_* in col 1 or 2 */ -/* flags bit 8 is or'ed into the VK, so we can distinguish keypad keys */ -/* regardless of numlock */ -int g_a2_key_to_wsym[][3] = { - { 0x35, VK_ESCAPE, 0 }, - { 0x7a, VK_F1, 0 }, - { 0x78, VK_F2, 0 }, // OG Was 7B but F2 is defined has 0x78 in a2_key_to_ascii - { 0x63, VK_F3, 0 }, - { 0x76, VK_F4, 0 }, - { 0x60, VK_F5, 0 }, - { 0x61, VK_F6, 0 }, - { 0x62, VK_F7, 0 }, - { 0x64, VK_F8, 0 }, - { 0x65, VK_F9, 0 }, - { 0x6d, VK_F10, 0 }, - { 0x67, VK_F11, 0 }, - { 0x6f, VK_F12, 0 }, - { 0x69, VK_F13, 0 }, - { 0x6b, VK_F14, 0 }, - { 0x71, VK_F15, 0 }, - { 0x7f, VK_PAUSE, VK_CANCEL+0x100 }, +int x_calc_ratio(float ratiox, float ratioy); - { 0x32, 0xc0, 0 }, /* '`' */ - { 0x12, '1', 0 }, - { 0x13, '2', 0 }, - { 0x14, '3', 0 }, - { 0x15, '4', 0 }, - { 0x17, '5', 0 }, - { 0x16, '6', 0 }, - { 0x1a, '7', 0 }, - { 0x1c, '8', 0 }, - { 0x19, '9', 0 }, - { 0x1d, '0', 0 }, - { 0x1b, 0xbd, 0 }, /* '-' */ - { 0x18, 0xbb, 0 }, /* '=' */ - { 0x33, VK_BACK, 0 }, /* backspace */ - { 0x72, VK_INSERT+0x100, 0 }, /* Insert key */ -/* { 0x73, XK_Home, 0 }, alias VK_HOME to be KP_Equal! */ - { 0x74, VK_PRIOR+0x100, 0 }, /* pageup */ - { 0x47, VK_NUMLOCK, VK_NUMLOCK+0x100 }, /* clear */ - { 0x51, VK_HOME+0x100, 0 }, /* KP_equal is HOME key */ - { 0x4b, VK_DIVIDE, VK_DIVIDE+0x100 }, - { 0x43, VK_MULTIPLY, VK_MULTIPLY+0x100 }, - - { 0x30, VK_TAB, 0 }, - { 0x0c, 'Q', 0 }, - { 0x0d, 'W', 0 }, - { 0x0e, 'E', 0 }, - { 0x0f, 'R', 0 }, - { 0x11, 'T', 0 }, - { 0x10, 'Y', 0 }, - { 0x20, 'U', 0 }, - { 0x22, 'I', 0 }, - { 0x1f, 'O', 0 }, - { 0x23, 'P', 0 }, - { 0x21, 0xdb, 0 }, /* [ */ - { 0x1e, 0xdd, 0 }, /* ] */ - { 0x2a, 0xdc, 0 }, /* backslash, bar */ - { 0x75, VK_DELETE+0x100, 0 }, - { 0x77, VK_END+0x100, VK_END }, - { 0x79, VK_NEXT+0x100, 0 }, - { 0x59, VK_NUMPAD7, VK_HOME }, - { 0x5b, VK_NUMPAD8, VK_UP }, - { 0x5c, VK_NUMPAD9, VK_PRIOR }, - { 0x4e, VK_SUBTRACT, VK_SUBTRACT+0x100 }, - - // { 0x39, VK_CAPITAL, 0 }, // Handled specially! - { 0x00, 'A', 0 }, - { 0x01, 'S', 0 }, - { 0x02, 'D', 0 }, - { 0x03, 'F', 0 }, - { 0x05, 'G', 0 }, - { 0x04, 'H', 0 }, - { 0x26, 'J', 0 }, - { 0x28, 'K', 0 }, - { 0x25, 'L', 0 }, - { 0x29, 0xba, 0 }, /* ; */ - { 0x27, 0xde, 0 }, /* single quote */ - { 0x24, VK_RETURN, 0 }, - { 0x56, VK_NUMPAD4, VK_LEFT }, - { 0x57, VK_NUMPAD5, VK_CLEAR }, - { 0x58, VK_NUMPAD6, VK_RIGHT }, - { 0x45, VK_ADD, 0 }, - - { 0x38, VK_SHIFT, 0 }, - { 0x06, 'Z', 0 }, - { 0x07, 'X', 0 }, - { 0x08, 'C', 0 }, - { 0x09, 'V', 0 }, - { 0x0b, 'B', 0 }, - { 0x2d, 'N', 0 }, - { 0x2e, 'M', 0 }, - { 0x2b, 0xbc, 0 }, /* , */ - { 0x2f, 0xbe, 0 }, /* . */ - { 0x2c, 0xbf, 0 }, /* / */ - { 0x3e, VK_UP+0x100, 0 }, - { 0x53, VK_NUMPAD1, VK_END }, - { 0x54, VK_NUMPAD2, VK_DOWN }, - { 0x55, VK_NUMPAD3, VK_NEXT }, - - { 0x36, VK_CONTROL, VK_CONTROL+0x100 }, - { 0x3a, VK_SNAPSHOT+0x100, VK_MENU+0x100 },/* Opt=prntscrn or alt-r */ - -// OG ActiveGS map OA-CA to Win & AltKey -#ifndef ACTIVEGS - { 0x37, VK_SCROLL, VK_MENU }, /* Command=scr_lock or alt-l */ -#else - { 0x7f, VK_CANCEL, 0 }, - { 0x3A, VK_LWIN+0x100, VK_LWIN }, - { 0x37, VK_MENU, 0 }, /* Command=alt-l */ - { 0x37, VK_LMENU, 0 }, /* Command=alt-l */ - { 0x7F, VK_SCROLL,0 }, /* RESET */ - { 0x36, VK_LCONTROL, 0 }, // CTRL -#endif - - { 0x31, ' ', 0 }, - { 0x3b, VK_LEFT+0x100, 0 }, - { 0x3d, VK_DOWN+0x100, 0 }, - { 0x3c, VK_RIGHT+0x100, 0 }, - { 0x52, VK_NUMPAD0, VK_INSERT }, - { 0x41, VK_DECIMAL, VK_DECIMAL }, - { 0x4c, VK_RETURN+0x100, 0 }, - { -1, -1, -1 } -}; - -extern int g_config_control_panel; int win_update_mouse(int x, int y, int button_states, int buttons_valid) @@ -273,8 +133,6 @@ int nb_win32_key=0; struct win32_mouse win32_mouses[MAX_EVENT]; struct win32_key win32_keys[MAX_EVENT]; -extern int g_config_control_panel; // OG Expose g_config_control_panel - // OG Push Mouse Event void add_event_mouse(int umsg,WPARAM wParam, LPARAM lParam) @@ -282,7 +140,7 @@ void add_event_mouse(int umsg,WPARAM wParam, LPARAM lParam) #ifdef ACTIVEGS if (g_config_control_panel) // OG ignore input events while in debugger - return ; + return; #endif win32_mouses[next_win32_mouse].umsg = umsg; @@ -298,14 +156,13 @@ void add_event_mouse(int umsg,WPARAM wParam, LPARAM lParam) void add_event_key(HWND hwnd, UINT raw_vk, BOOL down, int repeat, UINT flags) { - #ifdef ACTIVEGS if (g_config_control_panel) // OG ignore input events while in debugger - return ; + return; #endif if (nb_win32_key>=MAX_EVENT) - return ; + return; win32_keys[nb_win32_key].raw_vk = raw_vk; win32_keys[nb_win32_key].down = down; @@ -313,10 +170,8 @@ add_event_key(HWND hwnd, UINT raw_vk, BOOL down, int repeat, UINT flags) win32_keys[nb_win32_key].flags = flags; nb_win32_key++; - } - void win_event_mouse(int umsg,WPARAM wParam, LPARAM lParam) { @@ -420,22 +275,21 @@ win_event_quit(HWND hwnd) quitEmulator(); } -extern int g_needfullrefreshfornextframe ; +extern int g_needfullrefreshfornextframe ; void win_event_redraw() { -// outputInfo("win_event_redraw()\n"); g_needfullrefreshfornextframe = 1; } LRESULT CALLBACK win_event_handler(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) { -int i; -int numDraggedFiles; -int szFilename; -LPTSTR lpszFile; + int i; + int numDraggedFiles; + int szFilename; + LPTSTR lpszFile; switch(umsg) { case WM_MOUSEMOVE: @@ -471,32 +325,9 @@ LPTSTR lpszFile; HANDLE_MSG(hwnd, WM_DESTROY, win_event_quit); } -#if 0 - switch(umsg) { - case WM_NCACTIVATE: - case WM_NCHITTEST: - case WM_NCMOUSEMOVE: - case WM_SETCURSOR: - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_RBUTTONDOWN: - case WM_CONTEXTMENU: - case WM_RBUTTONUP: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_PAINT: - - break; - default: - printf("Got umsg2: %d\n", umsg); - } -#endif - return DefWindowProc(hwnd, umsg, wParam, lParam); } -// OG Added Generic gsportinit/gsportshut functions - void gsportinit(HWND _hwnd) { g_hwnd_main = _hwnd; @@ -507,11 +338,8 @@ void gsportinit(HWND _hwnd) g_main_cdc = CreateCompatibleDC(localdc); ReleaseDC(g_hwnd_main,localdc); - - } - void gsportshut() { if (g_main_cdc) @@ -522,12 +350,9 @@ void gsportshut() g_hwnd_main = NULL; } -extern void x_check_input_events(); - void check_input_events() { - x_check_input_events(); // OG Unstack Mouse Events @@ -551,7 +376,6 @@ check_input_events() } - void x_update_color(int col_num, int red, int green, int blue, word32 rgb) { @@ -572,8 +396,6 @@ show_xcolor_array() } } - - // OG Add function to clear all get_images loaded (dev dependent) void x_release_kimage(Kimage *kimage_ptr) { @@ -603,7 +425,6 @@ xdriver_end() // Should be renamed to dev_video_shut() ??? printf("win32 video driver end\n"); } - void x_get_kimage(Kimage *kimage_ptr) { @@ -651,7 +472,6 @@ x_get_kimage(Kimage *kimage_ptr) return; } - void dev_video_init() { @@ -706,7 +526,6 @@ extern int g_blue_right_shift ; g_blue_right_shift = 3; #endif - extra_size = sizeof(RGBQUAD); if(g_screen_depth == 8) { extra_size = 256 * sizeof(RGBQUAD); @@ -748,12 +567,8 @@ extern int g_blue_right_shift ; printf("Done with dev_video_init\n"); fflush(stdout); - } - - - void x_push_kimage(Kimage *kimage_ptr, int destx, int desty, int srcx, int srcy, int width, int height) @@ -788,7 +603,6 @@ x_push_kimage(Kimage *kimage_ptr, int destx, int desty, int srcx, int srcy, ReleaseDC(g_hwnd_main,localdc); } - void x_push_done() { @@ -817,8 +631,9 @@ x_hide_pointer(int do_hide) void x_full_screen(int do_full) { - DEVMODE dmScreenSettings; - int style; + DEVMODE dmScreenSettings; + int style; + g_win_status_debug = 1 - do_full; if (do_full && !g_win_fullscreen_state) { GetWindowRect(g_hwnd_main,&g_main_window_saved_rect); @@ -827,45 +642,44 @@ x_full_screen(int do_full) dmScreenSettings.dmPelsHeight = 600; dmScreenSettings.dmBitsPerPel = 24; dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH| - DM_PELSHEIGHT; + DM_PELSHEIGHT; - if (ChangeDisplaySettings(&dmScreenSettings, 2) + if (ChangeDisplaySettings(&dmScreenSettings, 2) !=DISP_CHANGE_SUCCESSFUL) { // If 24-bit palette does not work, try 32-bit dmScreenSettings.dmBitsPerPel = 32; - if (ChangeDisplaySettings(&dmScreenSettings, 2)) { + if (ChangeDisplaySettings(&dmScreenSettings, 2)) { printf ( "-- Unable to switch to fullscreen mode\n"); - printf ( + printf ( "-- No 24-bit or 32-bit mode for fullscreen\n"); - dmScreenSettings.dmBitsPerPel=-1; + dmScreenSettings.dmBitsPerPel=-1; } } if (dmScreenSettings.dmBitsPerPel >0) { g_win_fullscreen_state=!g_win_fullscreen_state; - GetWindowRect(g_hwnd_main,&g_main_window_saved_rect); - ChangeDisplaySettings(&dmScreenSettings, 4); + GetWindowRect(g_hwnd_main,&g_main_window_saved_rect); + ChangeDisplaySettings(&dmScreenSettings, 4); style=GetWindowLong(g_hwnd_main,GWL_STYLE); - style &= ~WS_CAPTION; + style &= ~WS_CAPTION; SetWindowLong(g_hwnd_main,GWL_STYLE,style); SetMenu(g_hwnd_main,NULL); - SetWindowPos(g_hwnd_main,HWND_TOPMOST,0,0, - GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN), - SWP_SHOWWINDOW); - - } + SetWindowPos(g_hwnd_main,HWND_TOPMOST,0,0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + SWP_SHOWWINDOW); + } } else { if (g_win_fullscreen_state) { ChangeDisplaySettings(NULL,0); - style=GetWindowLong(g_hwnd_main,GWL_STYLE); - style |= WS_CAPTION; - SetWindowLong(g_hwnd_main,GWL_STYLE,style); + style=GetWindowLong(g_hwnd_main,GWL_STYLE); + style |= WS_CAPTION; + SetWindowLong(g_hwnd_main,GWL_STYLE,style); SetWindowPos(g_hwnd_main, HWND_TOPMOST, g_main_window_saved_rect.top, g_main_window_saved_rect.left, g_main_window_saved_rect.right - g_main_window_saved_rect.left, g_main_window_saved_rect.bottom - g_main_window_saved_rect.top, - SWP_SHOWWINDOW); + SWP_SHOWWINDOW); g_win_fullscreen_state=!g_win_fullscreen_state; } } @@ -873,43 +687,43 @@ x_full_screen(int do_full) } void -clipboard_paste(void) +clipboard_paste() { - if (!IsClipboardFormatAvailable(CF_TEXT)) - return; - if (!OpenClipboard(g_hwnd_main)) - return; - { - HGLOBAL hclipboard = GetClipboardData(CF_TEXT); - if (!hclipboard) { - CloseClipboard(); - return; - } - { - LPSTR clipboard = (LPSTR)GlobalLock(hclipboard); - if (!clipboard) { - CloseClipboard(); - return; - } - if (g_clipboard) { - free(g_clipboard); - g_clipboard_pos = 0; - } - g_clipboard = strdup(clipboard); - } - GlobalUnlock(hclipboard); - } - CloseClipboard(); + if (!IsClipboardFormatAvailable(CF_TEXT)) + return; + if (!OpenClipboard(g_hwnd_main)) + return; + { + HGLOBAL hclipboard = GetClipboardData(CF_TEXT); + if (!hclipboard) { + CloseClipboard(); + return; + } + { + LPSTR clipboard = (LPSTR)GlobalLock(hclipboard); + if (!clipboard) { + CloseClipboard(); + return; + } + if (g_clipboard) { + free(g_clipboard); + g_clipboard_pos = 0; + } + g_clipboard = strdup(clipboard); + } + GlobalUnlock(hclipboard); + } + CloseClipboard(); } int -clipboard_get_char(void) +clipboard_get_char() { - if (!g_clipboard) - return 0; - if (g_clipboard[g_clipboard_pos] == '\n') - g_clipboard_pos++; - if (g_clipboard[g_clipboard_pos] == '\0') - return 0; - return g_clipboard[g_clipboard_pos++] | 0x80; + if (!g_clipboard) + return 0; + if (g_clipboard[g_clipboard_pos] == '\n') + g_clipboard_pos++; + if (g_clipboard[g_clipboard_pos] == '\0') + return 0; + return g_clipboard[g_clipboard_pos++] | 0x80; } diff --git a/src/win_keymap.h b/src/win_keymap.h new file mode 100644 index 0000000..913506b --- /dev/null +++ b/src/win_keymap.h @@ -0,0 +1,124 @@ +/* this table is used to search for the Windows VK_* in col 1 or 2 */ +/* flags bit 8 is or'ed into the VK, so we can distinguish keypad keys */ +/* regardless of numlock */ +int g_a2_key_to_wsym[][3] = { + { 0x35, VK_ESCAPE, 0 }, + { 0x7a, VK_F1, 0 }, + { 0x78, VK_F2, 0 }, // OG Was 7B but F2 is defined has 0x78 in a2_key_to_ascii + { 0x63, VK_F3, 0 }, + { 0x76, VK_F4, 0 }, + { 0x60, VK_F5, 0 }, + { 0x61, VK_F6, 0 }, + { 0x62, VK_F7, 0 }, + { 0x64, VK_F8, 0 }, + { 0x65, VK_F9, 0 }, + { 0x6d, VK_F10, 0 }, + { 0x67, VK_F11, 0 }, + { 0x6f, VK_F12, 0 }, + { 0x69, VK_F13, 0 }, + { 0x6b, VK_F14, 0 }, + { 0x71, VK_F15, 0 }, + { 0x7f, VK_PAUSE, VK_CANCEL+0x100 }, + + { 0x32, 0xc0, 0 }, /* '`' */ + { 0x12, '1', 0 }, + { 0x13, '2', 0 }, + { 0x14, '3', 0 }, + { 0x15, '4', 0 }, + { 0x17, '5', 0 }, + { 0x16, '6', 0 }, + { 0x1a, '7', 0 }, + { 0x1c, '8', 0 }, + { 0x19, '9', 0 }, + { 0x1d, '0', 0 }, + { 0x1b, 0xbd, 0 }, /* '-' */ + { 0x18, 0xbb, 0 }, /* '=' */ + { 0x33, VK_BACK, 0 }, /* backspace */ + { 0x72, VK_INSERT+0x100, 0 }, /* Insert key */ +/* { 0x73, XK_Home, 0 }, alias VK_HOME to be KP_Equal! */ + { 0x74, VK_PRIOR+0x100, 0 }, /* pageup */ + { 0x47, VK_NUMLOCK, VK_NUMLOCK+0x100 }, /* clear */ + { 0x51, VK_HOME+0x100, 0 }, /* KP_equal is HOME key */ + { 0x4b, VK_DIVIDE, VK_DIVIDE+0x100 }, + { 0x43, VK_MULTIPLY, VK_MULTIPLY+0x100 }, + + { 0x30, VK_TAB, 0 }, + { 0x0c, 'Q', 0 }, + { 0x0d, 'W', 0 }, + { 0x0e, 'E', 0 }, + { 0x0f, 'R', 0 }, + { 0x11, 'T', 0 }, + { 0x10, 'Y', 0 }, + { 0x20, 'U', 0 }, + { 0x22, 'I', 0 }, + { 0x1f, 'O', 0 }, + { 0x23, 'P', 0 }, + { 0x21, 0xdb, 0 }, /* [ */ + { 0x1e, 0xdd, 0 }, /* ] */ + { 0x2a, 0xdc, 0 }, /* backslash, bar */ + { 0x75, VK_DELETE+0x100, 0 }, + { 0x77, VK_END+0x100, VK_END }, + { 0x79, VK_NEXT+0x100, 0 }, + { 0x59, VK_NUMPAD7, VK_HOME }, + { 0x5b, VK_NUMPAD8, VK_UP }, + { 0x5c, VK_NUMPAD9, VK_PRIOR }, + { 0x4e, VK_SUBTRACT, VK_SUBTRACT+0x100 }, + + // { 0x39, VK_CAPITAL, 0 }, // Handled specially! + { 0x00, 'A', 0 }, + { 0x01, 'S', 0 }, + { 0x02, 'D', 0 }, + { 0x03, 'F', 0 }, + { 0x05, 'G', 0 }, + { 0x04, 'H', 0 }, + { 0x26, 'J', 0 }, + { 0x28, 'K', 0 }, + { 0x25, 'L', 0 }, + { 0x29, 0xba, 0 }, /* ; */ + { 0x27, 0xde, 0 }, /* single quote */ + { 0x24, VK_RETURN, 0 }, + { 0x56, VK_NUMPAD4, VK_LEFT }, + { 0x57, VK_NUMPAD5, VK_CLEAR }, + { 0x58, VK_NUMPAD6, VK_RIGHT }, + { 0x45, VK_ADD, 0 }, + + { 0x38, VK_SHIFT, 0 }, + { 0x06, 'Z', 0 }, + { 0x07, 'X', 0 }, + { 0x08, 'C', 0 }, + { 0x09, 'V', 0 }, + { 0x0b, 'B', 0 }, + { 0x2d, 'N', 0 }, + { 0x2e, 'M', 0 }, + { 0x2b, 0xbc, 0 }, /* , */ + { 0x2f, 0xbe, 0 }, /* . */ + { 0x2c, 0xbf, 0 }, /* / */ + { 0x3e, VK_UP+0x100, 0 }, + { 0x53, VK_NUMPAD1, VK_END }, + { 0x54, VK_NUMPAD2, VK_DOWN }, + { 0x55, VK_NUMPAD3, VK_NEXT }, + + { 0x36, VK_CONTROL, VK_CONTROL+0x100 }, + { 0x3a, VK_SNAPSHOT+0x100, VK_MENU+0x100 },/* Opt=prntscrn or alt-r */ + +// OG ActiveGS map OA-CA to Win & AltKey +#ifndef ACTIVEGS + { 0x37, VK_SCROLL, VK_MENU }, /* Command=scr_lock or alt-l */ +#else + { 0x7f, VK_CANCEL, 0 }, + { 0x3A, VK_LWIN+0x100, VK_LWIN }, + { 0x37, VK_MENU, 0 }, /* Command=alt-l */ + { 0x37, VK_LMENU, 0 }, /* Command=alt-l */ + { 0x7F, VK_SCROLL,0 }, /* RESET */ + { 0x36, VK_LCONTROL, 0 }, // CTRL +#endif + + { 0x31, ' ', 0 }, + { 0x3b, VK_LEFT+0x100, 0 }, + { 0x3d, VK_DOWN+0x100, 0 }, + { 0x3c, VK_RIGHT+0x100, 0 }, + { 0x52, VK_NUMPAD0, VK_INSERT }, + { 0x41, VK_DECIMAL, VK_DECIMAL }, + { 0x4c, VK_RETURN+0x100, 0 }, + { -1, -1, -1 } +}; \ No newline at end of file