mirror of
https://github.com/86Box/86Box.git
synced 2025-01-23 01:31:51 -05:00
Merge branch '86Box:master' into master
This commit is contained in:
commit
901b4cc730
7 changed files with 500 additions and 80 deletions
|
@ -11,8 +11,10 @@
|
|||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Jasmine Iwanek, <jriwanek@gmail.com>
|
||||
*
|
||||
* Copyright 2020 Miran Grca.
|
||||
* Copyright 2020 Miran Grca.
|
||||
* Copyright 2022-2023 Jasmine Iwanek.
|
||||
*/
|
||||
|
||||
#ifndef EMU_FLASH_H
|
||||
|
@ -26,10 +28,36 @@ extern const device_t intel_flash_bxb_device;
|
|||
|
||||
extern const device_t sst_flash_29ee010_device;
|
||||
extern const device_t sst_flash_29ee020_device;
|
||||
|
||||
extern const device_t winbond_flash_w29c512_device;
|
||||
extern const device_t winbond_flash_w29c010_device;
|
||||
extern const device_t winbond_flash_w29c020_device;
|
||||
extern const device_t winbond_flash_w29c040_device;
|
||||
|
||||
extern const device_t sst_flash_39sf512_device;
|
||||
extern const device_t sst_flash_39sf010_device;
|
||||
extern const device_t sst_flash_39sf020_device;
|
||||
extern const device_t sst_flash_39sf040_device;
|
||||
|
||||
extern const device_t sst_flash_39lf512_device;
|
||||
extern const device_t sst_flash_39lf010_device;
|
||||
extern const device_t sst_flash_39lf020_device;
|
||||
extern const device_t sst_flash_39lf040_device;
|
||||
extern const device_t sst_flash_39lf080_device;
|
||||
extern const device_t sst_flash_39lf016_device;
|
||||
|
||||
extern const device_t sst_flash_49lf002_device;
|
||||
extern const device_t sst_flash_49lf020_device;
|
||||
extern const device_t sst_flash_49lf020a_device;
|
||||
extern const device_t sst_flash_49lf003_device;
|
||||
extern const device_t sst_flash_49lf030_device;
|
||||
extern const device_t sst_flash_49lf004_device;
|
||||
extern const device_t sst_flash_49lf004c_device;
|
||||
extern const device_t sst_flash_49lf040_device;
|
||||
extern const device_t sst_flash_49lf008_device;
|
||||
extern const device_t sst_flash_49lf008c_device;
|
||||
extern const device_t sst_flash_49lf080_device;
|
||||
extern const device_t sst_flash_49lf016_device;
|
||||
extern const device_t sst_flash_49lf160_device;
|
||||
|
||||
#endif /*EMU_FLASH_H*/
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
#ifndef PLAT_DIR_H
|
||||
#define PLAT_DIR_H
|
||||
|
||||
/* Windows needs the POSIX re-implementations */
|
||||
#if defined(_WIN32)
|
||||
/* Windows and Termux needs the POSIX re-implementations */
|
||||
#if defined(_WIN32) || defined(__TERMUX__)
|
||||
# ifdef _MAX_FNAME
|
||||
# define MAXNAMLEN _MAX_FNAME
|
||||
# else
|
||||
|
|
|
@ -13,10 +13,12 @@
|
|||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Melissa Goad, <mszoopers@protonmail.com>
|
||||
* Jasmine Iwanek, <jriwanek@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
* Copyright 2020 Melissa Goad.
|
||||
* Copyright 2020 Melissa Goad.
|
||||
* Copyright 2022-2023 Jasmine Iwanek.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
@ -67,23 +69,69 @@ static char flash_path[1024];
|
|||
/* 1st cycle variant only on 39 */
|
||||
|
||||
#define SST 0xbf /* SST Manufacturer's ID */
|
||||
|
||||
#define SST29EE512 0x5d00
|
||||
#define SST29LE_VE512 0x3d00
|
||||
#define SST29EE010 0x0700
|
||||
#define SST29LE_VE010 0x0800
|
||||
#define SST29EE020 0x1000
|
||||
#define SST29LE_VE020 0x1200
|
||||
|
||||
#define SST39SF512 0xb400
|
||||
#define SST39SF010 0xb500
|
||||
#define SST39SF020 0xb600
|
||||
#define SST39SF040 0xb700
|
||||
|
||||
#define WINBOND 0xda /* Winbond Manufacturer's ID */
|
||||
#define W29C010 0xC100
|
||||
#define W29C020 0x4500
|
||||
#define SST39LF512 0xd400
|
||||
#define SST39LF010 0xd500
|
||||
#define SST39LF020 0xd600
|
||||
#define SST39LF040 0xd700
|
||||
#define SST39LF080 0xd800
|
||||
#define SST39LF016 0xd900
|
||||
|
||||
#define SIZE_512K 0x010000
|
||||
#define SIZE_1M 0x020000
|
||||
#define SIZE_2M 0x040000
|
||||
#define SIZE_4M 0x080000
|
||||
/*
|
||||
// 16 wide
|
||||
#define SST39WF400 0x272f
|
||||
#define SST39WF400B 0x272e
|
||||
#define SST39WF800 0x273f
|
||||
#define SST39WF800B 0x273e
|
||||
#define SST39WF1601 0xbf274b
|
||||
#define SST39WF1602 0xbf274a
|
||||
|
||||
#define SST39LF100 0x2788
|
||||
#define SST39LF200 0x2789
|
||||
#define SST39LF400 0x2780
|
||||
#define SST39LF800 0x2781
|
||||
#define SST39LF160 0x2782
|
||||
*/
|
||||
|
||||
#define SST49LF002 0x5700
|
||||
#define SST49LF020 0x6100
|
||||
#define SST49LF020A 0x5200
|
||||
#define SST49LF003 0x1b00
|
||||
#define SST49LF004 0x6000
|
||||
#define SST49LF004C 0x5400
|
||||
#define SST49LF040 0x5100
|
||||
#define SST49LF008 0x5a00
|
||||
#define SST49LF008C 0x5900
|
||||
#define SST49LF080 0x5b00
|
||||
#define SST49LF030 0x1c00
|
||||
#define SST49LF160 0x4c00
|
||||
#define SST49LF016 0x5c00
|
||||
|
||||
#define WINBOND 0xda /* Winbond Manufacturer's ID */
|
||||
#define W29C512 0xc800
|
||||
#define W29C010 0xc100
|
||||
#define W29C020 0x4500
|
||||
#define W29C040 0x4600
|
||||
|
||||
#define SIZE_512K 0x010000
|
||||
#define SIZE_1M 0x020000
|
||||
#define SIZE_2M 0x040000
|
||||
#define SIZE_3M 0x060000
|
||||
#define SIZE_4M 0x080000
|
||||
#define SIZE_8M 0x100000
|
||||
#define SIZE_16M 0x200000
|
||||
|
||||
static void
|
||||
sst_sector_erase(sst_t *dev, uint32_t addr)
|
||||
|
@ -483,20 +531,6 @@ const device_t sst_flash_29ee010_device = {
|
|||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t winbond_flash_w29c010_device = {
|
||||
.name = "Winbond W29C010 Flash BIOS",
|
||||
.internal_name = "winbond_flash_w29c010",
|
||||
.flags = 0,
|
||||
.local = WINBOND | W29C010 | SIZE_1M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_29ee020_device = {
|
||||
.name = "SST 29EE020 Flash BIOS",
|
||||
.internal_name = "sst_flash_29ee020",
|
||||
|
@ -511,6 +545,34 @@ const device_t sst_flash_29ee020_device = {
|
|||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t winbond_flash_w29c512_device = {
|
||||
.name = "Winbond W29C512 Flash BIOS",
|
||||
.internal_name = "winbond_flash_w29c512",
|
||||
.flags = 0,
|
||||
.local = WINBOND | W29C010 | SIZE_512K,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t winbond_flash_w29c010_device = {
|
||||
.name = "Winbond W29C010 Flash BIOS",
|
||||
.internal_name = "winbond_flash_w29c010",
|
||||
.flags = 0,
|
||||
.local = WINBOND | W29C010 | SIZE_1M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t winbond_flash_w29c020_device = {
|
||||
.name = "Winbond W29C020 Flash BIOS",
|
||||
.internal_name = "winbond_flash_w29c020",
|
||||
|
@ -525,6 +587,34 @@ const device_t winbond_flash_w29c020_device = {
|
|||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t winbond_flash_w29c040_device = {
|
||||
.name = "Winbond W29C040 Flash BIOS",
|
||||
.internal_name = "winbond_flash_w29c040",
|
||||
.flags = 0,
|
||||
.local = WINBOND | W29C040 | SIZE_4M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_39sf512_device = {
|
||||
.name = "SST 39SF512 Flash BIOS",
|
||||
.internal_name = "sst_flash_39sf512",
|
||||
.flags = 0,
|
||||
.local = SST | SST39SF512 | SIZE_512K,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_39sf010_device = {
|
||||
.name = "SST 39SF010 Flash BIOS",
|
||||
.internal_name = "sst_flash_39sf010",
|
||||
|
@ -566,3 +656,278 @@ const device_t sst_flash_39sf040_device = {
|
|||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_39lf512_device = {
|
||||
.name = "SST 39LF512 Flash BIOS",
|
||||
.internal_name = "sst_flash_39lf512",
|
||||
.flags = 0,
|
||||
.local = SST | SST39LF512 | SIZE_512K,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_39lf010_device = {
|
||||
.name = "SST 39LF010 Flash BIOS",
|
||||
.internal_name = "sst_flash_39lf010",
|
||||
.flags = 0,
|
||||
.local = SST | SST39LF010 | SIZE_1M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_39lf020_device = {
|
||||
.name = "SST 39LF020 Flash BIOS",
|
||||
.internal_name = "sst_flash_39lf020",
|
||||
.flags = 0,
|
||||
.local = SST | SST39LF020 | SIZE_2M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_39lf040_device = {
|
||||
.name = "SST 39LF040 Flash BIOS",
|
||||
.internal_name = "sst_flash_39lf040",
|
||||
.flags = 0,
|
||||
.local = SST | SST39LF040 | SIZE_4M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_39lf080_device = {
|
||||
.name = "SST 39LF080 Flash BIOS",
|
||||
.internal_name = "sst_flash_39lf080",
|
||||
.flags = 0,
|
||||
.local = SST | SST39LF080 | SIZE_8M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_39lf016_device = {
|
||||
.name = "SST 39LF016 Flash BIOS",
|
||||
.internal_name = "sst_flash_39lf016",
|
||||
.flags = 0,
|
||||
.local = SST | SST39LF016 | SIZE_16M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* Firmware Hubs. The FWH signals are not implemented yet. Firmware Hubs do write cycles
|
||||
* to read/write on the flash. SST Flashes still do traditional flashing via PP Mode. Our
|
||||
* BIOS firmwares don't seem to utilize FWH R/W thus the FWH ports remain unknown for an
|
||||
* implementation. We just contain the ID's so the BIOS can do ESCD & DMI writes with no
|
||||
* worries.
|
||||
*/
|
||||
|
||||
const device_t sst_flash_49lf002_device = {
|
||||
.name = "SST 49LF002 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf002",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF002 | SIZE_2M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf020_device = {
|
||||
.name = "SST 49LF020 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf0020",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF020 | SIZE_2M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf020a_device = {
|
||||
.name = "SST 49LF020A Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf0020a",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF020A | SIZE_2M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf003_device = {
|
||||
.name = "SST 49LF003 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf003",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF003 | SIZE_3M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf030_device = {
|
||||
.name = "SST 49LF030 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf030",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF030 | SIZE_3M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf004_device = {
|
||||
.name = "SST 49LF004 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf004",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF004 | SIZE_4M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf004c_device = {
|
||||
.name = "SST 49LF004C Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf004c",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF004C | SIZE_4M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf040_device = {
|
||||
.name = "SST 49LF040 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf040",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF040 | SIZE_4M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf008_device = {
|
||||
.name = "SST 49LF008 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf008",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF008 | SIZE_8M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf008c_device = {
|
||||
.name = "SST 49LF008C Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf008c",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF008C | SIZE_8M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf080_device = {
|
||||
.name = "SST 49LF080 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf080",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF080 | SIZE_8M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf016_device = {
|
||||
.name = "SST 49LF016 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf016",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF016 | SIZE_16M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t sst_flash_49lf160_device = {
|
||||
|
||||
.name = "SST 49LF160 Firmware Hub",
|
||||
.internal_name = "sst_flash_49lf160",
|
||||
.flags = 0,
|
||||
.local = SST | SST49LF160 | SIZE_16M,
|
||||
.init = sst_init,
|
||||
.close = sst_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
|
|
@ -76,22 +76,37 @@ parse_valuators(const double *input_values,
|
|||
|
||||
static bool exitthread = false;
|
||||
|
||||
static int
|
||||
xinput2_get_xtest_pointer()
|
||||
{
|
||||
/* The XTEST pointer events injected by VNC servers to move the cursor always report
|
||||
absolute coordinates, despite XTEST declaring relative axes (related: SDL issue 1836).
|
||||
This looks for the XTEST pointer so that we can assume it's absolute as a workaround. */
|
||||
int devs;
|
||||
XIDeviceInfo *info = XIQueryDevice(disp, XIAllDevices, &devs), *dev;
|
||||
for (int i = 0; i < devs; i++) {
|
||||
dev = &info[i];
|
||||
if ((dev->use == XISlavePointer) && !strcmp(dev->name, "Virtual core XTEST pointer"))
|
||||
return dev->deviceid;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
xinput2_proc()
|
||||
{
|
||||
Window win;
|
||||
win = DefaultRootWindow(disp);
|
||||
|
||||
int xtest_pointer = xinput2_get_xtest_pointer();
|
||||
|
||||
ximask.deviceid = XIAllMasterDevices;
|
||||
ximask.mask_len = XIMaskLen(XI_LASTEVENT);
|
||||
ximask.mask = (unsigned char *) calloc(ximask.mask_len, sizeof(unsigned char));
|
||||
|
||||
XISetMask(ximask.mask, XI_RawKeyPress);
|
||||
XISetMask(ximask.mask, XI_RawKeyRelease);
|
||||
XISetMask(ximask.mask, XI_RawButtonPress);
|
||||
XISetMask(ximask.mask, XI_RawButtonRelease);
|
||||
XISetMask(ximask.mask, XI_RawMotion);
|
||||
XISetMask(ximask.mask, XI_Motion);
|
||||
XISetMask(ximask.mask, XI_DeviceChanged);
|
||||
|
||||
XISelectEvents(disp, win, &ximask, 1);
|
||||
|
||||
|
@ -134,7 +149,7 @@ common_motion:
|
|||
const XIValuatorClassInfo *v = (const XIValuatorClassInfo *) xidevinfo->classes[i];
|
||||
if (v->type == XIValuatorClass) {
|
||||
/* Is this an absolute or relative axis? */
|
||||
if (v->mode == XIModeRelative) {
|
||||
if ((v->mode == XIModeRelative) && (rawev->sourceid != xtest_pointer)) {
|
||||
/* Set relative coordinates. */
|
||||
if (axis == 0)
|
||||
xi2_mouse_x = xi2_mouse_x + coords[axis];
|
||||
|
@ -145,19 +160,30 @@ common_motion:
|
|||
int disp_screen = XDefaultScreen(disp);
|
||||
double abs_div;
|
||||
if (axis == 0) {
|
||||
abs_div = (v->max - v->min) / (double) XDisplayWidth(disp, disp_screen);
|
||||
if (abs_div <= 0)
|
||||
abs_div = 1;
|
||||
abs_div = (coords[axis] - v->min) / abs_div;
|
||||
if (v->mode == XIModeRelative) {
|
||||
/* XTEST axes have dummy min/max values because they're nominally relative,
|
||||
but in practice, the injected absolute coordinates are already in pixels. */
|
||||
abs_div = coords[axis];
|
||||
} else {
|
||||
abs_div = (v->max - v->min) / (double) XDisplayWidth(disp, disp_screen);
|
||||
if (abs_div <= 0)
|
||||
abs_div = 1;
|
||||
abs_div = (coords[axis] - v->min) / abs_div;
|
||||
}
|
||||
|
||||
if (xi2_mouse_abs_x != 0)
|
||||
xi2_mouse_x = xi2_mouse_x + (abs_div - xi2_mouse_abs_x);
|
||||
xi2_mouse_abs_x = abs_div;
|
||||
} else {
|
||||
abs_div = (v->max - v->min) / (double) XDisplayHeight(disp, disp_screen);
|
||||
if (abs_div <= 0)
|
||||
abs_div = 1;
|
||||
abs_div = (coords[axis] - v->min) / abs_div;
|
||||
if (v->mode == XIModeRelative) {
|
||||
/* Same as above. */
|
||||
abs_div = coords[axis];
|
||||
} else {
|
||||
abs_div = (v->max - v->min) / (double) XDisplayHeight(disp, disp_screen);
|
||||
if (abs_div <= 0)
|
||||
abs_div = 1;
|
||||
abs_div = (coords[axis] - v->min) / abs_div;
|
||||
}
|
||||
|
||||
if (xi2_mouse_abs_y != 0)
|
||||
xi2_mouse_y = xi2_mouse_y + (abs_div - xi2_mouse_abs_y);
|
||||
|
@ -181,6 +207,14 @@ common_motion:
|
|||
XFlush(disp);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case XI_DeviceChanged:
|
||||
{
|
||||
/* Re-scan for XTEST pointer, just in case. */
|
||||
xtest_pointer = xinput2_get_xtest_pointer();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ static void
|
|||
ali5123_fdc_handler(ali5123_t *dev)
|
||||
{
|
||||
uint16_t ld_port = 0;
|
||||
uint8_t global_enable = !!(dev->regs[0x22] & (1 << 0));
|
||||
uint8_t global_enable = !(dev->regs[0x22] & (1 << 0));
|
||||
uint8_t local_enable = !!dev->ld_regs[0][0x30];
|
||||
|
||||
fdc_remove(dev->fdc);
|
||||
|
@ -81,7 +81,7 @@ static void
|
|||
ali5123_lpt_handler(ali5123_t *dev)
|
||||
{
|
||||
uint16_t ld_port = 0;
|
||||
uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
|
||||
uint8_t global_enable = !(dev->regs[0x22] & (1 << 3));
|
||||
uint8_t local_enable = !!dev->ld_regs[3][0x30];
|
||||
uint8_t lpt_irq = dev->ld_regs[3][0x70];
|
||||
|
||||
|
@ -100,9 +100,10 @@ ali5123_lpt_handler(ali5123_t *dev)
|
|||
static void
|
||||
ali5123_serial_handler(ali5123_t *dev, int uart)
|
||||
{
|
||||
uint8_t uart_nos[2][3]= { { 4, 5, 0xb }, { 4, 0xb, 5 } };
|
||||
uint16_t ld_port = 0;
|
||||
uint8_t uart_no = (uart == 2) ? 0x0b : (4 + uart);
|
||||
uint8_t global_enable = !!(dev->regs[0x22] & (1 << uart_no));
|
||||
uint8_t uart_no = uart_nos[!!(dev->regs[0x2d] & 0x20)][uart];
|
||||
uint8_t global_enable = !(dev->regs[0x22] & (1 << (4 + uart)));
|
||||
uint8_t local_enable = !!dev->ld_regs[uart_no][0x30];
|
||||
uint8_t mask = (uart == 1) ? 0x04 : 0x05;
|
||||
|
||||
|
@ -207,8 +208,7 @@ ali5123_write(uint16_t port, uint8_t val, void *priv)
|
|||
{
|
||||
ali5123_t *dev = (ali5123_t *) priv;
|
||||
uint8_t index = (port & 1) ? 0 : 1;
|
||||
uint8_t valxor = 0x00, keep = 0x00;
|
||||
uint8_t cur_ld;
|
||||
uint8_t valxor = 0x00, cur_ld = dev->regs[7];
|
||||
|
||||
if (index) {
|
||||
if (((val == 0x51) && (!dev->tries) && (!dev->locked)) || ((val == 0x23) && (dev->tries) && (!dev->locked))) {
|
||||
|
@ -236,27 +236,23 @@ ali5123_write(uint16_t port, uint8_t val, void *priv)
|
|||
if (dev->locked) {
|
||||
if (dev->cur_reg < 48) {
|
||||
valxor = val ^ dev->regs[dev->cur_reg];
|
||||
if ((val == 0x1f) || (val == 0x20) || (val == 0x21))
|
||||
if ((val >= 0x1f) && (val <= 0x21))
|
||||
return;
|
||||
dev->regs[dev->cur_reg] = val;
|
||||
} else {
|
||||
valxor = val ^ dev->ld_regs[dev->regs[7]][dev->cur_reg];
|
||||
if (((dev->cur_reg & 0xf0) == 0x70) && (dev->regs[7] < 4))
|
||||
valxor = val ^ dev->ld_regs[cur_ld][dev->cur_reg];
|
||||
if (((dev->cur_reg & 0xf0) == 0x70) && (cur_ld < 4))
|
||||
return;
|
||||
/* Block writes to some logical devices. */
|
||||
if (dev->regs[7] > 0x0c)
|
||||
if (cur_ld > 0x0c)
|
||||
return;
|
||||
else
|
||||
switch (dev->regs[7]) {
|
||||
case 0x01:
|
||||
case 0x02:
|
||||
case 0x06:
|
||||
case 0x08:
|
||||
case 0x09:
|
||||
case 0x0a:
|
||||
return;
|
||||
}
|
||||
dev->ld_regs[dev->regs[7]][dev->cur_reg] = val | keep;
|
||||
else switch (cur_ld) {
|
||||
case 0x01: case 0x02:
|
||||
case 0x06:
|
||||
case 0x08 ... 0x0a:
|
||||
return;
|
||||
}
|
||||
dev->ld_regs[cur_ld][dev->cur_reg] = val;
|
||||
}
|
||||
} else
|
||||
return;
|
||||
|
@ -281,16 +277,18 @@ ali5123_write(uint16_t port, uint8_t val, void *priv)
|
|||
if (valxor & 0x40)
|
||||
ali5123_serial_handler(dev, 2);
|
||||
break;
|
||||
case 0x2d:
|
||||
if (valxor & 0x20) {
|
||||
ali5123_serial_handler(dev, 1);
|
||||
ali5123_serial_handler(dev, 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
cur_ld = dev->regs[7];
|
||||
if ((dev->regs[7] == 5) && (dev->regs[0x2d] & 0x20))
|
||||
cur_ld = 0x0b;
|
||||
else if ((dev->regs[7] == 0x0b) && (dev->regs[0x2d] & 0x20))
|
||||
cur_ld = 5;
|
||||
switch (cur_ld) {
|
||||
case 0:
|
||||
/* FDD */
|
||||
|
@ -299,7 +297,7 @@ ali5123_write(uint16_t port, uint8_t val, void *priv)
|
|||
case 0x60:
|
||||
case 0x61:
|
||||
if ((dev->cur_reg == 0x30) && (val & 0x01))
|
||||
dev->regs[0x22] |= 0x01;
|
||||
dev->regs[0x22] &= ~0x01;
|
||||
if (valxor)
|
||||
ali5123_fdc_handler(dev);
|
||||
break;
|
||||
|
@ -339,7 +337,7 @@ ali5123_write(uint16_t port, uint8_t val, void *priv)
|
|||
case 0x61:
|
||||
case 0x70:
|
||||
if ((dev->cur_reg == 0x30) && (val & 0x01))
|
||||
dev->regs[0x22] |= 0x08;
|
||||
dev->regs[0x22] &= ~0x08;
|
||||
if (valxor)
|
||||
ali5123_lpt_handler(dev);
|
||||
break;
|
||||
|
@ -354,7 +352,7 @@ ali5123_write(uint16_t port, uint8_t val, void *priv)
|
|||
case 0x70:
|
||||
case 0xf0:
|
||||
if ((dev->cur_reg == 0x30) && (val & 0x01))
|
||||
dev->regs[0x22] |= 0x10;
|
||||
dev->regs[0x22] &= ~0x10;
|
||||
if (valxor)
|
||||
ali5123_serial_handler(dev, 0);
|
||||
break;
|
||||
|
@ -369,9 +367,9 @@ ali5123_write(uint16_t port, uint8_t val, void *priv)
|
|||
case 0x70:
|
||||
case 0xf0:
|
||||
if ((dev->cur_reg == 0x30) && (val & 0x01))
|
||||
dev->regs[0x22] |= 0x20;
|
||||
dev->regs[0x22] &= ~((dev->regs[0x2d] & 0x20) ? 0x40 : 0x20);
|
||||
if (valxor)
|
||||
ali5123_serial_handler(dev, 1);
|
||||
ali5123_serial_handler(dev, (dev->regs[0x2d] & 0x20) ? 2 : 1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -384,9 +382,9 @@ ali5123_write(uint16_t port, uint8_t val, void *priv)
|
|||
case 0x70:
|
||||
case 0xf0:
|
||||
if ((dev->cur_reg == 0x30) && (val & 0x01))
|
||||
dev->regs[0x22] |= 0x40;
|
||||
dev->regs[0x22] &= ~((dev->regs[0x2d] & 0x20) ? 0x20 : 0x40);
|
||||
if (valxor)
|
||||
ali5123_serial_handler(dev, 2);
|
||||
ali5123_serial_handler(dev, (dev->regs[0x2d] & 0x20) ? 1 : 2);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -411,11 +409,6 @@ ali5123_read(uint16_t port, void *priv)
|
|||
ret = dev->regs[dev->cur_reg];
|
||||
} else {
|
||||
cur_ld = dev->regs[7];
|
||||
if ((dev->regs[7] == 5) && (dev->regs[0x2d] & 0x20))
|
||||
cur_ld = 0x0b;
|
||||
else if ((dev->regs[7] == 0x0b) && (dev->regs[0x2d] & 0x20))
|
||||
cur_ld = 5;
|
||||
|
||||
ret = dev->ld_regs[cur_ld][dev->cur_reg];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -624,11 +624,11 @@ ui_msgbox_header(int flags, void *header, void *message)
|
|||
SDL_MessageBoxData msgdata;
|
||||
SDL_MessageBoxButtonData msgbtn;
|
||||
if (!header)
|
||||
header = (flags & MBX_ANSI) ? "86Box" : L"86Box";
|
||||
header = (void *) (flags & MBX_ANSI) ? "86Box" : L"86Box";
|
||||
if (header <= (void *) 7168)
|
||||
header = plat_get_string(header);
|
||||
header = (void *) plat_get_string((int) header);
|
||||
if (message <= (void *) 7168)
|
||||
message = plat_get_string(message);
|
||||
message = (void *) plat_get_string((int) message);
|
||||
msgbtn.buttonid = 1;
|
||||
msgbtn.text = "OK";
|
||||
msgbtn.flags = 0;
|
||||
|
|
|
@ -470,7 +470,7 @@ win_settings_changed(void)
|
|||
i = i || (fm_driver != temp_fm_driver);
|
||||
|
||||
/* Network category */
|
||||
i = i || (net_cards_conf[i].net_type != temp_net_type);
|
||||
i = i || (net_cards_conf[0].net_type != temp_net_type);
|
||||
i = i || strcmp(temp_pcap_dev, net_cards_conf[0].host_dev_name);
|
||||
i = i || (net_cards_conf[0].device_num != temp_net_card);
|
||||
|
||||
|
@ -561,7 +561,7 @@ win_settings_save(void)
|
|||
fm_driver = temp_fm_driver;
|
||||
|
||||
/* Network category */
|
||||
net_cards_conf[i].net_type = temp_net_type;
|
||||
net_cards_conf[0].net_type = temp_net_type;
|
||||
memset(net_cards_conf[0].host_dev_name, '\0', sizeof(net_cards_conf[0].host_dev_name));
|
||||
strcpy(net_cards_conf[0].host_dev_name, temp_pcap_dev);
|
||||
net_cards_conf[0].device_num = temp_net_card;
|
||||
|
|
Loading…
Reference in a new issue