Merge branch 'master' of https://github.com/86Box/86Box
This commit is contained in:
@@ -2,7 +2,7 @@ Building
|
||||
========
|
||||
In order to compile 86Box from this repository, please follow this step-by-step guide:
|
||||
|
||||
1. Install the [MSYS2](https://www.msys2.org/) environment. The rest of the guide will refer to the directory that you install it to (C:\msys32 or C:\msys64 by default) as the MSYS2 root.
|
||||
1. Install the [MSYS2](https://www.msys2.org/) environment. The rest of the guide will refer to the directory that you install it to (`C:\msys32` or `C:\msys64` by default) as the MSYS2 root.
|
||||
|
||||
2. Launch your MSYS2 environment using the `MSYS2 MinGW 32-bit` shortcut. If you do not want to use the shortcut, launch it using the `mingw32.exe` executable in the MSYS2 root.
|
||||
|
||||
|
@@ -275,6 +275,7 @@ piix_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
piix_t *dev = (piix_t *) priv;
|
||||
uint8_t *fregs;
|
||||
uint16_t base;
|
||||
int i;
|
||||
|
||||
/* Return on unsupported function. */
|
||||
@@ -443,8 +444,11 @@ piix_write(int func, int addr, uint8_t val, void *priv)
|
||||
else
|
||||
fregs[addr] = val & 0xc0;
|
||||
|
||||
base = fregs[addr | 0x01] << 8;
|
||||
base |= fregs[addr & 0xfe];
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
ddma_update_io_mapping(dev->ddma, (addr & 4) + i, fregs[addr & 0xfe] + (i << 4), fregs[addr | 0x01], 1);
|
||||
ddma_update_io_mapping(dev->ddma, (addr & 4) + i, fregs[addr & 0xfe] + (i << 4), fregs[addr | 0x01], (base != 0x0000));
|
||||
}
|
||||
break;
|
||||
case 0xa0:
|
||||
|
@@ -459,7 +459,8 @@ load_general(void)
|
||||
force_43 = !!config_get_int(cat, "force_43", 0);
|
||||
scale = config_get_int(cat, "scale", 1);
|
||||
if (scale > 3)
|
||||
scale = 3;
|
||||
scale = 3;
|
||||
dpi_scale = config_get_int(cat, "dpi_scale", 1);
|
||||
|
||||
enable_overscan = !!config_get_int(cat, "enable_overscan", 0);
|
||||
vid_cga_contrast = !!config_get_int(cat, "vid_cga_contrast", 0);
|
||||
@@ -1605,6 +1606,11 @@ save_general(void)
|
||||
else
|
||||
config_set_int(cat, "scale", scale);
|
||||
|
||||
if (dpi_scale == 1)
|
||||
config_delete_var(cat, "dpi_scale");
|
||||
else
|
||||
config_set_int(cat, "dpi_scale", dpi_scale);
|
||||
|
||||
if (enable_overscan == 0)
|
||||
config_delete_var(cat, "enable_overscan");
|
||||
else
|
||||
|
@@ -2069,7 +2069,8 @@ kbd_read(uint16_t port, void *priv)
|
||||
/* Only clear the transmit timeout flag on non-PS/2 controllers, as on
|
||||
PS/2 controller, it is the keyboard/mouse output source bit. */
|
||||
dev->status &= ~STAT_RTIMEOUT;
|
||||
if ((dev->flags & KBC_TYPE_MASK) > KBC_TYPE_PS2_NOREF)
|
||||
if (((dev->flags & KBC_TYPE_MASK) > KBC_TYPE_PS2_NOREF) &&
|
||||
((dev->flags & KBC_VEN_MASK) != KBC_VEN_IBM_MCA))
|
||||
dev->status &= ~STAT_TTIMEOUT;
|
||||
break;
|
||||
|
||||
|
@@ -82,6 +82,7 @@ extern int window_w, window_h, /* (C) window size and */
|
||||
invert_display, /* (C) invert the display */
|
||||
suppress_overscan; /* (C) suppress overscans */
|
||||
extern int scale; /* (C) screen scale factor */
|
||||
extern int dpi_scale; /* (C) DPI scaling of the emulated screen */
|
||||
extern int vid_api; /* (C) video renderer */
|
||||
extern int vid_cga_contrast, /* (C) video */
|
||||
video_fullscreen, /* (C) video */
|
||||
|
@@ -366,6 +366,7 @@ extern int machine_at_8500tuc_init(const machine_t *);
|
||||
extern int machine_at_m7shi_init(const machine_t *);
|
||||
extern int machine_at_tc430hx_init(const machine_t *);
|
||||
extern int machine_at_equium5200_init(const machine_t *);
|
||||
extern int machine_at_pcv240_init(const machine_t *);
|
||||
extern int machine_at_p65up5_cp55t2d_init(const machine_t *);
|
||||
|
||||
extern int machine_at_p55tvp4_init(const machine_t *);
|
||||
|
@@ -296,6 +296,7 @@
|
||||
#define IDM_VID_SCALE_2X 40056
|
||||
#define IDM_VID_SCALE_3X 40057
|
||||
#define IDM_VID_SCALE_4X 40058
|
||||
#define IDM_VID_HIDPI 40059
|
||||
#define IDM_VID_FULLSCREEN 40060
|
||||
#define IDM_VID_FS_FULL 40061
|
||||
#define IDM_VID_FS_43 40062
|
||||
|
32
src/include/86box/scsi_pcscsi.h
Normal file
32
src/include/86box/scsi_pcscsi.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Implementation of the AMD PCscsi and Tekram DC-390 SCSI
|
||||
* controllers using the NCR 53c9x series of chips.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Fabrice Bellard (QEMU)
|
||||
* Herve Poussineau (QEMU)
|
||||
* TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2005-2018 Fabrice Bellard.
|
||||
* Copyright 2012-2018 Herve Poussineau.
|
||||
* Copyright 2017,2018 Miran Grca.
|
||||
*/
|
||||
|
||||
#ifndef SCSI_PCSCSI_H
|
||||
# define SCSI_PCSCSI_H
|
||||
|
||||
|
||||
extern const device_t dc390_pci_device;
|
||||
|
||||
|
||||
#endif /*SCSI_BUSLOGIC_H*/
|
@@ -30,7 +30,9 @@ extern const device_t i82091aa_device;
|
||||
extern const device_t i82091aa_ide_device;
|
||||
extern const device_t pc87306_device;
|
||||
extern const device_t pc87307_device;
|
||||
extern const device_t pc87307_15c_device;
|
||||
extern const device_t pc87309_device;
|
||||
extern const device_t pc87309_15c_device;
|
||||
extern const device_t pc87332_device;
|
||||
extern const device_t pc87332_ps1_device;
|
||||
extern const device_t pc97307_device;
|
||||
|
@@ -1,6 +1,35 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
EEPROM_IDLE,
|
||||
EEPROM_WAIT,
|
||||
EEPROM_OPCODE,
|
||||
EEPROM_INPUT,
|
||||
EEPROM_OUTPUT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EEPROM_OP_EW = 4,
|
||||
EEPROM_OP_WRITE = 5,
|
||||
EEPROM_OP_READ = 6,
|
||||
EEPROM_OP_ERASE = 7,
|
||||
|
||||
EEPROM_OP_WRALMAIN = -1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EEPROM_OP_EWDS = 0,
|
||||
EEPROM_OP_WRAL = 1,
|
||||
EEPROM_OP_ERAL = 2,
|
||||
EEPROM_OP_EWEN = 3
|
||||
};
|
||||
|
||||
|
||||
typedef struct ati_eeprom_t
|
||||
{
|
||||
uint16_t data[256];
|
||||
@@ -10,6 +39,7 @@ typedef struct ati_eeprom_t
|
||||
int wp;
|
||||
uint32_t dat;
|
||||
int type;
|
||||
int address;
|
||||
|
||||
wchar_t fn[256];
|
||||
} ati_eeprom_t;
|
||||
|
@@ -33,6 +33,19 @@
|
||||
# include "resource.h"
|
||||
# undef BITMAP
|
||||
|
||||
/* DPI Awareness Context, copied from MinGW-w64 windef.h */
|
||||
#ifndef _DPI_AWARENESS_CONTEXTS_
|
||||
DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
|
||||
#define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
|
||||
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
|
||||
#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
|
||||
#endif
|
||||
|
||||
#ifndef WM_DPICHANGED_AFTERPARENT
|
||||
#define WM_DPICHANGED_AFTERPARENT 0x02E3
|
||||
#endif
|
||||
|
||||
/* Class names and such. */
|
||||
#define CLASS_NAME L"86BoxMainWnd"
|
||||
@@ -119,6 +132,8 @@ extern void win_joystick_handle(PRAWINPUT raw);
|
||||
|
||||
extern void win_notify_dlg_open(void);
|
||||
extern void win_notify_dlg_closed(void);
|
||||
extern int win_get_dpi(HWND hwnd);
|
||||
extern int win_get_system_metrics(int i, int dpi);
|
||||
|
||||
extern LPARAM win_get_string(int id);
|
||||
|
||||
|
@@ -180,7 +180,7 @@ machine_at_fw6400gx_init(const machine_t *model)
|
||||
device_add(&i440gx_device);
|
||||
device_add(&piix4e_device);
|
||||
device_add(&keyboard_ps2_ami_pci_device);
|
||||
device_add(&pc87309_device);
|
||||
device_add(&pc87309_15c_device);
|
||||
device_add(&sst_flash_29ee020_device);
|
||||
spd_register(SPD_TYPE_SDRAM, 0xF, 512);
|
||||
|
||||
|
@@ -496,6 +496,40 @@ machine_at_equium5200_init(const machine_t *model) // Information about that mac
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_pcv240_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear_combined2(L"roms/machines/pcv240/1010DD04.BIO",
|
||||
L"roms/machines/pcv240/1010DD04.BI1",
|
||||
L"roms/machines/pcv240/1010DD04.BI2",
|
||||
L"roms/machines/pcv240/1010DD04.BI3",
|
||||
L"roms/machines/pcv240/1010DD04.RCV",
|
||||
0x3a000, 128);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
machine_at_common_init(model);
|
||||
|
||||
pci_init(PCI_CONFIG_TYPE_1);
|
||||
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
|
||||
pci_register_slot(0x08, PCI_CARD_ONBOARD, 4, 0, 0, 0);
|
||||
pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4);
|
||||
pci_register_slot(0x0E, PCI_CARD_NORMAL, 2, 3, 4, 1);
|
||||
pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2);
|
||||
pci_register_slot(0x10, PCI_CARD_NORMAL, 4, 1, 2, 3);
|
||||
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
|
||||
device_add(&i430hx_device);
|
||||
device_add(&piix3_device);
|
||||
device_add(&keyboard_ps2_ami_pci_device);
|
||||
device_add(&pc87306_device);
|
||||
device_add(&intel_flash_bxt_ami_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_p65up5_cp55t2d_init(const machine_t *model)
|
||||
{
|
||||
|
@@ -160,40 +160,6 @@ machine_at_vs440fx_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_gw2kvs_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear_combined2(L"roms/machines/gw2kvs/1011CS1T.bio",
|
||||
L"roms/machines/gw2kvs/1011CS1T.bi1",
|
||||
L"roms/machines/gw2kvs/1011CS1T.bi2",
|
||||
L"roms/machines/gw2kvs/1011CS1T.bi3",
|
||||
L"roms/machines/gw2kvs/1011CS1T.rcv",
|
||||
0x3a000, 128);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
machine_at_common_init(model);
|
||||
|
||||
pci_init(PCI_CONFIG_TYPE_1);
|
||||
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
|
||||
pci_register_slot(0x0B, PCI_CARD_NORMAL, 1, 2, 3, 4);
|
||||
pci_register_slot(0x0F, PCI_CARD_NORMAL, 2, 3, 4, 1);
|
||||
pci_register_slot(0x11, PCI_CARD_NORMAL, 3, 4, 1, 2);
|
||||
pci_register_slot(0x13, PCI_CARD_NORMAL, 4, 1, 2, 3);
|
||||
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
|
||||
device_add(&i440fx_device);
|
||||
device_add(&piix3_device);
|
||||
device_add(&keyboard_ps2_intel_ami_pci_device);
|
||||
device_add(&pc87307_device);
|
||||
|
||||
device_add(&intel_flash_bxt_ami_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_ap440fx_init(const machine_t *model)
|
||||
{
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#define MACHINE_CPUS_PENTIUM_S73V {{ "Intel", cpus_Pentium3V}, {"IDT", cpus_WinChip}, {"", NULL}, {"", NULL}, {"", NULL}}
|
||||
#define MACHINE_CPUS_PENTIUM_S73VCH {{ "Intel", cpus_Pentium3V}, {"", NULL }, {"", NULL}, {"", NULL}, {"", NULL}}
|
||||
#define MACHINE_CPUS_PENTIUM_S7 {{ "Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"", NULL}, {"", NULL}}
|
||||
#define MACHINE_CPUS_PENTIUM_S7_INTEL {{"Intel", cpus_Pentium}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}
|
||||
#define MACHINE_CPUS_PENTIUM_SS7 {{ "Intel", cpus_Pentium}, {"IDT", cpus_WinChip_SS7}, {"AMD", cpus_K56_SS7}, {"", NULL}, {"", NULL}}
|
||||
#endif
|
||||
#endif
|
||||
@@ -300,6 +301,7 @@ const machine_t machines[] = {
|
||||
{ "[i430HX] Micronics M7S-Hi", "m7shi", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 511, machine_at_m7shi_init, NULL },
|
||||
{ "[i430HX] Intel TC430HX", "tc430hx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 255, machine_at_tc430hx_init, NULL },
|
||||
{ "[i430HX] Toshiba Equium 5200D", "equium5200", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 192, 8, 127, machine_at_equium5200_init, NULL },
|
||||
{ "[i430HX] Sony Vaio PCV-240", "pcv240", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 192, 8, 127, machine_at_pcv240_init, NULL },
|
||||
{ "[i430HX] ASUS P/I-P65UP5 (C-P55T2D)", "p65up5_cp55t2d", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_p65up5_cp55t2d_init, NULL },
|
||||
|
||||
/* 430VX */
|
||||
@@ -307,8 +309,8 @@ const machine_t machines[] = {
|
||||
{ "[i430VX] Shuttle HOT-557", "430vx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_i430vx_init, NULL },
|
||||
{ "[i430VX] Epox P55-VA", "p55va", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p55va_init, NULL },
|
||||
{ "[i430VX] HP Brio 80xx", "brio80xx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_brio80xx_init, NULL },
|
||||
{ "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, {{"Intel", cpus_Pentium}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_8500tvxa_init, NULL },
|
||||
{ "[i430VX] Compaq Presario 4500", "presario4500", MACHINE_TYPE_SOCKET7, {{"Intel", cpus_Pentium}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_presario4500_init, NULL },
|
||||
{ "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_8500tvxa_init, NULL },
|
||||
{ "[i430VX] Compaq Presario 4500", "presario4500", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_presario4500_init, NULL },
|
||||
{ "[i430VX] Packard Bell PB680", "pb680", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_pb680_init, NULL },
|
||||
|
||||
/* 430TX */
|
||||
|
1
src/pc.c
1
src/pc.c
@@ -116,6 +116,7 @@ int window_w, window_h, /* (C) window size and */
|
||||
invert_display = 0, /* (C) invert the display */
|
||||
suppress_overscan = 0; /* (C) suppress overscans */
|
||||
int scale = 0; /* (C) screen scale factor */
|
||||
int dpi_scale = 0; /* (C) DPI scaling of the emulated screen */
|
||||
int vid_api = 0; /* (C) video renderer */
|
||||
int vid_cga_contrast = 0, /* (C) video */
|
||||
video_fullscreen = 0, /* (C) video */
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#include <86box/scsi_buslogic.h>
|
||||
#include <86box/scsi_ncr5380.h>
|
||||
#include <86box/scsi_ncr53c8xx.h>
|
||||
#include <86box/scsi_pcscsi.h>
|
||||
#include <86box/scsi_spock.h>
|
||||
#ifdef WALTJE
|
||||
# include "scsi_wd33c93.h"
|
||||
@@ -79,6 +80,7 @@ static SCSI_CARD scsi_cards[] = {
|
||||
{ "[PCI] NCR 53C825A", "ncr53c825a", &ncr53c825a_pci_device, },
|
||||
{ "[PCI] NCR 53C860", "ncr53c860", &ncr53c860_pci_device, },
|
||||
{ "[PCI] NCR 53C875", "ncr53c875", &ncr53c875_pci_device, },
|
||||
{ "[PCI] Tekram DC-390", "dc390", &dc390_pci_device, },
|
||||
{ "[VLB] BusLogic BT-445S", "bt445s", &buslogic_445s_device, },
|
||||
{ "", "", NULL, },
|
||||
};
|
||||
|
1484
src/scsi/scsi_pcscsi.c
Normal file
1484
src/scsi/scsi_pcscsi.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -157,7 +157,7 @@ fdc_handler(pc87307_t *dev)
|
||||
addr = ((dev->ld_regs[0x03][0x30] << 8) | dev->ld_regs[0x03][0x31]) - 0x0002;
|
||||
irq = (dev->ld_regs[0x03][0x40] & 0x0f);
|
||||
|
||||
if (active && (addr <= 0xfff2)) {
|
||||
if (active && (addr <= 0xfff8)) {
|
||||
fdc_set_base(dev->fdc, addr);
|
||||
fdc_set_irq(dev->fdc, irq);
|
||||
}
|
||||
@@ -322,7 +322,7 @@ pc87307_write(uint16_t port, uint8_t val, void *priv)
|
||||
dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfb;
|
||||
break;
|
||||
case 0x03:
|
||||
dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfa;
|
||||
dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = (val & 0xfa) | 0x02;
|
||||
fdc_handler(dev);
|
||||
break;
|
||||
case 0x04:
|
||||
@@ -542,8 +542,13 @@ pc87307_init(const device_t *info)
|
||||
|
||||
pc87307_reset(dev);
|
||||
|
||||
io_sethandler(0x02e, 0x0002,
|
||||
pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev);
|
||||
if (info->local & 0x100) {
|
||||
io_sethandler(0x15c, 0x0002,
|
||||
pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev);
|
||||
} else {
|
||||
io_sethandler(0x02e, 0x0002,
|
||||
pc87307_read, NULL, NULL, pc87307_write, NULL, NULL, dev);
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
@@ -559,6 +564,16 @@ const device_t pc87307_device = {
|
||||
};
|
||||
|
||||
|
||||
const device_t pc87307_15c_device = {
|
||||
"National Semiconductor PC87307 Super I/O (Port 15Ch)",
|
||||
0,
|
||||
0x1c0,
|
||||
pc87307_init, pc87307_close, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t pc97307_device = {
|
||||
"National Semiconductor PC97307 Super I/O",
|
||||
0,
|
||||
|
@@ -255,7 +255,7 @@ pc87309_write(uint16_t port, uint8_t val, void *priv)
|
||||
case 0x61:
|
||||
switch (dev->regs[0x07]) {
|
||||
case 0x00:
|
||||
dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfa;
|
||||
dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = (val & 0xfa) | 0x02;
|
||||
fdc_handler(dev);
|
||||
break;
|
||||
case 0x01:
|
||||
@@ -460,8 +460,13 @@ pc87309_init(const device_t *info)
|
||||
|
||||
pc87309_reset(dev);
|
||||
|
||||
io_sethandler(0x02e, 0x0002,
|
||||
pc87309_read, NULL, NULL, pc87309_write, NULL, NULL, dev);
|
||||
if (info->local & 0x100) {
|
||||
io_sethandler(0x15c, 0x0002,
|
||||
pc87309_read, NULL, NULL, pc87309_write, NULL, NULL, dev);
|
||||
} else {
|
||||
io_sethandler(0x02e, 0x0002,
|
||||
pc87309_read, NULL, NULL, pc87309_write, NULL, NULL, dev);
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
@@ -475,3 +480,13 @@ const device_t pc87309_device = {
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t pc87309_15c_device = {
|
||||
"National Semiconductor PC87309 Super I/O (Port 15Ch)",
|
||||
0,
|
||||
0x1e0,
|
||||
pc87309_init, pc87309_close, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
|
@@ -28,33 +28,6 @@
|
||||
#include <86box/vid_ati_eeprom.h>
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
EEPROM_IDLE,
|
||||
EEPROM_WAIT,
|
||||
EEPROM_OPCODE,
|
||||
EEPROM_INPUT,
|
||||
EEPROM_OUTPUT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EEPROM_OP_EW = 4,
|
||||
EEPROM_OP_WRITE = 5,
|
||||
EEPROM_OP_READ = 6,
|
||||
EEPROM_OP_ERASE = 7,
|
||||
|
||||
EEPROM_OP_WRALMAIN = -1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EEPROM_OP_EWDS = 0,
|
||||
EEPROM_OP_WRAL = 1,
|
||||
EEPROM_OP_ERAL = 2,
|
||||
EEPROM_OP_EWEN = 3
|
||||
};
|
||||
|
||||
void ati_eeprom_load(ati_eeprom_t *eeprom, wchar_t *fn, int type)
|
||||
{
|
||||
FILE *f;
|
||||
|
@@ -1,21 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
version="1.20.0.0"
|
||||
processorArchitecture="*"
|
||||
name="86Box.exe"
|
||||
type="win32"
|
||||
/>
|
||||
<dependency>
|
||||
<assemblyIdentity
|
||||
version="1.20.0.0"
|
||||
processorArchitecture="*"
|
||||
name="86Box.exe"
|
||||
type="win32"
|
||||
/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<application>
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
|
@@ -80,6 +80,7 @@ BEGIN
|
||||
MENUITEM "1.&5x", IDM_VID_SCALE_3X
|
||||
MENUITEM "&2x", IDM_VID_SCALE_4X
|
||||
END
|
||||
MENUITEM "Hi&DPI scaling", IDM_VID_HIDPI
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Fullscreen\tCtrl+Alt+PageUP", IDM_VID_FULLSCREEN
|
||||
POPUP "Fullscreen &stretch mode"
|
||||
@@ -316,7 +317,7 @@ BEGIN
|
||||
WS_BORDER,53,45,166,14
|
||||
END
|
||||
|
||||
DLG_CONFIG DIALOG DISCARDABLE 0, 0, 366, 256
|
||||
DLG_CONFIG DIALOG DISCARDABLE 0, 0, 376, 256
|
||||
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "86Box Settings"
|
||||
FONT 9, "Segoe UI"
|
||||
@@ -324,8 +325,8 @@ BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,246,235,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,307,235,50,14
|
||||
CONTROL "List2",IDC_SETTINGSCATLIST,"SysListView32",LVS_LIST |
|
||||
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,90,212
|
||||
CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,226,363,1
|
||||
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,100,212
|
||||
CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,226,373,1
|
||||
/* Leave this commented out until we get into localization. */
|
||||
#if 0
|
||||
LTEXT "Language:",IDT_1700,7,237,41,10
|
||||
@@ -334,7 +335,7 @@ BEGIN
|
||||
#endif
|
||||
END
|
||||
|
||||
DLG_CFG_MACHINE DIALOG DISCARDABLE 97, 0, 305, 199
|
||||
DLG_CFG_MACHINE DIALOG DISCARDABLE 107, 0, 305, 199
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -376,7 +377,7 @@ BEGIN
|
||||
#endif
|
||||
END
|
||||
|
||||
DLG_CFG_VIDEO DIALOG DISCARDABLE 97, 0, 267, 45
|
||||
DLG_CFG_VIDEO DIALOG DISCARDABLE 107, 0, 267, 45
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -389,7 +390,7 @@ BEGIN
|
||||
PUSHBUTTON "Configure",IDC_BUTTON_VOODOO,222,26,38,12
|
||||
END
|
||||
|
||||
DLG_CFG_INPUT DIALOG DISCARDABLE 97, 0, 267, 65
|
||||
DLG_CFG_INPUT DIALOG DISCARDABLE 107, 0, 267, 65
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -406,7 +407,7 @@ BEGIN
|
||||
PUSHBUTTON "Joystick 4...",IDC_JOY4,209,44,50,14
|
||||
END
|
||||
|
||||
DLG_CFG_SOUND DIALOG DISCARDABLE 97, 0, 267, 199
|
||||
DLG_CFG_SOUND DIALOG DISCARDABLE 107, 0, 267, 199
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -442,7 +443,7 @@ BEGIN
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,115,94,10
|
||||
END
|
||||
|
||||
DLG_CFG_NETWORK DIALOG DISCARDABLE 97, 0, 267, 63
|
||||
DLG_CFG_NETWORK DIALOG DISCARDABLE 107, 0, 267, 63
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -460,7 +461,7 @@ BEGIN
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_NET,214,43,46,12
|
||||
END
|
||||
|
||||
DLG_CFG_PORTS DIALOG DISCARDABLE 97, 0, 267, 135
|
||||
DLG_CFG_PORTS DIALOG DISCARDABLE 107, 0, 267, 135
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -493,7 +494,7 @@ BEGIN
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,118,94,10
|
||||
END
|
||||
|
||||
DLG_CFG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 220
|
||||
DLG_CFG_PERIPHERALS DIALOG DISCARDABLE 107, 0, 267, 220
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -550,7 +551,7 @@ BEGIN
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_4,217,190,38,12
|
||||
END
|
||||
|
||||
DLG_CFG_HARD_DISKS DIALOG DISCARDABLE 97, 0, 267, 154
|
||||
DLG_CFG_HARD_DISKS DIALOG DISCARDABLE 107, 0, 267, 154
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -611,7 +612,7 @@ BEGIN
|
||||
WS_BORDER,7,16,204,12
|
||||
END
|
||||
|
||||
DLG_CFG_FLOPPY_AND_CDROM_DRIVES DIALOG DISCARDABLE 97, 0, 267, 222
|
||||
DLG_CFG_FLOPPY_AND_CDROM_DRIVES DIALOG DISCARDABLE 107, 0, 267, 222
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -645,7 +646,7 @@ BEGIN
|
||||
LTEXT "Speed:",IDT_1758,7,207,24,8
|
||||
END
|
||||
|
||||
DLG_CFG_OTHER_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 222
|
||||
DLG_CFG_OTHER_REMOVABLE_DEVICES DIALOG DISCARDABLE 107, 0, 267, 222
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
|
@@ -697,7 +697,7 @@ SCSIOBJ := scsi.o scsi_device.o \
|
||||
scsi_x54x.o \
|
||||
scsi_aha154x.o scsi_buslogic.o \
|
||||
scsi_ncr5380.o scsi_ncr53c8xx.o \
|
||||
scsi_spock.o
|
||||
scsi_pcscsi.o scsi_spock.o
|
||||
|
||||
NETOBJ := network.o \
|
||||
net_pcap.o \
|
||||
|
@@ -71,6 +71,7 @@
|
||||
|
||||
|
||||
static int first_cat = 0;
|
||||
static int dpi = 96;
|
||||
|
||||
/* Machine category */
|
||||
static int temp_machine_type, temp_machine, temp_cpu_m, temp_cpu, temp_wait_states, temp_fpu, temp_sync;
|
||||
@@ -153,8 +154,11 @@ image_list_init(HWND hwndList, const uint8_t *icon_ids)
|
||||
|
||||
int i = 0;
|
||||
|
||||
hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
|
||||
GetSystemMetrics(SM_CYSMICON),
|
||||
hSmall = ListView_GetImageList(hwndList, LVSIL_SMALL);
|
||||
if (hSmall != 0) ImageList_Destroy(hSmall);
|
||||
|
||||
hSmall = ImageList_Create(win_get_system_metrics(SM_CXSMICON, dpi),
|
||||
win_get_system_metrics(SM_CYSMICON, dpi),
|
||||
ILC_MASK | ILC_COLOR32, 1, 1);
|
||||
|
||||
while(1) {
|
||||
@@ -2680,6 +2684,16 @@ win_settings_hard_disks_recalc_list(HWND hwndList)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
win_settings_hard_disks_resize_columns(HWND hwndList)
|
||||
{
|
||||
int iCol;
|
||||
/* Bus, File, Cylinders, Heads, Sectors, Size */
|
||||
int width[C_COLUMNS_HARD_DISKS] = {130, 130, 41, 25, 25, 41};
|
||||
for (iCol = 0; iCol < C_COLUMNS_HARD_DISKS; iCol++) {
|
||||
ListView_SetColumnWidth(hwndList, iCol, MulDiv(width[iCol], dpi, 96));
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL
|
||||
win_settings_hard_disks_init_columns(HWND hwndList)
|
||||
@@ -2695,7 +2709,7 @@ win_settings_hard_disks_init_columns(HWND hwndList)
|
||||
|
||||
switch(iCol) {
|
||||
case 0: /* Bus */
|
||||
lvc.cx = 135;
|
||||
lvc.cx = 130;
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
break;
|
||||
case 2: /* Cylinders */
|
||||
@@ -2708,7 +2722,7 @@ win_settings_hard_disks_init_columns(HWND hwndList)
|
||||
lvc.fmt = LVCFMT_RIGHT;
|
||||
break;
|
||||
case 1: /* File */
|
||||
lvc.cx = 150;
|
||||
lvc.cx = 130;
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
break;
|
||||
case 5: /* Size (MB) 8 */
|
||||
@@ -2721,6 +2735,7 @@ win_settings_hard_disks_init_columns(HWND hwndList)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
win_settings_hard_disks_resize_columns(hwndList);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3682,6 +3697,11 @@ hd_bus_skip:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case WM_DPICHANGED_AFTERPARENT:
|
||||
h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS);
|
||||
win_settings_hard_disks_resize_columns(h);
|
||||
image_list_init(h, (const uint8_t *) hd_icons);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3920,6 +3940,14 @@ win_settings_zip_drives_recalc_list(HWND hwndList)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
win_settings_floppy_drives_resize_columns(HWND hwndList)
|
||||
{
|
||||
ListView_SetColumnWidth(hwndList, 0, MulDiv(250, dpi, 96));
|
||||
ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96));
|
||||
ListView_SetColumnWidth(hwndList, 2, MulDiv(75, dpi, 96));
|
||||
}
|
||||
|
||||
static BOOL
|
||||
win_settings_floppy_drives_init_columns(HWND hwndList)
|
||||
{
|
||||
@@ -3930,7 +3958,7 @@ win_settings_floppy_drives_init_columns(HWND hwndList)
|
||||
lvc.iSubItem = 0;
|
||||
lvc.pszText = plat_get_string(IDS_2092);
|
||||
|
||||
lvc.cx = 292;
|
||||
lvc.cx = 250;
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
|
||||
if (ListView_InsertColumn(hwndList, 0, &lvc) == -1)
|
||||
@@ -3952,12 +3980,20 @@ win_settings_floppy_drives_init_columns(HWND hwndList)
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
|
||||
if (ListView_InsertColumn(hwndList, 2, &lvc) == -1)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
win_settings_floppy_drives_resize_columns(hwndList);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
win_settings_cdrom_drives_resize_columns(HWND hwndList)
|
||||
{
|
||||
ListView_SetColumnWidth(hwndList, 0, MulDiv(342, dpi, 96));
|
||||
ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96));
|
||||
}
|
||||
|
||||
static BOOL
|
||||
win_settings_cdrom_drives_init_columns(HWND hwndList)
|
||||
{
|
||||
@@ -3981,11 +4017,18 @@ win_settings_cdrom_drives_init_columns(HWND hwndList)
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
|
||||
if (ListView_InsertColumn(hwndList, 1, &lvc) == -1)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
win_settings_cdrom_drives_resize_columns(hwndList);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
win_settings_mo_drives_resize_columns(HWND hwndList)
|
||||
{
|
||||
ListView_SetColumnWidth(hwndList, 0, MulDiv(120, dpi, 96));
|
||||
ListView_SetColumnWidth(hwndList, 1, MulDiv(260, dpi, 96));
|
||||
}
|
||||
|
||||
static BOOL
|
||||
win_settings_mo_drives_init_columns(HWND hwndList)
|
||||
@@ -4010,11 +4053,18 @@ win_settings_mo_drives_init_columns(HWND hwndList)
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
|
||||
if (ListView_InsertColumn(hwndList, 1, &lvc) == -1)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
win_settings_mo_drives_resize_columns(hwndList);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
win_settings_zip_drives_resize_columns(HWND hwndList)
|
||||
{
|
||||
ListView_SetColumnWidth(hwndList, 0, MulDiv(342, dpi, 96));
|
||||
ListView_SetColumnWidth(hwndList, 1, MulDiv(50, dpi, 96));
|
||||
}
|
||||
|
||||
static BOOL
|
||||
win_settings_zip_drives_init_columns(HWND hwndList)
|
||||
@@ -4039,8 +4089,9 @@ win_settings_zip_drives_init_columns(HWND hwndList)
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
|
||||
if (ListView_InsertColumn(hwndList, 1, &lvc) == -1)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
win_settings_zip_drives_resize_columns(hwndList);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -4856,6 +4907,14 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam
|
||||
}
|
||||
ignore_change = 0;
|
||||
|
||||
case WM_DPICHANGED_AFTERPARENT:
|
||||
h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
|
||||
win_settings_floppy_drives_resize_columns(h);
|
||||
image_list_init(h, (const uint8_t *) fd_icons);
|
||||
h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
|
||||
win_settings_cdrom_drives_resize_columns(h);
|
||||
image_list_init(h, (const uint8_t *) cd_icons);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
@@ -5122,6 +5181,14 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
|
||||
}
|
||||
ignore_change = 0;
|
||||
|
||||
case WM_DPICHANGED_AFTERPARENT:
|
||||
h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES);
|
||||
win_settings_mo_drives_resize_columns(h);
|
||||
image_list_init(h, (const uint8_t *) mo_icons);
|
||||
h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES);
|
||||
win_settings_zip_drives_resize_columns(h);
|
||||
image_list_init(h, (const uint8_t *) zip_icons);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
@@ -5244,6 +5311,7 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
dpi = win_get_dpi(hdlg);
|
||||
win_settings_init();
|
||||
displayed_category = -1;
|
||||
h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST);
|
||||
@@ -5277,6 +5345,11 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case WM_DPICHANGED:
|
||||
dpi = HIWORD(wParam);
|
||||
h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST);
|
||||
image_list_init(h, (const uint8_t *) cat_icons);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -70,6 +70,8 @@ static uint8_t *sb_part_icons;
|
||||
static int sb_parts = 0;
|
||||
static int sb_ready = 0;
|
||||
static uint8_t sb_map[256];
|
||||
static int dpi = 96;
|
||||
static int icon_width = 24;
|
||||
|
||||
/* Also used by win_settings.c */
|
||||
intptr_t
|
||||
@@ -537,7 +539,7 @@ ui_sb_update_panes(void)
|
||||
sb_parts = 0;
|
||||
for (i=0; i<FDD_NUM; i++) {
|
||||
if (fdd_get_type(i) != 0) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_FLOPPY | i;
|
||||
sb_map[SB_FLOPPY | i] = sb_parts;
|
||||
@@ -553,7 +555,7 @@ ui_sb_update_panes(void)
|
||||
if ((cdrom[i].bus_type == CDROM_BUS_SCSI) && (scsi_card_current == 0))
|
||||
continue;
|
||||
if (cdrom[i].bus_type != 0) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_CDROM | i;
|
||||
sb_map[SB_CDROM | i] = sb_parts;
|
||||
@@ -568,7 +570,7 @@ ui_sb_update_panes(void)
|
||||
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && (scsi_card_current == 0))
|
||||
continue;
|
||||
if (zip_drives[i].bus_type != 0) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_ZIP | i;
|
||||
sb_map[SB_ZIP | i] = sb_parts;
|
||||
@@ -583,7 +585,7 @@ ui_sb_update_panes(void)
|
||||
if ((mo_drives[i].bus_type == MO_BUS_SCSI) && (scsi_card_current == 0))
|
||||
continue;
|
||||
if (mo_drives[i].bus_type != 0) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_MO | i;
|
||||
sb_map[SB_MO | i] = sb_parts;
|
||||
@@ -591,56 +593,55 @@ ui_sb_update_panes(void)
|
||||
}
|
||||
}
|
||||
if (c_mfm && (hdint || !memcmp(hdc_name, "st506", 5))) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_MFM;
|
||||
sb_map[SB_HDD | HDD_BUS_MFM] = sb_parts;
|
||||
sb_parts++;
|
||||
}
|
||||
if (c_esdi && (hdint || !memcmp(hdc_name, "esdi", 4))) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_ESDI;
|
||||
sb_map[SB_HDD | HDD_BUS_ESDI] = sb_parts;
|
||||
sb_parts++;
|
||||
}
|
||||
if (c_xta && (hdint || !memcmp(hdc_name, "xta", 3))) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_XTA;
|
||||
sb_map[SB_HDD | HDD_BUS_XTA] = sb_parts;
|
||||
sb_parts++;
|
||||
}
|
||||
if (c_ide && (hdint || !memcmp(hdc_name, "xtide", 5) || !memcmp(hdc_name, "ide", 3))) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_IDE;
|
||||
sb_map[SB_HDD | HDD_BUS_IDE] = sb_parts;
|
||||
sb_parts++;
|
||||
}
|
||||
if (c_scsi && (scsi_card_current != 0)) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_SCSI;
|
||||
sb_map[SB_HDD | HDD_BUS_SCSI] = sb_parts;
|
||||
sb_parts++;
|
||||
}
|
||||
if (do_net) {
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_NETWORK;
|
||||
sb_map[SB_NETWORK] = sb_parts;
|
||||
sb_parts++;
|
||||
}
|
||||
|
||||
edge += SB_ICON_WIDTH;
|
||||
edge += icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = SB_SOUND;
|
||||
sb_map[SB_SOUND] = sb_parts;
|
||||
sb_parts++;
|
||||
|
||||
if (sb_parts)
|
||||
iStatusWidths[sb_parts - 1] += (24 - SB_ICON_WIDTH);
|
||||
iStatusWidths[sb_parts] = -1;
|
||||
sb_part_meanings[sb_parts] = SB_TEXT;
|
||||
sb_map[SB_TEXT] = sb_parts;
|
||||
@@ -718,7 +719,7 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
|
||||
|
||||
if (id >= (sb_parts - 1)) return;
|
||||
|
||||
pt.x = id * SB_ICON_WIDTH; /* Justify to the left. */
|
||||
pt.x = id * icon_width; /* Justify to the left. */
|
||||
pt.y = 0; /* Justify to the top. */
|
||||
ClientToScreen(hwnd, (LPPOINT) &pt);
|
||||
|
||||
@@ -744,6 +745,48 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
|
||||
pt.x, pt.y, 0, hwndSBAR, NULL);
|
||||
}
|
||||
|
||||
/* API: Load status bar icons */
|
||||
void
|
||||
StatusBarLoadIcon(HINSTANCE hInst) {
|
||||
int i;
|
||||
int x = win_get_system_metrics(SM_CXSMICON, dpi);
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
if (hIcon[i] != 0)
|
||||
DestroyIcon(hIcon[i]);
|
||||
}
|
||||
|
||||
for (i = 16; i < 18; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 24; i < 26; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 32; i < 34; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 48; i < 50; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 56; i < 58; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 64; i < 66; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 80; i < 82; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 96; i < 98; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 144; i < 146; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 152; i < 154; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 160; i < 162; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 176; i < 178; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 184; i < 186; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 192; i < 194; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
for (i = 243; i < 244; i++)
|
||||
hIcon[i] = LoadImage(hInst, MAKEINTRESOURCE(i), IMAGE_ICON, x, x, LR_DEFAULTCOLOR);
|
||||
}
|
||||
|
||||
/* Handle messages for the Status Bar window. */
|
||||
#if defined(__amd64__) || defined(__aarch64__)
|
||||
@@ -756,6 +799,8 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
RECT rc;
|
||||
POINT pt;
|
||||
int item_id = 0;
|
||||
int i;
|
||||
HINSTANCE hInst;
|
||||
|
||||
switch (message) {
|
||||
case WM_COMMAND:
|
||||
@@ -768,20 +813,38 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
pt.x = GET_X_LPARAM(lParam);
|
||||
pt.y = GET_Y_LPARAM(lParam);
|
||||
if (PtInRect((LPRECT) &rc, pt))
|
||||
StatusBarPopupMenu(hwnd, pt, (pt.x / SB_ICON_WIDTH));
|
||||
StatusBarPopupMenu(hwnd, pt, (pt.x / icon_width));
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
GetClientRect(hwnd, (LPRECT)& rc);
|
||||
pt.x = GET_X_LPARAM(lParam);
|
||||
pt.y = GET_Y_LPARAM(lParam);
|
||||
item_id = (pt.x / SB_ICON_WIDTH);
|
||||
item_id = (pt.x / icon_width);
|
||||
if (PtInRect((LPRECT) &rc, pt) && (item_id < sb_parts)) {
|
||||
if (sb_part_meanings[item_id] == SB_SOUND)
|
||||
SoundGainDialogCreate(hwndMain);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DPICHANGED_AFTERPARENT:
|
||||
/* DPI changed, reload icons */
|
||||
hInst = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
|
||||
dpi = win_get_dpi(hwnd);
|
||||
icon_width = MulDiv(SB_ICON_WIDTH, dpi, 96);
|
||||
StatusBarLoadIcon(hInst);
|
||||
|
||||
for (i=0; i<sb_parts; i++) {
|
||||
if (sb_part_icons[i] != 255) {
|
||||
SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)hIcon[sb_part_icons[i]]);
|
||||
}
|
||||
|
||||
iStatusWidths[i] = (i+1)*icon_width;
|
||||
}
|
||||
iStatusWidths[i-1] = -1;
|
||||
SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)sb_parts, (LPARAM)iStatusWidths);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(CallWindowProc((WNDPROC)OriginalProcedure,
|
||||
hwnd, message, wParam, lParam));
|
||||
@@ -797,39 +860,13 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
||||
{
|
||||
RECT rectDialog;
|
||||
int dw, dh;
|
||||
uint8_t i;
|
||||
|
||||
/* Get current DPI and calculate icon sizes */
|
||||
dpi = win_get_dpi(hwndParent);
|
||||
icon_width = MulDiv(SB_ICON_WIDTH, dpi, 96);
|
||||
|
||||
/* Load our icons into the cache for faster access. */
|
||||
for (i = 16; i < 18; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 24; i < 26; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 32; i < 34; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 48; i < 50; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 56; i < 58; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 64; i < 66; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 80; i < 82; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 96; i < 98; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 144; i < 146; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 152; i < 154; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 160; i < 162; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 176; i < 178; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 184; i < 186; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 192; i < 194; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 243; i < 244; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
StatusBarLoadIcon(hInst);
|
||||
|
||||
GetWindowRect(hwndParent, &rectDialog);
|
||||
dw = rectDialog.right - rectDialog.left;
|
||||
|
200
src/win/win_ui.c
200
src/win/win_ui.c
@@ -37,6 +37,7 @@
|
||||
#include <86box/vid_ega.h> // for update_overscan
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_midi.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/win.h>
|
||||
#include <86box/version.h>
|
||||
@@ -69,10 +70,67 @@ static wchar_t wTitle[512];
|
||||
static HHOOK hKeyboardHook;
|
||||
static int hook_enabled = 0, manager_wm = 0;
|
||||
static int save_window_pos = 0, pause_state = 0;
|
||||
static int dpi = 96;
|
||||
static int padded_frame = 0;
|
||||
|
||||
|
||||
static int vis = -1;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
return GetSystemMetrics(index);
|
||||
}
|
||||
|
||||
void
|
||||
ResizeWindowByClientArea(HWND hwnd, int width, int height)
|
||||
{
|
||||
if (vid_resize || padded_frame) {
|
||||
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);
|
||||
}
|
||||
|
||||
/* Set host cursor visible or not. */
|
||||
void
|
||||
show_cursor(int val)
|
||||
@@ -168,6 +226,7 @@ ResetAllMenus(void)
|
||||
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);
|
||||
CheckMenuItem(menuMain, IDM_VID_HIDPI, MF_UNCHECKED);
|
||||
|
||||
CheckMenuItem(menuMain, IDM_VID_CGACON, MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_VID_GRAYCT_601+0, MF_UNCHECKED);
|
||||
@@ -217,6 +276,7 @@ ResetAllMenus(void)
|
||||
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);
|
||||
CheckMenuItem(menuMain, IDM_VID_HIDPI, dpi_scale?MF_CHECKED:MF_UNCHECKED);
|
||||
|
||||
CheckMenuItem(menuMain, IDM_VID_CGACON, vid_cga_contrast?MF_CHECKED:MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_VID_GRAYCT_601+video_graytype, MF_CHECKED);
|
||||
@@ -290,8 +350,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HMENU hmenu;
|
||||
|
||||
int i, sb_borders[3];
|
||||
RECT rect;
|
||||
int i;
|
||||
RECT rect, *rect_p;
|
||||
|
||||
int temp_x, temp_y;
|
||||
|
||||
@@ -392,42 +452,28 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (vid_resize)
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW) | WS_VISIBLE);
|
||||
else
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) | WS_VISIBLE);
|
||||
else
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_MAXIMIZEBOX) | WS_VISIBLE);
|
||||
|
||||
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
|
||||
|
||||
GetWindowRect(hwnd, &rect);
|
||||
|
||||
/* Main Window. */
|
||||
if (GetSystemMetrics(SM_CXPADDEDBORDER) == 0) {
|
||||
/* For platforms that subsystem version < 6.0 (default on mingw/msys2) */
|
||||
/* In this case, border sizes are different between resizable and non-resizable window */
|
||||
MoveWindow(hwnd, rect.left, rect.top,
|
||||
unscaled_size_x + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2),
|
||||
unscaled_size_y + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + (GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYMENUSIZE)) + GetSystemMetrics(SM_CYCAPTION) + sbar_height,
|
||||
TRUE);
|
||||
/* 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 {
|
||||
/* For platforms that subsystem version >= 6.0 (default on llvm-mingw, mainly for Windows/ARM) */
|
||||
/* In this case, border sizes are the same between resizable and non-resizable window */
|
||||
MoveWindow(hwnd, rect.left, rect.top,
|
||||
unscaled_size_x + ((GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2),
|
||||
unscaled_size_y + ((GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2) + (GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYMENUSIZE)) + GetSystemMetrics(SM_CYCAPTION) + sbar_height,
|
||||
TRUE);
|
||||
temp_x = unscaled_size_x;
|
||||
temp_y = unscaled_size_y;
|
||||
}
|
||||
/* Main Window. */
|
||||
ResizeWindowByClientArea(hwnd, temp_x, temp_y + sbar_height);
|
||||
|
||||
/* Render window. */
|
||||
MoveWindow(hwndRender, 0, 0, unscaled_size_x, unscaled_size_y, TRUE);
|
||||
MoveWindow(hwndRender, 0, 0, temp_x, temp_y, TRUE);
|
||||
GetWindowRect(hwndRender, &rect);
|
||||
|
||||
/* Status bar. */
|
||||
MoveWindow(hwndSBAR,
|
||||
0, rect.bottom + GetSystemMetrics(SM_CYEDGE),
|
||||
unscaled_size_x, 17, TRUE);
|
||||
MoveWindow(hwndSBAR, 0, rect.bottom, temp_x, 17, TRUE);
|
||||
|
||||
if (mouse_capture) {
|
||||
GetWindowRect(hwndRender, &rect);
|
||||
|
||||
ClipCursor(&rect);
|
||||
}
|
||||
|
||||
@@ -440,6 +486,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
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);
|
||||
|
||||
scrnsz_x = unscaled_size_x;
|
||||
scrnsz_y = unscaled_size_y;
|
||||
doresize = 1;
|
||||
config_save();
|
||||
break;
|
||||
@@ -496,6 +545,13 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
config_save();
|
||||
break;
|
||||
|
||||
case IDM_VID_HIDPI:
|
||||
dpi_scale = !dpi_scale;
|
||||
CheckMenuItem(hmenu, IDM_VID_HIDPI, dpi_scale ? MF_CHECKED : MF_UNCHECKED);
|
||||
doresize = 1;
|
||||
config_save();
|
||||
break;
|
||||
|
||||
case IDM_VID_FORCE43:
|
||||
video_toggle_option(hmenu, &force_43, IDM_VID_FORCE43);
|
||||
video_force_resize_set(1);
|
||||
@@ -624,12 +680,22 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_ENTERMENULOOP:
|
||||
break;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
dpi = HIWORD(wParam);
|
||||
GetWindowRect(hwndSBAR, &rect);
|
||||
sbar_height = rect.bottom - rect.top;
|
||||
rect_p = (RECT*)lParam;
|
||||
if (vid_resize) {
|
||||
MoveWindow(hwnd, rect_p->left, rect_p->top, rect_p->right - rect_p->left, rect_p->bottom - rect_p->top, TRUE);
|
||||
} else if (!user_resize) {
|
||||
doresize = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
if (user_resize && !vid_resize)
|
||||
break;
|
||||
|
||||
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
|
||||
|
||||
temp_x = (lParam & 0xFFFF);
|
||||
temp_y = (lParam >> 16);
|
||||
|
||||
@@ -646,26 +712,22 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (temp_y < 1)
|
||||
temp_y = 1;
|
||||
|
||||
if ((temp_x != scrnsz_x) || (temp_y != scrnsz_y))
|
||||
if (vid_resize && ((temp_x != scrnsz_x) || (temp_y != scrnsz_y))) {
|
||||
scrnsz_x = temp_x;
|
||||
scrnsz_y = temp_y;
|
||||
doresize = 1;
|
||||
}
|
||||
|
||||
scrnsz_x = temp_x;
|
||||
scrnsz_y = temp_y;
|
||||
|
||||
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
||||
MoveWindow(hwndRender, 0, 0, temp_x, temp_y, TRUE);
|
||||
|
||||
GetWindowRect(hwndRender, &rect);
|
||||
|
||||
/* Status bar. */
|
||||
MoveWindow(hwndSBAR,
|
||||
0, rect.bottom + GetSystemMetrics(SM_CYEDGE),
|
||||
scrnsz_x, 17, TRUE);
|
||||
MoveWindow(hwndSBAR, 0, rect.bottom, temp_x, 17, TRUE);
|
||||
|
||||
plat_vidsize(scrnsz_x, scrnsz_y);
|
||||
plat_vidsize(temp_x, temp_y);
|
||||
|
||||
if (mouse_capture) {
|
||||
GetWindowRect(hwndRender, &rect);
|
||||
|
||||
ClipCursor(&rect);
|
||||
}
|
||||
|
||||
@@ -894,6 +956,9 @@ ui_init(int nCmdShow)
|
||||
TASKDIALOGCONFIG tdconfig = {0};
|
||||
TASKDIALOG_BUTTON tdbuttons[] = {{IDCANCEL, MAKEINTRESOURCE(IDS_2119)}};
|
||||
|
||||
/* Load DPI related Windows 10 APIs */
|
||||
user32_handle = dynld_module("user32.dll", user32_imports);
|
||||
|
||||
/* Set up TaskDialog configuration. */
|
||||
tdconfig.cbSize = sizeof(tdconfig);
|
||||
tdconfig.dwFlags = TDF_ENABLE_HYPERLINKS;
|
||||
@@ -973,6 +1038,19 @@ ui_init(int nCmdShow)
|
||||
|
||||
ui_window_title(title);
|
||||
|
||||
/* Get the current DPI */
|
||||
dpi = win_get_dpi(hwndMain);
|
||||
|
||||
/* Check if we have a padded window frame */
|
||||
padded_frame = (GetSystemMetrics(SM_CXPADDEDBORDER) != 0);
|
||||
|
||||
/* Create the status bar window. */
|
||||
StatusBarCreate(hwndMain, IDC_STATUS, hinstance);
|
||||
|
||||
/* Get the actual height of the status bar */
|
||||
GetWindowRect(hwndSBAR, &sbar_rect);
|
||||
sbar_height = sbar_rect.bottom - sbar_rect.top;
|
||||
|
||||
/* Set up main window for resizing if configured. */
|
||||
if (vid_resize)
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE,
|
||||
@@ -1019,15 +1097,6 @@ ui_init(int nCmdShow)
|
||||
/* Initialize the mouse module. */
|
||||
win_mouse_init();
|
||||
|
||||
/* Create the status bar window. */
|
||||
StatusBarCreate(hwndMain, IDC_STATUS, hinstance);
|
||||
|
||||
/* Get the actual height of the statusbar,
|
||||
* since that is not something we can change.
|
||||
*/
|
||||
GetWindowRect(hwndSBAR, &sbar_rect);
|
||||
sbar_height = sbar_rect.bottom - sbar_rect.top;
|
||||
|
||||
/*
|
||||
* Before we can create the Render window, we first have
|
||||
* to prepare some other things that it depends on.
|
||||
@@ -1137,6 +1206,9 @@ ui_init(int nCmdShow)
|
||||
discord_close();
|
||||
#endif
|
||||
|
||||
if (user32_handle != NULL)
|
||||
dynld_close(user32_handle);
|
||||
|
||||
return(messages.wParam);
|
||||
}
|
||||
|
||||
@@ -1218,42 +1290,26 @@ plat_pause(int p)
|
||||
void
|
||||
plat_resize(int x, int y)
|
||||
{
|
||||
int sb_borders[3];
|
||||
RECT r;
|
||||
|
||||
/* First, see if we should resize the UI window. */
|
||||
if (!vid_resize) {
|
||||
video_wait_for_blit();
|
||||
|
||||
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
|
||||
|
||||
GetWindowRect(hwndMain, &r);
|
||||
|
||||
if (GetSystemMetrics(SM_CXPADDEDBORDER) == 0) {
|
||||
/* For platforms that subsystem version < 6.0 (gcc on mingw/msys2) */
|
||||
/* In this case, border sizes are different between resizable and non-resizable window */
|
||||
MoveWindow(hwndMain, r.left, r.top,
|
||||
x + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2),
|
||||
y + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + (GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYMENUSIZE)) + GetSystemMetrics(SM_CYCAPTION) + sbar_height,
|
||||
TRUE);
|
||||
} else {
|
||||
/* For platforms that subsystem version >= 6.0 (clang/llvm on llvm-mingw, mainly for Windows/ARM) */
|
||||
/* In this case, border sizes are the same between resizable and non-resizable window */
|
||||
MoveWindow(hwndMain, r.left, r.top,
|
||||
x + ((GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2),
|
||||
y + ((GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2) + (GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYMENUSIZE)) + GetSystemMetrics(SM_CYCAPTION) + sbar_height,
|
||||
TRUE);
|
||||
/* scale the screen base on DPI */
|
||||
if (dpi_scale) {
|
||||
x = MulDiv(x, dpi, 96);
|
||||
y = MulDiv(y, dpi, 96);
|
||||
}
|
||||
ResizeWindowByClientArea(hwndMain, x, y + sbar_height);
|
||||
|
||||
MoveWindow(hwndRender, 0, 0, x, y, TRUE);
|
||||
GetWindowRect(hwndRender, &r);
|
||||
|
||||
MoveWindow(hwndSBAR,
|
||||
0, r.bottom + GetSystemMetrics(SM_CYEDGE),
|
||||
x, 17, TRUE);
|
||||
MoveWindow(hwndSBAR, 0, y, x, 17, TRUE);
|
||||
|
||||
if (mouse_capture) {
|
||||
GetWindowRect(hwndRender, &r);
|
||||
ClipCursor(&r);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user