Merge remote-tracking branch 'upstream/master' into qt-wacom-serial

This commit is contained in:
Cacodemon345
2023-01-07 11:38:25 +06:00
23 changed files with 230 additions and 85 deletions

9
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@@ -58,28 +58,29 @@ jobs:
- name: Prepare MSYS2 environment - name: Prepare MSYS2 environment
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
with: with:
release: false
update: true update: true
msystem: ${{ matrix.environment.msystem }} msystem: ${{ matrix.environment.msystem }}
install: >- install: >-
make make
${{ matrix.environment.prefix }}-gcc pacboy: >-
${{ matrix.environment.prefix }}-pkg-config gcc:p
${{ matrix.environment.prefix }}-freetype pkg-config:p
${{ matrix.environment.prefix }}-SDL2 freetype:p
${{ matrix.environment.prefix }}-zlib SDL2:p
${{ matrix.environment.prefix }}-libpng zlib:p
${{ matrix.environment.prefix }}-openal libpng:p
${{ matrix.environment.prefix }}-rtmidi openal:p
${{ matrix.environment.prefix }}-libvncserver rtmidi:p
libvncserver:p
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: make - name: make
run: >- run: >-
make -fwin/makefile.mingw -j make -fwin/Makefile.mingw -j
DEV_BUILD=${{ matrix.build.dev }} DEV_BUILD=${{ matrix.build.dev }}
DEBUG=${{ matrix.build.debug }} DEBUG=${{ matrix.build.debug }}
NEW_DYNAREC=${{ matrix.dynarec.new }} NEW_DYNAREC=${{ matrix.dynarec.new }}
X64=${{ matrix.environment.x64 }} X64=${{ matrix.environment.x64 }}
VNC=n
working-directory: ./src working-directory: ./src
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:

View File

@@ -76,13 +76,14 @@ jobs:
- name: Prepare MSYS2 environment - name: Prepare MSYS2 environment
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
with: with:
release: false
update: true update: true
msystem: ${{ matrix.environment.msystem }} msystem: ${{ matrix.environment.msystem }}
pacboy: >- pacboy: >-
ninja:p ninja:p
cmake:p cmake:p
gcc:p gcc:p
pkg-config:p pkgconf:p
freetype:p freetype:p
SDL2:p SDL2:p
zlib:p zlib:p
@@ -100,7 +101,6 @@ jobs:
-D CMAKE_INSTALL_PREFIX=./build/artifacts -D CMAKE_INSTALL_PREFIX=./build/artifacts
-D QT=${{ matrix.ui.qt }} -D QT=${{ matrix.ui.qt }}
-D STATIC_BUILD=${{ matrix.ui.static }} -D STATIC_BUILD=${{ matrix.ui.static }}
-D VNC=n
- name: Build - name: Build
run: cmake --build build run: cmake --build build
- name: Generate package - name: Generate package
@@ -169,7 +169,7 @@ jobs:
run: echo "C:/Program Files/LLVM/bin" >> $env:GITHUB_PATH run: echo "C:/Program Files/LLVM/bin" >> $env:GITHUB_PATH
- name: Download Ninja - name: Download Ninja
run: > 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 . Expand-Archive ninja-win.zip -DestinationPath .
- name: Setup NuGet Credentials - name: Setup NuGet Credentials
run: > run: >
@@ -211,7 +211,7 @@ jobs:
path: build/artifacts/** path: build/artifacts/**
linux: 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 runs-on: ubuntu-22.04
@@ -232,6 +232,13 @@ jobs:
- name: NDR - name: NDR
new: on new: on
slug: -NDR slug: -NDR
ui:
- name: Qt GUI
qt: on
slug: -Qt
packages: >-
qtbase5-dev
qttools5-dev
steps: steps:
- name: Install dependencies - name: Install dependencies
@@ -244,9 +251,9 @@ jobs:
libpng-dev libpng-dev
libc6-dev libc6-dev
librtmidi-dev librtmidi-dev
qtbase5-dev
qttools5-dev
libopenal-dev libopenal-dev
libvncserver-dev
${{ matrix.ui.packages }}
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Configure CMake - name: Configure CMake
run: >- run: >-
@@ -254,17 +261,18 @@ jobs:
--toolchain ./cmake/flags-gcc-x86_64.cmake --toolchain ./cmake/flags-gcc-x86_64.cmake
-D NEW_DYNAREC=${{ matrix.dynarec.new }} -D NEW_DYNAREC=${{ matrix.dynarec.new }}
-D CMAKE_INSTALL_PREFIX=./build/artifacts -D CMAKE_INSTALL_PREFIX=./build/artifacts
-D QT=${{ matrix.ui.qt }}
- name: Build - name: Build
run: cmake --build build run: cmake --build build
- name: Generate package - name: Generate package
run: cmake --install build run: cmake --install build
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: 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/** path: build/artifacts/**
macos11: 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 runs-on: macos-11
@@ -285,6 +293,12 @@ jobs:
- name: NDR - name: NDR
new: on new: on
slug: -NDR slug: -NDR
ui:
- name: Qt GUI
qt: on
slug: -Qt
packages: >-
qt@5
steps: steps:
- name: Install dependencies - name: Install dependencies
@@ -295,8 +309,9 @@ jobs:
sdl2 sdl2
libpng libpng
rtmidi rtmidi
qt@5
openal-soft openal-soft
libvncserver
${{ matrix.ui.packages }}
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Configure CMake - name: Configure CMake
run: >- run: >-
@@ -304,6 +319,7 @@ jobs:
--toolchain ./cmake/flags-gcc-x86_64.cmake --toolchain ./cmake/flags-gcc-x86_64.cmake
-D NEW_DYNAREC=${{ matrix.dynarec.new }} -D NEW_DYNAREC=${{ matrix.dynarec.new }}
-D CMAKE_INSTALL_PREFIX=./build/artifacts -D CMAKE_INSTALL_PREFIX=./build/artifacts
-D QT=${{ matrix.ui.qt }}
-D Qt5_ROOT=$(brew --prefix qt@5) -D Qt5_ROOT=$(brew --prefix qt@5)
-D Qt5LinguistTools_ROOT=$(brew --prefix qt@5) -D Qt5LinguistTools_ROOT=$(brew --prefix qt@5)
-D OpenAL_ROOT=$(brew --prefix openal-soft) -D OpenAL_ROOT=$(brew --prefix openal-soft)
@@ -313,5 +329,5 @@ jobs:
run: cmake --install build run: cmake --install build
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: 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/** path: build/artifacts/**

51
.github/workflows/codeql.yml vendored Normal file
View 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}}"

View File

@@ -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 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/*.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 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"'\)/'

View File

@@ -52,11 +52,14 @@ if(DEV_BRANCH)
endif() endif()
if(VNC) if(VNC)
add_compile_definitions(USE_VNC) find_package(LibVNCServer)
add_library(vnc OBJECT vnc.c vnc_keymap.c) if(LibVNCServer_FOUND)
target_link_libraries(86Box vnc vncserver) add_compile_definitions(USE_VNC)
if(WIN32) add_library(vnc OBJECT vnc.c vnc_keymap.c)
target_link_libraries(86Box ws2_32) target_link_libraries(86Box vnc LibVNCServer::vncserver)
if(WIN32)
target_link_libraries(86Box ws2_32)
endif()
endif() endif()
endif() endif()

View File

@@ -235,7 +235,7 @@ cpu_is_eligible(const cpu_family_t *cpu_family, int cpu, int machine)
if (packages & CPU_PKG_SOCKET3) if (packages & CPU_PKG_SOCKET3)
packages |= CPU_PKG_SOCKET1; packages |= CPU_PKG_SOCKET1;
else if (packages & CPU_PKG_SLOT1) else if (packages & CPU_PKG_SLOT1)
packages |= CPU_PKG_SOCKET370; packages |= CPU_PKG_SOCKET370 | CPU_PKG_SOCKET8;
/* Package type. */ /* Package type. */
if (!(cpu_family->package & packages)) if (!(cpu_family->package & packages))
@@ -2848,7 +2848,7 @@ amd_k_invalid_wrmsr:
break; break;
case 0x1b: case 0x1b:
cpu_log("APIC_BASE write: %08X%08X\n", EDX, EAX); 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; break;
case 0x2a: case 0x2a:
break; break;

View File

@@ -130,7 +130,7 @@ opFPU(s, x87_ts, 16, t.i, geteal, t.s, _32)
#ifndef FPU_8087 #ifndef FPU_8087
opFPU(s, x87_ts, 32, t.i, geteal, t.s, _32) opFPU(s, x87_ts, 32, t.i, geteal, t.s, _32)
#endif #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 #ifndef FPU_8087
opFPU(d, x87_td, 32, t.i, geteaq, t.d, _64) opFPU(d, x87_td, 32, t.i, geteaq, t.d, _64)
#endif #endif
@@ -139,7 +139,7 @@ opFPU(iw, uint16_t, 16, t, geteaw, (double) (int16_t) t, _i16)
#ifndef FPU_8087 #ifndef FPU_8087
opFPU(iw, uint16_t, 32, t, geteaw, (double) (int16_t) t, _i16) opFPU(iw, uint16_t, 32, t, geteaw, (double) (int16_t) t, _i16)
#endif #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 #ifndef FPU_8087
opFPU(il, uint32_t, 32, t, geteal, (double) (int32_t) t, _i32) opFPU(il, uint32_t, 32, t, geteal, (double) (int32_t) t, _i32)
#endif #endif

View File

@@ -96,6 +96,7 @@ static const device_t *mouse_curr;
static void *mouse_priv; static void *mouse_priv;
static int mouse_nbut; static int mouse_nbut;
static int (*mouse_dev_poll)(int x, int y, int z, int b, void *priv); 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 #ifdef ENABLE_MOUSE_LOG
int mouse_do_log = ENABLE_MOUSE_LOG; int mouse_do_log = ENABLE_MOUSE_LOG;
@@ -173,13 +174,22 @@ mouse_set_buttons(int buttons)
mouse_nbut = buttons; mouse_nbut = buttons;
} }
void
mouse_set_poll_ex(void (*poll_ex)(void))
{
mouse_poll_ex = poll_ex;
}
void void
mouse_process(void) mouse_process(void)
{ {
if (mouse_curr == NULL) if (mouse_curr == NULL)
return; return;
mouse_poll(); if (mouse_poll_ex)
mouse_poll_ex();
else
mouse_poll();
if ((mouse_dev_poll != NULL) || (mouse_curr->poll != NULL)) { if ((mouse_dev_poll != NULL) || (mouse_curr->poll != NULL)) {
if (mouse_curr->poll != NULL) if (mouse_curr->poll != NULL)

View File

@@ -88,7 +88,7 @@ discord_update_activity(int paused)
*(paren - 1) = '\0'; *(paren - 1) = '\0';
#pragma GCC diagnostic push #pragma GCC diagnostic push
#if defined(__GNUC__) #if defined(__GNUC__) && !defined (__clang__)
# pragma GCC diagnostic ignored "-Wformat-truncation" # pragma GCC diagnostic ignored "-Wformat-truncation"
#endif #endif
if (strlen(vm_name) < 100) { if (strlen(vm_name) < 100) {

View File

@@ -486,9 +486,9 @@ img_seek(int drive, int track)
for (side = 0; side < dev->sides; side++) { for (side = 0; side < dev->sides; side++) {
if (dev->disk_at_once) { if (dev->disk_at_once) {
cur_pos = (track * dev->sectors * ssize * dev->sides) + (side * dev->sectors * ssize); 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 { } 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)) if (read_bytes < (dev->sectors * ssize))
memset(dev->track_data[side] + read_bytes, 0xf6, (dev->sectors * ssize) - read_bytes); memset(dev->track_data[side] + read_bytes, 0xf6, (dev->sectors * ssize) - read_bytes);
} }

View File

@@ -108,7 +108,7 @@ typedef struct {
const char *file_filter; const char *file_filter;
const device_config_spinner_t spinner; const device_config_spinner_t spinner;
const device_config_selection_t selection[16]; const device_config_selection_t selection[16];
const device_config_bios_t bios[32]; const device_config_bios_t bios[32];
} device_config_t; } device_config_t;
typedef struct _device_ { typedef struct _device_ {

View File

@@ -71,6 +71,7 @@ extern void mouse_init(void);
extern void mouse_close(void); extern void mouse_close(void);
extern void mouse_reset(void); extern void mouse_reset(void);
extern void mouse_set_buttons(int buttons); 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_process(void);
extern void mouse_set_poll(int (*f)(int, int, int, int, void *), void *); extern void mouse_set_poll(int (*f)(int, int, int, int, void *), void *);
extern void mouse_poll(void); extern void mouse_poll(void);

View File

@@ -259,10 +259,17 @@ machine_at_scat_init(const machine_t *model, int is_v4, int is_ami)
{ {
machine_at_common_init(model); machine_at_common_init(model);
if (is_ami) if (machines[machine].bus_flags & MACHINE_BUS_PS2) {
device_add(&keyboard_at_ami_device); if (is_ami)
else device_add(&keyboard_ps2_ami_device);
device_add(&keyboard_at_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) if (is_v4)
device_add(&scat_4_device); device_add(&scat_4_device);

View File

@@ -407,7 +407,7 @@ new_page(escp_t *dev, int8_t save, int8_t resetx)
dev->curr_y = dev->top_margin; dev->curr_y = dev->top_margin;
if (dev->page) { if (dev->page) {
dev->page->dirty = 0; 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. */ /* 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; uint8_t colormask;
int i; int i;
float red = (float) redmax / (float) 30.9; double red = (double) redmax / (double) 30.9;
float green = (float) greenmax / (float) 30.9; double green = (double) greenmax / (double) 30.9;
float blue = (float) bluemax / (float) 30.9; double blue = (double) bluemax / (double) 30.9;
colormask = colorID <<= 5; colormask = colorID <<= 5;
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
dev->palcol[i + colormask].r = 255 - (uint8_t) floor(red * (float) i); dev->palcol[i + colormask].r = 255 - (uint8_t) floor(red * (double) i);
dev->palcol[i + colormask].g = 255 - (uint8_t) floor(green * (float) i); dev->palcol[i + colormask].g = 255 - (uint8_t) floor(green * (double) i);
dev->palcol[i + colormask].b = 255 - (uint8_t) floor(blue * (float) 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->w = (int) (dev->dpi * dev->page_width);
dev->page->h = (int) (dev->dpi * dev->page_height); dev->page->h = (int) (dev->dpi * dev->page_height);
dev->page->pitch = dev->page->w; dev->page->pitch = dev->page->w;
dev->page->pixels = (uint8_t *) malloc(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, dev->page->pitch * dev->page->h); memset(dev->page->pixels, 0x00, (size_t) dev->page->pitch * dev->page->h);
/* Initialize parameters. */ /* Initialize parameters. */
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {

View File

@@ -1088,7 +1088,7 @@ std::array<uint32_t, 256> x11_to_xt_2 {
0x53, 0x53,
0x138, 0x138,
0x55, 0x55,
0x35, 0x56,
0x57, 0x57,
0x58, 0x58,
0x56, 0x56,

View File

@@ -39,6 +39,7 @@ extern "C" {
// Disable c99-designator to avoid the warnings in rtmidi_*_device // Disable c99-designator to avoid the warnings in rtmidi_*_device
#ifdef __clang__ #ifdef __clang__
# if __has_warning("-Wc99-designator") # if __has_warning("-Wc99-designator")
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wc99-designator" # pragma clang diagnostic ignored "-Wc99-designator"
# endif # endif
#endif #endif
@@ -302,4 +303,11 @@ const device_t rtmidi_input_device = {
.force_redraw = NULL, .force_redraw = NULL,
.config = midi_input_config .config = midi_input_config
}; };
#ifdef __clang__
# if __has_warning("-Wc99-designator")
# pragma clang diagnostic pop
# endif
#endif
} }

View File

@@ -29,6 +29,15 @@ extern "C" {
#include <86box/snd_opl.h> #include <86box/snd_opl.h>
#include <86box/mem.h> #include <86box/mem.h>
#include <86box/rom.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 #define RSM_FRAC 10
@@ -432,4 +441,11 @@ const fm_drv_t ymfm_drv {
&ymfm_drv_set_do_cycles, &ymfm_drv_set_do_cycles,
NULL, NULL,
}; };
#ifdef __clang__
# if __has_warning("-Wc99-designator")
# pragma clang diagnostic pop
# endif
#endif
} }

View File

@@ -2663,8 +2663,8 @@ pgc_init(pgc_t *dev, int maxw, int maxh, int visw, int vish,
dev->visw = visw; dev->visw = visw;
dev->vish = vish; dev->vish = vish;
dev->vram = (uint8_t *) malloc(maxw * maxh); dev->vram = (uint8_t *) malloc((size_t) maxw * maxh);
memset(dev->vram, 0x00, maxw * maxh); memset(dev->vram, 0x00, (size_t) maxw * maxh);
dev->cga_vram = (uint8_t *) malloc(16384); dev->cga_vram = (uint8_t *) malloc(16384);
memset(dev->cga_vram, 0x00, 16384); memset(dev->cga_vram, 0x00, 16384);

View File

@@ -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_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); memset(line_ptr, 0, line_width);
} }

View File

@@ -804,7 +804,7 @@ create_bitmap(int x, int y)
bitmap_t *b = malloc(sizeof(bitmap_t) + (y * sizeof(uint32_t *))); bitmap_t *b = malloc(sizeof(bitmap_t) + (y * sizeof(uint32_t *)));
int c; int c;
b->dat = malloc(x * y * 4); b->dat = malloc((size_t) x * y * 4);
for (c = 0; c < y; c++) for (c = 0; c < y; c++)
b->line[c] = &(b->dat[c * x]); b->line[c] = &(b->dat[c * x]);
b->w = x; b->w = x;

View File

@@ -44,6 +44,15 @@ static int allowedX,
allowedY; allowedY;
static int ptr_x, ptr_y, ptr_but; 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 #ifdef ENABLE_VNC_LOG
int vnc_do_log = 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); 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 static void
vnc_ptrevent(int but, int x, int y, rfbClientPtr cl) vnc_ptrevent(int but, int x, int y, rfbClientPtr cl)
{ {
if (x >= 0 && x < allowedX && y >= 0 && y < allowedY) { ms.buttons = 0;
/* VNC uses absolute positions within the window, no deltas. */ if (but & 0x01)
if (x != ptr_x || y != ptr_y) { ms.buttons |= 0x01;
mouse_x += (x - ptr_x) / 100; if (but & 0x02)
mouse_y += (y - ptr_y) / 100; ms.buttons |= 0x04;
ptr_x = x; if (but & 0x04)
ptr_y = y; ms.buttons |= 0x02;
} ptr_but = but;
if (but != ptr_but) { /* VNC uses absolute positions within the window, no deltas. */
mouse_buttons = 0; ms.dx += (x - ptr_x) / 0.96; /* TODO: Figure out the correct scale factor for X and Y. */
if (but & 0x01) ms.dy += (y - ptr_y) / 0.96;
mouse_buttons |= 0x01; ptr_x = x;
if (but & 0x02) ptr_y = y;
mouse_buttons |= 0x04;
if (but & 0x04)
mouse_buttons |= 0x02;
ptr_but = but;
}
}
rfbDefaultPtrAddEvent(but, x, y, cl); rfbDefaultPtrAddEvent(but, x, y, cl);
} }
@@ -110,7 +133,8 @@ vnc_clientgone(rfbClientPtr cl)
vnc_log("VNC: no clients, pausing..\n"); vnc_log("VNC: no clients, pausing..\n");
/* Disable the mouse. */ /* Disable the mouse. */
plat_mouse_capture(0); // plat_mouse_capture(0);
mouse_set_poll_ex(NULL);
plat_pause(1); plat_pause(1);
} }
@@ -129,12 +153,14 @@ vnc_newclient(rfbClientPtr cl)
ptr_y = allowedY / 2; ptr_y = allowedY / 2;
mouse_x = mouse_y = mouse_z = 0; mouse_x = mouse_y = mouse_z = 0;
mouse_buttons = 0x00; mouse_buttons = 0x00;
memset(&ms, 0, sizeof(MOUSESTATE));
/* We now have clients, un-pause the emulator if needed. */ /* We now have clients, un-pause the emulator if needed. */
vnc_log("VNC: unpausing..\n"); vnc_log("VNC: unpausing..\n");
/* Enable the mouse. */ /* Enable the mouse. */
plat_mouse_capture(1); // plat_mouse_capture(1);
mouse_set_poll_ex(vnc_mouse_poll);
plat_pause(0); plat_pause(0);
} }
@@ -160,20 +186,15 @@ vnc_display(rfbClientPtr cl)
static void static void
vnc_blit(int x, int y, int w, int h, int monitor_index) vnc_blit(int x, int y, int w, int h, int monitor_index)
{ {
uint32_t *p; int row;
int yy;
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); video_blit_complete_monitor(monitor_index);
return; return;
} }
for (yy = 0; yy < h; yy++) { for (row = 0; row < h; ++row)
p = (uint32_t *) &(((uint32_t *) rfb->frameBuffer)[yy * VNC_MAX_X]); video_copy(&(((uint8_t *) rfb->frameBuffer)[row * 2048 * sizeof(uint32_t)]), &(buffer32->line[y + row][x]), w * sizeof(uint32_t));
if ((y + yy) >= 0 && (y + yy) < VNC_MAX_Y)
video_copy(p, &(buffer32->line[yy]), w * sizeof(uint32_t));
}
if (screenshots) if (screenshots)
video_screenshot((uint32_t *) rfb->frameBuffer, 0, 0, VNC_MAX_X); video_screenshot((uint32_t *) rfb->frameBuffer, 0, 0, VNC_MAX_X);
@@ -265,7 +286,7 @@ vnc_resize(int x, int y)
return; return;
/* TightVNC doesn't like certain sizes.. */ /* 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); vnc_log("VNC: invalid resoltion %dx%d requested!\n", x, y);
return; return;
} }

View File

@@ -416,7 +416,7 @@ ifeq ($(VNC), y)
OPTS += -I$(VNC_PATH)\INCLUDE OPTS += -I$(VNC_PATH)\INCLUDE
VNCLIB := -L$(VNC_PATH)\LIB VNCLIB := -L$(VNC_PATH)\LIB
endif endif
VNCLIB += -lvncserver VNCLIB += -lvncserver.dll
VNCOBJ := vnc.o vnc_keymap.o VNCOBJ := vnc.o vnc_keymap.o
endif endif