Merge remote-tracking branch 'origin/master' into version/4.1

This commit is contained in:
OBattler
2023-08-11 22:47:38 +02:00
41 changed files with 1068 additions and 971 deletions

View File

@@ -540,12 +540,25 @@ then
# Attempt to install dependencies.
sudo "$macports/bin/port" install $(cat .ci/dependencies_macports.txt) 2>&1 | tee macports.log
# Stop if no port version activation errors were found.
# Check for port activation errors.
stuck_dep=$(grep " cannot be built while another version of " macports.log | cut -d" " -f10)
[ -z $stuck_dep ] && break
if [ -n "$stuck_dep" ]
then
# Deactivate the stuck dependency and try again.
sudo "$macports/bin/port" -f deactivate "$stuck_dep"
continue
fi
# Deactivate the stuck dependency and try again.
sudo "$macports/bin/port" -f deactivate $stuck_dep
stuck_dep=$(grep " Please deactivate this port first, or " macports.log | cut -d" " -f5 | tr -d :)
if [ -n "$stuck_dep" ]
then
# Activate the stuck dependency and try again.
sudo "$macports/bin/port" -f activate "$stuck_dep"
continue
fi
# Stop if no errors were found.
break
done
# Remove MacPorts error detection log.

View File

@@ -141,12 +141,12 @@ acpi_update_irq(acpi_t *dev)
acpi_timer_update(dev, (dev->regs.pmen & TMROF_EN) && !(dev->regs.pmsts & TMROF_STS));
}
static void
acpi_do_raise_smi(void *priv, int do_smi, int is_apm)
void
acpi_raise_smi(void *priv, int do_smi)
{
acpi_t *dev = (acpi_t *) priv;
if (is_apm || (dev->regs.glbctl & 0x01)) {
if (dev->regs.glbctl & 0x01) {
if ((dev->vendor == VEN_VIA) || (dev->vendor == VEN_VIA_596B)) {
if (!dev->regs.smi_lock || !dev->regs.smi_active) {
if (do_smi)
@@ -168,12 +168,6 @@ acpi_do_raise_smi(void *priv, int do_smi, int is_apm)
}
}
void
acpi_raise_smi(void *priv, int do_smi)
{
acpi_do_raise_smi(priv, do_smi, 0);
}
static uint32_t
acpi_reg_read_common_regs(UNUSED(int size), uint16_t addr, void *priv)
{
@@ -1588,7 +1582,7 @@ acpi_apm_out(uint16_t port, uint8_t val, void *priv)
dev->apm->cmd = val;
if (dev->vendor == VEN_INTEL)
dev->regs.glbsts |= 0x20;
acpi_do_raise_smi(dev, dev->apm->do_smi, 1);
acpi_raise_smi(dev, dev->apm->do_smi);
} else
dev->apm->stat = val;
}

View File

@@ -439,13 +439,13 @@ device_has_config(const device_t *dev)
}
int
device_poll(const device_t *dev, int x, int y, int z, int b)
device_poll(const device_t *dev)
{
for (uint16_t c = 0; c < DEVICE_MAX; c++) {
if (devices[c] != NULL) {
if (devices[c] == dev) {
if (devices[c]->poll)
return (devices[c]->poll(x, y, z, b, 0, 0, device_priv[c]));
return (devices[c]->poll(device_priv[c]));
}
}
}
@@ -453,22 +453,6 @@ device_poll(const device_t *dev, int x, int y, int z, int b)
return 0;
}
void
device_register_pci_slot(const device_t *dev, int device, int type, int inta, int intb, int intc, int intd)
{
for (uint16_t c = 0; c < DEVICE_MAX; c++) {
if (devices[c] != NULL) {
if (devices[c] == dev) {
if (devices[c]->register_pci_slot)
devices[c]->register_pci_slot(device, type, inta, intb, intc, intd, device_priv[c]);
return;
}
}
}
return;
}
void
device_get_name(const device_t *dev, int bus, char *name)
{

View File

@@ -24,6 +24,8 @@ add_library(dev OBJECT bugger.c cassette.c cartridge.c hasp.c hwm.c hwm_lm75.c h
mouse.c mouse_bus.c mouse_serial.c mouse_ps2.c phoenix_486_jumper.c
mouse_wacom_tablet.c serial_passthrough.c)
target_link_libraries(86Box atomic)
if(ISAMEM_RAMPAGE)
target_compile_definitions(dev PRIVATE USE_ISAMEM_RAMPAGE)
endif()

View File

@@ -32,6 +32,8 @@
#include <86box/timer.h>
#include <86box/gdbstub.h>
#include <86box/mouse.h>
#include <86box/video.h>
#include <86box/plat.h>
#include <86box/plat_unused.h>
typedef struct mouse_t {
@@ -39,10 +41,6 @@ typedef struct mouse_t {
} mouse_t;
int mouse_type = 0;
atomic_int mouse_x;
atomic_int mouse_y;
atomic_int mouse_z;
atomic_int mouse_buttons;
int mouse_mode;
int mouse_timed = 1;
int mouse_tablet_in_proximity = 0;
@@ -52,8 +50,6 @@ double mouse_x_abs;
double mouse_y_abs;
double mouse_sensitivity = 1.0;
double mouse_x_error = 0.0;
double mouse_y_error = 0.0;
pc_timer_t mouse_timer; /* mouse event timer */
@@ -91,7 +87,7 @@ static mouse_t mouse_devices[] = {
{ &mouse_internal_device },
{ &mouse_logibus_device },
{ &mouse_msinport_device },
#if 0
#ifdef USE_GENIBUS
{ &mouse_genibus_device },
#endif
{ &mouse_mssystems_device },
@@ -104,10 +100,18 @@ static mouse_t mouse_devices[] = {
// clang-format on
};
static _Atomic double mouse_x;
static _Atomic double mouse_y;
static atomic_int mouse_z;
static atomic_int mouse_buttons;
static int mouse_delta_b;
static int mouse_old_b;
static const device_t *mouse_curr;
static void *mouse_priv;
static int mouse_nbut;
static int (*mouse_dev_poll)(int x, int y, int z, int b, void *priv);
static int (*mouse_dev_poll)(void *priv);
static void (*mouse_poll_ex)(void) = NULL;
static double sample_rate = 200.0;
@@ -130,33 +134,168 @@ mouse_log(const char *fmt, ...)
# define mouse_log(fmt, ...)
#endif
/* Initialize the mouse module. */
void
mouse_init(void)
mouse_clear_x(void)
{
/* Initialize local data. */
mouse_x = mouse_y = mouse_z = 0;
mouse_buttons = 0x00;
mouse_type = MOUSE_TYPE_NONE;
mouse_curr = NULL;
mouse_priv = NULL;
mouse_nbut = 0;
mouse_dev_poll = NULL;
mouse_x = 0.0;
}
void
mouse_close(void)
mouse_clear_y(void)
{
if (mouse_curr == NULL)
return;
mouse_y = 0.0;
}
mouse_curr = NULL;
mouse_priv = NULL;
mouse_nbut = 0;
mouse_dev_poll = NULL;
void
mouse_clear_coords(void)
{
mouse_clear_x();
mouse_clear_y();
timer_stop(&mouse_timer);
mouse_z = 0;
}
static void
mouse_clear_buttons(void)
{
mouse_buttons = 0x00;
mouse_old_b = 0x00;
mouse_delta_b = 0x00;
}
void
mouse_subtract_x(int *delta_x, int *o_x, int min, int max, int abs)
{
double real_x = mouse_x;
double smax_x;
double rsmin_x;
double smin_x;
rsmin_x = (double) min;
if (abs) {
smax_x = (double) max + ABS(rsmin_x);
max += ABS(min);
real_x += rsmin_x;
smin_x = 0;
} else {
smax_x = (double) max;
smin_x = rsmin_x;
}
/* Default the X and Y overflows to 1. */
if (o_x != NULL)
*o_x = 1;
if (real_x > smax_x) {
*delta_x = abs ? (int) real_x : max;
real_x -= smax_x;
} else if (real_x < smin_x) {
*delta_x = abs ? (int) real_x : min;
real_x += ABS(smin_x);
} else {
*delta_x = (int) real_x;
real_x = 0.0;
if (o_x != NULL)
*o_x = 0;
}
if (abs)
real_x -= rsmin_x;
mouse_x = real_x;
}
/* It appears all host platforms give us y in the Microsoft format
(positive to the south), so for all non-Microsoft report formsts,
we have to invert that. */
void
mouse_subtract_y(int *delta_y, int *o_y, int min, int max, int invert, int abs)
{
double real_y = mouse_y;
double smax_y;
double rsmin_y;
double smin_y;
if (invert)
real_y = -real_y;
rsmin_y = (double) min;
if (abs) {
smax_y = (double) max + ABS(rsmin_y);
max += ABS(min);
real_y += rsmin_y;
smin_y = 0;
} else {
smax_y = (double) max;
smin_y = rsmin_y;
}
/* Default the X and Y overflows to 1. */
if (o_y != NULL)
*o_y = 1;
if (real_y > smax_y) {
*delta_y = abs ? (int) real_y : max;
real_y -= smax_y;
} else if (real_y < smin_y) {
*delta_y = abs ? (int) real_y : min;
real_y += ABS(smin_y);
} else {
*delta_y = (int) real_y;
real_y = 0.0;
if (o_y != NULL)
*o_y = 0;
}
if (abs)
real_y -= rsmin_y;
if (invert)
real_y = -real_y;
mouse_y = real_y;
}
/* It appears all host platforms give us y in the Microsoft format
(positive to the south), so for all non-Microsoft report formsts,
we have to invenrt that. */
void
mouse_subtract_coords(int *delta_x, int *delta_y, int *o_x, int *o_y,
int min, int max, int invert, int abs)
{
mouse_subtract_x(delta_x, o_x, min, max, abs);
mouse_subtract_y(delta_y, o_y, min, max, invert, abs);
}
int
mouse_moved(void)
{
/* Convert them to integer so we treat < 1.0 and > -1.0 as 0. */
int ret = (((int) floor(mouse_x) != 0) || ((int) floor(mouse_y) != 0));
return ret;
}
int
mouse_state_changed(void)
{
int b_mask = (1 << mouse_nbut) - 1;
int wheel = (mouse_nbut >= 4);
int ret;
mouse_delta_b = (mouse_buttons ^ mouse_old_b);
mouse_old_b = mouse_buttons;
ret = mouse_moved() || ((mouse_z != 0) && wheel) || (mouse_delta_b & b_mask);
return ret;
}
int
mouse_mbut_changed(void)
{
return !!(mouse_delta_b & 0x04);
}
static void
@@ -178,34 +317,27 @@ mouse_timer_poll(UNUSED(void *priv))
void
mouse_scale(int x, int y)
{
double scaled_x = (((double) x) * mouse_sensitivity) + mouse_x_error;
double scaled_y = (((double) y) * mouse_sensitivity) + mouse_y_error;
double ratio_x = (double) monitors[0].mon_unscaled_size_x / (double) monitors[0].mon_res_x;
double ratio_y = (double) monitors[0].mon_efscrnsz_y / (double) monitors[0].mon_res_y;
mouse_x += (int) scaled_x;
mouse_y += (int) scaled_y;
mouse_x_error = scaled_x - floor(scaled_x);
mouse_y_error = scaled_y - floor(scaled_y);
mouse_x += (((double) x) * mouse_sensitivity * ratio_x);
mouse_y += (((double) y) * mouse_sensitivity * ratio_y);
}
void
mouse_scale_x(int x)
{
double scaled_x = ((double) x) * mouse_sensitivity + mouse_x_error;
double ratio_x = (double) monitors[0].mon_unscaled_size_x / (double) monitors[0].mon_res_x;
mouse_x += (int) scaled_x;
mouse_x_error = scaled_x - ((double) mouse_x);
mouse_x += (((double) x) * mouse_sensitivity * ratio_x);
}
void
mouse_scale_y(int y)
{
double scaled_y = ((double) y) * mouse_sensitivity + mouse_y_error;
double ratio_y = (double) monitors[0].mon_efscrnsz_y / (double) monitors[0].mon_res_y;
mouse_y += (int) scaled_y;
mouse_y_error = scaled_y - ((double) mouse_y);
mouse_y += (((double) y) * mouse_sensitivity * ratio_y);
}
void
@@ -214,6 +346,32 @@ mouse_set_z(int z)
mouse_z += z;
}
void
mouse_clear_z(void)
{
mouse_z = 0;
}
void
mouse_subtract_z(int *delta_z, int min, int max, int invert)
{
int real_z = invert ? -mouse_z : mouse_z;
if (mouse_z > max) {
*delta_z = max;
real_z -= max;
} else if (mouse_z < min) {
*delta_z = min;
real_z += ABS(min);
} else {
*delta_z = mouse_z;
mouse_clear_z();
real_z = 0;
}
mouse_z = invert ? -real_z : real_z;
}
void
mouse_set_buttons_ex(int b)
{
@@ -238,39 +396,6 @@ mouse_set_sample_rate(double new_rate)
timer_on_auto(&mouse_timer, 1000000.0 / sample_rate);
}
void
mouse_reset(void)
{
if (mouse_curr != NULL)
return; /* Mouse already initialized. */
mouse_log("MOUSE: reset(type=%d, '%s')\n",
mouse_type, mouse_devices[mouse_type].device->name);
/* Clear local data. */
mouse_x = mouse_y = mouse_z = 0;
mouse_buttons = 0x00;
mouse_mode = 0;
mouse_timed = 1;
mouse_x_error = mouse_y_error = 0.0;
/* If no mouse configured, we're done. */
if (mouse_type == 0)
return;
timer_add(&mouse_timer, mouse_timer_poll, NULL, 0);
/* Poll at 100 Hz, the default of a PS/2 mouse. */
sample_rate = 100.0;
timer_on_auto(&mouse_timer, 1000000.0 / sample_rate);
mouse_curr = mouse_devices[mouse_type].device;
if (mouse_curr != NULL)
mouse_priv = device_add(mouse_curr);
}
/* Callback from the hardware driver. */
void
mouse_set_buttons(int buttons)
@@ -279,9 +404,10 @@ mouse_set_buttons(int buttons)
}
void
mouse_set_poll_ex(void (*poll_ex)(void))
mouse_get_abs_coords(double *x_abs, double *y_abs)
{
mouse_poll_ex = poll_ex;
*x_abs = mouse_x_abs;
*y_abs = mouse_y_abs;
}
void
@@ -292,17 +418,22 @@ mouse_process(void)
if ((mouse_mode >= 1) && mouse_poll_ex)
mouse_poll_ex();
if ((mouse_dev_poll != NULL) || (mouse_curr->poll != NULL)) {
else if ((mouse_mode == 0) && ((mouse_dev_poll != NULL) || (mouse_curr->poll != NULL))) {
if (mouse_curr->poll != NULL)
mouse_curr->poll(mouse_x, mouse_y, mouse_z, mouse_buttons, mouse_x_abs, mouse_y_abs, mouse_priv);
mouse_curr->poll(mouse_priv);
else
mouse_dev_poll(mouse_x, mouse_y, mouse_z, mouse_buttons, mouse_priv);
mouse_dev_poll(mouse_priv);
}
}
void
mouse_set_poll(int (*func)(int, int, int, int, void *), void *arg)
mouse_set_poll_ex(void (*poll_ex)(void))
{
mouse_poll_ex = poll_ex;
}
void
mouse_set_poll(int (*func)(void *), void *arg)
{
if (mouse_type != MOUSE_TYPE_INTERNAL)
return;
@@ -364,3 +495,63 @@ mouse_get_ndev(void)
{
return ((sizeof(mouse_devices) / sizeof(mouse_t)) - 1);
}
void
mouse_reset(void)
{
if (mouse_curr != NULL)
return; /* Mouse already initialized. */
mouse_log("MOUSE: reset(type=%d, '%s')\n",
mouse_type, mouse_devices[mouse_type].device->name);
/* Clear local data. */
mouse_clear_coords();
mouse_clear_buttons();
mouse_mode = 0;
mouse_timed = 1;
/* If no mouse configured, we're done. */
if (mouse_type == 0)
return;
timer_add(&mouse_timer, mouse_timer_poll, NULL, 0);
/* Poll at 100 Hz, the default of a PS/2 mouse. */
sample_rate = 100.0;
timer_on_auto(&mouse_timer, 1000000.0 / sample_rate);
mouse_curr = mouse_devices[mouse_type].device;
if (mouse_curr != NULL)
mouse_priv = device_add(mouse_curr);
}
void
mouse_close(void)
{
if (mouse_curr == NULL)
return;
mouse_curr = NULL;
mouse_priv = NULL;
mouse_nbut = 0;
mouse_dev_poll = NULL;
timer_stop(&mouse_timer);
}
/* Initialize the mouse module. */
void
mouse_init(void)
{
/* Initialize local data. */
mouse_clear_coords();
mouse_clear_buttons();
mouse_type = MOUSE_TYPE_NONE;
mouse_curr = NULL;
mouse_priv = NULL;
mouse_nbut = 0;
mouse_dev_poll = NULL;
}

View File

@@ -475,10 +475,13 @@ ms_write(uint16_t port, uint8_t val, void *priv)
/* The emulator calls us with an update on the host mouse device. */
static int
bm_poll(int x, int y, UNUSED(int z), int b, UNUSED(double abs_x), UNUSED(double abs_y), void *priv)
bm_poll(void *priv)
{
mouse_t *dev = (mouse_t *) priv;
int xor ;
int delta_x;
int delta_y;
int xor;
int b = mouse_get_buttons_ex();
if (!mouse_capture && !video_fullscreen)
return 1;
@@ -486,8 +489,8 @@ bm_poll(int x, int y, UNUSED(int z), int b, UNUSED(double abs_x), UNUSED(double
if (!(dev->flags & FLAG_ENABLED))
return 1; /* Mouse is disabled, do nothing. */
if (!mouse_x && !mouse_y && !((b ^ dev->mouse_buttons_last) & 0x07)) {
dev->mouse_buttons_last = b;
if (!mouse_state_changed()) {
dev->mouse_buttons_last = 0x00;
return 1; /* State has not changed, do nothing. */
}
@@ -501,11 +504,11 @@ bm_poll(int x, int y, UNUSED(int z), int b, UNUSED(double abs_x), UNUSED(double
so update bits 6-3 here. */
/* If the mouse has moved, set bit 6. */
if (mouse_x || mouse_y)
if (mouse_moved())
dev->mouse_buttons |= 0x40;
/* Set bits 3-5 according to button state changes. */
xor = ((dev->current_b ^ dev->mouse_buttons) & 0x07) << 3;
xor = ((dev->current_b ^ mouse_get_buttons_ex()) & 0x07) << 3;
dev->mouse_buttons |= xor;
}
@@ -514,27 +517,10 @@ bm_poll(int x, int y, UNUSED(int z), int b, UNUSED(double abs_x), UNUSED(double
if (!dev->timer_enabled) {
/* If the counters are not frozen, update them. */
if (!(dev->flags & FLAG_HOLD)) {
if (mouse_x > 127) {
dev->current_x = 127;
mouse_x -= 127;
} else if (mouse_x < 1-128) {
dev->current_x = -128;
mouse_x += 128;
} else {
dev->current_x = mouse_x;
mouse_x = 0;
}
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 0, 0);
if (mouse_y > 127) {
dev->current_y = 127;
mouse_y -= 127;
} else if (mouse_y < 1-128) {
dev->current_y = -128;
mouse_y += 128;
} else {
dev->current_y = mouse_y;
mouse_y = 0;
}
dev->current_x = (int8_t) delta_x;
dev->current_y = (int8_t) delta_y;
dev->current_b = dev->mouse_buttons;
}
@@ -561,27 +547,7 @@ bm_update_data(mouse_t *dev)
/* If the counters are not frozen, update them. */
if ((mouse_capture || video_fullscreen) && !(dev->flags & FLAG_HOLD)) {
/* Update the deltas and the delays. */
if (mouse_x > 127) {
delta_x = 127;
mouse_x -= 127;
} else if (mouse_x < -128) {
delta_x = -128;
mouse_x += 128;
} else {
delta_x = mouse_x;
mouse_x = 0;
}
if (mouse_y > 127) {
delta_y = 127;
mouse_y -= 127;
} else if (mouse_y < -128) {
delta_y = -128;
mouse_y += 128;
} else {
delta_y = mouse_y;
mouse_y = 0;
}
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 0, 0);
dev->current_x = (int8_t) delta_x;
dev->current_y = (int8_t) delta_y;

View File

@@ -75,64 +75,40 @@ static void
ps2_report_coordinates(atkbc_dev_t *dev, int main)
{
uint8_t buff[3] = { 0x08, 0x00, 0x00 };
int temp_z;
int delta_x;
int delta_y;
int overflow_x;
int overflow_y;
int b = mouse_get_buttons_ex();
int delta_z;
if (mouse_x > 255) {
buff[0] |= 0x40;
buff[1] = 255;
mouse_x -= 255;
} else if (mouse_x < -256) {
buff[0] |= (0x40 | 0x10);
mouse_x += 256;
} else {
if (mouse_x < 0)
buff[0] |= 0x10;
buff[1] = mouse_x;
mouse_x = 0;
}
mouse_subtract_coords(&delta_x, &delta_y, &overflow_x, &overflow_y,
-256, 255, 1, 0);
mouse_subtract_z(&delta_z, -8, 7, 1);
if (mouse_y < -255) {
buff[0] |= 0x80;
buff[2] = 255;
mouse_y += 255;
} else if (mouse_y > 256) {
buff[0] |= (0x80 | 0x20);
mouse_y -= 256;
} else {
if (mouse_y > 0)
buff[0] |= 0x20;
buff[2] = -mouse_y;
mouse_y = 0;
}
if (dev->z < -7) {
temp_z = 7;
temp_z += 7;
} else if (mouse_z > 8) {
temp_z = (-8) & 0x0f;
mouse_z -= 8;
} else {
temp_z = (-mouse_y) & 0x0f;
mouse_z = 0;
}
buff[0] |= (mouse_buttons & ((dev->flags & FLAG_INTELLI) ? 0x07 : 0x03));
buff[0] = (overflow_y << 7) | (overflow_x << 6) |
((delta_y & 0x0100) >> 3) | ((delta_x & 0x0100) >> 4) |
(b & ((dev->flags & FLAG_INTELLI) ? 0x07 : 0x03));
buff[1] = (delta_x & 0x00ff);
buff[2] = (delta_y & 0x00ff);
kbc_at_dev_queue_add(dev, buff[0], main);
kbc_at_dev_queue_add(dev, buff[1], main);
kbc_at_dev_queue_add(dev, buff[2], main);
if (dev->flags & FLAG_INTMODE) {
delta_z &= 0x0f;
if (dev->flags & FLAG_5BTN) {
if (mouse_buttons & 8)
temp_z |= 0x10;
if (mouse_buttons & 16)
temp_z |= 0x20;
if (b & 8)
delta_z |= 0x10;
if (b & 16)
delta_z |= 0x20;
} else {
/* The wheel coordinate is sign-extended. */
if (temp_z & 0x08)
temp_z |= 0xf0;
if (delta_z & 0x08)
delta_z |= 0xf0;
}
kbc_at_dev_queue_add(dev, temp_z, main);
kbc_at_dev_queue_add(dev, delta_z, main);
}
}
@@ -162,6 +138,7 @@ static void
ps2_write(void *priv)
{
atkbc_dev_t *dev = (atkbc_dev_t *) priv;
int b;
uint8_t temp;
uint8_t val;
static uint8_t last_data[6] = { 0x00 };
@@ -220,15 +197,16 @@ ps2_write(void *priv)
case 0xe9: /* status request */
mouse_ps2_log("%s: Status request\n", dev->name);
b = mouse_get_buttons_ex();
kbc_at_dev_queue_add(dev, 0xfa, 0);
temp = (dev->flags & 0x20);
if (mouse_scan)
temp |= FLAG_ENABLED;
if (mouse_buttons & 1)
if (b & 1)
temp |= 4;
if (mouse_buttons & 2)
if (b & 2)
temp |= 1;
if ((mouse_buttons & 4) && (dev->flags & FLAG_INTELLI))
if ((b & 4) && (dev->flags & FLAG_INTELLI))
temp |= 2;
kbc_at_dev_queue_add(dev, temp, 0);
kbc_at_dev_queue_add(dev, dev->resolution, 0);
@@ -322,20 +300,16 @@ ps2_write(void *priv)
}
static int
ps2_poll(int x, int y, int z, int b, UNUSED(double abs_x), UNUSED(double abs_y), void *priv)
ps2_poll(void *priv)
{
atkbc_dev_t *dev = (atkbc_dev_t *) priv;
int packet_size = (dev->flags & FLAG_INTMODE) ? 4 : 3;
int cond = (!mouse_capture && !video_fullscreen) || (!mouse_scan || (!x && !y && !z && (b == dev->b))) ||
int cond = (!mouse_capture && !video_fullscreen) || (!mouse_scan || mouse_state_changed()) ||
((dev->mode == MODE_STREAM) && (kbc_at_dev_queue_pos(dev, 1) >= (FIFO_SIZE - packet_size)));
if (!cond) {
dev->b = b;
if (dev->mode == MODE_STREAM)
ps2_report_coordinates(dev, 1);
}
if (!cond && (dev->mode == MODE_STREAM))
ps2_report_coordinates(dev, 1);
return cond;
}
@@ -361,9 +335,6 @@ mouse_ps2_init(const device_t *info)
if (i > 4)
dev->flags |= FLAG_EXPLORER;
if (i >= 4)
i = 3;
mouse_ps2_log("%s: buttons=%d\n", dev->name, i);
/* Tell them how many buttons we have. */

View File

@@ -82,10 +82,8 @@ typedef struct mouse_t {
int8_t type; /* type of this device */
int8_t port;
int abs_x;
int abs_y;
int old_buttons;
int state;
int bps;
int rps;
@@ -177,97 +175,22 @@ sermouse_transmit(mouse_t *dev, int len, int from_report, int to_report)
sermouse_set_period(dev, dev->transmit_period);
}
/* It appears all host platforms give us y in the Microsoft format
(positive to the south), so for all non-Microsoft report formsts,
we have to invenrt that. */
static void
sermouse_subtract_coords(mouse_t *dev, int *delta_x, int *delta_y, int min, int max, int invert, int abs)
{
int real_y = mouse_y;
int abs_max = max + ABS(min);
if (invert)
real_y = -real_y;
if (mouse_x > max) {
if (abs) {
dev->abs_x += max;
*delta_x = dev->abs_x;
} else
*delta_x = max;
mouse_x -= max;
} else if (mouse_x < min) {
if (abs) {
dev->abs_x += min;
*delta_x = dev->abs_x;
} else
*delta_x = min;
mouse_x += ABS(min);
} else {
if (abs) {
dev->abs_x += mouse_x;
*delta_x = dev->abs_x;
} else
*delta_x = mouse_x;
mouse_x = 0;
}
if (real_y > max) {
if (abs) {
dev->abs_y += max;
*delta_y = dev->abs_y;
} else
*delta_y = max;
real_y -= max;
} else if (real_y < min) {
if (abs) {
dev->abs_y += min;
*delta_y = dev->abs_y;
} else
*delta_y = min;
real_y += ABS(min);
} else {
if (abs) {
dev->abs_y += real_y;
*delta_y = dev->abs_y;
} else
*delta_y = real_y;
real_y = 0;
}
if (abs) {
if (dev->abs_x < 0)
*delta_x = 0;
else if (dev->abs_x > abs_max)
*delta_x = abs_max;
if (dev->abs_y < 0)
*delta_y = 0;
else if (dev->abs_y > abs_max)
*delta_y = abs_max;
}
if (invert)
real_y = -real_y;
mouse_y = real_y;
}
static uint8_t
sermouse_report_msystems(mouse_t *dev)
{
int delta_x = 0;
int delta_y = 0;
int b = mouse_get_buttons_ex();
sermouse_subtract_coords(dev, &delta_x, &delta_y, -128, 127, 1, 0);
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 1, 0);
dev->buf[0] = 0x80;
dev->buf[0] |= (mouse_buttons & 0x01) ? 0x00 : 0x04; /* left button */
dev->buf[0] |= (b & 0x01) ? 0x00 : 0x04; /* left button */
if (dev->but >= 3)
dev->buf[0] |= (mouse_buttons & 0x04) ? 0x00 : 0x02; /* middle button */
dev->buf[0] |= (b & 0x04) ? 0x00 : 0x02; /* middle button */
else
dev->buf[0] |= 0x02; /* middle button */
dev->buf[0] |= (mouse_buttons & 0x02) ? 0x00 : 0x01; /* right button */
dev->buf[0] |= (b & 0x02) ? 0x00 : 0x01; /* right button */
dev->buf[1] = delta_x;
dev->buf[2] = delta_y;
dev->buf[2] = delta_x; /* same as byte 1 */
@@ -281,14 +204,15 @@ sermouse_report_3bp(mouse_t *dev)
{
int delta_x = 0;
int delta_y = 0;
int b = mouse_get_buttons_ex();
sermouse_subtract_coords(dev, &delta_x, &delta_y, -128, 127, 1, 0);
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 1, 0);
dev->buf[0] = 0x80;
dev->buf[0] |= (mouse_buttons & 0x01) ? 0x04 : 0x00; /* left button */
dev->buf[0] |= (b & 0x01) ? 0x04 : 0x00; /* left button */
if (dev->but >= 3)
dev->buf[0] |= (mouse_buttons & 0x04) ? 0x02 : 0x00; /* middle button */
dev->buf[0] |= (mouse_buttons & 0x02) ? 0x01 : 0x00; /* right button */
dev->buf[0] |= (b & 0x04) ? 0x02 : 0x00; /* middle button */
dev->buf[0] |= (b & 0x02) ? 0x01 : 0x00; /* right button */
dev->buf[1] = delta_x;
dev->buf[2] = delta_y;
dev->buf[2] = delta_x; /* same as byte 1 */
@@ -302,8 +226,9 @@ sermouse_report_mmseries(mouse_t *dev)
{
int delta_x = 0;
int delta_y = 0;
int b = mouse_get_buttons_ex();
sermouse_subtract_coords(dev, &delta_x, &delta_y, -127, 127, 1, 0);
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -127, 127, 1, 0);
dev->buf[0] = 0x80;
if (delta_x >= 0)
@@ -311,10 +236,10 @@ sermouse_report_mmseries(mouse_t *dev)
if (delta_y >= 0)
dev->buf[0] |= 0x08;
dev->buf[0] |= (mouse_buttons & 0x01) ? 0x04 : 0x00; /* left button */
dev->buf[0] |= (b & 0x01) ? 0x04 : 0x00; /* left button */
if (dev->but >= 3)
dev->buf[0] |= (mouse_buttons & 0x04) ? 0x02 : 0x00; /* middle button */
dev->buf[0] |= (mouse_buttons & 0x02) ? 0x01 : 0x00; /* right button */
dev->buf[0] |= (b & 0x04) ? 0x02 : 0x00; /* middle button */
dev->buf[0] |= (b & 0x02) ? 0x01 : 0x00; /* right button */
dev->buf[1] = ABS(delta_x) & 0x7f;
dev->buf[2] = ABS(delta_y) & 0x7f;
mouse_serial_log("MM series mouse report: %02X %02X %02X\n", dev->buf[0], dev->buf[1], dev->buf[2]);
@@ -327,14 +252,15 @@ sermouse_report_bp1(mouse_t *dev, int abs)
{
int delta_x = 0;
int delta_y = 0;
int b = mouse_get_buttons_ex();
sermouse_subtract_coords(dev, &delta_x, &delta_y, -2048, 2047, 1, abs);
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -2048, 2047, 1, abs);
dev->buf[0] = 0x80;
dev->buf[0] |= (mouse_buttons & 0x01) ? 0x10 : 0x00; /* left button */
dev->buf[0] |= (b & 0x01) ? 0x10 : 0x00; /* left button */
if (dev->but >= 3)
dev->buf[0] |= (mouse_buttons & 0x04) ? 0x08 : 0x00; /* middle button */
dev->buf[0] |= (mouse_buttons & 0x02) ? 0x04 : 0x00; /* right button */
dev->buf[0] |= (b & 0x04) ? 0x08 : 0x00; /* middle button */
dev->buf[0] |= (b & 0x02) ? 0x04 : 0x00; /* right button */
dev->buf[1] = (delta_x & 0x3f);
dev->buf[2] = ((delta_x >> 6) & 0x3f);
dev->buf[3] = (delta_y & 0x3f);
@@ -350,15 +276,17 @@ sermouse_report_ms(mouse_t *dev)
int delta_x = 0;
int delta_y = 0;
int delta_z = 0;
int b = mouse_get_buttons_ex();
sermouse_subtract_coords(dev, &delta_x, &delta_y, -128, 127, 0, 0);
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 0, 0);
mouse_subtract_z(&delta_z, -8, 7, 1);
dev->buf[0] = 0x40;
dev->buf[0] |= (((delta_y >> 6) & 0x03) << 2);
dev->buf[0] |= ((delta_x >> 6) & 0x03);
if (mouse_buttons & 0x01)
if (b & 0x01)
dev->buf[0] |= 0x20;
if (mouse_buttons & 0x02)
if (b & 0x02)
dev->buf[0] |= 0x10;
dev->buf[1] = delta_x & 0x3f;
dev->buf[2] = delta_y & 0x3f;
@@ -366,12 +294,12 @@ sermouse_report_ms(mouse_t *dev)
if (dev->but == 3) {
len = 3;
if (dev->format == FORMAT_MS) {
if (mouse_buttons & 0x04) {
if (b & 0x04) {
dev->buf[3] = 0x20;
len++;
}
} else {
if ((mouse_buttons ^ dev->old_buttons) & 0x04) {
if (mouse_mbut_changed()) {
/* Microsoft 3-button mice send a fourth byte of 0x00 when the middle button
has changed. */
dev->buf[3] = 0x00;
@@ -381,19 +309,8 @@ sermouse_report_ms(mouse_t *dev)
} else if (dev->but == 4) {
len = 4;
if (mouse_z > 7) {
delta_z = 7;
mouse_z -= 7;
} else if (mouse_z < -8) {
delta_z = -8;
mouse_z += 8;
} else {
delta_z = mouse_z;
mouse_z = 0;
}
dev->buf[3] = delta_z & 0x0f;
if (mouse_buttons & 0x04)
if (b & 0x04)
dev->buf[3] |= 0x10;
} else
len = 3;
@@ -408,13 +325,14 @@ sermouse_report_hex(mouse_t *dev)
uint8_t but = 0x00;
int delta_x = 0;
int delta_y = 0;
int b = mouse_get_buttons_ex();
sermouse_subtract_coords(dev, &delta_x, &delta_y, -128, 127, 1, 0);
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 1, 0);
but |= (mouse_buttons & 0x01) ? 0x04 : 0x00; /* left button */
but |= (b & 0x01) ? 0x04 : 0x00; /* left button */
if (dev->but >= 3)
but |= (mouse_buttons & 0x04) ? 0x02 : 0x00; /* middle button */
but |= (mouse_buttons & 0x02) ? 0x01 : 0x00; /* right button */
but |= (b & 0x04) ? 0x02 : 0x00; /* middle button */
but |= (b & 0x02) ? 0x01 : 0x00; /* right button */
sprintf(ret, "%01X%02X%02X", but & 0x0f, (int8_t) delta_x, (int8_t) delta_y);
@@ -465,16 +383,9 @@ sermouse_report(mouse_t *dev)
static void
sermouse_transmit_report(mouse_t *dev, int from_report)
{
int z_changed = (dev->but == 4) ? mouse_z : 0;
int b_changed = ((mouse_buttons ^ dev->old_buttons) & 0x07);
if (dev->but < 3)
b_changed &= ~0x04;
if (mouse_capture && (mouse_x || mouse_y || z_changed || b_changed)) {
if (mouse_capture && mouse_state_changed())
sermouse_transmit(dev, sermouse_report(dev), from_report, 1);
dev->old_buttons = mouse_buttons;
} else {
else {
if (dev->prompt || dev->continuous)
sermouse_set_period(dev, 0.0);
else {
@@ -496,7 +407,7 @@ sermouse_transmit_report(mouse_t *dev, int from_report)
}
static int
sermouse_poll(int x, int y, int z, int b, UNUSED(double abs_x), UNUSED(double abs_y), void *priv)
sermouse_poll(void *priv)
{
mouse_t *dev = (mouse_t *) priv;
@@ -611,6 +522,7 @@ static void
ltsermouse_process_command(mouse_t *dev)
{
int cmd_to_rps[9] = { 10, 20, 35, 70, 150, 0, -1, 100, 50 };
int b;
uint8_t format_codes[FORMATS_NUM] = {
[FORMAT_BP1_ABS] = 0x0c,
[FORMAT_BP1_REL] = 0x06,
@@ -669,7 +581,7 @@ ltsermouse_process_command(mouse_t *dev)
case 0x41:
/* Absolute Bit Pad One Packed Binary Format */
dev->abs_x = dev->abs_y = 0;
mouse_clear_coords();
fallthrough;
case 0x42: /* Relative Bit Pad One Packed Binary Format */
case 0x53: /* MM Series Data Format */
@@ -698,7 +610,8 @@ ltsermouse_process_command(mouse_t *dev)
break;
case 0x05:
/* Diagnostic */
dev->buf[0] = ((mouse_buttons & 0x01) << 2) | ((mouse_buttons & 0x06) >> 1);
b = mouse_get_buttons_ex();
dev->buf[0] = ((b & 0x01) << 2) | ((b & 0x06) >> 1);
dev->buf[1] = dev->buf[2] = 0x00;
sermouse_transmit(dev, 3, 0, 0);
break;

View File

@@ -424,9 +424,17 @@ wacom_write(UNUSED(struct serial_s *serial), void *priv, uint8_t data)
}
static int
wacom_poll(int x, int y, UNUSED(int z), int b, double abs_x, double abs_y, void *priv)
wacom_poll(void *priv)
{
mouse_wacom_t *wacom = (mouse_wacom_t *) priv;
int delta_x;
int delta_y;
int b = mouse_get_buttons_ex();
double abs_x;
double abs_y;
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -32768, 32767, 0, 0);
mouse_get_abs_coords(&abs_x, &abs_y);
if (wacom->settings_bits.cmd_set == WACOM_CMDSET_IV) {
wacom->abs_x = abs_x * 5039. * (wacom->x_res / 1000.);
@@ -442,8 +450,8 @@ wacom_poll(int x, int y, UNUSED(int z), int b, double abs_x, double abs_y, void
wacom->abs_x = 0;
if (wacom->abs_y < 0)
wacom->abs_y = 0;
wacom->rel_x = x;
wacom->rel_y = y;
wacom->rel_x = delta_x;
wacom->rel_y = delta_y;
}
if (wacom->b != b)
wacom->oldb = wacom->b;

View File

@@ -143,8 +143,10 @@ extern int is_pentium; /* TODO: Move back to cpu/cpu.h when it's figured out,
extern int fixed_size_x;
extern int fixed_size_y;
extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */
extern double mouse_x_error; /* Mouse error accumulator - Y */
extern double mouse_y_error; /* Mouse error accumulator - Y */
#ifdef _Atomic
extern _Atomic double mouse_x_error; /* Mouse error accumulator - Y */
extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */
#endif
extern int pit_mode; /* (C) force setting PIT mode */
extern int fm_driver; /* (C) select FM sound driver */

View File

@@ -135,8 +135,7 @@ typedef struct _device_ {
void (*reset)(void *priv);
union {
int (*available)(void);
int (*poll)(int x, int y, int z, int b, double abs_x, double abs_y, void *priv);
void (*register_pci_slot)(int device, int type, int inta, int intb, int intc, int intd, void *priv);
int (*poll)(void *priv);
};
void (*speed_changed)(void *priv);
void (*force_redraw)(void *priv);
@@ -179,8 +178,7 @@ extern void device_close_all(void);
extern void device_reset_all(uint32_t match_flags);
extern void *device_get_priv(const device_t *d);
extern int device_available(const device_t *d);
extern int device_poll(const device_t *d, int x, int y, int z, int b);
extern void device_register_pci_slot(const device_t *d, int device, int type, int inta, int intb, int intc, int intd);
extern int device_poll(const device_t *d);
extern void device_speed_changed(void);
extern void device_force_redraw(void);
extern void device_get_name(const device_t *d, int bus, char *name);

View File

@@ -26,7 +26,7 @@
#endif
#define MOUSE_TYPE_NONE 0 /* no mouse configured */
#define MOUSE_TYPE_INTERNAL 1 /* machine has internal mouse */
#define MOUSE_TYPE_INTERNAL 1 /* achine has internal mouse */
#define MOUSE_TYPE_LOGIBUS 2 /* Logitech/ATI Bus Mouse */
#define MOUSE_TYPE_INPORT 3 /* Microsoft InPort Mouse */
#if 0
@@ -47,11 +47,6 @@
#ifdef __cplusplus
extern "C" {
#else
extern atomic_int mouse_x;
extern atomic_int mouse_y;
extern atomic_int mouse_z;
extern atomic_int mouse_buttons;
#endif
extern int mouse_type;
@@ -62,17 +57,14 @@ extern double mouse_x_abs;
extern double mouse_y_abs;
extern int tablet_tool_type;
extern double mouse_sensitivity;
extern double mouse_x_error;
extern double mouse_y_error;
#ifdef EMU_DEVICE_H
extern const device_t *mouse_get_device(int mouse);
extern void *mouse_ps2_init(const device_t *);
extern const device_t mouse_logibus_device;
extern const device_t mouse_logibus_onboard_device;
extern const device_t mouse_msinport_device;
# if 0
# ifdef USE_GENIBUS
extern const device_t mouse_genibus_device;
# endif
extern const device_t mouse_mssystems_device;
@@ -83,33 +75,44 @@ extern const device_t mouse_wacom_device;
extern const device_t mouse_wacom_artpad_device;
#endif
extern void mouse_init(void);
extern void mouse_close(void);
extern void mouse_reset(void);
extern void mouse_set_buttons(int buttons);
extern void mouse_set_poll_ex(void (*poll_ex)(void));
extern void mouse_process(void);
extern void mouse_set_poll(int (*f)(int, int, int, int, void *), void *);
extern void mouse_clear_x(void);
extern void mouse_clear_y(void);
extern void mouse_clear_coords(void);
extern void mouse_subtract_x(int *delta_x, int *o_x, int min, int max, int abs);
extern void mouse_subtract_y(int *delta_y, int *o_y, int min, int max, int invert, int abs);
extern void mouse_subtract_coords(int *delta_x, int *delta_y, int *o_x, int *o_y,
int min, int max, int invert, int abs);
extern int mouse_moved(void);
extern int mouse_state_changed(void);
extern int mouse_mbut_changed(void);
extern void mouse_scale(int x, int y);
extern void mouse_scale_x(int x);
extern void mouse_scale_y(int y);
extern void mouse_set_z(int z);
extern void mouse_clear_z(void);
extern void mouse_subtract_z(int *delta_z, int min, int max, int invert);
extern void mouse_set_buttons_ex(int b);
extern int mouse_get_buttons_ex(void);
extern void mouse_set_sample_rate(double new_rate);
extern void mouse_set_buttons(int buttons);
extern void mouse_get_abs_coords(double *x_abs, double *y_abs);
extern void mouse_process(void);
extern void mouse_set_poll_ex(void (*poll_ex)(void));
extern void mouse_set_poll(int (*f)(void *), void *);
extern char * mouse_get_name(int mouse);
extern char * mouse_get_internal_name(int mouse);
extern int mouse_get_from_internal_name(char *s);
extern int mouse_has_config(int mouse);
#ifdef EMU_DEVICE_H
extern const device_t *mouse_get_device(int mouse);
#endif
extern int mouse_get_buttons(void);
extern int mouse_get_ndev(void);
extern void mouse_reset(void);
extern void mouse_close(void);
extern void mouse_init(void);
extern void mouse_bus_set_irq(void *priv, int irq);
extern void mouse_set_sample_rate(double new_rate);
extern void mouse_scale(int x, int y);
extern void mouse_scale_x(int x);
extern void mouse_scale_y(int y);
extern void mouse_set_z(int z);
extern void mouse_set_buttons_ex(int b);
extern int mouse_get_buttons_ex(void);
extern char *mouse_get_name(int mouse);
extern char *mouse_get_internal_name(int mouse);
extern int mouse_get_from_internal_name(char *s);
extern int mouse_has_config(int mouse);
extern int mouse_get_type(int mouse);
extern int mouse_get_ndev(void);
extern int mouse_get_buttons(void);
extern void mouse_clear_data(void *priv);
extern void mouse_bus_set_irq(void *priv, int irq);
#ifdef __cplusplus
}

View File

@@ -143,6 +143,7 @@ extern void plat_vid_reload_options(void);
extern uint32_t plat_language_code(char *langcode);
extern void plat_language_code_r(uint32_t lcid, char *outbuf, int len);
extern void plat_get_cpu_string(char *outbuf, uint8_t len);
extern double plat_get_dpi(void);
/* Resource management. */
extern void set_language(uint32_t id);

View File

@@ -152,8 +152,6 @@ typedef struct amstrad_t {
pc_timer_t send_delay_timer;
/* Mouse stuff. */
uint8_t mousex;
uint8_t mousey;
int oldb;
/* Video stuff. */
@@ -2012,9 +2010,9 @@ ms_write(uint16_t addr, UNUSED(uint8_t val), void *priv)
amstrad_t *ams = (amstrad_t *) priv;
if ((addr == 0x78) || (addr == 0x79))
ams->mousex = 0;
mouse_clear_x();
else
ams->mousey = 0;
mouse_clear_y();
}
static uint8_t
@@ -2022,25 +2020,26 @@ ms_read(uint16_t addr, void *priv)
{
amstrad_t *ams = (amstrad_t *) priv;
uint8_t ret;
int delta = 0;
if ((addr == 0x78) || (addr == 0x79)) {
ret = ams->mousex;
ams->mousex = 0;
mouse_subtract_x(&delta, NULL, -128, 127, 0);
mouse_clear_x();
} else {
ret = ams->mousey;
ams->mousey = 0;
mouse_subtract_y(&delta, NULL, -128, 127, 1, 0);
mouse_clear_y();
}
ret = (uint8_t) (int8_t) delta;
return ret;
}
static int
ms_poll(int x, int y, UNUSED(int z), int b, void *priv)
ms_poll(void *priv)
{
amstrad_t *ams = (amstrad_t *) priv;
ams->mousex += x;
ams->mousey -= y;
int b = mouse_get_buttons_ex();
if ((b & 1) && !(ams->oldb & 1))
keyboard_send(0x7e);

View File

@@ -1,74 +1,74 @@
/*
* 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 Miscellaneous, Fake, Hypervisor machines.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2019 Miran Grca.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <86box/86box.h>
#include <86box/mem.h>
#include <86box/io.h>
#include <86box/rom.h>
#include <86box/pci.h>
#include <86box/device.h>
#include <86box/chipset.h>
#include <86box/hdc.h>
#include <86box/hdc_ide.h>
#include <86box/keyboard.h>
#include <86box/flash.h>
#include <86box/sio.h>
#include <86box/hwm.h>
#include <86box/spd.h>
#include <86box/video.h>
#include "cpu.h"
#include <86box/machine.h>
#include <86box/sound.h>
int
machine_at_vpc2007_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/vpc2007/13500.bin",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
is_vpc = 1;
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4);
pci_register_slot(0x08, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x09, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0A, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0B, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 1, 2, 3, 4);
device_add(&i440bx_no_agp_device);
device_add(&piix4e_device);
device_add(&w83977f_370_device);
device_add(&keyboard_ps2_ami_pci_device);
device_add(&intel_flash_bxt_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 256); /* real VPC provides invalid SPD data */
return ret;
}
/*
* 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 Miscellaneous, Fake, Hypervisor machines.
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2019 Miran Grca.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <86box/86box.h>
#include <86box/mem.h>
#include <86box/io.h>
#include <86box/rom.h>
#include <86box/pci.h>
#include <86box/device.h>
#include <86box/chipset.h>
#include <86box/hdc.h>
#include <86box/hdc_ide.h>
#include <86box/keyboard.h>
#include <86box/flash.h>
#include <86box/sio.h>
#include <86box/hwm.h>
#include <86box/spd.h>
#include <86box/video.h>
#include "cpu.h"
#include <86box/machine.h>
#include <86box/sound.h>
int
machine_at_vpc2007_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/vpc2007/13500.bin",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
is_vpc = 1;
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4);
pci_register_slot(0x08, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x09, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0A, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0B, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 1, 2, 3, 4);
device_add(&i440bx_no_agp_device);
device_add(&piix4e_device);
device_add(&w83977f_370_device);
device_add(&keyboard_ps2_ami_pci_device);
device_add(&intel_flash_bxt_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 256); /* real VPC provides invalid SPD data */
return ret;
}

View File

@@ -1,153 +1,153 @@
/*
* 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 Slot 2 machines.
*
* Slot 2 is quite a rare type of Slot. Used mostly by Pentium II & III Xeons
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2019 Miran Grca.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <86box/86box.h>
#include <86box/mem.h>
#include <86box/io.h>
#include <86box/rom.h>
#include <86box/pci.h>
#include <86box/device.h>
#include <86box/chipset.h>
#include <86box/hdc.h>
#include <86box/hdc_ide.h>
#include <86box/keyboard.h>
#include <86box/flash.h>
#include <86box/sio.h>
#include <86box/hwm.h>
#include <86box/spd.h>
#include <86box/video.h>
#include <86box/clock.h>
#include "cpu.h"
#include <86box/machine.h>
int
machine_at_6gxu_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/6gxu/6gxu.f1c",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x08, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); /* On-Board SCSI. Not emulated at the moment */
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
device_add(&i440gx_device);
device_add(&piix4e_device);
device_add(&keyboard_ps2_pci_device);
device_add(&w83977ef_device);
device_add(&sst_flash_39sf020_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 512);
device_add(&w83782d_device); /* fans: CPU, Power, System; temperatures: System, CPU, unused */
hwm_values.temperatures[2] = 0; /* unused */
hwm_values.voltages[1] = 1500; /* VGTL */
return ret;
}
int
machine_at_s2dge_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/s2dge/2gu7301.rom",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 0, 0);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x12, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x14, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 0, 0);
device_add(&i440gx_device);
device_add(&piix4e_device);
device_add(&keyboard_ps2_ami_pci_device);
device_add(&w83977tf_device);
device_add(&intel_flash_bxt_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 512);
device_add(&w83781d_device); /* fans: CPU1, CPU2, Thermal Control; temperatures: unused, CPU1, CPU2? */
hwm_values.fans[1] = 0; /* no CPU2 fan */
hwm_values.temperatures[0] = 0; /* unused */
hwm_values.temperatures[2] = 0; /* CPU2? */
return ret;
}
int
machine_at_fw6400gx_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/fw6400gx/FWGX1211.ROM",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4);
pci_register_slot(0x0A, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x0C, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 0, 0);
device_add(&i440gx_device);
device_add(&piix4e_device);
device_add(&keyboard_ps2_ami_pci_device);
device_add(&pc87309_15c_device);
device_add(ics9xxx_get(ICS9250_08));
device_add(&sst_flash_29ee020_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 512);
device_add(&w83781d_device); /* fans: Chassis, Power, CPU; temperatures: System, CPU, unused */
hwm_values.temperatures[3] = 0; /* unused */
hwm_values.voltages[1] = 1500; /* Vtt */
return ret;
}
/*
* 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 Slot 2 machines.
*
* Slot 2 is quite a rare type of Slot. Used mostly by Pentium II & III Xeons
*
*
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2016-2019 Miran Grca.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <86box/86box.h>
#include <86box/mem.h>
#include <86box/io.h>
#include <86box/rom.h>
#include <86box/pci.h>
#include <86box/device.h>
#include <86box/chipset.h>
#include <86box/hdc.h>
#include <86box/hdc_ide.h>
#include <86box/keyboard.h>
#include <86box/flash.h>
#include <86box/sio.h>
#include <86box/hwm.h>
#include <86box/spd.h>
#include <86box/video.h>
#include <86box/clock.h>
#include "cpu.h"
#include <86box/machine.h>
int
machine_at_6gxu_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/6gxu/6gxu.f1c",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x08, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); /* On-Board SCSI. Not emulated at the moment */
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
device_add(&i440gx_device);
device_add(&piix4e_device);
device_add(&keyboard_ps2_pci_device);
device_add(&w83977ef_device);
device_add(&sst_flash_39sf020_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 512);
device_add(&w83782d_device); /* fans: CPU, Power, System; temperatures: System, CPU, unused */
hwm_values.temperatures[2] = 0; /* unused */
hwm_values.voltages[1] = 1500; /* VGTL */
return ret;
}
int
machine_at_s2dge_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/s2dge/2gu7301.rom",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 0, 0);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x12, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x14, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 0, 0);
device_add(&i440gx_device);
device_add(&piix4e_device);
device_add(&keyboard_ps2_ami_pci_device);
device_add(&w83977tf_device);
device_add(&intel_flash_bxt_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 512);
device_add(&w83781d_device); /* fans: CPU1, CPU2, Thermal Control; temperatures: unused, CPU1, CPU2? */
hwm_values.fans[1] = 0; /* no CPU2 fan */
hwm_values.temperatures[0] = 0; /* unused */
hwm_values.temperatures[2] = 0; /* CPU2? */
return ret;
}
int
machine_at_fw6400gx_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/fw6400gx/FWGX1211.ROM",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4);
pci_register_slot(0x0A, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x0C, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 4, 1, 2, 3);
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 0, 0);
device_add(&i440gx_device);
device_add(&piix4e_device);
device_add(&keyboard_ps2_ami_pci_device);
device_add(&pc87309_15c_device);
device_add(ics9xxx_get(ICS9250_08));
device_add(&sst_flash_29ee020_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 512);
device_add(&w83781d_device); /* fans: Chassis, Power, CPU; temperatures: System, CPU, unused */
hwm_values.temperatures[3] = 0; /* unused */
hwm_values.voltages[1] = 1500; /* Vtt */
return ret;
}

View File

@@ -131,9 +131,8 @@ typedef struct m24_kbd_t {
/* Mouse stuff. */
int mouse_mode;
int x;
int y;
int b;
pc_timer_t send_delay_timer;
} m24_kbd_t;
@@ -732,12 +731,14 @@ m24_kbd_reset(void *priv)
}
static int
ms_poll(int x, int y, UNUSED(int z), int b, void *priv)
ms_poll(void *priv)
{
m24_kbd_t *m24_kbd = (m24_kbd_t *) priv;
m24_kbd->x += x;
m24_kbd->y += y;
int delta_x;
int delta_y;
int o_x;
int o_y;
int b = mouse_get_buttons_ex();
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return 0xff;
@@ -770,53 +771,45 @@ ms_poll(int x, int y, UNUSED(int z), int b, void *priv)
if (((key_queue_end - key_queue_start) & 0xf) > 12)
return 0xff;
if (!m24_kbd->x && !m24_kbd->y)
if (!mouse_moved())
return 0xff;
m24_kbd->y = -m24_kbd->y;
mouse_subtract_coords(&delta_x, &delta_y, &o_x, &o_y, -127, 127, 1, 0);
if (m24_kbd->x < -127)
m24_kbd->x = -127;
if (m24_kbd->x > 127)
m24_kbd->x = 127;
if (m24_kbd->x < -127)
m24_kbd->x = 0x80 | ((-m24_kbd->x) & 0x7f);
if ((delta_x == -127) && o_x)
delta_x = 0x80 | ((-delta_x) & 0x7f);
if (m24_kbd->y < -127)
m24_kbd->y = -127;
if (m24_kbd->y > 127)
m24_kbd->y = 127;
if (m24_kbd->y < -127)
m24_kbd->y = 0x80 | ((-m24_kbd->y) & 0x7f);
if ((delta_y == -127) && o_y)
delta_y = 0x80 | ((-delta_y) & 0x7f);
m24_kbd_adddata(0xfe);
m24_kbd_adddata(m24_kbd->x);
m24_kbd_adddata(m24_kbd->y);
m24_kbd->x = m24_kbd->y = 0;
m24_kbd_adddata(delta_x);
m24_kbd_adddata(delta_y);
} else {
while (m24_kbd->x < -4) {
mouse_subtract_coords(&delta_x, &delta_y, &o_x, &o_y, -127, 127, 1, 0);
while (delta_x < -4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return 0xff;
m24_kbd->x += 4;
delta_x += 4;
m24_kbd_adddata(m24_kbd->scan[3]);
}
while (m24_kbd->x > 4) {
while (delta_x > 4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return 0xff;
m24_kbd->x -= 4;
delta_x -= 4;
m24_kbd_adddata(m24_kbd->scan[4]);
}
while (m24_kbd->y < -4) {
while (delta_y < -4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return 0xff;
m24_kbd->y += 4;
delta_y += 4;
m24_kbd_adddata(m24_kbd->scan[5]);
}
while (m24_kbd->y > 4) {
while (delta_y > 4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return 0xff;
m24_kbd->y -= 4;
delta_y -= 4;
m24_kbd_adddata(m24_kbd->scan[6]);
}
}

View File

@@ -375,6 +375,7 @@ pic_action(pic_t *dev, uint8_t irq, uint8_t eoi, uint8_t rotate)
if (rotate)
dev->priority = (irq + 1) & 7;
pic_update_request(dev, irq);
update_pending();
}
}
@@ -414,13 +415,10 @@ pic_latch_read(UNUSED(uint16_t addr), UNUSED(void *priv))
{
uint8_t ret = 0xff;
pic_log("pic_latch_read(%04X): %02X%02X\n", enabled_latches, latched_irqs & 0x10, latched_irqs & 0x02);
pic_log("pic_latch_read(%04X): %04X\n", enabled_latches, latched_irqs & 0x1002);
if ((latched_irqs & enabled_latches) & 0x0002)
picintc(0x0002);
if ((latched_irqs & enabled_latches) & 0x1000)
picintc(0x1000);
if (latched_irqs & 0x1002)
picintc(latched_irqs & 0x1002);
/* Return FF - we just lower IRQ 1 and IRQ 12. */
return ret;

View File

@@ -293,7 +293,9 @@ MainWindow::MainWindow(QWidget *parent)
connect(this, &MainWindow::resizeContentsMonitor, this, [this](int w, int h, int monitor_index) {
if (!QApplication::platformName().contains("eglfs") && vid_resize != 1) {
#ifdef QT_RESIZE_DEBUG
qDebug() << "Resize";
#endif
w = (w / (!dpi_scale ? util::screenOfWidget(renderers[monitor_index].get())->devicePixelRatio() : 1.));
int modifiedHeight = (h / (!dpi_scale ? util::screenOfWidget(renderers[monitor_index].get())->devicePixelRatio() : 1.));

View File

@@ -37,13 +37,17 @@
#include <QLocalSocket>
#include <QTimer>
#include <QProcess>
#include <QRegularExpression>
#include <QLibrary>
#include <QElapsedTimer>
#include <QScreen>
#include "qt_rendererstack.hpp"
#include "qt_mainwindow.hpp"
#include "qt_progsettings.hpp"
#include "qt_util.hpp"
#ifdef Q_OS_UNIX
# include <sys/mman.h>
@@ -640,7 +644,7 @@ plat_get_global_config_dir(char* strptr)
}
void
plat_init_rom_paths()
plat_init_rom_paths(void)
{
auto paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
@@ -712,7 +716,7 @@ plat_get_cpu_string(char *outbuf, uint8_t len) {
if (line.isNull()) {
break;
}
if(line.contains(QRegExp("model name.*:"))) {
if(QRegularExpression("model name.*:").match(line).hasMatch()) {
auto list = line.split(": ");
if(!list.last().isEmpty()) {
cpu_string = list.last();
@@ -726,4 +730,10 @@ plat_get_cpu_string(char *outbuf, uint8_t len) {
qstrncpy(outbuf, cpu_string.toUtf8().constData(), len);
}
}
double
plat_get_dpi(void)
{
return util::screenOfWidget(main_window)->devicePixelRatio();
}

View File

@@ -27,6 +27,7 @@
extern "C" {
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/video.h>
}
@@ -51,62 +52,71 @@ integer_scale(double *d, double *g)
void
RendererCommon::onResize(int width, int height)
{
if ((video_fullscreen == 0) && (video_fullscreen_scale_maximized ? ((parentWidget->isMaximized() == false) && (main_window->isAncestorOf(parentWidget) && main_window->isMaximized() == false)) : 1)) {
/* This is needed so that the if below does not take like, 5 lines. */
bool is_fs = (video_fullscreen == 0);
bool parent_max = (parentWidget->isMaximized() == false);
bool main_is_ancestor = main_window->isAncestorOf(parentWidget);
bool main_max = main_window->isMaximized();
bool main_is_max = (main_is_ancestor && main_max == false);
if (is_fs && (video_fullscreen_scale_maximized ? (parent_max && main_is_max) : 1))
destination.setRect(0, 0, width, height);
return;
}
double dx;
double dy;
double dw;
double dh;
double gsr;
else {
double dx;
double dy;
double dw;
double dh;
double gsr;
double hw = width;
double hh = height;
double gw = source.width();
double gh = source.height();
double hsr = hw / hh;
double hw = width;
double hh = height;
double gw = source.width();
double gh = source.height();
double hsr = hw / hh;
switch (video_fullscreen_scale) {
case FULLSCR_SCALE_INT:
gsr = gw / gh;
if (gsr <= hsr) {
dw = hh * gsr;
dh = hh;
} else {
dw = hw;
dh = hw / gsr;
}
integer_scale(&dw, &gw);
integer_scale(&dh, &gh);
dx = (hw - dw) / 2.0;
dy = (hh - dh) / 2.0;
destination.setRect(dx, dy, dw, dh);
break;
case FULLSCR_SCALE_43:
case FULLSCR_SCALE_KEEPRATIO:
if (video_fullscreen_scale == FULLSCR_SCALE_43) {
gsr = 4.0 / 3.0;
} else {
switch (video_fullscreen_scale) {
case FULLSCR_SCALE_INT:
gsr = gw / gh;
}
if (gsr <= hsr) {
dw = hh * gsr;
dh = hh;
} else {
dw = hw;
dh = hw / gsr;
}
integer_scale(&dw, &gw);
integer_scale(&dh, &gh);
dx = (hw - dw) / 2.0;
dy = (hh - dh) / 2.0;
destination.setRect((int) dx, (int) dy, (int) dw, (int) dh);
break;
case FULLSCR_SCALE_43:
case FULLSCR_SCALE_KEEPRATIO:
if (video_fullscreen_scale == FULLSCR_SCALE_43)
gsr = 4.0 / 3.0;
else
gsr = gw / gh;
if (gsr <= hsr) {
dw = hh * gsr;
dh = hh;
} else {
dw = hw;
dh = hw / gsr;
}
dx = (hw - dw) / 2.0;
dy = (hh - dh) / 2.0;
destination.setRect(dx, dy, dw, dh);
break;
case FULLSCR_SCALE_FULL:
default:
destination.setRect(0, 0, hw, hh);
break;
if (gsr <= hsr) {
dw = hh * gsr;
dh = hh;
} else {
dw = hw;
dh = hw / gsr;
}
dx = (hw - dw) / 2.0;
dy = (hh - dh) / 2.0;
destination.setRect((int) dx, (int) dy, (int) dw, (int) dh);
break;
case FULLSCR_SCALE_FULL:
default:
destination.setRect(0, 0, (int) hw, (int) hh);
break;
}
}
monitors[r_monitor_index].mon_res_x = (int) ((double) destination.width() * plat_get_dpi());
monitors[r_monitor_index].mon_res_y = (int) ((double) destination.height() * plat_get_dpi());
}
bool

View File

@@ -38,8 +38,10 @@ public:
virtual bool hasBlitFunc() { return false; }
virtual void blit(int x, int y, int w, int h) { }
int r_monitor_index = 0;
protected:
bool eventDelegate(QEvent *event, bool &result);
bool eventDelegate(QEvent *event, bool &result);
QRect source { 0, 0, 0, 0 };
QRect destination;

View File

@@ -177,7 +177,17 @@ RendererStack::mouseReleaseEvent(QMouseEvent *event)
return;
}
if (mouse_capture || (mouse_mode >= 1)) {
if ((mouse_mode >= 1) && ((m_monitor_index < 1) || mousedata.mouse_tablet_in_proximity))
#ifdef Q_OS_WINDOWS
if (((m_monitor_index >= 1) && (mouse_mode >= 1) && mousedata.mouse_tablet_in_proximity) ||
((m_monitor_index < 1) && (mouse_mode >= 1)))
#else
#ifndef __APPLE__
if (((m_monitor_index >= 1) && (mouse_mode >= 1) && mousedata.mouse_tablet_in_proximity) ||
(m_monitor_index < 1))
#else
if ((m_monitor_index >= 1) && (mouse_mode >= 1) && mousedata.mouse_tablet_in_proximity)
#endif
#endif
mouse_set_buttons_ex(mouse_get_buttons_ex() & ~event->button());
}
isMouseDown &= ~1;
@@ -188,7 +198,17 @@ RendererStack::mousePressEvent(QMouseEvent *event)
{
isMouseDown |= 1;
if (mouse_capture || (mouse_mode >= 1)) {
if ((mouse_mode >= 1) && ((m_monitor_index < 1) || mousedata.mouse_tablet_in_proximity))
#ifdef Q_OS_WINDOWS
if (((m_monitor_index >= 1) && (mouse_mode >= 1) && mousedata.mouse_tablet_in_proximity) ||
((m_monitor_index < 1) && (mouse_mode >= 1)))
#else
#ifndef __APPLE__
if (((m_monitor_index >= 1) && (mouse_mode >= 1) && mousedata.mouse_tablet_in_proximity) ||
(m_monitor_index < 1))
#else
if ((m_monitor_index >= 1) && (mouse_mode >= 1) && mousedata.mouse_tablet_in_proximity)
#endif
#endif
mouse_set_buttons_ex(mouse_get_buttons_ex() | event->button());
}
event->accept();
@@ -532,3 +552,19 @@ RendererStack::event(QEvent* event)
}
return QStackedWidget::event(event);
}
void
RendererStack::setFocusRenderer()
{
if (current)
current->setFocus();
}
void
RendererStack::onResize(int width, int height)
{
if (rendererWindow) {
rendererWindow->r_monitor_index = m_monitor_index;
rendererWindow->onResize(width, height);
}
}

View File

@@ -71,16 +71,8 @@ public:
/* Returns options dialog for current renderer */
QDialog *getOptions(QWidget *parent) { return rendererWindow ? rendererWindow->getOptions(parent) : nullptr; }
void setFocusRenderer()
{
if (current)
current->setFocus();
}
void onResize(int width, int height)
{
if (rendererWindow)
rendererWindow->onResize(width, height);
}
void setFocusRenderer();
void onResize(int width, int height);
void (*mouse_capture_func)(QWindow *window) = nullptr;
void (*mouse_uncapture_func)() = nullptr;

View File

@@ -1,62 +1,62 @@
#ifndef QT_SETTINGS_BUS_TRACKING_HPP
#define QT_SETTINGS_BUS_TRACKING_HPP
#include <QWidget>
#define TRACK_CLEAR 0
#define TRACK_SET 1
#define DEV_HDD 0x01
#define DEV_CDROM 0x02
#define DEV_ZIP 0x04
#define DEV_MO 0x08
#define BUS_MFM 0
#define BUS_ESDI 1
#define BUS_XTA 2
#define BUS_IDE 3
#define BUS_SCSI 4
#define CHANNEL_NONE 0xff
namespace Ui {
class SettingsBusTracking;
}
class SettingsBusTracking {
public:
explicit SettingsBusTracking();
~SettingsBusTracking() = default;
/* These return 0xff is none is free. */
uint8_t next_free_mfm_channel();
uint8_t next_free_esdi_channel();
uint8_t next_free_xta_channel();
uint8_t next_free_ide_channel();
uint8_t next_free_scsi_id();
int mfm_bus_full();
int esdi_bus_full();
int xta_bus_full();
int ide_bus_full();
int scsi_bus_full();
/* Set: 0 = Clear the device from the tracking, 1 = Set the device on the tracking.
Device type: 1 = Hard Disk, 2 = CD-ROM, 4 = ZIP, 8 = Magneto-Optical.
Bus: 0 = MFM, 1 = ESDI, 2 = XTA, 3 = IDE, 4 = SCSI. */
void device_track(int set, uint8_t dev_type, int bus, int channel);
private:
/* 1 channel, 2 devices per channel, 8 bits per device = 16 bits. */
uint64_t mfm_tracking { 0 };
/* 1 channel, 2 devices per channel, 8 bits per device = 16 bits. */
uint64_t esdi_tracking { 0 };
/* 1 channel, 2 devices per channel, 8 bits per device = 16 bits. */
uint64_t xta_tracking { 0 };
/* 16 channels (prepatation for that weird IDE card), 2 devices per channel, 8 bits per device = 256 bits. */
uint64_t ide_tracking[4] { 0, 0, 0, 0 };
/* 4 buses, 16 devices per bus, 8 bits per device (future-proofing) = 512 bits. */
uint64_t scsi_tracking[8] { 0, 0, 0, 0, 0, 0, 0, 0 };
};
#endif // QT_SETTINGS_BUS_TRACKING_HPP
#ifndef QT_SETTINGS_BUS_TRACKING_HPP
#define QT_SETTINGS_BUS_TRACKING_HPP
#include <QWidget>
#define TRACK_CLEAR 0
#define TRACK_SET 1
#define DEV_HDD 0x01
#define DEV_CDROM 0x02
#define DEV_ZIP 0x04
#define DEV_MO 0x08
#define BUS_MFM 0
#define BUS_ESDI 1
#define BUS_XTA 2
#define BUS_IDE 3
#define BUS_SCSI 4
#define CHANNEL_NONE 0xff
namespace Ui {
class SettingsBusTracking;
}
class SettingsBusTracking {
public:
explicit SettingsBusTracking();
~SettingsBusTracking() = default;
/* These return 0xff is none is free. */
uint8_t next_free_mfm_channel();
uint8_t next_free_esdi_channel();
uint8_t next_free_xta_channel();
uint8_t next_free_ide_channel();
uint8_t next_free_scsi_id();
int mfm_bus_full();
int esdi_bus_full();
int xta_bus_full();
int ide_bus_full();
int scsi_bus_full();
/* Set: 0 = Clear the device from the tracking, 1 = Set the device on the tracking.
Device type: 1 = Hard Disk, 2 = CD-ROM, 4 = ZIP, 8 = Magneto-Optical.
Bus: 0 = MFM, 1 = ESDI, 2 = XTA, 3 = IDE, 4 = SCSI. */
void device_track(int set, uint8_t dev_type, int bus, int channel);
private:
/* 1 channel, 2 devices per channel, 8 bits per device = 16 bits. */
uint64_t mfm_tracking { 0 };
/* 1 channel, 2 devices per channel, 8 bits per device = 16 bits. */
uint64_t esdi_tracking { 0 };
/* 1 channel, 2 devices per channel, 8 bits per device = 16 bits. */
uint64_t xta_tracking { 0 };
/* 16 channels (prepatation for that weird IDE card), 2 devices per channel, 8 bits per device = 256 bits. */
uint64_t ide_tracking[4] { 0, 0, 0, 0 };
/* 4 buses, 16 devices per bus, 8 bits per device (future-proofing) = 512 bits. */
uint64_t scsi_tracking[8] { 0, 0, 0, 0, 0, 0, 0, 0 };
};
#endif // QT_SETTINGS_BUS_TRACKING_HPP

View File

@@ -938,9 +938,6 @@ VulkanRenderer2::startNextFrame()
if (err != VK_SUCCESS)
qFatal("Failed to map memory: %d", err);
QMatrix4x4 m = m_proj;
#if 0
m.rotate(m_rotation, 0, 0, 1);
#endif
memcpy(p, m.constData(), 16 * sizeof(float));
m_devFuncs->vkUnmapMemory(dev, m_bufMem);
p = nullptr;

View File

@@ -1,94 +1,93 @@
#pragma once
/****************************************************************************
**
** Copyright (C) 2022 Cacodemon345
** Copyright (C) 2017 The Qt Company Ltd.
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/
#include <QVulkanWindow>
#include <QImage>
#if QT_CONFIG(vulkan)
# include "qt_vulkanwindowrenderer.hpp"
class VulkanRenderer2 : public QVulkanWindowRenderer {
public:
void *mappedPtr = nullptr;
size_t imagePitch = 2048 * 4;
VulkanRenderer2(QVulkanWindow *w);
void initResources() override;
void initSwapChainResources() override;
void releaseSwapChainResources() override;
void releaseResources() override;
void startNextFrame() override;
private:
VkShaderModule createShader(const QString &name);
bool createTexture();
bool createTextureImage(const QSize &size, VkImage *image, VkDeviceMemory *mem,
VkImageTiling tiling, VkImageUsageFlags usage, uint32_t memIndex);
bool writeLinearImage(const QImage &img, VkImage image, VkDeviceMemory memory);
void ensureTexture();
void updateSamplers();
QVulkanWindow *m_window;
QVulkanDeviceFunctions *m_devFuncs;
VkDeviceMemory m_bufMem = VK_NULL_HANDLE;
VkBuffer m_buf = VK_NULL_HANDLE;
VkDescriptorBufferInfo m_uniformBufInfo[QVulkanWindow::MAX_CONCURRENT_FRAME_COUNT];
VkDescriptorPool m_descPool = VK_NULL_HANDLE;
VkDescriptorSetLayout m_descSetLayout = VK_NULL_HANDLE;
VkDescriptorSet m_descSet[QVulkanWindow::MAX_CONCURRENT_FRAME_COUNT];
VkPipelineCache m_pipelineCache = VK_NULL_HANDLE;
VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE;
VkPipeline m_pipeline = VK_NULL_HANDLE;
VkSampler m_sampler = VK_NULL_HANDLE;
VkSampler m_linearSampler = VK_NULL_HANDLE;
VkImage m_texImage = VK_NULL_HANDLE;
VkDeviceMemory m_texMem = VK_NULL_HANDLE;
bool m_texLayoutPending = false;
VkImageView m_texView = VK_NULL_HANDLE;
VkImage m_texStaging = VK_NULL_HANDLE;
VkDeviceMemory m_texStagingMem = VK_NULL_HANDLE;
bool m_texStagingPending = false;
bool m_texStagingTransferLayout = false;
QSize m_texSize;
VkFormat m_texFormat;
QMatrix4x4 m_proj;
float m_rotation = 0.0f;
};
#endif
#pragma once
/****************************************************************************
**
** Copyright (C) 2022 Cacodemon345
** Copyright (C) 2017 The Qt Company Ltd.
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/
#include <QVulkanWindow>
#include <QImage>
#if QT_CONFIG(vulkan)
# include "qt_vulkanwindowrenderer.hpp"
class VulkanRenderer2 : public QVulkanWindowRenderer {
public:
void *mappedPtr = nullptr;
size_t imagePitch = 2048 * 4;
VulkanRenderer2(QVulkanWindow *w);
void initResources() override;
void initSwapChainResources() override;
void releaseSwapChainResources() override;
void releaseResources() override;
void startNextFrame() override;
private:
VkShaderModule createShader(const QString &name);
bool createTexture();
bool createTextureImage(const QSize &size, VkImage *image, VkDeviceMemory *mem,
VkImageTiling tiling, VkImageUsageFlags usage, uint32_t memIndex);
bool writeLinearImage(const QImage &img, VkImage image, VkDeviceMemory memory);
void ensureTexture();
void updateSamplers();
QVulkanWindow *m_window;
QVulkanDeviceFunctions *m_devFuncs;
VkDeviceMemory m_bufMem = VK_NULL_HANDLE;
VkBuffer m_buf = VK_NULL_HANDLE;
VkDescriptorBufferInfo m_uniformBufInfo[QVulkanWindow::MAX_CONCURRENT_FRAME_COUNT];
VkDescriptorPool m_descPool = VK_NULL_HANDLE;
VkDescriptorSetLayout m_descSetLayout = VK_NULL_HANDLE;
VkDescriptorSet m_descSet[QVulkanWindow::MAX_CONCURRENT_FRAME_COUNT];
VkPipelineCache m_pipelineCache = VK_NULL_HANDLE;
VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE;
VkPipeline m_pipeline = VK_NULL_HANDLE;
VkSampler m_sampler = VK_NULL_HANDLE;
VkSampler m_linearSampler = VK_NULL_HANDLE;
VkImage m_texImage = VK_NULL_HANDLE;
VkDeviceMemory m_texMem = VK_NULL_HANDLE;
bool m_texLayoutPending = false;
VkImageView m_texView = VK_NULL_HANDLE;
VkImage m_texStaging = VK_NULL_HANDLE;
VkDeviceMemory m_texStagingMem = VK_NULL_HANDLE;
bool m_texStagingPending = false;
bool m_texStagingTransferLayout = false;
QSize m_texSize;
VkFormat m_texFormat;
QMatrix4x4 m_proj;
};
#endif

View File

@@ -41,15 +41,15 @@ joystick_init()
plat_joystick_state[c].nr_povs = SDL_JoystickNumHats(sdl_joy[c]);
for (d = 0; d < std::min(plat_joystick_state[c].nr_axes, 8); d++) {
sprintf(plat_joystick_state[c].axis[d].name, "Axis %i", d);
snprintf(plat_joystick_state[c].axis[d].name, sizeof(plat_joystick_state[c].axis[d].name), "Axis %i", d);
plat_joystick_state[c].axis[d].id = d;
}
for (d = 0; d < std::min(plat_joystick_state[c].nr_buttons, 8); d++) {
sprintf(plat_joystick_state[c].button[d].name, "Button %i", d);
snprintf(plat_joystick_state[c].button[d].name, sizeof(plat_joystick_state[c].button[d].name), "Button %i", d);
plat_joystick_state[c].button[d].id = d;
}
for (d = 0; d < std::min(plat_joystick_state[c].nr_povs, 4); d++) {
sprintf(plat_joystick_state[c].pov[d].name, "POV %i", d);
snprintf(plat_joystick_state[c].pov[d].name, sizeof(plat_joystick_state[c].pov[d].name), "POV %i", d);
plat_joystick_state[c].pov[d].id = d;
}
}

View File

@@ -191,7 +191,7 @@ Bit32u MidiStreamParserImpl::parseShortMessageDataBytes(const Bit8u stream[], Bi
} else if (dataByte < 0xF8) {
// Discard invalid bytes and start over
char s[128];
sprintf(s, "parseShortMessageDataBytes: Invalid short message: status %02x, expected length %i, actual %i -> ignored", *streamBuffer, shortMessageLength, streamBufferSize);
snprintf(s, sizeof(s), "parseShortMessageDataBytes: Invalid short message: status %02x, expected length %i, actual %i -> ignored", *streamBuffer, shortMessageLength, streamBufferSize);
midiReporter.printDebug(s);
streamBufferSize = 0; // Clear streamBuffer
return parsedLength;

View File

@@ -54,7 +54,7 @@ Part::Part(Synth *useSynth, unsigned int usePartNum) {
// Nasty hack for rhythm
timbreTemp = NULL;
} else {
sprintf(name, "Part %d", partNum + 1);
snprintf(name, sizeof(name), "Part %d", partNum + 1);
timbreTemp = &synth->mt32ram.timbreTemp[partNum];
}
currentInstr[0] = 0;

View File

@@ -150,12 +150,15 @@ public:
{
for (uint32_t i = 0; i < num_samples; i++) {
m_chip.generate(&m_output);
if (ChipType::OUTPUTS == 1) {
*data++ = m_output.data[(m_type == FM_YMF278B) ? 4 : 0];
*data++ = m_output.data[(m_type == FM_YMF278B) ? 4 : 0];
if(m_type == FM_YMF278B) {
*data++ += m_output.data[4 % ChipType::OUTPUTS];
*data++ += m_output.data[5 % ChipType::OUTPUTS];
} else if (ChipType::OUTPUTS == 1) {
*data++ = m_output.data[0];
*data++ = m_output.data[0];
} else {
*data++ = m_output.data[(m_type == FM_YMF278B) ? 4 : 0];
*data++ = m_output.data[(m_type == FM_YMF278B) ? 5 : (1 % ChipType::OUTPUTS)];
*data++ = m_output.data[0];
*data++ = m_output.data[1 % ChipType::OUTPUTS];
}
}
}
@@ -167,12 +170,15 @@ public:
m_oldsamples[0] = m_samples[0];
m_oldsamples[1] = m_samples[1];
m_chip.generate(&m_output);
if (ChipType::OUTPUTS == 1) {
m_samples[0] = m_output.data[(m_type == FM_YMF278B) ? 4 : 0];
m_samples[1] = m_output.data[(m_type == FM_YMF278B) ? 4 : 0];
if(m_type == FM_YMF278B) {
m_samples[0] += m_output.data[4 % ChipType::OUTPUTS];
m_samples[1] += m_output.data[5 % ChipType::OUTPUTS];
} else if (ChipType::OUTPUTS == 1) {
m_samples[0] = m_output.data[0];
m_samples[1] = m_output.data[0];
} else {
m_samples[0] = m_output.data[(m_type == FM_YMF278B) ? 4 : 0];
m_samples[1] = m_output.data[(m_type == FM_YMF278B) ? 5 : (1 % ChipType::OUTPUTS)];
m_samples[0] = m_output.data[0];
m_samples[1] = m_output.data[1 % ChipType::OUTPUTS];
}
m_samplecnt -= m_rateratio;
}

View File

@@ -46,6 +46,8 @@
#include <string>
#include <vector>
#define SNPRINTF_BUFFER_SIZE_CALC (256 - (end - &buffer[0]))
namespace ymfm
{
@@ -350,7 +352,7 @@ public:
{
// create file
char name[20];
sprintf(name, "wavlog-%02d.wav", m_index);
snprintf(name, sizeof(name), "wavlog-%02d.wav", m_index);
FILE *out = fopen(name, "wb");
// make the wav file header

View File

@@ -1522,8 +1522,11 @@ void fm_engine_base<RegisterType>::engine_timer_expired(uint32_t tnum)
m_modified_channels |= 1 << chnum;
}
// reset
m_timer_running[tnum] = false;
// Make sure the array does not go out of bounds to keep gcc happy
if(tnum < 2) {
// reset
m_timer_running[tnum] = false;
}
update_timer(tnum, 1, 0);
}

View File

@@ -388,7 +388,7 @@ std::string opl_registers_base<Revision>::log_keyon(uint32_t choffs, uint32_t op
char buffer[256];
char *end = &buffer[0];
end += sprintf(end, "%2u.%02u freq=%04X fb=%u alg=%X mul=%X tl=%02X ksr=%u ns=%u ksl=%u adr=%X/%X/%X sl=%X sus=%u",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, "%2u.%02u freq=%04X fb=%u alg=%X mul=%X tl=%02X ksr=%u ns=%u ksl=%u adr=%X/%X/%X sl=%X sus=%u",
chnum, opnum,
ch_block_freq(choffs),
ch_feedback(choffs),
@@ -405,25 +405,25 @@ std::string opl_registers_base<Revision>::log_keyon(uint32_t choffs, uint32_t op
op_eg_sustain(opoffs));
if (OUTPUTS > 1)
end += sprintf(end, " out=%c%c%c%c",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " out=%c%c%c%c",
ch_output_0(choffs) ? 'L' : '-',
ch_output_1(choffs) ? 'R' : '-',
ch_output_2(choffs) ? '0' : '-',
ch_output_3(choffs) ? '1' : '-');
if (op_lfo_am_enable(opoffs) != 0)
end += sprintf(end, " am=%u", lfo_am_depth());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " am=%u", lfo_am_depth());
if (op_lfo_pm_enable(opoffs) != 0)
end += sprintf(end, " pm=%u", lfo_pm_depth());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " pm=%u", lfo_pm_depth());
if (waveform_enable() && op_waveform(opoffs) != 0)
end += sprintf(end, " wf=%u", op_waveform(opoffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " wf=%u", op_waveform(opoffs));
if (is_rhythm(choffs))
end += sprintf(end, " rhy=1");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " rhy=1");
if (DYNAMIC_OPS)
{
operator_mapping map;
operator_map(map);
if (bitfield(map.chan[chnum], 16, 8) != 0xff)
end += sprintf(end, " 4op");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " 4op");
}
return buffer;
@@ -687,7 +687,7 @@ std::string opll_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
char buffer[256];
char *end = &buffer[0];
end += sprintf(end, "%u.%02u freq=%04X inst=%X fb=%u mul=%X",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, "%u.%02u freq=%04X inst=%X fb=%u mul=%X",
chnum, opnum,
ch_block_freq(choffs),
ch_instrument(choffs),
@@ -695,11 +695,11 @@ std::string opll_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
op_multiple(opoffs));
if (bitfield(opoffs, 0) == 1 || (is_rhythm(choffs) && choffs >= 6))
end += sprintf(end, " vol=%X", op_volume(opoffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " vol=%X", op_volume(opoffs));
else
end += sprintf(end, " tl=%02X", ch_total_level(choffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " tl=%02X", ch_total_level(choffs));
end += sprintf(end, " ksr=%u ksl=%u adr=%X/%X/%X sl=%X sus=%u/%u",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " ksr=%u ksl=%u adr=%X/%X/%X sl=%X sus=%u/%u",
op_ksr(opoffs),
op_ksl(opoffs),
op_attack_rate(opoffs),
@@ -710,13 +710,13 @@ std::string opll_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
ch_sustain(choffs));
if (op_lfo_am_enable(opoffs))
end += sprintf(end, " am=1");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " am=1");
if (op_lfo_pm_enable(opoffs))
end += sprintf(end, " pm=1");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " pm=1");
if (op_waveform(opoffs) != 0)
end += sprintf(end, " wf=1");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " wf=1");
if (is_rhythm(choffs))
end += sprintf(end, " rhy=1");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " rhy=1");
return buffer;
}

View File

@@ -356,7 +356,7 @@ std::string opm_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
char buffer[256];
char *end = &buffer[0];
end += sprintf(end, "%u.%02u freq=%04X dt2=%u dt=%u fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X out=%c%c",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, "%u.%02u freq=%04X dt2=%u dt=%u fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X out=%c%c",
chnum, opnum,
ch_block_freq(choffs),
op_detune2(opoffs),
@@ -376,14 +376,14 @@ std::string opm_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
bool am = (lfo_am_depth() != 0 && ch_lfo_am_sens(choffs) != 0 && op_lfo_am_enable(opoffs) != 0);
if (am)
end += sprintf(end, " am=%u/%02X", ch_lfo_am_sens(choffs), lfo_am_depth());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " am=%u/%02X", ch_lfo_am_sens(choffs), lfo_am_depth());
bool pm = (lfo_pm_depth() != 0 && ch_lfo_pm_sens(choffs) != 0);
if (pm)
end += sprintf(end, " pm=%u/%02X", ch_lfo_pm_sens(choffs), lfo_pm_depth());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " pm=%u/%02X", ch_lfo_pm_sens(choffs), lfo_pm_depth());
if (am || pm)
end += sprintf(end, " lfo=%02X/%c", lfo_rate(), "WQTN"[lfo_waveform()]);
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " lfo=%02X/%c", lfo_rate(), "WQTN"[lfo_waveform()]);
if (noise_enable() && opoffs == 31)
end += sprintf(end, " noise=1");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " noise=1");
return buffer;
}

View File

@@ -411,7 +411,7 @@ std::string opn_registers_base<IsOpnA>::log_keyon(uint32_t choffs, uint32_t opof
char buffer[256];
char *end = &buffer[0];
end += sprintf(end, "%u.%02u freq=%04X dt=%u fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, "%u.%02u freq=%04X dt=%u fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X",
chnum, opnum,
block_freq,
op_detune(opoffs),
@@ -427,21 +427,21 @@ std::string opn_registers_base<IsOpnA>::log_keyon(uint32_t choffs, uint32_t opof
op_sustain_level(opoffs));
if (OUTPUTS > 1)
end += sprintf(end, " out=%c%c",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " out=%c%c",
ch_output_0(choffs) ? 'L' : '-',
ch_output_1(choffs) ? 'R' : '-');
if (op_ssg_eg_enable(opoffs))
end += sprintf(end, " ssg=%X", op_ssg_eg_mode(opoffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " ssg=%X", op_ssg_eg_mode(opoffs));
bool am = (op_lfo_am_enable(opoffs) && ch_lfo_am_sens(choffs) != 0);
if (am)
end += sprintf(end, " am=%u", ch_lfo_am_sens(choffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " am=%u", ch_lfo_am_sens(choffs));
bool pm = (ch_lfo_pm_sens(choffs) != 0);
if (pm)
end += sprintf(end, " pm=%u", ch_lfo_pm_sens(choffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " pm=%u", ch_lfo_pm_sens(choffs));
if (am || pm)
end += sprintf(end, " lfo=%02X", lfo_rate());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " lfo=%02X", lfo_rate());
if (multi_freq() && choffs == 2)
end += sprintf(end, " multi=1");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " multi=1");
return buffer;
}

View File

@@ -341,7 +341,7 @@ std::string opq_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
char buffer[256];
char *end = &buffer[0];
end += sprintf(end, "%u.%02u freq=%04X dt=%+2d fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X out=%c%c",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, "%u.%02u freq=%04X dt=%+2d fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X out=%c%c",
chnum, opnum,
(opoffs & 1) ? ch_block_freq_24(choffs) : ch_block_freq_13(choffs),
int32_t(op_detune(opoffs)) - 0x20,
@@ -360,14 +360,14 @@ std::string opq_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
bool am = (lfo_enable() && op_lfo_am_enable(opoffs) && ch_lfo_am_sens(choffs) != 0);
if (am)
end += sprintf(end, " am=%u", ch_lfo_am_sens(choffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " am=%u", ch_lfo_am_sens(choffs));
bool pm = (lfo_enable() && ch_lfo_pm_sens(choffs) != 0);
if (pm)
end += sprintf(end, " pm=%u", ch_lfo_pm_sens(choffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " pm=%u", ch_lfo_pm_sens(choffs));
if (am || pm)
end += sprintf(end, " lfo=%02X", lfo_rate());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " lfo=%02X", lfo_rate());
if (ch_reverb(choffs))
end += sprintf(end, " reverb");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " reverb");
return buffer;
}

View File

@@ -557,14 +557,14 @@ std::string opz_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
char buffer[256];
char *end = &buffer[0];
end += sprintf(end, "%u.%02u", chnum, opnum);
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, "%u.%02u", chnum, opnum);
if (op_fix_mode(opoffs))
end += sprintf(end, " fixfreq=%X fine=%X shift=%X", op_fix_frequency(opoffs), op_fine(opoffs), op_fix_range(opoffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " fixfreq=%X fine=%X shift=%X", op_fix_frequency(opoffs), op_fine(opoffs), op_fix_range(opoffs));
else
end += sprintf(end, " freq=%04X dt2=%u fine=%X", ch_block_freq(choffs), op_detune2(opoffs), op_fine(opoffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " freq=%04X dt2=%u fine=%X", ch_block_freq(choffs), op_detune2(opoffs), op_fine(opoffs));
end += sprintf(end, " dt=%u fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X out=%c%c",
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " dt=%u fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X out=%c%c",
op_detune(opoffs),
ch_feedback(choffs),
ch_algorithm(choffs),
@@ -580,32 +580,32 @@ std::string opz_registers::log_keyon(uint32_t choffs, uint32_t opoffs)
ch_output_1(choffs) ? 'R' : '-');
if (op_eg_shift(opoffs) != 0)
end += sprintf(end, " egshift=%u", op_eg_shift(opoffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " egshift=%u", op_eg_shift(opoffs));
bool am = (lfo_am_depth() != 0 && ch_lfo_am_sens(choffs) != 0 && op_lfo_am_enable(opoffs) != 0);
if (am)
end += sprintf(end, " am=%u/%02X", ch_lfo_am_sens(choffs), lfo_am_depth());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " am=%u/%02X", ch_lfo_am_sens(choffs), lfo_am_depth());
bool pm = (lfo_pm_depth() != 0 && ch_lfo_pm_sens(choffs) != 0);
if (pm)
end += sprintf(end, " pm=%u/%02X", ch_lfo_pm_sens(choffs), lfo_pm_depth());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " pm=%u/%02X", ch_lfo_pm_sens(choffs), lfo_pm_depth());
if (am || pm)
end += sprintf(end, " lfo=%02X/%c", lfo_rate(), "WQTN"[lfo_waveform()]);
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " lfo=%02X/%c", lfo_rate(), "WQTN"[lfo_waveform()]);
bool am2 = (lfo2_am_depth() != 0 && ch_lfo2_am_sens(choffs) != 0 && op_lfo_am_enable(opoffs) != 0);
if (am2)
end += sprintf(end, " am2=%u/%02X", ch_lfo2_am_sens(choffs), lfo2_am_depth());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " am2=%u/%02X", ch_lfo2_am_sens(choffs), lfo2_am_depth());
bool pm2 = (lfo2_pm_depth() != 0 && ch_lfo2_pm_sens(choffs) != 0);
if (pm2)
end += sprintf(end, " pm2=%u/%02X", ch_lfo2_pm_sens(choffs), lfo2_pm_depth());
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " pm2=%u/%02X", ch_lfo2_pm_sens(choffs), lfo2_pm_depth());
if (am2 || pm2)
end += sprintf(end, " lfo2=%02X/%c", lfo2_rate(), "WQTN"[lfo2_waveform()]);
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " lfo2=%02X/%c", lfo2_rate(), "WQTN"[lfo2_waveform()]);
if (op_reverb_rate(opoffs) != 0)
end += sprintf(end, " rev=%u", op_reverb_rate(opoffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " rev=%u", op_reverb_rate(opoffs));
if (op_waveform(opoffs) != 0)
end += sprintf(end, " wf=%u", op_waveform(opoffs));
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " wf=%u", op_waveform(opoffs));
if (noise_enable() && opoffs == 31)
end += sprintf(end, " noise=1");
end += snprintf(end, SNPRINTF_BUFFER_SIZE_CALC, " noise=1");
return buffer;
}

View File

@@ -139,6 +139,7 @@ herculesplus_out(uint16_t port, uint8_t val, void *priv)
return;
old = dev->crtc[dev->crtcreg];
dev->crtc[dev->crtcreg] = val;
if (dev->crtc[10] == 6 && dev->crtc[11] == 7) {
/*Fix for Generic Turbo XT BIOS,
*which sets up cursor registers wrong*/
@@ -364,7 +365,6 @@ draw_char_ram48(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
unsigned olc = 0;
unsigned val;
unsigned ibg;
unsigned ifg = 0;
unsigned cfg;
const unsigned char *fnt;
int cw = HERCULESPLUS_CW;
@@ -459,8 +459,8 @@ text_line(herculesplus_t *dev, uint16_t ca)
for (uint8_t x = 0; x < dev->crtc[1]; x++) {
if (dev->ctrl & 8) {
chr = dev->vram[(dev->ma << 1) & 0xfff];
attr = dev->vram[((dev->ma << 1) + 1) & 0xfff];
chr = dev->vram[(dev->ma << 1) & 0x3fff];
attr = dev->vram[((dev->ma << 1) + 1) & 0x3fff];
} else
chr = attr = 0;
@@ -535,6 +535,7 @@ herculesplus_poll(void *priv)
int x;
int oldvc;
int oldsc;
int cw = HERCULESPLUS_CW;
VIDEO_MONITOR_PROLOGUE();
if (!dev->linepos) {
@@ -558,7 +559,7 @@ herculesplus_poll(void *priv)
if ((dev->ctrl & HERCULESPLUS_CTRL_GRAPH) && (dev->ctrl2 & HERCULESPLUS_CTRL2_GRAPH))
x = dev->crtc[1] << 4;
else
x = dev->crtc[1] * 9;
x = dev->crtc[1] * cw;
video_process_8(x, dev->displine);
}
@@ -621,7 +622,7 @@ herculesplus_poll(void *priv)
if ((dev->ctrl & HERCULESPLUS_CTRL_GRAPH) && (dev->ctrl2 & HERCULESPLUS_CTRL2_GRAPH))
x = dev->crtc[1] << 4;
else
x = dev->crtc[1] * 9;
x = dev->crtc[1] * cw;
dev->lastline++;
if ((dev->ctrl & 8) && ((x != xsize) || ((dev->lastline - dev->firstline) != ysize) || video_force_resize_get())) {
xsize = x;

View File

@@ -749,8 +749,8 @@ text_line(incolor_t *dev, uint16_t ca)
for (uint8_t x = 0; x < dev->crtc[1]; x++) {
if (dev->ctrl & 8) {
chr = dev->vram[(dev->ma << 1) & 0xfff];
attr = dev->vram[((dev->ma << 1) + 1) & 0xfff];
chr = dev->vram[(dev->ma << 1) & 0x3fff];
attr = dev->vram[((dev->ma << 1) + 1) & 0x3fff];
} else
chr = attr = 0;
@@ -850,6 +850,7 @@ incolor_poll(void *priv)
int x;
int oldvc;
int oldsc;
int cw = INCOLOR_CW;
if (!dev->linepos) {
timer_advance_u64(&dev->timer, dev->dispofftime);
@@ -931,7 +932,7 @@ incolor_poll(void *priv)
if ((dev->ctrl & INCOLOR_CTRL_GRAPH) && (dev->ctrl2 & INCOLOR_CTRL2_GRAPH))
x = dev->crtc[1] << 4;
else
x = dev->crtc[1] * 9;
x = dev->crtc[1] * cw;
dev->lastline++;
if ((dev->ctrl & 8) && ((x != xsize) || ((dev->lastline - dev->firstline) != ysize) || video_force_resize_get())) {
xsize = x;

View File

@@ -3164,9 +3164,9 @@ banshee_init_common(const device_t *info, char *fn, int has_sgram, int type, int
banshee->svga.decode_mask = 0x1ffffff;
if (banshee->has_bios)
pci_add_card(banshee->agp ? PCI_ADD_AGP : PCI_ADD_VIDEO, banshee_pci_read, banshee_pci_write, banshee, &banshee->pci_slot);
else
pci_add_card(banshee->agp ? PCI_ADD_AGP : PCI_ADD_NORMAL, banshee_pci_read, banshee_pci_write, banshee, &banshee->pci_slot);
else
pci_add_card(banshee->agp ? PCI_ADD_AGP : PCI_ADD_VIDEO, banshee_pci_read, banshee_pci_write, banshee, &banshee->pci_slot);
banshee->voodoo = voodoo_2d3d_card_init(voodoo_type);
banshee->voodoo->p = banshee;