Merge remote-tracking branch 'upstream/master' into qt-wacom-serial
This commit is contained in:
9
.github/dependabot.yml
vendored
Normal file
9
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
|
||||
# Maintain dependencies for GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
23
.github/workflows/c-cpp.yml
vendored
23
.github/workflows/c-cpp.yml
vendored
@@ -58,28 +58,29 @@ jobs:
|
||||
- name: Prepare MSYS2 environment
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
release: false
|
||||
update: true
|
||||
msystem: ${{ matrix.environment.msystem }}
|
||||
install: >-
|
||||
make
|
||||
${{ matrix.environment.prefix }}-gcc
|
||||
${{ matrix.environment.prefix }}-pkg-config
|
||||
${{ matrix.environment.prefix }}-freetype
|
||||
${{ matrix.environment.prefix }}-SDL2
|
||||
${{ matrix.environment.prefix }}-zlib
|
||||
${{ matrix.environment.prefix }}-libpng
|
||||
${{ matrix.environment.prefix }}-openal
|
||||
${{ matrix.environment.prefix }}-rtmidi
|
||||
${{ matrix.environment.prefix }}-libvncserver
|
||||
pacboy: >-
|
||||
gcc:p
|
||||
pkg-config:p
|
||||
freetype:p
|
||||
SDL2:p
|
||||
zlib:p
|
||||
libpng:p
|
||||
openal:p
|
||||
rtmidi:p
|
||||
libvncserver:p
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: >-
|
||||
make -fwin/makefile.mingw -j
|
||||
make -fwin/Makefile.mingw -j
|
||||
DEV_BUILD=${{ matrix.build.dev }}
|
||||
DEBUG=${{ matrix.build.debug }}
|
||||
NEW_DYNAREC=${{ matrix.dynarec.new }}
|
||||
X64=${{ matrix.environment.x64 }}
|
||||
VNC=n
|
||||
working-directory: ./src
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
36
.github/workflows/cmake.yml
vendored
36
.github/workflows/cmake.yml
vendored
@@ -76,13 +76,14 @@ jobs:
|
||||
- name: Prepare MSYS2 environment
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
release: false
|
||||
update: true
|
||||
msystem: ${{ matrix.environment.msystem }}
|
||||
pacboy: >-
|
||||
ninja:p
|
||||
cmake:p
|
||||
gcc:p
|
||||
pkg-config:p
|
||||
pkgconf:p
|
||||
freetype:p
|
||||
SDL2:p
|
||||
zlib:p
|
||||
@@ -100,7 +101,6 @@ jobs:
|
||||
-D CMAKE_INSTALL_PREFIX=./build/artifacts
|
||||
-D QT=${{ matrix.ui.qt }}
|
||||
-D STATIC_BUILD=${{ matrix.ui.static }}
|
||||
-D VNC=n
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Generate package
|
||||
@@ -169,7 +169,7 @@ jobs:
|
||||
run: echo "C:/Program Files/LLVM/bin" >> $env:GITHUB_PATH
|
||||
- name: Download Ninja
|
||||
run: >
|
||||
Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip -OutFile ninja-win.zip &&
|
||||
Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip -OutFile ninja-win.zip &&
|
||||
Expand-Archive ninja-win.zip -DestinationPath .
|
||||
- name: Setup NuGet Credentials
|
||||
run: >
|
||||
@@ -211,7 +211,7 @@ jobs:
|
||||
path: build/artifacts/**
|
||||
|
||||
linux:
|
||||
name: "Linux GCC 11 (Qt GUI, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, x86_64)"
|
||||
name: "Linux GCC 11 (${{ matrix.ui.name }}, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, x86_64)"
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
@@ -232,6 +232,13 @@ jobs:
|
||||
- name: NDR
|
||||
new: on
|
||||
slug: -NDR
|
||||
ui:
|
||||
- name: Qt GUI
|
||||
qt: on
|
||||
slug: -Qt
|
||||
packages: >-
|
||||
qtbase5-dev
|
||||
qttools5-dev
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
@@ -244,9 +251,9 @@ jobs:
|
||||
libpng-dev
|
||||
libc6-dev
|
||||
librtmidi-dev
|
||||
qtbase5-dev
|
||||
qttools5-dev
|
||||
libopenal-dev
|
||||
libvncserver-dev
|
||||
${{ matrix.ui.packages }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure CMake
|
||||
run: >-
|
||||
@@ -254,17 +261,18 @@ jobs:
|
||||
--toolchain ./cmake/flags-gcc-x86_64.cmake
|
||||
-D NEW_DYNAREC=${{ matrix.dynarec.new }}
|
||||
-D CMAKE_INSTALL_PREFIX=./build/artifacts
|
||||
-D QT=${{ matrix.ui.qt }}
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Generate package
|
||||
run: cmake --install build
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: '86Box-Qt${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-UbuntuJammy-x86_64-gha${{ github.run_number }}'
|
||||
name: '86Box${{ matrix.ui.slug }}${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-UbuntuJammy-x86_64-gha${{ github.run_number }}'
|
||||
path: build/artifacts/**
|
||||
|
||||
macos11:
|
||||
name: "macOS 11 (Qt GUI, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, x86_64)"
|
||||
name: "macOS 11 (${{ matrix.ui.name }}, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, x86_64)"
|
||||
|
||||
runs-on: macos-11
|
||||
|
||||
@@ -285,6 +293,12 @@ jobs:
|
||||
- name: NDR
|
||||
new: on
|
||||
slug: -NDR
|
||||
ui:
|
||||
- name: Qt GUI
|
||||
qt: on
|
||||
slug: -Qt
|
||||
packages: >-
|
||||
qt@5
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
@@ -295,8 +309,9 @@ jobs:
|
||||
sdl2
|
||||
libpng
|
||||
rtmidi
|
||||
qt@5
|
||||
openal-soft
|
||||
libvncserver
|
||||
${{ matrix.ui.packages }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure CMake
|
||||
run: >-
|
||||
@@ -304,6 +319,7 @@ jobs:
|
||||
--toolchain ./cmake/flags-gcc-x86_64.cmake
|
||||
-D NEW_DYNAREC=${{ matrix.dynarec.new }}
|
||||
-D CMAKE_INSTALL_PREFIX=./build/artifacts
|
||||
-D QT=${{ matrix.ui.qt }}
|
||||
-D Qt5_ROOT=$(brew --prefix qt@5)
|
||||
-D Qt5LinguistTools_ROOT=$(brew --prefix qt@5)
|
||||
-D OpenAL_ROOT=$(brew --prefix openal-soft)
|
||||
@@ -313,5 +329,5 @@ jobs:
|
||||
run: cmake --install build
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: '86Box-Qt${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-macOS-x86_64-gha${{ github.run_number }}'
|
||||
name: '86Box${{ matrix.ui.slug }}${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-macOS-x86_64-gha${{ github.run_number }}'
|
||||
path: build/artifacts/**
|
||||
|
51
.github/workflows/codeql.yml
vendored
Normal file
51
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on: [ push, pull_request]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: >-
|
||||
sudo apt update && sudo apt install
|
||||
build-essential
|
||||
ninja-build
|
||||
libfreetype-dev
|
||||
libsdl2-dev
|
||||
libpng-dev
|
||||
libc6-dev
|
||||
librtmidi-dev
|
||||
qtbase5-dev
|
||||
qttools5-dev
|
||||
libopenal-dev
|
||||
libvncserver-dev
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
@@ -73,3 +73,5 @@ patch_file src/unix/assets/*.spec '%global romver' 's/(^%global\ romver\s+)[0-9]
|
||||
patch_file src/unix/assets/*.spec 'changelog version' 's/(^[*]\s.*>\s+)[0-9].+/\1'"$newversion"-1'/'
|
||||
patch_file src/unix/assets/*.spec 'changelog date' 's/(^[*]\s)[a-zA-Z]{3}\s[a-zA-Z]{3}\s[0-9]{2}\s[0-9]{4}/\1'"$(pretty_date)"'/'
|
||||
patch_file src/unix/assets/*.metainfo.xml release 's/(<release version=")[^"]+(" date=")[^"]+/\1'"$newversion"'\2'"$(date +%Y-%m-%d)"'/'
|
||||
patch_file debian/changelog 'changelog date' 's/> .+/> '"$(date -R)"'/'
|
||||
patch_file debian/changelog 'changelog version' 's/86box \(.+\)/86box \('"$newversion"'\)/'
|
||||
|
@@ -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