From 760689b35dbfb2afb04ff2514acb7528d0be7e35 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 Feb 2018 00:01:52 +0100 Subject: [PATCH] Fixed (S)VGA sense again; Added option to remap right CTRL to left ALT so that right CTRL + TAB can be used to send the guest ALT+TAB. --- src/config.c | 9 ++++++++- src/video/vid_svga.c | 4 ++-- src/win/86Box.rc | 5 +++-- src/win/resource.h | 3 ++- src/win/win_keyboard.c | 7 ++++++- src/win/win_ui.c | 13 ++++++++++++- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/config.c b/src/config.c index 958310707..5a3dedc4d 100644 --- a/src/config.c +++ b/src/config.c @@ -8,7 +8,7 @@ * * Configuration file handler. * - * Version: @(#)config.c 1.0.40 2018/02/06 + * Version: @(#)config.c 1.0.41 2018/02/09 * * Authors: Sarah Walker, * Miran Grca, @@ -433,6 +433,8 @@ load_general(void) video_grayscale = config_get_int(cat, "video_grayscale", 0); video_graytype = config_get_int(cat, "video_graytype", 0); + rctrl_is_lalt = config_get_int(cat, "rctrl_is_lalt", 0); + window_remember = config_get_int(cat, "window_remember", 0); if (window_remember) { p = config_get_string(cat, "window_coordinates", NULL); @@ -1523,6 +1525,11 @@ save_general(void) else config_set_int(cat, "video_graytype", video_graytype); + if (rctrl_is_lalt == 0) + config_delete_var(cat, "rctrl_is_lalt"); + else + config_set_int(cat, "rctrl_is_lalt", rctrl_is_lalt); + if (window_remember) { config_set_int(cat, "window_remember", window_remember); diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 954632ae3..c069a1148 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -11,7 +11,7 @@ * This is intended to be used by another SVGA driver, * and not as a card in it's own right. * - * Version: @(#)vid_svga.c 1.0.19 2018/02/08 + * Version: @(#)vid_svga.c 1.0.20 2018/02/09 * * Authors: Sarah Walker, * Miran Grca, @@ -251,7 +251,7 @@ uint8_t svga_in(uint16_t addr, void *p) case 0x3C1: return svga->attrregs[svga->attraddr]; case 0x3c2: - if ((svga->vgapal[0].r + svga->vgapal[0].g + svga->vgapal[0].b) >= 0x50) + if ((svga->vgapal[0].r + svga->vgapal[0].g + svga->vgapal[0].b) >= 0x4e) temp = 0; else temp = 0x10; diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 25409c3de..8ab9a0ce9 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -8,7 +8,7 @@ * * Application resource script for Windows. * - * Version: @(#)86Box.rc 1.0.28 2018/02/06 + * Version: @(#)86Box.rc 1.0.29 2018/02/09 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -46,8 +46,9 @@ MainMenu MENU DISCARDABLE BEGIN POPUP "&Action" BEGIN - MENUITEM "&Hard Reset", IDM_ACTION_HRESET + MENUITEM "&Right CTRL is left ALT", IDM_ACTION_RCTRL_IS_LALT MENUITEM SEPARATOR + MENUITEM "&Hard Reset", IDM_ACTION_HRESET MENUITEM "&Ctrl+Alt+Del\tCtrl+F12", IDM_ACTION_RESET_CAD MENUITEM SEPARATOR MENUITEM "Ctrl+Alt+&Esc", IDM_ACTION_CTRL_ALT_ESC diff --git a/src/win/resource.h b/src/win/resource.h index 6b49ab605..c9e9212ae 100644 --- a/src/win/resource.h +++ b/src/win/resource.h @@ -8,7 +8,7 @@ * * Windows resource defines. * - * Version: @(#)resource.h 1.0.19 2018/02/06 + * Version: @(#)resource.h 1.0.20 2018/02/09 * * Authors: Sarah Walker, * Miran Grca, @@ -229,6 +229,7 @@ #define IDM_ABOUT 40001 #define IDC_ABOUT_ICON 65535 +#define IDM_ACTION_RCTRL_IS_LALT 40010 #define IDM_ACTION_SCREENSHOT 40011 #define IDM_ACTION_HRESET 40012 #define IDM_ACTION_RESET_CAD 40013 diff --git a/src/win/win_keyboard.c b/src/win/win_keyboard.c index c44d4fe13..1e99591cc 100644 --- a/src/win/win_keyboard.c +++ b/src/win/win_keyboard.c @@ -8,7 +8,7 @@ * * Windows raw keyboard input handler. * - * Version: @(#)win_keyboard.c 1.0.8 2018/01/29 + * Version: @(#)win_keyboard.c 1.0.8 2018/02/09 * * Author: Miran Grca, * @@ -180,6 +180,11 @@ keyboard_handle(LPARAM lParam, int infocus) is not captured, suppress the ALT and send a TAB key up. */ keyboard_input(0, 0x00F); } else { + /* Translate right CTRL to left ALT if the user has so + chosen. */ + if ((scancode == 0x11D) && rctrl_is_lalt) + scancode = 0x038; + /* Normal scan code pass through, pass it through as is if it's not an invalid scan code. */ if (scancode != 0xFFFF) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 577960d3b..28c983980 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -8,7 +8,7 @@ * * user Interface module for WinAPI on Windows. * - * Version: @(#)win_ui.c 1.0.16 2018/02/06 + * Version: @(#)win_ui.c 1.0.17 2018/02/09 * * Authors: Sarah Walker, * Miran Grca, @@ -51,6 +51,7 @@ HMENU menuMain; /* application main menu */ HICON hIcon[512]; /* icon data loaded from resources */ RECT oldclip; /* mouse rect */ int infocus = 1; +int rctrl_is_lalt = 0; char openfilestring[260]; WCHAR wopenfilestring[260]; @@ -132,6 +133,8 @@ ResetAllMenus(void) EnableMenuItem(menuMain, IDM_CONFIG_SAVE, MF_DISABLED); #endif + CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, MF_UNCHECKED); + #ifdef ENABLE_LOG_TOGGLES # ifdef ENABLE_BUSLOGIC_LOG CheckMenuItem(menuMain, IDM_LOG_BUSLOGIC, MF_UNCHECKED); @@ -190,6 +193,8 @@ ResetAllMenus(void) CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+3, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+4, MF_UNCHECKED); + CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED); + #ifdef ENABLE_LOG_TOGGLES # ifdef ENABLE_BUSLOGIC_LOG CheckMenuItem(menuMain, IDM_LOG_BUSLOGIC, buslogic_do_log?MF_CHECKED:MF_UNCHECKED); @@ -302,6 +307,12 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) pc_send_cae(); break; + case IDM_ACTION_RCTRL_IS_LALT: + rctrl_is_lalt ^= 1; + CheckMenuItem(hmenu, IDM_ACTION_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED); + config_save(); + break; + case IDM_ACTION_PAUSE: plat_pause(dopause ^ 1); CheckMenuItem(menuMain, IDM_ACTION_PAUSE, dopause ? MF_CHECKED : MF_UNCHECKED);