2017-11-19 03:15:29 -05: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.
|
|
|
|
|
*
|
|
|
|
|
* user Interface module for WinAPI on Windows.
|
|
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2017-11-19 03:15:29 -05:00
|
|
|
*
|
|
|
|
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
|
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
|
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
|
|
|
|
*
|
2020-01-19 06:19:07 +01:00
|
|
|
* Copyright 2008-2020 Sarah Walker.
|
|
|
|
|
* Copyright 2016-2020 Miran Grca.
|
|
|
|
|
* Copyright 2017-2020 Fred N. van Kempen.
|
|
|
|
|
* Copyright 2019,2020 GH Cao.
|
2017-11-19 03:15:29 -05:00
|
|
|
*/
|
|
|
|
|
#define UNICODE
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <commctrl.h>
|
|
|
|
|
#include <stdint.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#include <stdio.h>
|
2017-11-19 03:15:29 -05:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <wchar.h>
|
2020-11-28 07:04:40 +01:00
|
|
|
#include <86box/plat.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
|
|
|
|
#include <86box/config.h>
|
2020-11-16 00:01:21 +01:00
|
|
|
#include "../cpu/cpu.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/device.h>
|
|
|
|
|
#include <86box/keyboard.h>
|
|
|
|
|
#include <86box/mouse.h>
|
2020-11-19 19:27:04 +01:00
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/nvr.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/video.h>
|
|
|
|
|
#include <86box/vid_ega.h> // for update_overscan
|
|
|
|
|
#include <86box/plat_midi.h>
|
2020-09-02 11:03:14 +08:00
|
|
|
#include <86box/plat_dynld.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/ui.h>
|
|
|
|
|
#include <86box/win.h>
|
2020-07-19 19:21:03 -03:00
|
|
|
#include <86box/version.h>
|
2019-12-04 13:12:34 +01:00
|
|
|
#ifdef USE_DISCORD
|
2020-03-29 14:24:42 +02:00
|
|
|
# include <86box/win_discord.h>
|
2019-12-04 13:12:34 +01:00
|
|
|
#endif
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2021-02-10 20:22:51 +00:00
|
|
|
#ifdef MTR_ENABLED
|
|
|
|
|
#include <minitrace/minitrace.h>
|
|
|
|
|
#endif
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
#define TIMER_1SEC 1 /* ID of the one-second timer */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Platform Public data, specific. */
|
|
|
|
|
HWND hwndMain, /* application main window */
|
|
|
|
|
hwndRender; /* machine render window */
|
|
|
|
|
HMENU menuMain; /* application main menu */
|
2018-07-15 01:41:53 +02:00
|
|
|
HICON hIcon[256]; /* icon data loaded from resources */
|
2017-11-19 03:15:29 -05:00
|
|
|
RECT oldclip; /* mouse rect */
|
2021-04-12 03:42:03 +02:00
|
|
|
int sbar_height = 23; /* statusbar height */
|
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
|
|
|
int minimized = 0;
|
2021-04-12 03:42:03 +02:00
|
|
|
int infocus = 1, button_down = 0;
|
2018-02-10 00:01:52 +01:00
|
|
|
int rctrl_is_lalt = 0;
|
2018-10-28 18:26:51 +01:00
|
|
|
int user_resize = 0;
|
2021-04-12 05:58:59 +02:00
|
|
|
int fixed_size_x = 0, fixed_size_y = 0;
|
2021-07-19 02:27:22 +02:00
|
|
|
int kbd_req_capture = 0;
|
2021-07-30 04:01:46 +02:00
|
|
|
int hide_status_bar = 0;
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2020-05-12 13:36:47 +02:00
|
|
|
extern char openfilestring[512];
|
|
|
|
|
extern WCHAR wopenfilestring[512];
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Local data. */
|
|
|
|
|
static wchar_t wTitle[512];
|
2020-12-19 00:04:36 +01:00
|
|
|
static int manager_wm = 0;
|
2019-11-03 03:18:30 +01:00
|
|
|
static int save_window_pos = 0, pause_state = 0;
|
2021-07-19 02:27:22 +02:00
|
|
|
static int dpi = 96;
|
|
|
|
|
static int padded_frame = 0;
|
|
|
|
|
static int vis = -1;
|
2017-12-15 18:47:29 +01:00
|
|
|
|
2020-09-02 11:03:14 +08:00
|
|
|
/* Per Monitor DPI Aware v2 APIs, Windows 10 v1703+ */
|
|
|
|
|
void* user32_handle = NULL;
|
|
|
|
|
static UINT (WINAPI *pGetDpiForWindow)(HWND);
|
|
|
|
|
static UINT (WINAPI *pGetSystemMetricsForDpi)(int i, UINT dpi);
|
|
|
|
|
static DPI_AWARENESS_CONTEXT (WINAPI *pGetWindowDpiAwarenessContext)(HWND);
|
|
|
|
|
static BOOL (WINAPI *pAreDpiAwarenessContextsEqual)(DPI_AWARENESS_CONTEXT A, DPI_AWARENESS_CONTEXT B);
|
|
|
|
|
static dllimp_t user32_imports[] = {
|
|
|
|
|
{ "GetDpiForWindow", &pGetDpiForWindow },
|
|
|
|
|
{ "GetSystemMetricsForDpi", &pGetSystemMetricsForDpi },
|
|
|
|
|
{ "GetWindowDpiAwarenessContext", &pGetWindowDpiAwarenessContext },
|
|
|
|
|
{ "AreDpiAwarenessContextsEqual", &pAreDpiAwarenessContextsEqual },
|
|
|
|
|
{ NULL, NULL }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
win_get_dpi(HWND hwnd) {
|
|
|
|
|
if (user32_handle != NULL) {
|
|
|
|
|
return pGetDpiForWindow(hwnd);
|
|
|
|
|
} else {
|
|
|
|
|
HDC dc = GetDC(hwnd);
|
|
|
|
|
UINT dpi = GetDeviceCaps(dc, LOGPIXELSX);
|
|
|
|
|
ReleaseDC(hwnd, dc);
|
|
|
|
|
return dpi;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int win_get_system_metrics(int index, int dpi) {
|
|
|
|
|
if (user32_handle != NULL) {
|
|
|
|
|
/* Only call GetSystemMetricsForDpi when we are using PMv2 */
|
|
|
|
|
DPI_AWARENESS_CONTEXT c = pGetWindowDpiAwarenessContext(hwndMain);
|
|
|
|
|
if (pAreDpiAwarenessContextsEqual(c, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2))
|
|
|
|
|
return pGetSystemMetricsForDpi(index, dpi);
|
|
|
|
|
}
|
2021-03-25 03:20:25 -05:00
|
|
|
|
2020-09-02 11:03:14 +08:00
|
|
|
return GetSystemMetrics(index);
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-02 11:19:09 +08:00
|
|
|
void
|
|
|
|
|
ResizeWindowByClientArea(HWND hwnd, int width, int height)
|
|
|
|
|
{
|
2021-04-12 05:58:59 +02:00
|
|
|
if ((vid_resize == 1) || padded_frame) {
|
2020-09-02 11:19:09 +08:00
|
|
|
int padding = win_get_system_metrics(SM_CXPADDEDBORDER, dpi);
|
|
|
|
|
width += (win_get_system_metrics(SM_CXFRAME, dpi) + padding) * 2;
|
|
|
|
|
height += (win_get_system_metrics(SM_CYFRAME, dpi) + padding) * 2;
|
|
|
|
|
} else {
|
|
|
|
|
width += win_get_system_metrics(SM_CXFIXEDFRAME, dpi) * 2;
|
|
|
|
|
height += win_get_system_metrics(SM_CYFIXEDFRAME, dpi) * 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
height += win_get_system_metrics(SM_CYCAPTION, dpi);
|
|
|
|
|
height += win_get_system_metrics(SM_CYBORDER, dpi) + win_get_system_metrics(SM_CYMENUSIZE, dpi);
|
|
|
|
|
|
|
|
|
|
SetWindowPos(hwnd, NULL, 0, 0, width, height, SWP_NOMOVE);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-15 00:42:10 -05:00
|
|
|
/* Set host cursor visible or not. */
|
|
|
|
|
void
|
|
|
|
|
show_cursor(int val)
|
|
|
|
|
{
|
2017-12-15 18:47:29 +01:00
|
|
|
if (val == vis)
|
|
|
|
|
return;
|
2017-12-15 00:42:10 -05:00
|
|
|
|
2017-12-15 18:47:29 +01:00
|
|
|
if (val == 0) {
|
2018-04-25 23:51:13 +02:00
|
|
|
while (1)
|
2017-12-15 18:47:29 +01:00
|
|
|
if (ShowCursor(FALSE) < 0) break;
|
2018-04-25 23:51:13 +02:00
|
|
|
} else
|
2017-12-15 18:47:29 +01:00
|
|
|
ShowCursor(TRUE);
|
|
|
|
|
|
2017-12-15 00:42:10 -05:00
|
|
|
vis = val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
HICON
|
|
|
|
|
LoadIconEx(PCTSTR pszIconName)
|
|
|
|
|
{
|
|
|
|
|
return((HICON)LoadImage(hinstance, pszIconName, IMAGE_ICON,
|
|
|
|
|
16, 16, LR_SHARED));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
video_toggle_option(HMENU h, int *val, int id)
|
|
|
|
|
{
|
|
|
|
|
startblit();
|
|
|
|
|
*val ^= 1;
|
|
|
|
|
CheckMenuItem(h, id, *val ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
endblit();
|
|
|
|
|
config_save();
|
|
|
|
|
device_force_redraw();
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-28 03:29:14 +02:00
|
|
|
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
|
2021-04-23 16:09:45 +03:00
|
|
|
/* Recursively finds and deletes target submenu */
|
2021-05-01 20:49:23 +03:00
|
|
|
static int
|
|
|
|
|
delete_submenu(HMENU parent, HMENU target)
|
2021-04-23 16:09:45 +03:00
|
|
|
{
|
|
|
|
|
for (int i = 0; i < GetMenuItemCount(parent); i++)
|
|
|
|
|
{
|
|
|
|
|
MENUITEMINFO mii;
|
|
|
|
|
mii.cbSize = sizeof(mii);
|
|
|
|
|
mii.fMask = MIIM_SUBMENU;
|
|
|
|
|
|
|
|
|
|
if (GetMenuItemInfo(parent, i, TRUE, &mii) != 0)
|
|
|
|
|
{
|
|
|
|
|
if (mii.hSubMenu == target)
|
|
|
|
|
{
|
|
|
|
|
DeleteMenu(parent, i, MF_BYPOSITION);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (mii.hSubMenu != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (delete_submenu(mii.hSubMenu, target))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2021-07-28 03:29:14 +02:00
|
|
|
#endif
|
2021-04-23 16:09:45 +03:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
show_render_options_menu()
|
|
|
|
|
{
|
2021-04-26 02:45:20 +05:00
|
|
|
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
|
2021-04-23 16:09:45 +03:00
|
|
|
static int menu_vidapi = -1;
|
|
|
|
|
static HMENU cur_menu = NULL;
|
|
|
|
|
|
|
|
|
|
if (vid_api == menu_vidapi)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (cur_menu != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (delete_submenu(menuMain, cur_menu))
|
|
|
|
|
cur_menu = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cur_menu == NULL)
|
|
|
|
|
{
|
|
|
|
|
switch (IDM_VID_SDL_SW + vid_api)
|
|
|
|
|
{
|
|
|
|
|
case IDM_VID_OPENGL_CORE:
|
|
|
|
|
cur_menu = LoadMenu(hinstance, VID_GL_SUBMENU);
|
|
|
|
|
InsertMenu(GetSubMenu(menuMain, 1), 4, MF_BYPOSITION | MF_STRING | MF_POPUP, (UINT_PTR)cur_menu, plat_get_string(IDS_2144));
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GL_FPS_BLITTER, video_framerate == -1 ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GL_FPS_25, video_framerate == 25 ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GL_FPS_30, video_framerate == 30 ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GL_FPS_50, video_framerate == 50 ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GL_FPS_60, video_framerate == 60 ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GL_FPS_75, video_framerate == 75 ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GL_VSYNC, video_vsync ? MF_CHECKED : MF_UNCHECKED);
|
2021-04-26 09:51:23 +03:00
|
|
|
EnableMenuItem(menuMain, IDM_VID_GL_NOSHADER, strlen(video_shader) > 0 ? MF_ENABLED : MF_DISABLED);
|
2021-04-23 16:09:45 +03:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menu_vidapi = vid_api;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-01 20:49:23 +03:00
|
|
|
static void
|
|
|
|
|
video_set_filter_menu(HMENU menu)
|
|
|
|
|
{
|
|
|
|
|
CheckMenuItem(menu, IDM_VID_FILTER_NEAREST, vid_api == 0 || video_filter_method == 0 ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menu, IDM_VID_FILTER_LINEAR, vid_api != 0 && video_filter_method == 1 ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
EnableMenuItem(menu, IDM_VID_FILTER_NEAREST, vid_api == 0 ? MF_GRAYED : MF_ENABLED);
|
|
|
|
|
EnableMenuItem(menu, IDM_VID_FILTER_LINEAR, vid_api == 0 ? MF_GRAYED : MF_ENABLED);
|
|
|
|
|
}
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
ResetAllMenus(void)
|
|
|
|
|
{
|
2018-02-10 00:01:52 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, MF_UNCHECKED);
|
2021-07-19 02:27:22 +02:00
|
|
|
CheckMenuItem(menuMain, IDM_ACTION_KBD_REQ_CAPTURE, MF_UNCHECKED);
|
2018-02-10 00:01:52 +01:00
|
|
|
|
2018-02-11 20:51:42 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, MF_UNCHECKED);
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
#ifdef ENABLE_LOG_TOGGLES
|
|
|
|
|
# ifdef ENABLE_BUSLOGIC_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_BUSLOGIC, MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_CDROM_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_CDROM, MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_D86F_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_D86F, MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_FDC_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_FDC, MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_IDE_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_IDE, MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_SERIAL_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_SERIAL, MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_NIC_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_NIC, MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-07-30 19:17:46 +02:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_HIDE_STATUS_BAR, MF_UNCHECKED);
|
2017-11-19 03:15:29 -05:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_FORCE43, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_OVERSCAN, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_INVERT, MF_UNCHECKED);
|
|
|
|
|
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_RESIZE, MF_UNCHECKED);
|
2019-12-05 00:51:07 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_SDL_SW, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_SDL_HW, MF_UNCHECKED);
|
2020-11-26 18:20:24 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_SDL_OPENGL, MF_UNCHECKED);
|
2021-04-26 02:45:20 +05:00
|
|
|
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
|
2021-04-17 13:45:11 +03:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_OPENGL_CORE, MF_UNCHECKED);
|
2021-04-23 16:09:45 +03:00
|
|
|
show_render_options_menu();
|
2021-04-17 13:45:11 +03:00
|
|
|
#endif
|
2020-04-18 11:51:54 +02:00
|
|
|
#ifdef USE_VNC
|
2019-12-05 00:51:07 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_VNC, MF_UNCHECKED);
|
2020-04-18 11:51:54 +02:00
|
|
|
#endif
|
2017-11-19 03:15:29 -05:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_FS_FULL+0, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_FS_FULL+1, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_FS_FULL+2, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_FS_FULL+3, MF_UNCHECKED);
|
2018-01-17 18:43:36 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_FS_FULL+4, MF_UNCHECKED);
|
2017-11-19 03:15:29 -05:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_REMEMBER, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_SCALE_1X+0, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_SCALE_1X+1, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_SCALE_1X+2, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_SCALE_1X+3, MF_UNCHECKED);
|
2020-09-02 11:26:26 +08:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_HIDPI, MF_UNCHECKED);
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_CGACON, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAYCT_601+0, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAYCT_601+1, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAYCT_601+2, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+0, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+1, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+2, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+3, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+4, MF_UNCHECKED);
|
|
|
|
|
|
2018-02-10 00:01:52 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED);
|
2021-07-19 02:27:22 +02:00
|
|
|
CheckMenuItem(menuMain, IDM_ACTION_KBD_REQ_CAPTURE, kbd_req_capture ? MF_CHECKED : MF_UNCHECKED);
|
2018-02-10 00:01:52 +01:00
|
|
|
|
2018-02-11 20:51:42 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, update_icons ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
#ifdef ENABLE_LOG_TOGGLES
|
|
|
|
|
# ifdef ENABLE_BUSLOGIC_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_BUSLOGIC, buslogic_do_log?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_CDROM_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_CDROM, cdrom_do_log?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_D86F_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_D86F, d86f_do_log?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_FDC_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_FDC, fdc_do_log?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_IDE_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_IDE, ide_do_log?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_SERIAL_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_SERIAL, serial_do_log?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef ENABLE_NIC_LOG
|
|
|
|
|
CheckMenuItem(menuMain, IDM_LOG_NIC, nic_do_log?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-07-30 19:37:50 +02:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_HIDE_STATUS_BAR, hide_status_bar ? MF_CHECKED : MF_UNCHECKED);
|
2017-11-19 03:15:29 -05:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_FORCE43, force_43?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_OVERSCAN, enable_overscan?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_INVERT, invert_display ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
|
2021-04-12 05:58:59 +02:00
|
|
|
if (vid_resize == 1)
|
2017-11-19 03:15:29 -05:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_RESIZE, MF_CHECKED);
|
2019-12-05 00:51:07 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_SDL_SW+vid_api, MF_CHECKED);
|
2017-11-19 03:15:29 -05:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_FS_FULL+video_fullscreen_scale, MF_CHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_REMEMBER, window_remember?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_SCALE_1X+scale, MF_CHECKED);
|
2021-04-12 05:58:59 +02:00
|
|
|
CheckMenuItem(menuMain, IDM_VID_HIDPI, dpi_scale?MF_CHECKED:MF_UNCHECKED);
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_CGACON, vid_cga_contrast?MF_CHECKED:MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAYCT_601+video_graytype, MF_CHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+video_grayscale, MF_CHECKED);
|
2019-12-04 21:55:35 +01:00
|
|
|
|
2021-05-01 20:49:23 +03:00
|
|
|
video_set_filter_menu(menuMain);
|
|
|
|
|
|
2019-12-04 21:55:35 +01:00
|
|
|
#ifdef USE_DISCORD
|
|
|
|
|
if (discord_loaded)
|
|
|
|
|
CheckMenuItem(menuMain, IDM_DISCORD, enable_discord ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
else
|
|
|
|
|
EnableMenuItem(menuMain, IDM_DISCORD, MF_DISABLED);
|
|
|
|
|
#endif
|
2021-02-10 20:22:51 +00:00
|
|
|
#ifdef MTR_ENABLED
|
|
|
|
|
EnableMenuItem(menuMain, IDM_ACTION_END_TRACE, MF_DISABLED);
|
|
|
|
|
#endif
|
2021-04-12 05:58:59 +02:00
|
|
|
|
|
|
|
|
if (vid_resize) {
|
|
|
|
|
if (vid_resize >= 2) {
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_RESIZE, MF_UNCHECKED);
|
|
|
|
|
EnableMenuItem(menuMain, IDM_VID_RESIZE, MF_GRAYED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_SCALE_1X + scale, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_VID_SCALE_2X, MF_CHECKED);
|
|
|
|
|
EnableMenuItem(menuMain, IDM_VID_SCALE_1X, MF_GRAYED);
|
|
|
|
|
EnableMenuItem(menuMain, IDM_VID_SCALE_2X, MF_GRAYED);
|
|
|
|
|
EnableMenuItem(menuMain, IDM_VID_SCALE_3X, MF_GRAYED);
|
|
|
|
|
EnableMenuItem(menuMain, IDM_VID_SCALE_4X, MF_GRAYED);
|
|
|
|
|
}
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-11-03 03:18:30 +01:00
|
|
|
void
|
|
|
|
|
win_notify_dlg_open(void)
|
|
|
|
|
{
|
|
|
|
|
manager_wm = 1;
|
|
|
|
|
pause_state = dopause;
|
|
|
|
|
plat_pause(1);
|
|
|
|
|
if (source_hwnd)
|
|
|
|
|
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SENDDLGSTATUS, (WPARAM) 1, (LPARAM) hwndMain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
win_notify_dlg_closed(void)
|
|
|
|
|
{
|
|
|
|
|
if (source_hwnd)
|
|
|
|
|
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SENDDLGSTATUS, (WPARAM) 0, (LPARAM) hwndMain);
|
|
|
|
|
plat_pause(pause_state);
|
|
|
|
|
manager_wm = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-11-16 00:01:21 +01:00
|
|
|
void
|
|
|
|
|
plat_power_off(void)
|
|
|
|
|
{
|
|
|
|
|
confirm_exit = 0;
|
2020-11-19 19:27:04 +01:00
|
|
|
nvr_save();
|
2020-11-16 00:01:21 +01:00
|
|
|
config_save();
|
|
|
|
|
|
|
|
|
|
/* Deduct a sufficiently large number of cycles that no instructions will
|
|
|
|
|
run before the main thread is terminated */
|
|
|
|
|
cycles -= 99999999;
|
|
|
|
|
|
|
|
|
|
KillTimer(hwndMain, TIMER_1SEC);
|
|
|
|
|
PostQuitMessage(0);
|
2020-11-19 19:27:04 +01:00
|
|
|
|
|
|
|
|
/* Cleanly terminate all of the emulator's components so as
|
|
|
|
|
to avoid things like threads getting stuck. */
|
2021-07-21 04:05:40 +02:00
|
|
|
// do_stop();
|
|
|
|
|
cpu_thread_run = 0;
|
2020-11-19 19:27:04 +01:00
|
|
|
|
2021-07-21 04:05:40 +02:00
|
|
|
// exit(-1);
|
2020-11-16 00:01:21 +01:00
|
|
|
}
|
|
|
|
|
|
2021-02-10 20:22:51 +00:00
|
|
|
#ifdef MTR_ENABLED
|
|
|
|
|
static void
|
|
|
|
|
handle_trace(HMENU hmenu, int trace)
|
|
|
|
|
{
|
|
|
|
|
EnableMenuItem(hmenu, IDM_ACTION_BEGIN_TRACE, trace? MF_GRAYED : MF_ENABLED);
|
|
|
|
|
EnableMenuItem(hmenu, IDM_ACTION_END_TRACE, trace? MF_ENABLED : MF_GRAYED);
|
|
|
|
|
if (trace) {
|
|
|
|
|
init_trace();
|
|
|
|
|
} else {
|
|
|
|
|
shutdown_trace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2020-11-16 00:01:21 +01:00
|
|
|
|
2020-11-28 07:04:40 +01:00
|
|
|
/* Catch WM_INPUT messages for 'current focus' window. */
|
|
|
|
|
#if defined(__amd64__) || defined(__aarch64__)
|
|
|
|
|
static LRESULT CALLBACK
|
|
|
|
|
#else
|
|
|
|
|
static BOOL CALLBACK
|
|
|
|
|
#endif
|
|
|
|
|
input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
switch (message) {
|
|
|
|
|
case WM_INPUT:
|
|
|
|
|
if (infocus) {
|
|
|
|
|
UINT size = 0;
|
|
|
|
|
PRAWINPUT raw = NULL;
|
|
|
|
|
|
|
|
|
|
/* Here we read the raw input data */
|
|
|
|
|
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
|
|
|
|
|
raw = (PRAWINPUT)malloc(size);
|
|
|
|
|
if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, raw, &size, sizeof(RAWINPUTHEADER)) == size) {
|
|
|
|
|
switch(raw->header.dwType)
|
|
|
|
|
{
|
|
|
|
|
case RIM_TYPEKEYBOARD:
|
|
|
|
|
keyboard_handle(raw);
|
|
|
|
|
break;
|
|
|
|
|
case RIM_TYPEMOUSE:
|
|
|
|
|
win_mouse_handle(raw);
|
|
|
|
|
break;
|
|
|
|
|
case RIM_TYPEHID:
|
|
|
|
|
win_joystick_handle(raw);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
free(raw);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case WM_SETFOCUS:
|
|
|
|
|
infocus = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_KILLFOCUS:
|
|
|
|
|
infocus = 0;
|
|
|
|
|
plat_mouse_capture(0);
|
|
|
|
|
break;
|
|
|
|
|
|
2021-04-12 03:42:03 +02:00
|
|
|
case WM_LBUTTONDOWN:
|
|
|
|
|
button_down |= 1;
|
|
|
|
|
break;
|
|
|
|
|
|
2020-11-28 07:04:40 +01:00
|
|
|
case WM_LBUTTONUP:
|
2021-04-12 03:42:03 +02:00
|
|
|
if ((button_down & 1) && !video_fullscreen)
|
2020-11-28 07:04:40 +01:00
|
|
|
plat_mouse_capture(1);
|
2021-04-12 03:42:03 +02:00
|
|
|
button_down &= ~1;
|
2020-11-28 07:04:40 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_MBUTTONUP:
|
|
|
|
|
if (mouse_get_buttons() < 3)
|
|
|
|
|
plat_mouse_capture(0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return(1);
|
|
|
|
|
/* return(CallWindowProc((WNDPROC)input_orig_proc,
|
|
|
|
|
hwnd, message, wParam, lParam)); */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
static LRESULT CALLBACK
|
|
|
|
|
MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
HMENU hmenu;
|
2018-02-14 12:04:54 +01:00
|
|
|
|
2020-09-02 11:19:09 +08:00
|
|
|
int i;
|
|
|
|
|
RECT rect, *rect_p;
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2021-02-24 21:00:14 +01:00
|
|
|
WINDOWPOS *pos;
|
|
|
|
|
|
2018-02-14 15:23:02 +01:00
|
|
|
int temp_x, temp_y;
|
|
|
|
|
|
2020-11-28 07:04:40 +01:00
|
|
|
if (input_proc(hwnd, message, wParam, lParam) == 0)
|
|
|
|
|
return(0);
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
switch (message) {
|
|
|
|
|
case WM_CREATE:
|
|
|
|
|
SetTimer(hwnd, TIMER_1SEC, 1000, NULL);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
|
hmenu = GetMenu(hwnd);
|
|
|
|
|
switch (LOWORD(wParam)) {
|
|
|
|
|
case IDM_ACTION_SCREENSHOT:
|
|
|
|
|
take_screenshot();
|
|
|
|
|
break;
|
|
|
|
|
|
2021-02-10 20:22:51 +00:00
|
|
|
#ifdef MTR_ENABLED
|
2021-04-12 03:42:03 +02:00
|
|
|
case IDM_ACTION_BEGIN_TRACE:
|
|
|
|
|
case IDM_ACTION_END_TRACE:
|
|
|
|
|
case IDM_ACTION_TRACE:
|
|
|
|
|
tracing_on = !tracing_on;
|
|
|
|
|
handle_trace(hmenu, tracing_on);
|
|
|
|
|
break;
|
2021-02-10 20:22:51 +00:00
|
|
|
#endif
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case IDM_ACTION_HRESET:
|
2019-11-03 03:18:30 +01:00
|
|
|
win_notify_dlg_open();
|
2020-07-27 19:55:25 -03:00
|
|
|
if (confirm_reset)
|
|
|
|
|
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL);
|
|
|
|
|
else
|
|
|
|
|
i = 0;
|
|
|
|
|
if ((i % 10) == 0) {
|
2020-05-31 04:49:23 +02:00
|
|
|
pc_reset_hard();
|
2020-07-27 19:55:25 -03:00
|
|
|
if (i == 10) {
|
|
|
|
|
confirm_reset = 0;
|
2020-11-19 19:27:04 +01:00
|
|
|
nvr_save();
|
2020-07-27 19:55:25 -03:00
|
|
|
config_save();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-03 03:18:30 +01:00
|
|
|
win_notify_dlg_closed();
|
2017-11-19 03:15:29 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_ACTION_RESET_CAD:
|
2020-05-31 04:49:23 +02:00
|
|
|
pc_send_cad();
|
2017-11-19 03:15:29 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_ACTION_EXIT:
|
2019-11-03 03:18:30 +01:00
|
|
|
win_notify_dlg_open();
|
2020-07-27 19:55:25 -03:00
|
|
|
if (confirm_exit && confirm_exit_cmdl)
|
|
|
|
|
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
2020-01-19 06:19:07 +01:00
|
|
|
else
|
2020-07-27 19:55:25 -03:00
|
|
|
i = 0;
|
|
|
|
|
if ((i % 10) == 0) {
|
|
|
|
|
if (i == 10) {
|
|
|
|
|
confirm_exit = 0;
|
2020-11-19 19:27:04 +01:00
|
|
|
nvr_save();
|
2020-07-27 19:55:25 -03:00
|
|
|
config_save();
|
|
|
|
|
}
|
2019-09-22 21:10:47 +02:00
|
|
|
KillTimer(hwnd, TIMER_1SEC);
|
|
|
|
|
PostQuitMessage(0);
|
2019-11-03 03:18:30 +01:00
|
|
|
}
|
|
|
|
|
win_notify_dlg_closed();
|
2017-11-19 03:15:29 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_ACTION_CTRL_ALT_ESC:
|
|
|
|
|
pc_send_cae();
|
|
|
|
|
break;
|
|
|
|
|
|
2018-02-10 00:01:52 +01:00
|
|
|
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;
|
|
|
|
|
|
2021-07-19 02:27:22 +02:00
|
|
|
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;
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case IDM_ACTION_PAUSE:
|
|
|
|
|
plat_pause(dopause ^ 1);
|
2018-01-19 15:39:13 +01:00
|
|
|
CheckMenuItem(menuMain, IDM_ACTION_PAUSE, dopause ? MF_CHECKED : MF_UNCHECKED);
|
2017-11-19 03:15:29 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_CONFIG:
|
|
|
|
|
win_settings_open(hwnd);
|
|
|
|
|
break;
|
|
|
|
|
|
2021-08-05 03:50:43 +05:00
|
|
|
case IDM_SND_GAIN:
|
|
|
|
|
SoundGainDialogCreate(hwnd);
|
|
|
|
|
break;
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case IDM_ABOUT:
|
|
|
|
|
AboutDialogCreate(hwnd);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-07-19 19:21:03 -03:00
|
|
|
case IDM_DOCS:
|
|
|
|
|
ShellExecute(hwnd, L"open", EMU_DOCS_URL, NULL, NULL, SW_SHOW);
|
|
|
|
|
break;
|
|
|
|
|
|
2018-02-11 20:51:42 +01:00
|
|
|
case IDM_UPDATE_ICONS:
|
|
|
|
|
update_icons ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_UPDATE_ICONS, update_icons ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
2021-07-30 04:01:46 +02:00
|
|
|
case IDM_VID_HIDE_STATUS_BAR:
|
|
|
|
|
hide_status_bar ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_HIDE_STATUS_BAR, hide_status_bar ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
ShowWindow(hwndSBAR, hide_status_bar ? SW_HIDE : SW_SHOW);
|
|
|
|
|
GetWindowRect(hwnd, &rect);
|
|
|
|
|
if (hide_status_bar)
|
|
|
|
|
MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top - sbar_height, TRUE);
|
|
|
|
|
else
|
|
|
|
|
MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top + sbar_height, TRUE);
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case IDM_VID_RESIZE:
|
2021-04-12 05:58:59 +02:00
|
|
|
vid_resize ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_RESIZE, (vid_resize & 1) ? MF_CHECKED : MF_UNCHECKED);
|
2018-02-14 12:04:54 +01:00
|
|
|
|
2021-04-12 05:58:59 +02:00
|
|
|
if (vid_resize == 1)
|
2018-02-01 14:46:17 +01:00
|
|
|
SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW) | WS_VISIBLE);
|
2020-09-02 11:19:09 +08:00
|
|
|
else
|
|
|
|
|
SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_MAXIMIZEBOX) | WS_VISIBLE);
|
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
|
|
|
|
2020-09-02 11:26:26 +08:00
|
|
|
/* scale the screen base on DPI */
|
|
|
|
|
if (dpi_scale) {
|
|
|
|
|
temp_x = MulDiv(unscaled_size_x, dpi, 96);
|
|
|
|
|
temp_y = MulDiv(unscaled_size_y, dpi, 96);
|
|
|
|
|
} else {
|
|
|
|
|
temp_x = unscaled_size_x;
|
|
|
|
|
temp_y = unscaled_size_y;
|
|
|
|
|
}
|
2018-02-14 12:04:54 +01:00
|
|
|
|
2021-07-30 04:01:46 +02:00
|
|
|
if (hide_status_bar)
|
|
|
|
|
ResizeWindowByClientArea(hwnd, temp_x, temp_y);
|
|
|
|
|
else
|
|
|
|
|
ResizeWindowByClientArea(hwnd, temp_x, temp_y + sbar_height);
|
2018-02-14 12:04:54 +01:00
|
|
|
|
|
|
|
|
if (mouse_capture) {
|
|
|
|
|
ClipCursor(&rect);
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
if (vid_resize) {
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_SCALE_1X + scale, MF_UNCHECKED);
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_SCALE_2X, MF_CHECKED);
|
|
|
|
|
scale = 1;
|
|
|
|
|
}
|
|
|
|
|
EnableMenuItem(hmenu, IDM_VID_SCALE_1X, vid_resize ? MF_GRAYED : MF_ENABLED);
|
|
|
|
|
EnableMenuItem(hmenu, IDM_VID_SCALE_2X, vid_resize ? MF_GRAYED : MF_ENABLED);
|
|
|
|
|
EnableMenuItem(hmenu, IDM_VID_SCALE_3X, vid_resize ? MF_GRAYED : MF_ENABLED);
|
|
|
|
|
EnableMenuItem(hmenu, IDM_VID_SCALE_4X, vid_resize ? MF_GRAYED : MF_ENABLED);
|
2020-09-02 11:19:09 +08:00
|
|
|
|
|
|
|
|
scrnsz_x = unscaled_size_x;
|
|
|
|
|
scrnsz_y = unscaled_size_y;
|
2017-11-19 03:15:29 -05:00
|
|
|
doresize = 1;
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_VID_REMEMBER:
|
|
|
|
|
window_remember = !window_remember;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_REMEMBER, window_remember ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
GetWindowRect(hwnd, &rect);
|
2021-09-14 22:20:20 +02:00
|
|
|
if (window_remember || (vid_resize & 2)) {
|
2017-11-19 03:15:29 -05:00
|
|
|
window_x = rect.left;
|
|
|
|
|
window_y = rect.top;
|
2021-09-14 22:17:47 +02:00
|
|
|
if (!(vid_resize & 2)) {
|
|
|
|
|
window_w = rect.right - rect.left;
|
|
|
|
|
window_h = rect.bottom - rect.top;
|
|
|
|
|
}
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
2019-12-05 00:51:07 +01:00
|
|
|
case IDM_VID_SDL_SW:
|
|
|
|
|
case IDM_VID_SDL_HW:
|
2020-11-26 18:20:24 +01:00
|
|
|
case IDM_VID_SDL_OPENGL:
|
2021-04-26 02:45:20 +05:00
|
|
|
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
|
2021-04-17 13:45:11 +03:00
|
|
|
case IDM_VID_OPENGL_CORE:
|
|
|
|
|
#endif
|
2020-04-18 11:51:54 +02:00
|
|
|
#ifdef USE_VNC
|
2017-11-19 03:15:29 -05:00
|
|
|
case IDM_VID_VNC:
|
2020-04-18 11:51:54 +02:00
|
|
|
#endif
|
2019-12-05 00:51:07 +01:00
|
|
|
CheckMenuItem(hmenu, IDM_VID_SDL_SW + vid_api, MF_UNCHECKED);
|
|
|
|
|
plat_setvid(LOWORD(wParam) - IDM_VID_SDL_SW);
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_SDL_SW + vid_api, MF_CHECKED);
|
2021-05-01 20:49:23 +03:00
|
|
|
video_set_filter_menu(hmenu);
|
2017-11-19 03:15:29 -05:00
|
|
|
config_save();
|
2021-04-23 16:09:45 +03:00
|
|
|
show_render_options_menu();
|
2017-11-19 03:15:29 -05:00
|
|
|
break;
|
|
|
|
|
|
2021-04-26 02:45:20 +05:00
|
|
|
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
|
2021-04-23 16:09:45 +03:00
|
|
|
case IDM_VID_GL_FPS_BLITTER:
|
|
|
|
|
case IDM_VID_GL_FPS_25:
|
|
|
|
|
case IDM_VID_GL_FPS_30:
|
|
|
|
|
case IDM_VID_GL_FPS_50:
|
|
|
|
|
case IDM_VID_GL_FPS_60:
|
|
|
|
|
case IDM_VID_GL_FPS_75:
|
|
|
|
|
{
|
|
|
|
|
static const int fps[] = { -1, 25, 30, 50, 60, 75 };
|
|
|
|
|
int idx = 0;
|
|
|
|
|
for (; fps[idx] != video_framerate; idx++);
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_GL_FPS_BLITTER + idx, MF_UNCHECKED);
|
|
|
|
|
video_framerate = fps[LOWORD(wParam) - IDM_VID_GL_FPS_BLITTER];
|
|
|
|
|
CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED);
|
|
|
|
|
plat_vid_reload_options();
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2021-04-21 01:33:01 +03:00
|
|
|
case IDM_VID_GL_VSYNC:
|
|
|
|
|
video_vsync = !video_vsync;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_GL_VSYNC, video_vsync ? MF_CHECKED : MF_UNCHECKED);
|
2021-04-23 16:09:45 +03:00
|
|
|
plat_vid_reload_options();
|
2021-04-21 01:33:01 +03:00
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
case IDM_VID_GL_SHADER:
|
|
|
|
|
win_notify_dlg_open();
|
|
|
|
|
if (file_dlg_st(hwnd, IDS_2143, video_shader, NULL, 0) == 0)
|
2021-04-26 09:51:23 +03:00
|
|
|
{
|
2021-04-21 01:33:01 +03:00
|
|
|
strcpy_s(video_shader, sizeof(video_shader), openfilestring);
|
2021-04-26 09:51:23 +03:00
|
|
|
EnableMenuItem(menuMain, IDM_VID_GL_NOSHADER, strlen(video_shader) > 0 ? MF_ENABLED : MF_DISABLED);
|
|
|
|
|
}
|
2021-04-21 01:33:01 +03:00
|
|
|
win_notify_dlg_closed();
|
2021-04-23 16:09:45 +03:00
|
|
|
plat_vid_reload_options();
|
2021-04-21 01:33:01 +03:00
|
|
|
break;
|
2021-04-26 09:51:23 +03:00
|
|
|
case IDM_VID_GL_NOSHADER:
|
|
|
|
|
video_shader[0] = '\0';
|
|
|
|
|
EnableMenuItem(menuMain, IDM_VID_GL_NOSHADER, MF_DISABLED);
|
|
|
|
|
plat_vid_reload_options();
|
|
|
|
|
break;
|
2021-04-21 01:33:01 +03:00
|
|
|
#endif
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case IDM_VID_FULLSCREEN:
|
|
|
|
|
plat_setfullscreen(1);
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_VID_FS_FULL:
|
|
|
|
|
case IDM_VID_FS_43:
|
2021-03-25 03:20:25 -05:00
|
|
|
case IDM_VID_FS_KEEPRATIO:
|
2017-11-19 03:15:29 -05:00
|
|
|
case IDM_VID_FS_INT:
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_FS_FULL+video_fullscreen_scale, MF_UNCHECKED);
|
|
|
|
|
video_fullscreen_scale = LOWORD(wParam) - IDM_VID_FS_FULL;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_FS_FULL+video_fullscreen_scale, MF_CHECKED);
|
|
|
|
|
device_force_redraw();
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_VID_SCALE_1X:
|
|
|
|
|
case IDM_VID_SCALE_2X:
|
|
|
|
|
case IDM_VID_SCALE_3X:
|
|
|
|
|
case IDM_VID_SCALE_4X:
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_SCALE_1X+scale, MF_UNCHECKED);
|
|
|
|
|
scale = LOWORD(wParam) - IDM_VID_SCALE_1X;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_SCALE_1X+scale, MF_CHECKED);
|
2020-11-28 07:04:40 +01:00
|
|
|
reset_screen_size();
|
2017-11-19 03:15:29 -05:00
|
|
|
device_force_redraw();
|
|
|
|
|
video_force_resize_set(1);
|
2020-12-26 17:02:48 +01:00
|
|
|
doresize = 1;
|
2017-11-19 03:15:29 -05:00
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
2021-05-01 20:49:23 +03:00
|
|
|
case IDM_VID_FILTER_NEAREST:
|
|
|
|
|
case IDM_VID_FILTER_LINEAR:
|
|
|
|
|
video_filter_method = LOWORD(wParam) - IDM_VID_FILTER_NEAREST;
|
|
|
|
|
video_set_filter_menu(hmenu);
|
|
|
|
|
plat_vid_reload_options();
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
2020-09-02 11:26:26 +08:00
|
|
|
case IDM_VID_HIDPI:
|
|
|
|
|
dpi_scale = !dpi_scale;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_HIDPI, dpi_scale ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
doresize = 1;
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
2021-04-12 03:42:03 +02:00
|
|
|
case IDM_VID_SPECIFY_DIM:
|
|
|
|
|
SpecifyDimensionsDialogCreate(hwnd);
|
|
|
|
|
break;
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case IDM_VID_FORCE43:
|
|
|
|
|
video_toggle_option(hmenu, &force_43, IDM_VID_FORCE43);
|
|
|
|
|
video_force_resize_set(1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_VID_INVERT:
|
|
|
|
|
video_toggle_option(hmenu, &invert_display, IDM_VID_INVERT);
|
2021-10-06 02:26:30 +02:00
|
|
|
video_copy = (video_grayscale || invert_display) ? video_transform_copy : memcpy;
|
2017-11-19 03:15:29 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_VID_OVERSCAN:
|
|
|
|
|
update_overscan = 1;
|
|
|
|
|
video_toggle_option(hmenu, &enable_overscan, IDM_VID_OVERSCAN);
|
|
|
|
|
video_force_resize_set(1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_VID_CGACON:
|
|
|
|
|
vid_cga_contrast ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_CGACON, vid_cga_contrast ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
cgapal_rebuild();
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_VID_GRAYCT_601:
|
|
|
|
|
case IDM_VID_GRAYCT_709:
|
|
|
|
|
case IDM_VID_GRAYCT_AVE:
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_GRAYCT_601+video_graytype, MF_UNCHECKED);
|
|
|
|
|
video_graytype = LOWORD(wParam) - IDM_VID_GRAYCT_601;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_GRAYCT_601+video_graytype, MF_CHECKED);
|
|
|
|
|
device_force_redraw();
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_VID_GRAY_RGB:
|
|
|
|
|
case IDM_VID_GRAY_MONO:
|
|
|
|
|
case IDM_VID_GRAY_AMBER:
|
|
|
|
|
case IDM_VID_GRAY_GREEN:
|
|
|
|
|
case IDM_VID_GRAY_WHITE:
|
|
|
|
|
CheckMenuItem(hmenu, IDM_VID_GRAY_RGB+video_grayscale, MF_UNCHECKED);
|
|
|
|
|
video_grayscale = LOWORD(wParam) - IDM_VID_GRAY_RGB;
|
2021-10-06 02:26:30 +02:00
|
|
|
video_copy = (video_grayscale || invert_display) ? video_transform_copy : memcpy;
|
2017-11-19 03:15:29 -05:00
|
|
|
CheckMenuItem(hmenu, IDM_VID_GRAY_RGB+video_grayscale, MF_CHECKED);
|
|
|
|
|
device_force_redraw();
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
2019-12-04 21:55:35 +01:00
|
|
|
#ifdef USE_DISCORD
|
|
|
|
|
case IDM_DISCORD:
|
|
|
|
|
if (! discord_loaded) break;
|
|
|
|
|
enable_discord ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_DISCORD, enable_discord ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
if(enable_discord) {
|
|
|
|
|
discord_init();
|
|
|
|
|
discord_update_activity(dopause);
|
|
|
|
|
} else
|
|
|
|
|
discord_close();
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
#ifdef ENABLE_LOG_TOGGLES
|
|
|
|
|
# ifdef ENABLE_BUSLOGIC_LOG
|
|
|
|
|
case IDM_LOG_BUSLOGIC:
|
|
|
|
|
buslogic_do_log ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_LOG_BUSLOGIC, buslogic_do_log ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
break;
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
# ifdef ENABLE_CDROM_LOG
|
|
|
|
|
case IDM_LOG_CDROM:
|
|
|
|
|
cdrom_do_log ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_LOG_CDROM, cdrom_do_log ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
break;
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
# ifdef ENABLE_D86F_LOG
|
|
|
|
|
case IDM_LOG_D86F:
|
|
|
|
|
d86f_do_log ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_LOG_D86F, d86f_do_log ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
break;
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
# ifdef ENABLE_FDC_LOG
|
|
|
|
|
case IDM_LOG_FDC:
|
|
|
|
|
fdc_do_log ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_LOG_FDC, fdc_do_log ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
break;
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
# ifdef ENABLE_IDE_LOG
|
|
|
|
|
case IDM_LOG_IDE:
|
|
|
|
|
ide_do_log ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_LOG_IDE, ide_do_log ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
break;
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
# ifdef ENABLE_SERIAL_LOG
|
|
|
|
|
case IDM_LOG_SERIAL:
|
|
|
|
|
serial_do_log ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_LOG_SERIAL, serial_do_log ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
break;
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
# ifdef ENABLE_NIC_LOG
|
|
|
|
|
case IDM_LOG_NIC:
|
|
|
|
|
nic_do_log ^= 1;
|
|
|
|
|
CheckMenuItem(hmenu, IDM_LOG_NIC, nic_do_log ? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
break;
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_LOG_BREAKPOINT
|
|
|
|
|
case IDM_LOG_BREAKPOINT:
|
|
|
|
|
pclog("---- LOG BREAKPOINT ----\n");
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_VRAM_DUMP
|
|
|
|
|
case IDM_DUMP_VRAM:
|
|
|
|
|
svga_dump_vram();
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
2020-04-23 01:24:01 +02:00
|
|
|
default:
|
2020-04-26 17:00:45 +02:00
|
|
|
media_menu_proc(hwnd, message, wParam, lParam);
|
2020-04-23 01:24:01 +02:00
|
|
|
break;
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
|
|
|
|
return(0);
|
|
|
|
|
|
|
|
|
|
case WM_ENTERMENULOOP:
|
|
|
|
|
break;
|
|
|
|
|
|
2020-09-02 11:19:09 +08:00
|
|
|
case WM_DPICHANGED:
|
|
|
|
|
dpi = HIWORD(wParam);
|
|
|
|
|
GetWindowRect(hwndSBAR, &rect);
|
|
|
|
|
sbar_height = rect.bottom - rect.top;
|
|
|
|
|
rect_p = (RECT*)lParam;
|
2021-04-12 05:58:59 +02:00
|
|
|
if (vid_resize == 1)
|
2020-09-02 11:19:09 +08:00
|
|
|
MoveWindow(hwnd, rect_p->left, rect_p->top, rect_p->right - rect_p->left, rect_p->bottom - rect_p->top, TRUE);
|
2021-04-12 05:58:59 +02:00
|
|
|
else if (vid_resize >= 2) {
|
|
|
|
|
temp_x = fixed_size_x;
|
|
|
|
|
temp_y = fixed_size_y;
|
|
|
|
|
if (dpi_scale) {
|
|
|
|
|
temp_x = MulDiv(temp_x, dpi, 96);
|
|
|
|
|
temp_y = MulDiv(temp_y, dpi, 96);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Main Window. */
|
2021-07-30 04:01:46 +02:00
|
|
|
if (hide_status_bar)
|
|
|
|
|
ResizeWindowByClientArea(hwndMain, temp_x, temp_y);
|
|
|
|
|
else
|
|
|
|
|
ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height);
|
2021-04-12 05:58:59 +02:00
|
|
|
} else if (!user_resize)
|
2020-09-02 11:19:09 +08:00
|
|
|
doresize = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
2021-02-24 21:00:14 +01:00
|
|
|
case WM_WINDOWPOSCHANGED:
|
|
|
|
|
pos = (WINDOWPOS*)lParam;
|
|
|
|
|
GetClientRect(hwndMain, &rect);
|
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
|
|
|
|
2021-02-24 21:00:14 +01:00
|
|
|
if (IsIconic(hwndMain)) {
|
2020-11-26 18:20:24 +01:00
|
|
|
plat_vidapi_enable(0);
|
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
|
|
|
minimized = 1;
|
2021-02-24 21:00:14 +01:00
|
|
|
return(0);
|
|
|
|
|
} else if (minimized) {
|
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
|
|
|
minimized = 0;
|
|
|
|
|
video_force_resize_set(1);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-18 00:01:39 +02:00
|
|
|
if (!(pos->flags & SWP_NOSIZE) && (window_remember || (vid_resize & 2))) {
|
2021-02-24 21:00:14 +01:00
|
|
|
window_x = pos->x;
|
|
|
|
|
window_y = pos->y;
|
2021-09-14 22:20:20 +02:00
|
|
|
if (!(vid_resize & 2)) {
|
|
|
|
|
window_w = pos->cx;
|
|
|
|
|
window_h = pos->cy;
|
|
|
|
|
}
|
2021-02-24 21:00:14 +01:00
|
|
|
save_window_pos = 1;
|
|
|
|
|
config_save();
|
2020-09-02 11:19:09 +08:00
|
|
|
}
|
2018-02-14 15:23:02 +01:00
|
|
|
|
2021-04-06 21:38:34 +03:00
|
|
|
if (!(pos->flags & SWP_NOSIZE) || !user_resize) {
|
2021-02-24 21:00:14 +01:00
|
|
|
plat_vidapi_enable(0);
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2021-07-30 04:01:46 +02:00
|
|
|
if (hide_status_bar)
|
|
|
|
|
MoveWindow(hwndRender, 0, 0, rect.right, rect.bottom, TRUE);
|
|
|
|
|
else {
|
|
|
|
|
MoveWindow(hwndSBAR, 0, rect.bottom - sbar_height, sbar_height, rect.right, TRUE);
|
|
|
|
|
MoveWindow(hwndRender, 0, 0, rect.right, rect.bottom - sbar_height, TRUE);
|
|
|
|
|
}
|
2018-02-14 15:23:02 +01:00
|
|
|
|
2021-02-24 21:00:14 +01:00
|
|
|
GetClientRect(hwndRender, &rect);
|
2021-07-18 17:52:22 +02:00
|
|
|
if (dpi_scale) {
|
|
|
|
|
temp_x = MulDiv(rect.right, 96, dpi);
|
|
|
|
|
temp_y = MulDiv(rect.bottom, 96, dpi);
|
|
|
|
|
|
|
|
|
|
if (temp_x != scrnsz_x || temp_y != scrnsz_y) {
|
|
|
|
|
scrnsz_x = temp_x;
|
|
|
|
|
scrnsz_y = temp_y;
|
|
|
|
|
doresize = 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (rect.right != scrnsz_x || rect.bottom != scrnsz_y) {
|
|
|
|
|
scrnsz_x = rect.right;
|
|
|
|
|
scrnsz_y = rect.bottom;
|
|
|
|
|
doresize = 1;
|
|
|
|
|
}
|
2021-02-24 21:00:14 +01:00
|
|
|
}
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2021-02-24 21:00:14 +01:00
|
|
|
plat_vidsize(rect.right, rect.bottom);
|
2018-02-15 12:48:31 +01:00
|
|
|
|
2021-02-24 21:00:14 +01:00
|
|
|
if (mouse_capture) {
|
|
|
|
|
GetWindowRect(hwndRender, &rect);
|
|
|
|
|
ClipCursor(&rect);
|
|
|
|
|
}
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2021-02-24 21:00:14 +01:00
|
|
|
plat_vidapi_enable(2);
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
2020-11-28 07:04:40 +01:00
|
|
|
|
2021-02-24 21:00:14 +01:00
|
|
|
return(0);
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
case WM_TIMER:
|
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 (wParam == TIMER_1SEC)
|
2017-11-19 03:15:29 -05:00
|
|
|
pc_onesec();
|
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 ((wParam >= 0x8000) && (wParam <= 0x80ff))
|
|
|
|
|
ui_sb_timer_callback(wParam & 0xff);
|
2017-11-19 03:15:29 -05:00
|
|
|
break;
|
2021-03-25 03:20:25 -05:00
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case WM_LEAVEFULLSCREEN:
|
|
|
|
|
plat_setfullscreen(0);
|
|
|
|
|
config_save();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_KEYDOWN:
|
|
|
|
|
case WM_KEYUP:
|
|
|
|
|
case WM_SYSKEYDOWN:
|
|
|
|
|
case WM_SYSKEYUP:
|
|
|
|
|
return(0);
|
|
|
|
|
|
2019-09-22 21:10:47 +02:00
|
|
|
case WM_CLOSE:
|
2019-11-03 03:18:30 +01:00
|
|
|
win_notify_dlg_open();
|
2020-07-27 19:55:25 -03:00
|
|
|
if (confirm_exit && confirm_exit_cmdl)
|
|
|
|
|
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
2020-01-19 06:19:07 +01:00
|
|
|
else
|
2020-07-27 19:55:25 -03:00
|
|
|
i = 0;
|
|
|
|
|
if ((i % 10) == 0) {
|
|
|
|
|
if (i == 10) {
|
|
|
|
|
confirm_exit = 0;
|
2020-11-19 19:27:04 +01:00
|
|
|
nvr_save();
|
2020-07-27 19:55:25 -03:00
|
|
|
config_save();
|
|
|
|
|
}
|
2019-09-22 21:10:47 +02:00
|
|
|
KillTimer(hwnd, TIMER_1SEC);
|
|
|
|
|
PostQuitMessage(0);
|
2019-11-03 03:18:30 +01:00
|
|
|
}
|
|
|
|
|
win_notify_dlg_closed();
|
2019-09-22 21:10:47 +02:00
|
|
|
break;
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case WM_DESTROY:
|
|
|
|
|
KillTimer(hwnd, TIMER_1SEC);
|
|
|
|
|
PostQuitMessage(0);
|
|
|
|
|
break;
|
|
|
|
|
|
2018-01-19 15:39:13 +01:00
|
|
|
case WM_SHOWSETTINGS:
|
2019-11-02 16:18:18 +01:00
|
|
|
if (manager_wm)
|
|
|
|
|
break;
|
|
|
|
|
manager_wm = 1;
|
2018-01-19 15:39:13 +01:00
|
|
|
win_settings_open(hwnd);
|
2019-11-02 16:18:18 +01:00
|
|
|
manager_wm = 0;
|
2018-01-19 15:39:13 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_PAUSE:
|
2019-11-02 16:18:18 +01:00
|
|
|
if (manager_wm)
|
|
|
|
|
break;
|
|
|
|
|
manager_wm = 1;
|
2018-01-19 15:39:13 +01:00
|
|
|
plat_pause(dopause ^ 1);
|
|
|
|
|
CheckMenuItem(menuMain, IDM_ACTION_PAUSE, dopause ? MF_CHECKED : MF_UNCHECKED);
|
2019-11-02 16:18:18 +01:00
|
|
|
manager_wm = 0;
|
2018-01-19 15:39:13 +01:00
|
|
|
break;
|
|
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
case WM_HARDRESET:
|
2019-11-02 16:18:18 +01:00
|
|
|
if (manager_wm)
|
|
|
|
|
break;
|
2019-11-03 03:18:30 +01:00
|
|
|
win_notify_dlg_open();
|
2020-07-27 19:55:25 -03:00
|
|
|
if (confirm_reset)
|
|
|
|
|
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL);
|
|
|
|
|
else
|
|
|
|
|
i = 0;
|
|
|
|
|
if ((i % 10) == 0) {
|
2020-05-31 04:49:23 +02:00
|
|
|
pc_reset_hard();
|
2020-07-27 19:55:25 -03:00
|
|
|
if (i == 10) {
|
|
|
|
|
confirm_reset = 0;
|
2020-11-19 19:27:04 +01:00
|
|
|
nvr_save();
|
2020-07-27 19:55:25 -03:00
|
|
|
config_save();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-03 03:18:30 +01:00
|
|
|
win_notify_dlg_closed();
|
2018-10-10 22:33:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_SHUTDOWN:
|
2019-11-02 16:18:18 +01:00
|
|
|
if (manager_wm)
|
|
|
|
|
break;
|
2019-11-03 03:18:30 +01:00
|
|
|
win_notify_dlg_open();
|
2020-07-27 19:55:25 -03:00
|
|
|
if (confirm_exit && confirm_exit_cmdl)
|
|
|
|
|
i = ui_msgbox_ex(MBX_QUESTION_YN | MBX_DONTASK, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
|
2020-01-19 06:19:07 +01:00
|
|
|
else
|
2020-07-27 19:55:25 -03:00
|
|
|
i = 0;
|
|
|
|
|
if ((i % 10) == 0) {
|
|
|
|
|
if (i == 10) {
|
|
|
|
|
confirm_exit = 0;
|
2020-11-19 19:27:04 +01:00
|
|
|
nvr_save();
|
2020-07-27 19:55:25 -03:00
|
|
|
config_save();
|
|
|
|
|
}
|
2019-10-31 18:15:44 +01:00
|
|
|
KillTimer(hwnd, TIMER_1SEC);
|
|
|
|
|
PostQuitMessage(0);
|
|
|
|
|
}
|
2019-11-03 03:18:30 +01:00
|
|
|
win_notify_dlg_closed();
|
2018-10-10 22:33:24 +02:00
|
|
|
break;
|
|
|
|
|
|
2018-10-12 16:27:47 +02:00
|
|
|
case WM_CTRLALTDEL:
|
2019-11-02 16:18:18 +01:00
|
|
|
if (manager_wm)
|
|
|
|
|
break;
|
|
|
|
|
manager_wm = 1;
|
2020-05-31 04:49:23 +02:00
|
|
|
pc_send_cad();
|
2019-11-02 16:18:18 +01:00
|
|
|
manager_wm = 0;
|
2018-10-12 16:27:47 +02:00
|
|
|
break;
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
case WM_SYSCOMMAND:
|
|
|
|
|
/*
|
|
|
|
|
* Disable ALT key *ALWAYS*,
|
|
|
|
|
* I don't think there's any use for
|
|
|
|
|
* reaching the menu that way.
|
|
|
|
|
*/
|
|
|
|
|
if (wParam == SC_KEYMENU && HIWORD(lParam) <= 0) {
|
|
|
|
|
return 0; /*disable ALT key for menu*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return(DefWindowProc(hwnd, message, wParam, lParam));
|
2018-07-15 01:41:53 +02:00
|
|
|
|
|
|
|
|
case WM_SETFOCUS:
|
|
|
|
|
infocus = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_KILLFOCUS:
|
|
|
|
|
infocus = 0;
|
|
|
|
|
plat_mouse_capture(0);
|
|
|
|
|
break;
|
2018-10-28 18:26:51 +01:00
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
case WM_ACTIVATE:
|
2020-11-28 07:04:40 +01:00
|
|
|
if ((wParam != WA_INACTIVE) && !(video_fullscreen & 2)) {
|
2020-11-26 18:20:24 +01:00
|
|
|
video_force_resize_set(1);
|
|
|
|
|
plat_vidapi_enable(0);
|
|
|
|
|
plat_vidapi_enable(1);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2018-10-28 18:26:51 +01:00
|
|
|
case WM_ENTERSIZEMOVE:
|
|
|
|
|
user_resize = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_EXITSIZEMOVE:
|
|
|
|
|
user_resize = 0;
|
|
|
|
|
|
|
|
|
|
/* If window is not resizable, then tell the main thread to
|
|
|
|
|
resize it, as sometimes, moves can mess up the window size. */
|
|
|
|
|
if (!vid_resize)
|
|
|
|
|
doresize = 1;
|
|
|
|
|
break;
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT CALLBACK
|
|
|
|
|
SubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
2020-11-28 07:04:40 +01:00
|
|
|
{
|
|
|
|
|
switch (message) {
|
2021-04-12 03:42:03 +02:00
|
|
|
case WM_LBUTTONDOWN:
|
|
|
|
|
button_down |= 2;
|
|
|
|
|
break;
|
|
|
|
|
|
2020-11-28 07:04:40 +01:00
|
|
|
case WM_LBUTTONUP:
|
2021-04-12 03:42:03 +02:00
|
|
|
if ((button_down & 2) && !video_fullscreen)
|
2020-11-28 07:04:40 +01:00
|
|
|
plat_mouse_capture(1);
|
2021-04-12 03:42:03 +02:00
|
|
|
button_down &= ~2;
|
2020-11-28 07:04:40 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_MBUTTONUP:
|
|
|
|
|
if (mouse_get_buttons() < 3)
|
|
|
|
|
plat_mouse_capture(0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return(DefWindowProc(hwnd, message, wParam, lParam));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT CALLBACK
|
|
|
|
|
SDLMainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
if (input_proc(hwnd, message, wParam, lParam) == 0)
|
|
|
|
|
return(0);
|
|
|
|
|
|
|
|
|
|
return(DefWindowProc(hwnd, message, wParam, lParam));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT CALLBACK
|
|
|
|
|
SDLSubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
2017-11-19 03:15:29 -05:00
|
|
|
{
|
|
|
|
|
return(DefWindowProc(hwnd, message, wParam, lParam));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-06-17 22:56:18 -03:00
|
|
|
static HRESULT CALLBACK
|
|
|
|
|
TaskDialogProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData)
|
|
|
|
|
{
|
|
|
|
|
switch (message) {
|
|
|
|
|
case TDN_HYPERLINK_CLICKED:
|
|
|
|
|
/* open linked URL */
|
|
|
|
|
ShellExecute(hwnd, L"open", (LPCWSTR) lParam, NULL, NULL, SW_SHOW);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
int
|
2017-11-23 17:42:00 -05:00
|
|
|
ui_init(int nCmdShow)
|
2017-11-19 03:15:29 -05:00
|
|
|
{
|
|
|
|
|
WCHAR title[200];
|
|
|
|
|
WNDCLASSEX wincl; /* buffer for main window's class */
|
2018-07-15 01:41:53 +02:00
|
|
|
RAWINPUTDEVICE ridev; /* RawInput device */
|
2021-04-29 19:33:36 +02:00
|
|
|
MSG messages = {0}; /* received-messages buffer */
|
2020-06-17 22:56:18 -03:00
|
|
|
HWND hwnd = NULL; /* handle for our window */
|
2017-11-19 03:15:29 -05:00
|
|
|
HACCEL haccel; /* handle to accelerator table */
|
2020-06-17 22:56:18 -03:00
|
|
|
RECT sbar_rect; /* RECT of the status bar */
|
2017-11-19 03:15:29 -05:00
|
|
|
int bRet;
|
2020-06-17 22:56:18 -03:00
|
|
|
TASKDIALOGCONFIG tdconfig = {0};
|
2020-06-17 23:24:56 -03:00
|
|
|
TASKDIALOG_BUTTON tdbuttons[] = {{IDCANCEL, MAKEINTRESOURCE(IDS_2119)}};
|
2020-06-17 22:56:18 -03:00
|
|
|
|
2020-09-02 11:03:14 +08:00
|
|
|
/* Load DPI related Windows 10 APIs */
|
|
|
|
|
user32_handle = dynld_module("user32.dll", user32_imports);
|
|
|
|
|
|
2020-06-17 22:56:18 -03:00
|
|
|
/* Set up TaskDialog configuration. */
|
|
|
|
|
tdconfig.cbSize = sizeof(tdconfig);
|
|
|
|
|
tdconfig.dwFlags = TDF_ENABLE_HYPERLINKS;
|
|
|
|
|
tdconfig.dwCommonButtons = 0;
|
|
|
|
|
tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_STRINGS);
|
|
|
|
|
tdconfig.pszMainIcon = TD_ERROR_ICON;
|
|
|
|
|
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2050);
|
|
|
|
|
tdconfig.cButtons = ARRAYSIZE(tdbuttons);
|
|
|
|
|
tdconfig.pButtons = tdbuttons;
|
|
|
|
|
tdconfig.pfCallback = TaskDialogProcedure;
|
|
|
|
|
|
|
|
|
|
/* Start settings-only mode if requested. */
|
2018-01-19 15:39:13 +01:00
|
|
|
if (settings_only) {
|
|
|
|
|
if (! pc_init_modules()) {
|
|
|
|
|
/* Dang, no ROMs found at all! */
|
2020-06-17 22:56:18 -03:00
|
|
|
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2120);
|
|
|
|
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056);
|
|
|
|
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
2018-01-19 15:39:13 +01:00
|
|
|
return(6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
win_settings_open(NULL);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-04 21:55:35 +01:00
|
|
|
#ifdef USE_DISCORD
|
|
|
|
|
if(! discord_load()) {
|
|
|
|
|
enable_discord = 0;
|
|
|
|
|
} else if (enable_discord) {
|
|
|
|
|
/* Initialize the Discord API */
|
|
|
|
|
discord_init();
|
|
|
|
|
|
|
|
|
|
/* Update Discord status */
|
|
|
|
|
discord_update_activity(dopause);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
/* Create our main window's class and register it. */
|
|
|
|
|
wincl.hInstance = hinstance;
|
|
|
|
|
wincl.lpszClassName = CLASS_NAME;
|
|
|
|
|
wincl.lpfnWndProc = MainWindowProcedure;
|
|
|
|
|
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
|
|
|
|
|
wincl.cbSize = sizeof(WNDCLASSEX);
|
2021-10-16 18:18:34 +02:00
|
|
|
wincl.hIcon = NULL;
|
|
|
|
|
wincl.hIconSm = NULL;
|
2017-11-19 03:15:29 -05:00
|
|
|
wincl.hCursor = NULL;
|
|
|
|
|
wincl.lpszMenuName = NULL;
|
|
|
|
|
wincl.cbClsExtra = 0;
|
|
|
|
|
wincl.cbWndExtra = 0;
|
|
|
|
|
wincl.hbrBackground = CreateSolidBrush(RGB(0,0,0));
|
2021-10-16 18:18:34 +02:00
|
|
|
|
|
|
|
|
/* Load proper icons */
|
|
|
|
|
wchar_t path[MAX_PATH + 1] = {0};
|
|
|
|
|
GetModuleFileNameW(hinstance, path, MAX_PATH);
|
|
|
|
|
ExtractIconExW(path, 0, &wincl.hIcon, &wincl.hIconSm, 1);
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
if (! RegisterClassEx(&wincl))
|
|
|
|
|
return(2);
|
|
|
|
|
wincl.lpszClassName = SUB_CLASS_NAME;
|
|
|
|
|
wincl.lpfnWndProc = SubWindowProcedure;
|
2020-11-28 07:04:40 +01:00
|
|
|
if (! RegisterClassEx(&wincl))
|
|
|
|
|
return(2);
|
|
|
|
|
wincl.lpszClassName = SDL_CLASS_NAME;
|
|
|
|
|
wincl.lpfnWndProc = SDLMainWindowProcedure;
|
|
|
|
|
if (! RegisterClassEx(&wincl))
|
|
|
|
|
return(2);
|
|
|
|
|
wincl.lpszClassName = SDL_SUB_CLASS_NAME;
|
|
|
|
|
wincl.lpfnWndProc = SDLSubWindowProcedure;
|
2017-11-19 03:15:29 -05:00
|
|
|
if (! RegisterClassEx(&wincl))
|
|
|
|
|
return(2);
|
|
|
|
|
|
|
|
|
|
/* Load the Window Menu(s) from the resources. */
|
|
|
|
|
menuMain = LoadMenu(hinstance, MENU_NAME);
|
|
|
|
|
|
|
|
|
|
/* Now create our main window. */
|
|
|
|
|
mbstowcs(title, emu_version, sizeof_w(title));
|
|
|
|
|
hwnd = CreateWindowEx (
|
|
|
|
|
0, /* no extended possibilites */
|
|
|
|
|
CLASS_NAME, /* class name */
|
|
|
|
|
title, /* Title Text */
|
|
|
|
|
(WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX) | DS_3DLOOK,
|
|
|
|
|
CW_USEDEFAULT, /* Windows decides the position */
|
|
|
|
|
CW_USEDEFAULT, /* where window ends up on the screen */
|
|
|
|
|
scrnsz_x+(GetSystemMetrics(SM_CXFIXEDFRAME)*2), /* width */
|
|
|
|
|
scrnsz_y+(GetSystemMetrics(SM_CYFIXEDFRAME)*2)+GetSystemMetrics(SM_CYMENUSIZE)+GetSystemMetrics(SM_CYCAPTION)+1, /* and height in pixels */
|
|
|
|
|
HWND_DESKTOP, /* window is a child to desktop */
|
|
|
|
|
menuMain, /* menu */
|
|
|
|
|
hinstance, /* Program Instance handler */
|
|
|
|
|
NULL); /* no Window Creation data */
|
2020-06-17 22:56:18 -03:00
|
|
|
hwndMain = tdconfig.hwndParent = hwnd;
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
ui_window_title(title);
|
|
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
/* Get the current DPI */
|
|
|
|
|
dpi = win_get_dpi(hwndMain);
|
2020-09-02 11:19:09 +08:00
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
/* Check if we have a padded window frame */
|
|
|
|
|
padded_frame = (GetSystemMetrics(SM_CXPADDEDBORDER) != 0);
|
2020-09-02 11:19:09 +08:00
|
|
|
|
|
|
|
|
/* Create the status bar window. */
|
|
|
|
|
StatusBarCreate(hwndMain, IDC_STATUS, hinstance);
|
|
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
/* Get the actual height of the status bar */
|
|
|
|
|
GetWindowRect(hwndSBAR, &sbar_rect);
|
|
|
|
|
sbar_height = sbar_rect.bottom - sbar_rect.top;
|
2021-07-30 04:01:46 +02:00
|
|
|
if (hide_status_bar)
|
|
|
|
|
ShowWindow(hwndSBAR, SW_HIDE);
|
2020-09-02 11:19:09 +08:00
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
/* Set up main window for resizing if configured. */
|
2021-04-12 05:58:59 +02:00
|
|
|
if (vid_resize == 1)
|
2017-11-19 03:15:29 -05:00
|
|
|
SetWindowLongPtr(hwnd, GWL_STYLE,
|
|
|
|
|
(WS_OVERLAPPEDWINDOW));
|
2021-04-12 05:58:59 +02:00
|
|
|
else
|
2017-11-19 03:15:29 -05:00
|
|
|
SetWindowLongPtr(hwnd, GWL_STYLE,
|
|
|
|
|
(WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX));
|
|
|
|
|
|
2021-02-24 21:01:31 +01:00
|
|
|
/* Create the Machine Rendering window. */
|
|
|
|
|
hwndRender = CreateWindow(/*L"STATIC"*/ SUB_CLASS_NAME, NULL, WS_CHILD|SS_BITMAP,
|
|
|
|
|
0, 0, 1, 1, hwnd, NULL, hinstance, NULL);
|
|
|
|
|
|
2021-02-26 17:23:59 +01:00
|
|
|
/* Initiate a resize in order to properly arrange all controls.
|
|
|
|
|
Move to the last-saved position if needed. */
|
2021-04-12 05:58:59 +02:00
|
|
|
if ((vid_resize < 2) && window_remember)
|
2017-11-19 03:15:29 -05:00
|
|
|
MoveWindow(hwnd, window_x, window_y, window_w, window_h, TRUE);
|
2021-04-12 05:58:59 +02:00
|
|
|
else {
|
|
|
|
|
if (vid_resize >= 2) {
|
2021-09-18 00:01:39 +02:00
|
|
|
MoveWindow(hwnd, window_x, window_y, window_w, window_h, TRUE);
|
2021-04-12 05:58:59 +02:00
|
|
|
scrnsz_x = fixed_size_x;
|
|
|
|
|
scrnsz_y = fixed_size_y;
|
|
|
|
|
}
|
2021-07-30 04:01:46 +02:00
|
|
|
if (hide_status_bar)
|
|
|
|
|
ResizeWindowByClientArea(hwndMain, scrnsz_x, scrnsz_y);
|
|
|
|
|
else
|
|
|
|
|
ResizeWindowByClientArea(hwndMain, scrnsz_x, scrnsz_y + sbar_height);
|
2021-04-12 05:58:59 +02:00
|
|
|
}
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
/* Reset all menus to their defaults. */
|
|
|
|
|
ResetAllMenus();
|
2020-04-26 17:00:45 +02:00
|
|
|
media_menu_init();
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
/* Make the window visible on the screen. */
|
2017-11-23 17:42:00 -05:00
|
|
|
ShowWindow(hwnd, nCmdShow);
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2021-05-11 00:00:34 +03:00
|
|
|
/* Warn the user about unsupported configs. */
|
|
|
|
|
if (cpu_override && ui_msgbox_ex(MBX_WARNING | MBX_QUESTION_OK, (void*)IDS_2145, (void*)IDS_2146, (void*)IDS_2147, (void*)IDS_2119, NULL))
|
|
|
|
|
{
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-16 22:09:13 +05:00
|
|
|
GetClipCursor(&oldclip);
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
/* Initialize the RawInput (keyboard) module. */
|
|
|
|
|
memset(&ridev, 0x00, sizeof(ridev));
|
|
|
|
|
ridev.usUsagePage = 0x01;
|
|
|
|
|
ridev.usUsage = 0x06;
|
|
|
|
|
ridev.dwFlags = RIDEV_NOHOTKEYS;
|
|
|
|
|
ridev.hwndTarget = NULL; /* current focus window */
|
|
|
|
|
if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) {
|
2020-06-17 22:56:18 -03:00
|
|
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2105);
|
|
|
|
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
2018-07-15 01:41:53 +02:00
|
|
|
return(4);
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
2018-07-15 01:41:53 +02:00
|
|
|
keyboard_getkeymap();
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
/* Load the accelerator table */
|
|
|
|
|
haccel = LoadAccelerators(hinstance, ACCEL_NAME);
|
|
|
|
|
if (haccel == NULL) {
|
2020-06-17 22:56:18 -03:00
|
|
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2104);
|
|
|
|
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
2018-07-15 01:41:53 +02:00
|
|
|
return(3);
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
|
|
|
|
|
2017-12-04 11:59:26 -05:00
|
|
|
/* Initialize the mouse module. */
|
2021-09-18 21:33:13 +02:00
|
|
|
if (!start_in_fullscreen)
|
2021-09-18 15:24:00 +02:00
|
|
|
win_mouse_init();
|
2017-12-04 11:59:26 -05:00
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
/*
|
|
|
|
|
* Before we can create the Render window, we first have
|
|
|
|
|
* to prepare some other things that it depends on.
|
|
|
|
|
*/
|
2020-04-27 13:24:43 +02:00
|
|
|
ghMutex = CreateMutex(NULL, FALSE, NULL);
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2017-12-15 03:40:36 +01:00
|
|
|
/* All done, fire up the actual emulated machine. */
|
|
|
|
|
if (! pc_init_modules()) {
|
|
|
|
|
/* Dang, no ROMs found at all! */
|
2020-06-17 22:56:18 -03:00
|
|
|
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2120);
|
|
|
|
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056);
|
|
|
|
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
2017-12-15 03:40:36 +01:00
|
|
|
return(6);
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
/* Initialize the configured Video API. */
|
|
|
|
|
if (! plat_setvid(vid_api)) {
|
2020-06-17 22:56:18 -03:00
|
|
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2089);
|
|
|
|
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
2017-11-19 03:15:29 -05:00
|
|
|
return(5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set up the current window size. */
|
2021-04-17 22:43:31 +02:00
|
|
|
if (vid_resize & 2)
|
|
|
|
|
plat_resize(fixed_size_x, fixed_size_y);
|
|
|
|
|
else
|
|
|
|
|
plat_resize(scrnsz_x, scrnsz_y);
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2021-09-18 15:24:00 +02:00
|
|
|
/* Initialize the rendering window, or fullscreen. */
|
2021-09-18 21:33:13 +02:00
|
|
|
if (start_in_fullscreen)
|
2021-09-18 15:24:00 +02:00
|
|
|
plat_setfullscreen(3);
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
/* Fire up the machine. */
|
2018-10-30 13:32:25 +01:00
|
|
|
pc_reset_hard_init();
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
/* Set the PAUSE mode depending on the renderer. */
|
|
|
|
|
plat_pause(0);
|
|
|
|
|
|
2018-01-19 15:39:13 +01:00
|
|
|
/* If so requested via the command line, inform the
|
|
|
|
|
* application that started us of our HWND, using the
|
|
|
|
|
* the hWnd and unique ID the application has given
|
|
|
|
|
* us. */
|
|
|
|
|
if (source_hwnd)
|
2018-10-24 16:01:20 +02:00
|
|
|
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SENDHWND, (WPARAM) unique_id, (LPARAM) hwndMain);
|
2018-01-19 15:39:13 +01:00
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
/*
|
|
|
|
|
* Everything has been configured, and all seems to work,
|
|
|
|
|
* so now it is time to start the main thread to do some
|
|
|
|
|
* real work, and we will hang in here, dealing with the
|
|
|
|
|
* UI until we're done.
|
|
|
|
|
*/
|
|
|
|
|
do_start();
|
|
|
|
|
|
|
|
|
|
/* Run the message loop. It will run until GetMessage() returns 0 */
|
2021-03-25 03:20:25 -05:00
|
|
|
while (! is_quit) {
|
2017-11-19 03:15:29 -05:00
|
|
|
bRet = GetMessage(&messages, NULL, 0, 0);
|
2021-03-25 03:20:25 -05:00
|
|
|
if ((bRet == 0) || is_quit) break;
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
if (bRet == -1) {
|
|
|
|
|
fatal("bRet is -1\n");
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-21 04:05:40 +02:00
|
|
|
/* 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;
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2021-06-15 15:26:04 +03:00
|
|
|
if (! TranslateAccelerator(hwnd, haccel, &messages))
|
|
|
|
|
{
|
|
|
|
|
/* Don't process other keypresses. */
|
|
|
|
|
if (messages.message == WM_SYSKEYDOWN ||
|
|
|
|
|
messages.message == WM_SYSKEYUP ||
|
|
|
|
|
messages.message == WM_KEYDOWN ||
|
|
|
|
|
messages.message == WM_KEYUP)
|
|
|
|
|
continue;
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
TranslateMessage(&messages);
|
|
|
|
|
DispatchMessage(&messages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mouse_capture && keyboard_ismsexit()) {
|
|
|
|
|
/* Release the in-app mouse. */
|
|
|
|
|
plat_mouse_capture(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (video_fullscreen && keyboard_isfsexit()) {
|
|
|
|
|
/* Signal "exit fullscreen mode". */
|
|
|
|
|
plat_setfullscreen(0);
|
|
|
|
|
}
|
2019-12-04 13:12:34 +01:00
|
|
|
|
|
|
|
|
#ifdef USE_DISCORD
|
|
|
|
|
/* Run Discord API callbacks */
|
2019-12-04 21:55:35 +01:00
|
|
|
if (enable_discord)
|
|
|
|
|
discord_run_callbacks();
|
2019-12-04 13:12:34 +01:00
|
|
|
#endif
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timeEndPeriod(1);
|
|
|
|
|
|
|
|
|
|
if (mouse_capture)
|
|
|
|
|
plat_mouse_capture(0);
|
|
|
|
|
|
2017-12-04 11:59:26 -05:00
|
|
|
/* Close down the emulator. */
|
|
|
|
|
do_stop();
|
|
|
|
|
|
2020-11-28 07:04:40 +01:00
|
|
|
UnregisterClass(SDL_SUB_CLASS_NAME, hinstance);
|
|
|
|
|
UnregisterClass(SDL_CLASS_NAME, hinstance);
|
2017-11-19 03:15:29 -05:00
|
|
|
UnregisterClass(SUB_CLASS_NAME, hinstance);
|
|
|
|
|
UnregisterClass(CLASS_NAME, hinstance);
|
|
|
|
|
|
2017-12-04 11:59:26 -05:00
|
|
|
win_mouse_close();
|
2017-11-19 03:15:29 -05:00
|
|
|
|
2019-12-04 13:12:34 +01:00
|
|
|
#ifdef USE_DISCORD
|
|
|
|
|
/* Shut down the Discord integration */
|
|
|
|
|
discord_close();
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-09-02 11:03:14 +08:00
|
|
|
if (user32_handle != NULL)
|
|
|
|
|
dynld_close(user32_handle);
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
return(messages.wParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t *
|
|
|
|
|
ui_window_title(wchar_t *s)
|
|
|
|
|
{
|
|
|
|
|
if (! video_fullscreen) {
|
2020-01-15 05:24:33 +01:00
|
|
|
if (s != NULL) {
|
2021-03-14 20:35:01 +01:00
|
|
|
wcsncpy(wTitle, s, sizeof_w(wTitle) - 1);
|
2020-01-15 05:24:33 +01:00
|
|
|
} else
|
2017-11-19 03:15:29 -05:00
|
|
|
s = wTitle;
|
|
|
|
|
|
|
|
|
|
SetWindowText(hwndMain, s);
|
|
|
|
|
} else {
|
|
|
|
|
if (s == NULL)
|
|
|
|
|
s = wTitle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* We should have the language ID as a parameter. */
|
|
|
|
|
void
|
|
|
|
|
plat_pause(int p)
|
|
|
|
|
{
|
|
|
|
|
static wchar_t oldtitle[512];
|
2021-04-01 00:04:59 +02:00
|
|
|
wchar_t title[512];
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
/* If un-pausing, as the renderer if that's OK. */
|
|
|
|
|
if (p == 0)
|
|
|
|
|
p = get_vidpause();
|
|
|
|
|
|
|
|
|
|
/* If already so, done. */
|
2019-11-03 03:18:30 +01:00
|
|
|
if (dopause == p) {
|
|
|
|
|
/* Send the WM to a manager if needed. */
|
|
|
|
|
if (source_hwnd)
|
|
|
|
|
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SENDSTATUS, (WPARAM) !!dopause, (LPARAM) hwndMain);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
if (p) {
|
2021-03-14 20:35:01 +01:00
|
|
|
wcsncpy(oldtitle, ui_window_title(NULL), sizeof_w(oldtitle) - 1);
|
2017-11-19 03:15:29 -05:00
|
|
|
wcscpy(title, oldtitle);
|
|
|
|
|
wcscat(title, L" - PAUSED -");
|
|
|
|
|
ui_window_title(title);
|
|
|
|
|
} else {
|
|
|
|
|
ui_window_title(oldtitle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dopause = p;
|
|
|
|
|
|
|
|
|
|
/* Update the actual menu. */
|
|
|
|
|
CheckMenuItem(menuMain, IDM_ACTION_PAUSE,
|
|
|
|
|
(dopause) ? MF_CHECKED : MF_UNCHECKED);
|
2018-10-23 19:41:17 +02:00
|
|
|
|
2019-12-04 13:12:34 +01:00
|
|
|
#if USE_DISCORD
|
|
|
|
|
/* Update Discord status */
|
2019-12-04 21:55:35 +01:00
|
|
|
if(enable_discord)
|
|
|
|
|
discord_update_activity(dopause);
|
2019-12-04 13:12:34 +01:00
|
|
|
#endif
|
|
|
|
|
|
2018-10-23 19:41:17 +02:00
|
|
|
/* Send the WM to a manager if needed. */
|
|
|
|
|
if (source_hwnd)
|
2018-10-24 18:56:17 +02:00
|
|
|
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SENDSTATUS, (WPARAM) !!dopause, (LPARAM) hwndMain);
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Tell the UI about a new screen resolution. */
|
|
|
|
|
void
|
|
|
|
|
plat_resize(int x, int y)
|
|
|
|
|
{
|
|
|
|
|
/* First, see if we should resize the UI window. */
|
|
|
|
|
if (!vid_resize) {
|
2020-09-02 11:26:26 +08:00
|
|
|
/* scale the screen base on DPI */
|
|
|
|
|
if (dpi_scale) {
|
|
|
|
|
x = MulDiv(x, dpi, 96);
|
|
|
|
|
y = MulDiv(y, dpi, 96);
|
|
|
|
|
}
|
2021-07-30 04:01:46 +02:00
|
|
|
if (hide_status_bar)
|
|
|
|
|
ResizeWindowByClientArea(hwndMain, x, y);
|
|
|
|
|
else
|
|
|
|
|
ResizeWindowByClientArea(hwndMain, x, y + sbar_height);
|
2017-11-19 03:15:29 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
plat_mouse_capture(int on)
|
|
|
|
|
{
|
|
|
|
|
RECT rect;
|
|
|
|
|
|
2021-07-19 02:27:22 +02:00
|
|
|
if (!kbd_req_capture && (mouse_type == MOUSE_TYPE_NONE))
|
2018-03-19 04:19:19 +01:00
|
|
|
return;
|
|
|
|
|
|
2017-11-19 03:15:29 -05:00
|
|
|
if (on && !mouse_capture) {
|
|
|
|
|
/* Enable the in-app mouse. */
|
|
|
|
|
GetClipCursor(&oldclip);
|
|
|
|
|
GetWindowRect(hwndRender, &rect);
|
|
|
|
|
ClipCursor(&rect);
|
2017-12-15 00:42:10 -05:00
|
|
|
show_cursor(0);
|
2017-11-19 03:15:29 -05:00
|
|
|
mouse_capture = 1;
|
|
|
|
|
} else if (!on && mouse_capture) {
|
|
|
|
|
/* Disable the in-app mouse. */
|
|
|
|
|
ClipCursor(&oldclip);
|
2017-12-15 18:47:29 +01:00
|
|
|
show_cursor(-1);
|
2017-11-19 03:15:29 -05:00
|
|
|
|
|
|
|
|
mouse_capture = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|