Merge remote-tracking branch 'upstream/master' into qt-wacom-serial
This commit is contained in:
@@ -52,11 +52,14 @@ if(DEV_BRANCH)
|
||||
endif()
|
||||
|
||||
if(VNC)
|
||||
add_compile_definitions(USE_VNC)
|
||||
add_library(vnc OBJECT vnc.c vnc_keymap.c)
|
||||
target_link_libraries(86Box vnc vncserver)
|
||||
if(WIN32)
|
||||
target_link_libraries(86Box ws2_32)
|
||||
find_package(LibVNCServer)
|
||||
if(LibVNCServer_FOUND)
|
||||
add_compile_definitions(USE_VNC)
|
||||
add_library(vnc OBJECT vnc.c vnc_keymap.c)
|
||||
target_link_libraries(86Box vnc LibVNCServer::vncserver)
|
||||
if(WIN32)
|
||||
target_link_libraries(86Box ws2_32)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ cpu_is_eligible(const cpu_family_t *cpu_family, int cpu, int machine)
|
||||
if (packages & CPU_PKG_SOCKET3)
|
||||
packages |= CPU_PKG_SOCKET1;
|
||||
else if (packages & CPU_PKG_SLOT1)
|
||||
packages |= CPU_PKG_SOCKET370;
|
||||
packages |= CPU_PKG_SOCKET370 | CPU_PKG_SOCKET8;
|
||||
|
||||
/* Package type. */
|
||||
if (!(cpu_family->package & packages))
|
||||
@@ -2848,7 +2848,7 @@ amd_k_invalid_wrmsr:
|
||||
break;
|
||||
case 0x1b:
|
||||
cpu_log("APIC_BASE write: %08X%08X\n", EDX, EAX);
|
||||
// msr.apic_base = EAX | ((uint64_t)EDX << 32);
|
||||
// msr.apic_base = EAX | ((uint64_t) EDX << 32);
|
||||
break;
|
||||
case 0x2a:
|
||||
break;
|
||||
|
||||
@@ -130,7 +130,7 @@ opFPU(s, x87_ts, 16, t.i, geteal, t.s, _32)
|
||||
#ifndef FPU_8087
|
||||
opFPU(s, x87_ts, 32, t.i, geteal, t.s, _32)
|
||||
#endif
|
||||
opFPU(d, x87_td, 16, t.i, geteaq, t.d, _64)
|
||||
opFPU(d, x87_td, 16, t.i, geteaq, t.d, _64)
|
||||
#ifndef FPU_8087
|
||||
opFPU(d, x87_td, 32, t.i, geteaq, t.d, _64)
|
||||
#endif
|
||||
@@ -139,7 +139,7 @@ opFPU(iw, uint16_t, 16, t, geteaw, (double) (int16_t) t, _i16)
|
||||
#ifndef FPU_8087
|
||||
opFPU(iw, uint16_t, 32, t, geteaw, (double) (int16_t) t, _i16)
|
||||
#endif
|
||||
opFPU(il, uint32_t, 16, t, geteal, (double) (int32_t) t, _i32)
|
||||
opFPU(il, uint32_t, 16, t, geteal, (double) (int32_t) t, _i32)
|
||||
#ifndef FPU_8087
|
||||
opFPU(il, uint32_t, 32, t, geteal, (double) (int32_t) t, _i32)
|
||||
#endif
|
||||
|
||||
@@ -96,6 +96,7 @@ 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 void (*mouse_poll_ex)(void) = NULL;
|
||||
|
||||
#ifdef ENABLE_MOUSE_LOG
|
||||
int mouse_do_log = ENABLE_MOUSE_LOG;
|
||||
@@ -173,13 +174,22 @@ mouse_set_buttons(int buttons)
|
||||
mouse_nbut = buttons;
|
||||
}
|
||||
|
||||
void
|
||||
mouse_set_poll_ex(void (*poll_ex)(void))
|
||||
{
|
||||
mouse_poll_ex = poll_ex;
|
||||
}
|
||||
|
||||
void
|
||||
mouse_process(void)
|
||||
{
|
||||
if (mouse_curr == NULL)
|
||||
return;
|
||||
|
||||
mouse_poll();
|
||||
if (mouse_poll_ex)
|
||||
mouse_poll_ex();
|
||||
else
|
||||
mouse_poll();
|
||||
|
||||
if ((mouse_dev_poll != NULL) || (mouse_curr->poll != NULL)) {
|
||||
if (mouse_curr->poll != NULL)
|
||||
|
||||
@@ -88,7 +88,7 @@ discord_update_activity(int paused)
|
||||
*(paren - 1) = '\0';
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__GNUC__) && !defined (__clang__)
|
||||
# pragma GCC diagnostic ignored "-Wformat-truncation"
|
||||
#endif
|
||||
if (strlen(vm_name) < 100) {
|
||||
|
||||
@@ -486,9 +486,9 @@ img_seek(int drive, int track)
|
||||
for (side = 0; side < dev->sides; side++) {
|
||||
if (dev->disk_at_once) {
|
||||
cur_pos = (track * dev->sectors * ssize * dev->sides) + (side * dev->sectors * ssize);
|
||||
memcpy(dev->track_data[side], dev->disk_data + cur_pos, dev->sectors * ssize);
|
||||
memcpy(dev->track_data[side], dev->disk_data + cur_pos, (size_t) dev->sectors * ssize);
|
||||
} else {
|
||||
read_bytes = fread(dev->track_data[side], 1, dev->sectors * ssize, dev->f);
|
||||
read_bytes = fread(dev->track_data[side], 1, (size_t) dev->sectors * ssize, dev->f);
|
||||
if (read_bytes < (dev->sectors * ssize))
|
||||
memset(dev->track_data[side] + read_bytes, 0xf6, (dev->sectors * ssize) - read_bytes);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ typedef struct {
|
||||
const char *file_filter;
|
||||
const device_config_spinner_t spinner;
|
||||
const device_config_selection_t selection[16];
|
||||
const device_config_bios_t bios[32];
|
||||
const device_config_bios_t bios[32];
|
||||
} device_config_t;
|
||||
|
||||
typedef struct _device_ {
|
||||
|
||||
@@ -71,6 +71,7 @@ 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_poll(void);
|
||||
|
||||
@@ -259,10 +259,17 @@ machine_at_scat_init(const machine_t *model, int is_v4, int is_ami)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
|
||||
if (is_ami)
|
||||
device_add(&keyboard_at_ami_device);
|
||||
else
|
||||
device_add(&keyboard_at_device);
|
||||
if (machines[machine].bus_flags & MACHINE_BUS_PS2) {
|
||||
if (is_ami)
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
else
|
||||
device_add(&keyboard_ps2_device);
|
||||
} else {
|
||||
if (is_ami)
|
||||
device_add(&keyboard_at_ami_device);
|
||||
else
|
||||
device_add(&keyboard_at_device);
|
||||
}
|
||||
|
||||
if (is_v4)
|
||||
device_add(&scat_4_device);
|
||||
|
||||
@@ -407,7 +407,7 @@ new_page(escp_t *dev, int8_t save, int8_t resetx)
|
||||
dev->curr_y = dev->top_margin;
|
||||
if (dev->page) {
|
||||
dev->page->dirty = 0;
|
||||
memset(dev->page->pixels, 0x00, dev->page->pitch * dev->page->h);
|
||||
memset(dev->page->pixels, 0x00, (size_t) dev->page->pitch * dev->page->h);
|
||||
}
|
||||
|
||||
/* Make the page's file name. */
|
||||
@@ -444,16 +444,16 @@ fill_palette(uint8_t redmax, uint8_t greenmax, uint8_t bluemax, uint8_t colorID,
|
||||
uint8_t colormask;
|
||||
int i;
|
||||
|
||||
float red = (float) redmax / (float) 30.9;
|
||||
float green = (float) greenmax / (float) 30.9;
|
||||
float blue = (float) bluemax / (float) 30.9;
|
||||
double red = (double) redmax / (double) 30.9;
|
||||
double green = (double) greenmax / (double) 30.9;
|
||||
double blue = (double) bluemax / (double) 30.9;
|
||||
|
||||
colormask = colorID <<= 5;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
dev->palcol[i + colormask].r = 255 - (uint8_t) floor(red * (float) i);
|
||||
dev->palcol[i + colormask].g = 255 - (uint8_t) floor(green * (float) i);
|
||||
dev->palcol[i + colormask].b = 255 - (uint8_t) floor(blue * (float) i);
|
||||
dev->palcol[i + colormask].r = 255 - (uint8_t) floor(red * (double) i);
|
||||
dev->palcol[i + colormask].g = 255 - (uint8_t) floor(green * (double) i);
|
||||
dev->palcol[i + colormask].b = 255 - (uint8_t) floor(blue * (double) i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2043,8 +2043,8 @@ escp_init(void *lpt)
|
||||
dev->page->w = (int) (dev->dpi * dev->page_width);
|
||||
dev->page->h = (int) (dev->dpi * dev->page_height);
|
||||
dev->page->pitch = dev->page->w;
|
||||
dev->page->pixels = (uint8_t *) malloc(dev->page->pitch * dev->page->h);
|
||||
memset(dev->page->pixels, 0x00, dev->page->pitch * dev->page->h);
|
||||
dev->page->pixels = (uint8_t *) malloc((size_t) dev->page->pitch * dev->page->h);
|
||||
memset(dev->page->pixels, 0x00, (size_t) dev->page->pitch * dev->page->h);
|
||||
|
||||
/* Initialize parameters. */
|
||||
for (i = 0; i < 32; i++) {
|
||||
|
||||
@@ -1088,7 +1088,7 @@ std::array<uint32_t, 256> x11_to_xt_2 {
|
||||
0x53,
|
||||
0x138,
|
||||
0x55,
|
||||
0x35,
|
||||
0x56,
|
||||
0x57,
|
||||
0x58,
|
||||
0x56,
|
||||
|
||||
@@ -39,6 +39,7 @@ extern "C" {
|
||||
// Disable c99-designator to avoid the warnings in rtmidi_*_device
|
||||
#ifdef __clang__
|
||||
# if __has_warning("-Wc99-designator")
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wc99-designator"
|
||||
# endif
|
||||
#endif
|
||||
@@ -302,4 +303,11 @@ const device_t rtmidi_input_device = {
|
||||
.force_redraw = NULL,
|
||||
.config = midi_input_config
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
# if __has_warning("-Wc99-designator")
|
||||
# pragma clang diagnostic pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,15 @@ extern "C" {
|
||||
#include <86box/snd_opl.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
|
||||
// Disable c99-designator to avoid the warnings in *_ymfm_device
|
||||
#ifdef __clang__
|
||||
# if __has_warning("-Wc99-designator")
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wc99-designator"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#define RSM_FRAC 10
|
||||
@@ -432,4 +441,11 @@ const fm_drv_t ymfm_drv {
|
||||
&ymfm_drv_set_do_cycles,
|
||||
NULL,
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
# if __has_warning("-Wc99-designator")
|
||||
# pragma clang diagnostic pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -2663,8 +2663,8 @@ pgc_init(pgc_t *dev, int maxw, int maxh, int visw, int vish,
|
||||
dev->visw = visw;
|
||||
dev->vish = vish;
|
||||
|
||||
dev->vram = (uint8_t *) malloc(maxw * maxh);
|
||||
memset(dev->vram, 0x00, maxw * maxh);
|
||||
dev->vram = (uint8_t *) malloc((size_t) maxw * maxh);
|
||||
memset(dev->vram, 0x00, (size_t) maxw * maxh);
|
||||
dev->cga_vram = (uint8_t *) malloc(16384);
|
||||
memset(dev->cga_vram, 0x00, 16384);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ svga_render_blank(svga_t *svga)
|
||||
}
|
||||
|
||||
uint32_t *line_ptr = &buffer32->line[svga->displine + svga->y_add][svga->x_add];
|
||||
uint32_t line_width = (svga->hdisp + svga->scrollcache) * char_width * sizeof(uint32_t);
|
||||
uint32_t line_width = (uint32_t) (svga->hdisp + svga->scrollcache) * char_width * sizeof(uint32_t);
|
||||
memset(line_ptr, 0, line_width);
|
||||
}
|
||||
|
||||
|
||||
@@ -804,7 +804,7 @@ create_bitmap(int x, int y)
|
||||
bitmap_t *b = malloc(sizeof(bitmap_t) + (y * sizeof(uint32_t *)));
|
||||
int c;
|
||||
|
||||
b->dat = malloc(x * y * 4);
|
||||
b->dat = malloc((size_t) x * y * 4);
|
||||
for (c = 0; c < y; c++)
|
||||
b->line[c] = &(b->dat[c * x]);
|
||||
b->w = x;
|
||||
|
||||
83
src/vnc.c
83
src/vnc.c
@@ -44,6 +44,15 @@ static int allowedX,
|
||||
allowedY;
|
||||
static int ptr_x, ptr_y, ptr_but;
|
||||
|
||||
typedef struct {
|
||||
int buttons;
|
||||
int dx;
|
||||
int dy;
|
||||
int dwheel;
|
||||
} MOUSESTATE;
|
||||
|
||||
static MOUSESTATE ms;
|
||||
|
||||
#ifdef ENABLE_VNC_LOG
|
||||
int vnc_do_log = ENABLE_VNC_LOG;
|
||||
|
||||
@@ -71,29 +80,43 @@ vnc_kbdevent(rfbBool down, rfbKeySym k, rfbClientPtr cl)
|
||||
vnc_kbinput(down ? 1 : 0, (int) k);
|
||||
}
|
||||
|
||||
void
|
||||
vnc_mouse_poll(void)
|
||||
{
|
||||
static int b = 0;
|
||||
if (ms.dx != 0 || ms.dy != 0) {
|
||||
mouse_x += ms.dx;
|
||||
mouse_y += ms.dy;
|
||||
|
||||
ms.dx = 0;
|
||||
ms.dy = 0;
|
||||
|
||||
// pclog("dx=%d, dy=%d, dwheel=%d\n", mouse_x, mouse_y, mouse_z);
|
||||
}
|
||||
|
||||
if (b != ms.buttons) {
|
||||
mouse_buttons = ms.buttons;
|
||||
b = ms.buttons;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vnc_ptrevent(int but, int x, int y, rfbClientPtr cl)
|
||||
{
|
||||
if (x >= 0 && x < allowedX && y >= 0 && y < allowedY) {
|
||||
/* VNC uses absolute positions within the window, no deltas. */
|
||||
if (x != ptr_x || y != ptr_y) {
|
||||
mouse_x += (x - ptr_x) / 100;
|
||||
mouse_y += (y - ptr_y) / 100;
|
||||
ptr_x = x;
|
||||
ptr_y = y;
|
||||
}
|
||||
ms.buttons = 0;
|
||||
if (but & 0x01)
|
||||
ms.buttons |= 0x01;
|
||||
if (but & 0x02)
|
||||
ms.buttons |= 0x04;
|
||||
if (but & 0x04)
|
||||
ms.buttons |= 0x02;
|
||||
ptr_but = but;
|
||||
|
||||
if (but != ptr_but) {
|
||||
mouse_buttons = 0;
|
||||
if (but & 0x01)
|
||||
mouse_buttons |= 0x01;
|
||||
if (but & 0x02)
|
||||
mouse_buttons |= 0x04;
|
||||
if (but & 0x04)
|
||||
mouse_buttons |= 0x02;
|
||||
ptr_but = but;
|
||||
}
|
||||
}
|
||||
/* VNC uses absolute positions within the window, no deltas. */
|
||||
ms.dx += (x - ptr_x) / 0.96; /* TODO: Figure out the correct scale factor for X and Y. */
|
||||
ms.dy += (y - ptr_y) / 0.96;
|
||||
ptr_x = x;
|
||||
ptr_y = y;
|
||||
|
||||
rfbDefaultPtrAddEvent(but, x, y, cl);
|
||||
}
|
||||
@@ -110,7 +133,8 @@ vnc_clientgone(rfbClientPtr cl)
|
||||
vnc_log("VNC: no clients, pausing..\n");
|
||||
|
||||
/* Disable the mouse. */
|
||||
plat_mouse_capture(0);
|
||||
// plat_mouse_capture(0);
|
||||
mouse_set_poll_ex(NULL);
|
||||
|
||||
plat_pause(1);
|
||||
}
|
||||
@@ -129,12 +153,14 @@ vnc_newclient(rfbClientPtr cl)
|
||||
ptr_y = allowedY / 2;
|
||||
mouse_x = mouse_y = mouse_z = 0;
|
||||
mouse_buttons = 0x00;
|
||||
memset(&ms, 0, sizeof(MOUSESTATE));
|
||||
|
||||
/* We now have clients, un-pause the emulator if needed. */
|
||||
vnc_log("VNC: unpausing..\n");
|
||||
|
||||
/* Enable the mouse. */
|
||||
plat_mouse_capture(1);
|
||||
// plat_mouse_capture(1);
|
||||
mouse_set_poll_ex(vnc_mouse_poll);
|
||||
|
||||
plat_pause(0);
|
||||
}
|
||||
@@ -160,20 +186,15 @@ vnc_display(rfbClientPtr cl)
|
||||
static void
|
||||
vnc_blit(int x, int y, int w, int h, int monitor_index)
|
||||
{
|
||||
uint32_t *p;
|
||||
int yy;
|
||||
int row;
|
||||
|
||||
if (monitor_index || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL)) {
|
||||
if (monitor_index || (x < 0) || (y < 0) || (w < VNC_MIN_X) || (h < VNC_MIN_Y) || (w > VNC_MAX_X) || (h > VNC_MAX_Y) || (buffer32 == NULL)) {
|
||||
video_blit_complete_monitor(monitor_index);
|
||||
return;
|
||||
}
|
||||
|
||||
for (yy = 0; yy < h; yy++) {
|
||||
p = (uint32_t *) &(((uint32_t *) rfb->frameBuffer)[yy * VNC_MAX_X]);
|
||||
|
||||
if ((y + yy) >= 0 && (y + yy) < VNC_MAX_Y)
|
||||
video_copy(p, &(buffer32->line[yy]), w * sizeof(uint32_t));
|
||||
}
|
||||
for (row = 0; row < h; ++row)
|
||||
video_copy(&(((uint8_t *) rfb->frameBuffer)[row * 2048 * sizeof(uint32_t)]), &(buffer32->line[y + row][x]), w * sizeof(uint32_t));
|
||||
|
||||
if (screenshots)
|
||||
video_screenshot((uint32_t *) rfb->frameBuffer, 0, 0, VNC_MAX_X);
|
||||
@@ -265,7 +286,7 @@ vnc_resize(int x, int y)
|
||||
return;
|
||||
|
||||
/* TightVNC doesn't like certain sizes.. */
|
||||
if (x < VNC_MIN_X || x > VNC_MAX_X || y < VNC_MIN_Y || y > VNC_MAX_Y) {
|
||||
if ((x < VNC_MIN_X) || (x > VNC_MAX_X) || (y < VNC_MIN_Y) || (y > VNC_MAX_Y)) {
|
||||
vnc_log("VNC: invalid resoltion %dx%d requested!\n", x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ ifeq ($(VNC), y)
|
||||
OPTS += -I$(VNC_PATH)\INCLUDE
|
||||
VNCLIB := -L$(VNC_PATH)\LIB
|
||||
endif
|
||||
VNCLIB += -lvncserver
|
||||
VNCLIB += -lvncserver.dll
|
||||
VNCOBJ := vnc.o vnc_keymap.o
|
||||
endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user