2017-05-30 03:38:38 +02:00
|
|
|
/*
|
|
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Windows raw keyboard input handler.
|
|
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
|
|
|
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
2017-10-11 05:40:44 -04:00
|
|
|
*
|
2018-01-20 15:46:37 +01:00
|
|
|
* Copyright 2016-2018 Miran Grca.
|
2017-05-30 03:38:38 +02:00
|
|
|
*/
|
2017-05-27 03:53:32 +02:00
|
|
|
#define UNICODE
|
|
|
|
|
#define _WIN32_WINNT 0x0501
|
|
|
|
|
#define BITMAP WINDOWS_BITMAP
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <windowsx.h>
|
|
|
|
|
#undef BITMAP
|
2017-10-11 05:40:44 -04:00
|
|
|
#include <stdint.h>
|
2017-05-27 03:53:32 +02:00
|
|
|
#include <stdio.h>
|
2017-10-11 05:40:44 -04:00
|
|
|
#include <string.h>
|
2017-05-27 03:53:32 +02:00
|
|
|
#include <stdlib.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
|
|
|
|
#include <86box/device.h>
|
|
|
|
|
#include <86box/keyboard.h>
|
|
|
|
|
#include <86box/plat.h>
|
|
|
|
|
#include <86box/win.h>
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-09-25 04:31:20 -04:00
|
|
|
|
2018-01-13 22:56:13 +01:00
|
|
|
static uint16_t scancode_map[768];
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-24 22:10:21 -04:00
|
|
|
|
2017-05-27 03:53:32 +02:00
|
|
|
/* This is so we can disambiguate scan codes that would otherwise conflict and get
|
|
|
|
|
passed on incorrectly. */
|
2017-10-24 22:10:21 -04:00
|
|
|
static UINT16
|
|
|
|
|
convert_scan_code(UINT16 scan_code)
|
2017-05-27 03:53:32 +02:00
|
|
|
{
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if ((scan_code & 0xff00) == 0xe000)
|
|
|
|
|
scan_code = (scan_code & 0xff) | 0x0100;
|
|
|
|
|
|
|
|
|
|
if (scan_code == 0xE11D)
|
|
|
|
|
scan_code = 0x0100;
|
2018-01-21 13:59:21 +01:00
|
|
|
/* E0 00 is sent by some USB keyboards for their special keys, as it is an
|
|
|
|
|
invalid scan code (it has no untranslated set 2 equivalent), we mark it
|
|
|
|
|
appropriately so it does not get passed through. */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
else if ((scan_code > 0x01FF) || (scan_code == 0x0100))
|
2018-01-13 22:56:13 +01:00
|
|
|
scan_code = 0xFFFF;
|
|
|
|
|
|
|
|
|
|
return scan_code;
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-24 22:10:21 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
keyboard_getkeymap(void)
|
2017-05-27 03:53:32 +02:00
|
|
|
{
|
2017-10-24 22:10:21 -04:00
|
|
|
WCHAR *keyName = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout";
|
|
|
|
|
WCHAR *valueName = L"Scancode Map";
|
|
|
|
|
unsigned char buf[32768];
|
|
|
|
|
DWORD bufSize;
|
|
|
|
|
HKEY hKey;
|
|
|
|
|
int j;
|
|
|
|
|
UINT32 *bufEx2;
|
|
|
|
|
int scMapCount;
|
|
|
|
|
UINT16 *bufEx;
|
|
|
|
|
int scancode_unmapped;
|
|
|
|
|
int scancode_mapped;
|
|
|
|
|
|
|
|
|
|
/* First, prepare the default scan code map list which is 1:1.
|
|
|
|
|
* Remappings will be inserted directly into it.
|
2018-01-13 22:56:13 +01:00
|
|
|
* 512 bytes so this takes less memory, bit 9 set means E0
|
|
|
|
|
* prefix.
|
2017-10-24 22:10:21 -04:00
|
|
|
*/
|
2018-01-13 22:56:13 +01:00
|
|
|
for (j = 0; j < 512; j++)
|
|
|
|
|
scancode_map[j] = j;
|
2017-10-24 22:10:21 -04:00
|
|
|
|
|
|
|
|
/* Get the scan code remappings from:
|
|
|
|
|
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout */
|
|
|
|
|
bufSize = 32768;
|
|
|
|
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, 1, &hKey) == ERROR_SUCCESS) {
|
|
|
|
|
if (RegQueryValueEx(hKey, valueName, NULL, NULL, buf, &bufSize) == ERROR_SUCCESS) {
|
|
|
|
|
bufEx2 = (UINT32 *) buf;
|
|
|
|
|
scMapCount = bufEx2[2];
|
|
|
|
|
if ((bufSize != 0) && (scMapCount != 0)) {
|
|
|
|
|
bufEx = (UINT16 *) (buf + 12);
|
|
|
|
|
for (j = 0; j < scMapCount*2; j += 2) {
|
|
|
|
|
/* Each scan code is 32-bit: 16 bits of remapped scan code,
|
|
|
|
|
and 16 bits of original scan code. */
|
|
|
|
|
scancode_unmapped = bufEx[j + 1];
|
|
|
|
|
scancode_mapped = bufEx[j];
|
|
|
|
|
|
2018-01-13 22:56:13 +01:00
|
|
|
scancode_unmapped = convert_scan_code(scancode_unmapped);
|
2017-10-24 22:10:21 -04:00
|
|
|
scancode_mapped = convert_scan_code(scancode_mapped);
|
|
|
|
|
|
2018-01-13 22:56:13 +01:00
|
|
|
/* Ignore source scan codes with prefixes other than E1
|
|
|
|
|
that are not E1 1D. */
|
|
|
|
|
if (scancode_unmapped != 0xFFFF)
|
|
|
|
|
scancode_map[scancode_unmapped] = scancode_mapped;
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-24 22:10:21 -04:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-24 22:10:21 -04:00
|
|
|
|
|
|
|
|
void
|
2020-02-04 22:29:01 +08:00
|
|
|
keyboard_handle(PRAWINPUT raw)
|
2017-05-27 03:53:32 +02:00
|
|
|
{
|
2017-10-24 22:10:21 -04:00
|
|
|
USHORT scancode;
|
2018-02-10 01:19:31 +01:00
|
|
|
static int recv_lalt = 0, recv_ralt = 0, recv_tab = 0;
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2020-02-04 22:29:01 +08:00
|
|
|
RAWKEYBOARD rawKB = raw->data.keyboard;
|
2017-10-24 22:10:21 -04:00
|
|
|
scancode = rawKB.MakeCode;
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-24 22:10:21 -04:00
|
|
|
/* If it's not a scan code that starts with 0xE1 */
|
|
|
|
|
if (!(rawKB.Flags & RI_KEY_E1)) {
|
2018-01-21 13:59:21 +01:00
|
|
|
if (rawKB.Flags & RI_KEY_E0)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
scancode |= 0x100;
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2018-01-13 22:56:13 +01:00
|
|
|
/* Translate the scan code to 9-bit */
|
|
|
|
|
scancode = convert_scan_code(scancode);
|
|
|
|
|
|
2017-10-24 22:10:21 -04:00
|
|
|
/* Remap it according to the list from the Registry */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if (scancode != scancode_map[scancode])
|
|
|
|
|
pclog("Scan code remap: %03X -> %03X\n", scancode, scancode);
|
2017-10-24 22:10:21 -04:00
|
|
|
scancode = scancode_map[scancode];
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2018-01-13 22:56:13 +01:00
|
|
|
/* If it's not 0xFFFF, send it to the emulated
|
|
|
|
|
keyboard.
|
|
|
|
|
We use scan code 0xFFFF to mean a mapping that
|
|
|
|
|
has a prefix other than E0 and that is not E1 1D,
|
|
|
|
|
which is, for our purposes, invalid. */
|
2018-01-20 15:46:37 +01:00
|
|
|
if ((scancode == 0x00F) &&
|
|
|
|
|
!(rawKB.Flags & RI_KEY_BREAK) &&
|
2018-02-10 01:19:31 +01:00
|
|
|
(recv_lalt || recv_ralt) &&
|
2018-01-20 15:46:37 +01:00
|
|
|
!mouse_capture) {
|
|
|
|
|
/* We received a TAB while ALT was pressed, while the mouse
|
|
|
|
|
is not captured, suppress the TAB and send an ALT key up. */
|
2018-02-10 01:19:31 +01:00
|
|
|
if (recv_lalt) {
|
2018-01-20 15:46:37 +01:00
|
|
|
keyboard_input(0, 0x038);
|
2018-02-01 03:14:55 +01:00
|
|
|
/* Extra key press and release so the guest is not stuck in the
|
|
|
|
|
menu bar. */
|
|
|
|
|
keyboard_input(1, 0x038);
|
|
|
|
|
keyboard_input(0, 0x038);
|
2018-02-10 01:19:31 +01:00
|
|
|
recv_lalt = 0;
|
2018-02-01 03:14:55 +01:00
|
|
|
}
|
2018-02-10 01:19:31 +01:00
|
|
|
if (recv_ralt) {
|
2018-01-20 15:46:37 +01:00
|
|
|
keyboard_input(0, 0x138);
|
2018-02-01 03:14:55 +01:00
|
|
|
/* Extra key press and release so the guest is not stuck in the
|
|
|
|
|
menu bar. */
|
|
|
|
|
keyboard_input(1, 0x138);
|
|
|
|
|
keyboard_input(0, 0x138);
|
2018-02-10 01:19:31 +01:00
|
|
|
recv_ralt = 0;
|
2018-02-01 03:14:55 +01:00
|
|
|
}
|
2018-01-20 15:46:37 +01:00
|
|
|
} else if (((scancode == 0x038) || (scancode == 0x138)) &&
|
|
|
|
|
!(rawKB.Flags & RI_KEY_BREAK) &&
|
2018-02-10 01:19:31 +01:00
|
|
|
recv_tab &&
|
2018-01-20 15:46:37 +01:00
|
|
|
!mouse_capture) {
|
|
|
|
|
/* We received an ALT while TAB was pressed, while the mouse
|
|
|
|
|
is not captured, suppress the ALT and send a TAB key up. */
|
|
|
|
|
keyboard_input(0, 0x00F);
|
2018-02-10 01:19:31 +01:00
|
|
|
recv_tab = 0;
|
2018-01-20 15:46:37 +01:00
|
|
|
} else {
|
2018-02-10 01:19:31 +01:00
|
|
|
switch(scancode) {
|
|
|
|
|
case 0x00F:
|
|
|
|
|
recv_tab = !(rawKB.Flags & RI_KEY_BREAK);
|
|
|
|
|
break;
|
|
|
|
|
case 0x038:
|
|
|
|
|
recv_lalt = !(rawKB.Flags & RI_KEY_BREAK);
|
|
|
|
|
break;
|
|
|
|
|
case 0x138:
|
|
|
|
|
recv_ralt = !(rawKB.Flags & RI_KEY_BREAK);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-10 00:01:52 +01:00
|
|
|
/* Translate right CTRL to left ALT if the user has so
|
|
|
|
|
chosen. */
|
|
|
|
|
if ((scancode == 0x11D) && rctrl_is_lalt)
|
|
|
|
|
scancode = 0x038;
|
|
|
|
|
|
2018-01-20 15:46:37 +01:00
|
|
|
/* Normal scan code pass through, pass it through as is if
|
|
|
|
|
it's not an invalid scan code. */
|
|
|
|
|
if (scancode != 0xFFFF)
|
|
|
|
|
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
|
|
|
|
}
|
2017-10-24 22:10:21 -04:00
|
|
|
} else {
|
|
|
|
|
if (rawKB.MakeCode == 0x1D) {
|
2018-01-13 22:56:13 +01:00
|
|
|
scancode = scancode_map[0x100]; /* Translate E1 1D to 0x100 (which would
|
|
|
|
|
otherwise be E0 00 but that is invalid
|
|
|
|
|
anyway).
|
|
|
|
|
Also, take a potential mapping into
|
|
|
|
|
account. */
|
2018-01-21 13:59:21 +01:00
|
|
|
} else
|
|
|
|
|
scancode = 0xFFFF;
|
2018-01-13 22:56:13 +01:00
|
|
|
if (scancode != 0xFFFF)
|
|
|
|
|
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
2017-09-25 04:31:20 -04:00
|
|
|
}
|