Merge branch 'master' of https://github.com/86Box/86Box into feature/savquest
This commit is contained in:
12
src/86box.c
12
src/86box.c
@@ -85,7 +85,7 @@
|
||||
and declared here instead. */
|
||||
int dopause; /* system is paused */
|
||||
int doresize; /* screen resize requested */
|
||||
int is_quit; /* system exit requested */
|
||||
volatile int is_quit; /* system exit requested */
|
||||
uint64_t timer_freq;
|
||||
char emu_version[200]; /* version ID string */
|
||||
|
||||
@@ -919,14 +919,8 @@ pc_close(thread_t *ptr)
|
||||
/* Claim the video blitter. */
|
||||
startblit();
|
||||
|
||||
/* Terminate the main thread. */
|
||||
if (ptr != NULL) {
|
||||
/* Terminate the UI thread. */
|
||||
is_quit = 1;
|
||||
thread_wait(ptr, -1);
|
||||
|
||||
/* Wait some more. */
|
||||
plat_delay_ms(200);
|
||||
}
|
||||
|
||||
#if (defined(USE_DYNAREC) && defined(USE_NEW_DYNAREC))
|
||||
codegen_close();
|
||||
@@ -953,7 +947,7 @@ pc_close(thread_t *ptr)
|
||||
|
||||
#ifdef ENABLE_808X_LOG
|
||||
if (dump_on_exit)
|
||||
dumpregs(0);
|
||||
dumpregs(0);
|
||||
#endif
|
||||
|
||||
video_close();
|
||||
|
@@ -1070,7 +1070,6 @@ acpi_reg_write_via_596b(int size, uint16_t addr, uint8_t val, void *p)
|
||||
break;
|
||||
case 0x4c: case 0x4d: case 0x4e: case 0x4f:
|
||||
/* GPO Port Output Value */
|
||||
pclog("Write %02X to %02X\n", val, addr);
|
||||
dev->regs.gpo_val = ((dev->regs.gpo_val & ~(0xff << shift32)) | (val << shift32)) & 0x7fffffff;
|
||||
break;
|
||||
default:
|
||||
|
@@ -513,6 +513,7 @@ load_general(void)
|
||||
}
|
||||
|
||||
sound_gain = config_get_int(cat, "sound_gain", 0);
|
||||
kbd_req_capture = config_get_int(cat, "kbd_req_capture", 0);
|
||||
|
||||
confirm_reset = config_get_int(cat, "confirm_reset", 1);
|
||||
confirm_exit = config_get_int(cat, "confirm_exit", 1);
|
||||
@@ -1804,11 +1805,14 @@ config_load(void)
|
||||
memset(zip_drives, 0, sizeof(zip_drive_t));
|
||||
|
||||
if (! config_read(cfg_path)) {
|
||||
config_changed = 1;
|
||||
|
||||
cpu_f = (cpu_family_t *) &cpu_families[0];
|
||||
cpu = 0;
|
||||
#ifdef USE_LANGUAGE
|
||||
plat_langid = 0x0409;
|
||||
#endif
|
||||
kbd_req_capture = 0;
|
||||
scale = 1;
|
||||
machine = machine_get_machine_from_internal_name("ibmpc");
|
||||
fpu_type = fpu_get_type(cpu_f, cpu, "none");
|
||||
@@ -1968,6 +1972,11 @@ save_general(void)
|
||||
else
|
||||
config_delete_var(cat, "sound_gain");
|
||||
|
||||
if (kbd_req_capture != 0)
|
||||
config_set_int(cat, "kbd_req_capture", kbd_req_capture);
|
||||
else
|
||||
config_delete_var(cat, "kbd_req_capture");
|
||||
|
||||
if (confirm_reset != 1)
|
||||
config_set_int(cat, "confirm_reset", confirm_reset);
|
||||
else
|
||||
|
@@ -681,16 +681,17 @@ add_to_kbc_queue_front(atkbd_t *dev, uint8_t val, uint8_t channel, uint8_t stat_
|
||||
if (channel == 2) {
|
||||
if (dev->mem[0] & 0x02)
|
||||
picint(0x1000);
|
||||
dev->last_irq = 0x1000;
|
||||
} else {
|
||||
if (dev->mem[0] & 0x01)
|
||||
picint(2);
|
||||
dev->last_irq = 2;
|
||||
}
|
||||
dev->out = val;
|
||||
if (channel == 2)
|
||||
dev->status = (dev->status & ~STAT_IFULL) | (STAT_OFULL | STAT_MFULL) | stat_hi;
|
||||
else
|
||||
dev->status = (dev->status & ~(STAT_IFULL | STAT_MFULL)) | STAT_OFULL | stat_hi;
|
||||
dev->last_irq = 0x0000;
|
||||
}
|
||||
|
||||
|
||||
@@ -1055,8 +1056,8 @@ write_output(atkbd_t *dev, uint8_t val)
|
||||
uint8_t kbc_ven = dev->flags & KBC_VEN_MASK;
|
||||
kbd_log("ATkbc: write output port: %02X (old: %02X)\n", val, dev->output_port);
|
||||
|
||||
if ((kbc_ven == KBC_VEN_AMI) || ((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF))
|
||||
val |= ((dev->mem[0] << 4) & 0x30);
|
||||
if ((kbc_ven == KBC_VEN_AMI) || ((dev->flags & KBC_TYPE_MASK) < KBC_TYPE_PS2_NOREF))
|
||||
val |= ((dev->mem[0] << 4) & 0x10);
|
||||
|
||||
if ((dev->output_port ^ val) & 0x20) { /*IRQ 12*/
|
||||
if (val & 0x20)
|
||||
@@ -2070,10 +2071,8 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
|
||||
case 0xd0: /* read output port */
|
||||
kbd_log("ATkbc: read output port\n");
|
||||
mask = 0xff;
|
||||
if (dev->mem[0] & 0x10)
|
||||
if (((dev->flags & KBC_TYPE_MASK) < KBC_TYPE_PS2_NOREF) && (dev->mem[0] & 0x10))
|
||||
mask &= 0xbf;
|
||||
if (((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF) && (dev->mem[0] & 0x20))
|
||||
mask &= 0xf7;
|
||||
add_to_kbc_queue_front(dev, dev->output_port & mask, 0, 0x00);
|
||||
break;
|
||||
|
||||
|
@@ -1882,7 +1882,11 @@ static uint8_t
|
||||
ide_status(ide_t *ide, ide_t *ide_other, int ch)
|
||||
{
|
||||
if ((ide->type == IDE_NONE) && ((ide_other->type == IDE_NONE) || !(ch & 1)))
|
||||
#ifdef STATUS_BIT_7_PULLDOWN
|
||||
return 0x7F; /* Bit 7 pulled down, all other bits pulled up, per the spec. */
|
||||
#else
|
||||
return 0xFF;
|
||||
#endif
|
||||
else if ((ide->type == IDE_NONE) && (ch & 1))
|
||||
return 0x00; /* On real hardware, a slave with a present master always returns a status of 0x00. */
|
||||
else if (ide->type == IDE_ATAPI)
|
||||
|
@@ -189,6 +189,8 @@ extern void resub_cycles(int old_cycles);
|
||||
extern double isa_timing;
|
||||
extern int io_delay, framecountx;
|
||||
|
||||
extern volatile int cpu_thread_run;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -64,8 +64,8 @@ extern "C" {
|
||||
/* Global variables residing in the platform module. */
|
||||
extern int dopause, /* system is paused */
|
||||
doresize, /* screen resize requested */
|
||||
is_quit, /* system exit requested */
|
||||
mouse_capture; /* mouse is captured in app */
|
||||
extern volatile int is_quit; /* system exit requested */
|
||||
|
||||
#ifdef MTR_ENABLED
|
||||
extern int tracing_on;
|
||||
@@ -80,6 +80,8 @@ extern int update_icons;
|
||||
extern int unscaled_size_x, /* current unscaled size X */
|
||||
unscaled_size_y; /* current unscaled size Y */
|
||||
|
||||
extern int kbd_req_capture;
|
||||
|
||||
/* System-related functions. */
|
||||
extern char *fix_exe_path(char *str);
|
||||
extern FILE *plat_fopen(const char *path, const char *mode);
|
||||
|
@@ -285,17 +285,18 @@
|
||||
|
||||
#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
|
||||
#define IDM_ACTION_EXIT 40014
|
||||
#define IDM_ACTION_CTRL_ALT_ESC 40015
|
||||
#define IDM_ACTION_PAUSE 40016
|
||||
#define IDM_ACTION_KBD_REQ_CAPTURE 40010
|
||||
#define IDM_ACTION_RCTRL_IS_LALT 40011
|
||||
#define IDM_ACTION_SCREENSHOT 40012
|
||||
#define IDM_ACTION_HRESET 40013
|
||||
#define IDM_ACTION_RESET_CAD 40014
|
||||
#define IDM_ACTION_EXIT 40015
|
||||
#define IDM_ACTION_CTRL_ALT_ESC 40016
|
||||
#define IDM_ACTION_PAUSE 40017
|
||||
#ifdef MTR_ENABLED
|
||||
#define IDM_ACTION_BEGIN_TRACE 40017
|
||||
#define IDM_ACTION_END_TRACE 40018
|
||||
#define IDM_ACTION_TRACE 40019
|
||||
#define IDM_ACTION_BEGIN_TRACE 40018
|
||||
#define IDM_ACTION_END_TRACE 40019
|
||||
#define IDM_ACTION_TRACE 40020
|
||||
#endif
|
||||
#define IDM_CONFIG 40020
|
||||
#define IDM_CONFIG_LOAD 40021
|
||||
|
@@ -108,7 +108,8 @@ typedef struct {
|
||||
stat;
|
||||
uint8_t plane_write, /* 1512/200 */
|
||||
plane_read, /* 1512/200 */
|
||||
border; /* 1512/200 */
|
||||
border, /* 1512/200 */
|
||||
invert; /* 512/640 */
|
||||
int fontbase; /* 1512/200 */
|
||||
int linepos,
|
||||
displine;
|
||||
@@ -1695,8 +1696,17 @@ vid_init_200(amstrad_t *ams)
|
||||
|
||||
overscan_x = overscan_y = 16;
|
||||
|
||||
green = makecol(0x1C, 0x71, 0x31);
|
||||
blue = makecol(0x0f, 0x21, 0x3f);
|
||||
if (ams->type == AMS_PC200)
|
||||
vid->invert = 0;
|
||||
else
|
||||
vid->invert = device_get_config_int("invert");
|
||||
if (vid->invert) {
|
||||
blue = makecol(0x1C, 0x71, 0x31);
|
||||
green = makecol(0x0f, 0x21, 0x3f);
|
||||
} else {
|
||||
green = makecol(0x1C, 0x71, 0x31);
|
||||
blue = makecol(0x0f, 0x21, 0x3f);
|
||||
}
|
||||
cgapal_rebuild();
|
||||
set_lcd_cols(0);
|
||||
|
||||
@@ -1954,6 +1964,9 @@ device_config_t vid_ppc512_config[] =
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"invert", "Invert LCD colors", CONFIG_BINARY, "", 0
|
||||
},
|
||||
{
|
||||
"", "", -1
|
||||
}
|
||||
|
@@ -119,6 +119,7 @@ typedef struct t1000_t
|
||||
int dispon;
|
||||
int vsynctime;
|
||||
uint8_t video_options;
|
||||
uint8_t backlight, invert;
|
||||
|
||||
uint8_t *vram;
|
||||
} t1000_t;
|
||||
@@ -588,8 +589,23 @@ static void t1000_recalcattrs(t1000_t *t1000)
|
||||
* are bold */
|
||||
|
||||
/* Set up colours */
|
||||
blue = makecol(0x2D, 0x39, 0x5A);
|
||||
grey = makecol(0x85, 0xa0, 0xD6);
|
||||
if (t1000->invert) {
|
||||
if (t1000->backlight) {
|
||||
grey = makecol(0x2D, 0x39, 0x5A);
|
||||
blue = makecol(0x85, 0xa0, 0xD6);
|
||||
} else {
|
||||
grey = makecol(0x0f, 0x21, 0x3f);
|
||||
blue = makecol(0x1C, 0x71, 0x31);
|
||||
}
|
||||
} else {
|
||||
if (t1000->backlight) {
|
||||
blue = makecol(0x2D, 0x39, 0x5A);
|
||||
grey = makecol(0x85, 0xa0, 0xD6);
|
||||
} else {
|
||||
blue = makecol(0x0f, 0x21, 0x3f);
|
||||
grey = makecol(0x1C, 0x71, 0x31);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialise the attribute mapping. Start by defaulting everything
|
||||
* to grey on blue, and with bold set by bit 3 */
|
||||
@@ -682,6 +698,9 @@ static void *t1000_init(const device_t *info)
|
||||
|
||||
t1000->internal = 1;
|
||||
|
||||
t1000->backlight = device_get_config_int("backlight");
|
||||
t1000->invert = device_get_config_int("invert");
|
||||
|
||||
/* 16k video RAM */
|
||||
t1000->vram = malloc(0x4000);
|
||||
|
||||
@@ -740,6 +759,12 @@ static const device_config_t t1000_config[] =
|
||||
},
|
||||
.default_int = 0
|
||||
},
|
||||
{
|
||||
"backlight", "Enable backlight", CONFIG_BINARY, "", 1
|
||||
},
|
||||
{
|
||||
"invert", "Invert colors", CONFIG_BINARY, "", 0
|
||||
},
|
||||
{
|
||||
.type = -1
|
||||
}
|
||||
|
@@ -691,10 +691,6 @@ nvr_read(uint16_t addr, void *priv)
|
||||
ret = (nvr->regs[RTC_REGA] & 0x7f) | local->stat;
|
||||
break;
|
||||
|
||||
case RTC_REGB:
|
||||
ret = nvr->regs[local->addr[addr_id]] | 0x40;
|
||||
break;
|
||||
|
||||
case RTC_REGC:
|
||||
picintc(1 << nvr->irq);
|
||||
ret = nvr->regs[RTC_REGC];
|
||||
|
@@ -6148,7 +6148,8 @@ static void *s3_init(const device_t *info)
|
||||
case S3_DIAMOND_STEALTH_SE:
|
||||
svga->decode_mask = (4 << 20) - 1;
|
||||
s3->id = 0xe1; /*Trio32*/
|
||||
s3->id_ext = s3->id_ext_pci = 0x10;
|
||||
s3->id_ext = 0x10;
|
||||
s3->id_ext_pci = 0x11;
|
||||
s3->packed_mmio = 1;
|
||||
|
||||
svga->clock_gen = s3;
|
||||
|
@@ -45,6 +45,7 @@ MainMenu MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&Action"
|
||||
BEGIN
|
||||
MENUITEM "&Keyboard requires capture", IDM_ACTION_KBD_REQ_CAPTURE
|
||||
MENUITEM "&Right CTRL is left ALT", IDM_ACTION_RCTRL_IS_LALT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Hard Reset", IDM_ACTION_HRESET
|
||||
|
@@ -69,6 +69,7 @@ HANDLE ghMutex;
|
||||
LCID lang_id; /* current language ID used */
|
||||
DWORD dwSubLangID;
|
||||
int acp_utf8; /* Windows supports UTF-8 codepage */
|
||||
volatile int cpu_thread_run = 1;
|
||||
|
||||
|
||||
/* Local data. */
|
||||
@@ -487,7 +488,7 @@ main_thread(void *param)
|
||||
title_update = 1;
|
||||
old_time = GetTickCount();
|
||||
drawits = frames = 0;
|
||||
while (!is_quit) {
|
||||
while (!is_quit && cpu_thread_run) {
|
||||
/* See if it is time to run a frame of code. */
|
||||
new_time = GetTickCount();
|
||||
drawits += (new_time - old_time);
|
||||
@@ -511,7 +512,7 @@ main_thread(void *param)
|
||||
Sleep(1);
|
||||
|
||||
/* If needed, handle a screen resize. */
|
||||
if (doresize && !video_fullscreen) {
|
||||
if (doresize && !video_fullscreen && !is_quit) {
|
||||
if (vid_resize & 2)
|
||||
plat_resize(fixed_size_x, fixed_size_y);
|
||||
else
|
||||
@@ -519,6 +520,8 @@ main_thread(void *param)
|
||||
doresize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
is_quit = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -542,7 +545,7 @@ do_start(void)
|
||||
win_log("Main timer precision: %llu\n", timer_freq);
|
||||
|
||||
/* Start the emulator, really. */
|
||||
thMain = thread_create(main_thread, &is_quit);
|
||||
thMain = thread_create(main_thread, NULL);
|
||||
SetThreadPriority(thMain, THREAD_PRIORITY_HIGHEST);
|
||||
}
|
||||
|
||||
@@ -551,16 +554,17 @@ do_start(void)
|
||||
void
|
||||
do_stop(void)
|
||||
{
|
||||
is_quit = 1;
|
||||
/* Claim the video blitter. */
|
||||
startblit();
|
||||
|
||||
plat_delay_ms(100);
|
||||
|
||||
if (source_hwnd)
|
||||
PostMessage((HWND) (uintptr_t) source_hwnd, WM_HAS_SHUTDOWN, (WPARAM) 0, (LPARAM) hwndMain);
|
||||
vid_apis[vid_api].close();
|
||||
|
||||
pc_close(thMain);
|
||||
|
||||
thMain = NULL;
|
||||
|
||||
if (source_hwnd)
|
||||
PostMessage((HWND) (uintptr_t) source_hwnd, WM_HAS_SHUTDOWN, (WPARAM) 0, (LPARAM) hwndMain);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -114,89 +114,92 @@ keyboard_handle(PRAWINPUT raw)
|
||||
static int recv_lalt = 0, recv_ralt = 0, recv_tab = 0;
|
||||
|
||||
RAWKEYBOARD rawKB = raw->data.keyboard;
|
||||
scancode = rawKB.MakeCode;
|
||||
scancode = rawKB.MakeCode;
|
||||
|
||||
/* If it's not a scan code that starts with 0xE1 */
|
||||
if (!(rawKB.Flags & RI_KEY_E1)) {
|
||||
if (rawKB.Flags & RI_KEY_E0)
|
||||
scancode |= 0x100;
|
||||
if (kbd_req_capture && !mouse_capture && !video_fullscreen)
|
||||
return;
|
||||
|
||||
/* Translate the scan code to 9-bit */
|
||||
scancode = convert_scan_code(scancode);
|
||||
/* If it's not a scan code that starts with 0xE1 */
|
||||
if (!(rawKB.Flags & RI_KEY_E1)) {
|
||||
if (rawKB.Flags & RI_KEY_E0)
|
||||
scancode |= 0x100;
|
||||
|
||||
/* Remap it according to the list from the Registry */
|
||||
if (scancode != scancode_map[scancode])
|
||||
pclog("Scan code remap: %03X -> %03X\n", scancode, scancode);
|
||||
scancode = scancode_map[scancode];
|
||||
/* Translate the scan code to 9-bit */
|
||||
scancode = convert_scan_code(scancode);
|
||||
|
||||
/* 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. */
|
||||
if ((scancode == 0x00F) &&
|
||||
!(rawKB.Flags & RI_KEY_BREAK) &&
|
||||
(recv_lalt || recv_ralt) &&
|
||||
!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. */
|
||||
if (recv_lalt) {
|
||||
keyboard_input(0, 0x038);
|
||||
/* Extra key press and release so the guest is not stuck in the
|
||||
menu bar. */
|
||||
keyboard_input(1, 0x038);
|
||||
keyboard_input(0, 0x038);
|
||||
recv_lalt = 0;
|
||||
}
|
||||
if (recv_ralt) {
|
||||
keyboard_input(0, 0x138);
|
||||
/* Extra key press and release so the guest is not stuck in the
|
||||
menu bar. */
|
||||
keyboard_input(1, 0x138);
|
||||
keyboard_input(0, 0x138);
|
||||
recv_ralt = 0;
|
||||
}
|
||||
} else if (((scancode == 0x038) || (scancode == 0x138)) &&
|
||||
!(rawKB.Flags & RI_KEY_BREAK) &&
|
||||
recv_tab &&
|
||||
!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);
|
||||
recv_tab = 0;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
/* Remap it according to the list from the Registry */
|
||||
if (scancode != scancode_map[scancode])
|
||||
pclog("Scan code remap: %03X -> %03X\n", scancode, scancode);
|
||||
scancode = scancode_map[scancode];
|
||||
|
||||
/* 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)
|
||||
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
||||
/* 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. */
|
||||
if ((scancode == 0x00F) &&
|
||||
!(rawKB.Flags & RI_KEY_BREAK) &&
|
||||
(recv_lalt || recv_ralt) &&
|
||||
!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. */
|
||||
if (recv_lalt) {
|
||||
keyboard_input(0, 0x038);
|
||||
/* Extra key press and release so the guest is not stuck in the
|
||||
menu bar. */
|
||||
keyboard_input(1, 0x038);
|
||||
keyboard_input(0, 0x038);
|
||||
recv_lalt = 0;
|
||||
}
|
||||
if (recv_ralt) {
|
||||
keyboard_input(0, 0x138);
|
||||
/* Extra key press and release so the guest is not stuck in the
|
||||
menu bar. */
|
||||
keyboard_input(1, 0x138);
|
||||
keyboard_input(0, 0x138);
|
||||
recv_ralt = 0;
|
||||
}
|
||||
} else if (((scancode == 0x038) || (scancode == 0x138)) &&
|
||||
!(rawKB.Flags & RI_KEY_BREAK) &&
|
||||
recv_tab &&
|
||||
!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);
|
||||
recv_tab = 0;
|
||||
} else {
|
||||
if (rawKB.MakeCode == 0x1D) {
|
||||
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. */
|
||||
} else
|
||||
scancode = 0xFFFF;
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
||||
}
|
||||
} else {
|
||||
if (rawKB.MakeCode == 0x1D) {
|
||||
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. */
|
||||
} else
|
||||
scancode = 0xFFFF;
|
||||
if (scancode != 0xFFFF)
|
||||
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
||||
}
|
||||
}
|
||||
|
@@ -67,6 +67,7 @@ int infocus = 1, button_down = 0;
|
||||
int rctrl_is_lalt = 0;
|
||||
int user_resize = 0;
|
||||
int fixed_size_x = 0, fixed_size_y = 0;
|
||||
int kbd_req_capture = 0;
|
||||
|
||||
extern char openfilestring[512];
|
||||
extern WCHAR wopenfilestring[512];
|
||||
@@ -80,11 +81,9 @@ static int hook_enabled = 0;
|
||||
#endif
|
||||
static int manager_wm = 0;
|
||||
static int save_window_pos = 0, pause_state = 0;
|
||||
static int dpi = 96;
|
||||
static int padded_frame = 0;
|
||||
|
||||
|
||||
static int vis = -1;
|
||||
static int dpi = 96;
|
||||
static int padded_frame = 0;
|
||||
static int vis = -1;
|
||||
|
||||
/* Per Monitor DPI Aware v2 APIs, Windows 10 v1703+ */
|
||||
void* user32_handle = NULL;
|
||||
@@ -263,6 +262,7 @@ ResetAllMenus(void)
|
||||
#endif
|
||||
|
||||
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_ACTION_KBD_REQ_CAPTURE, MF_UNCHECKED);
|
||||
|
||||
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, MF_UNCHECKED);
|
||||
|
||||
@@ -328,6 +328,7 @@ ResetAllMenus(void)
|
||||
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+4, MF_UNCHECKED);
|
||||
|
||||
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_ACTION_KBD_REQ_CAPTURE, kbd_req_capture ? MF_CHECKED : MF_UNCHECKED);
|
||||
|
||||
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, update_icons ? MF_CHECKED : MF_UNCHECKED);
|
||||
|
||||
@@ -406,7 +407,8 @@ LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
BOOL bControlKeyDown;
|
||||
KBDLLHOOKSTRUCT *p;
|
||||
|
||||
if (nCode < 0 || nCode != HC_ACTION || (!mouse_capture && !video_fullscreen))
|
||||
if (nCode < 0 || nCode != HC_ACTION ||
|
||||
(!mouse_capture && !video_fullscreen) || (kbd_req_capture && !mouse_capture && !video_fullscreen))
|
||||
return(CallNextHookEx(hKeyboardHook, nCode, wParam, lParam));
|
||||
|
||||
p = (KBDLLHOOKSTRUCT*)lParam;
|
||||
@@ -475,9 +477,10 @@ plat_power_off(void)
|
||||
|
||||
/* Cleanly terminate all of the emulator's components so as
|
||||
to avoid things like threads getting stuck. */
|
||||
do_stop();
|
||||
// do_stop();
|
||||
cpu_thread_run = 0;
|
||||
|
||||
exit(-1);
|
||||
// exit(-1);
|
||||
}
|
||||
|
||||
#ifdef MTR_ENABLED
|
||||
@@ -671,6 +674,12 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
config_save();
|
||||
break;
|
||||
|
||||
case IDM_ACTION_KBD_REQ_CAPTURE:
|
||||
kbd_req_capture ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_ACTION_KBD_REQ_CAPTURE, kbd_req_capture ? 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);
|
||||
@@ -1539,10 +1548,10 @@ ui_init(int nCmdShow)
|
||||
fatal("bRet is -1\n");
|
||||
}
|
||||
|
||||
if (messages.message == WM_QUIT) {
|
||||
is_quit = 1;
|
||||
break;
|
||||
}
|
||||
/* On WM_QUIT, tell the CPU thread to stop running. That will then tell us
|
||||
to stop running as well. */
|
||||
if (messages.message == WM_QUIT)
|
||||
cpu_thread_run = 0;
|
||||
|
||||
if (! TranslateAccelerator(hwnd, haccel, &messages))
|
||||
{
|
||||
@@ -1688,7 +1697,7 @@ plat_mouse_capture(int on)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
if (mouse_type == MOUSE_TYPE_NONE)
|
||||
if (!kbd_req_capture && (mouse_type == MOUSE_TYPE_NONE))
|
||||
return;
|
||||
|
||||
if (on && !mouse_capture) {
|
||||
|
Reference in New Issue
Block a user