From 6f1be1509250dfa32f45a3dd021e5a8950dd357e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 6 Apr 2023 20:56:14 -0300 Subject: [PATCH 1/8] Jenkins: Extend AppImage icon search mask just in case --- .ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.sh b/.ci/build.sh index ea49fa825..26fd24a76 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -1014,7 +1014,7 @@ else mkdir -p "$icon_dir" cp -rp "$icon_size" "$icon_dir/apps" done - project_icon=$(find "$icon_base/"[0-9]*x[0-9]*/* -type f -name '*.png' | head -1 | grep -oP '/\K([^/]+)(?=\.[^\.]+$)') + project_icon=$(find "$icon_base/"[0-9]*x[0-9]*/* -type f -name '*.png' -o -name '*.svg' | head -1 | grep -oP '/\K([^/]+)(?=\.[^\.]+$)') # Archive executable, while also stripping it if requested. mkdir -p archive_tmp/usr/local/bin From afc645460dbf43fecf36d83e7e28edfed180fe8e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 6 Apr 2023 22:09:42 -0300 Subject: [PATCH 2/8] qt: Clean up Linux keycode disambiguation code --- src/qt/qt_mainwindow.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index f360a83e9..e0a272436 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1505,28 +1505,28 @@ x11_keycode_to_keysym(uint32_t keycode) finalkeycode = be_to_xt[keycode]; #else static Display *x11display = nullptr; - if (QApplication::platformName().contains("wayland")) { - selected_keycode = x11_to_xt_2; - } else if (QApplication::platformName().contains("eglfs")) { + if (QApplication::platformName().contains("eglfs")) { keycode -= 8; if (keycode <= 88) finalkeycode = keycode; else finalkeycode = evdev_to_xt[keycode]; - } else if (!x11display) { - x11display = XOpenDisplay(nullptr); - if (XKeysymToKeycode(x11display, XK_Home) == 110) { + } else { + if (QApplication::platformName().contains("wayland")) { selected_keycode = x11_to_xt_2; - } else if (XKeysymToKeycode(x11display, XK_Home) == 69) { - selected_keycode = x11_to_xt_vnc; + } else if (!x11display) { + x11display = XOpenDisplay(nullptr); + if (XKeysymToKeycode(x11display, XK_Home) == 110) { + selected_keycode = x11_to_xt_2; + } else if (XKeysymToKeycode(x11display, XK_Home) == 69) { + selected_keycode = x11_to_xt_vnc; + } } - } - if (!QApplication::platformName().contains("eglfs")) finalkeycode = selected_keycode[keycode]; -#endif - if (rctrl_is_lalt && finalkeycode == 0x11D) { - finalkeycode = 0x38; } +#endif + if (rctrl_is_lalt && finalkeycode == 0x11D) + finalkeycode = 0x38; return finalkeycode; } From 9ebbaea6c51be4f0d7e0909b05e168f5d6e8e54a Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 11 Apr 2023 11:58:11 -0300 Subject: [PATCH 3/8] qt: Add special case for Microsoft scroll keys --- src/qt/qt_mainwindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 0c5e204ce..8f230ec5a 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -941,6 +941,15 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode) } break; + case 0x10b: /* Microsoft scroll up normal */ + case 0x18b: /* Microsoft scroll down normal */ + /* This abuses make/break codes. Send them manually, only on press. */ + if (down) { + keyboard_send(0xe0); + keyboard_send(keycode & 0xff); + } + return; + case 0x11d: /* Right Ctrl */ if (rctrl_is_lalt) keycode = 0x38; /* map to Left Alt */ From 7c2ec22e495a4e23173f4738d6a703ed83f898c6 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 11 Apr 2023 12:02:38 -0300 Subject: [PATCH 4/8] mem: Add memory map logging --- src/mem/mem.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/mem/mem.c b/src/mem/mem.c index 9de4a670f..eaf7b58f6 100644 --- a/src/mem/mem.c +++ b/src/mem/mem.c @@ -2313,6 +2313,56 @@ mem_mapping_recalc(uint64_t base, uint64_t size) } flushmmucache_cr3(); + +#ifdef ENABLE_MEM_LOG + pclog("\nMemory map:\n"); + mem_mapping_t *write = (mem_mapping_t *) -1, *read = (mem_mapping_t *) -1, *write_bus = (mem_mapping_t *) -1, *read_bus = (mem_mapping_t *) -1; + for (c = 0; c < (sizeof(write_mapping) / sizeof(write_mapping[0])); c++) { + if ((write_mapping[c] == write) && (read_mapping[c] == read) && (write_mapping_bus[c] == write_bus) && (read_mapping_bus[c] == read_bus)) + continue; + write = write_mapping[c]; + read = read_mapping[c]; + write_bus = write_mapping_bus[c]; + read_bus = read_mapping_bus[c]; + + pclog("%08X | ", c << MEM_GRANULARITY_BITS); + if (read) { + pclog("R%c%c%c %08X+% 8X", + read->read_b ? 'b' : ' ', read->read_w ? 'w' : ' ', read->read_l ? 'l' : ' ', + read->base, read->size); + } else { + pclog(" "); + } + if (write) { + pclog(" | W%c%c%c %08X+% 8X", + write->write_b ? 'b' : ' ', write->write_w ? 'w' : ' ', write->write_l ? 'l' : ' ', + write->base, write->size); + } else { + pclog(" | "); + } + pclog(" | %c\n", _mem_exec[c] ? 'X' : ' '); + + if ((write != write_bus) || (read != read_bus)) { + pclog(" ^ bus | "); + if (read_bus) { + pclog("R%c%c%c %08X+% 8X", + read_bus->read_b ? 'b' : ' ', read_bus->read_w ? 'w' : ' ', read_bus->read_l ? 'l' : ' ', + read_bus->base, read_bus->size); + } else { + pclog(" "); + } + if (write_bus) { + pclog(" | W%c%c%c %08X+% 8X", + write_bus->write_b ? 'b' : ' ', write_bus->write_w ? 'w' : ' ', write_bus->write_l ? 'l' : ' ', + write_bus->base, write_bus->size); + } else { + pclog(" | "); + } + pclog(" |\n"); + } + } + pclog("\n"); +#endif } void From d6d509ff4578bb173a5bd45d103e027297e4e821 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 11 Apr 2023 12:04:07 -0300 Subject: [PATCH 5/8] mem: Fix RAM size integer overflow with a not-yet-supported size --- src/mem/mem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mem/mem.c b/src/mem/mem.c index eaf7b58f6..a71621d51 100644 --- a/src/mem/mem.c +++ b/src/mem/mem.c @@ -2628,7 +2628,8 @@ mem_init_ram_mapping(mem_mapping_t *mapping, uint32_t base, uint32_t size) void mem_reset(void) { - uint32_t c, m; + uint32_t c; + size_t m; memset(page_ff, 0xff, sizeof(page_ff)); @@ -2666,7 +2667,7 @@ mem_reset(void) mem_size = 2097152; #endif - m = 1024UL * mem_size; + m = 1024UL * (size_t) mem_size; #if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)) if (mem_size > 1048576) { From 2e3b89fb8596837046bf8c2735c9605f4570a7b6 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 11 Apr 2023 13:00:15 -0300 Subject: [PATCH 6/8] vid_ddc: Upgrade to EDID 1.4 with proper physical size so that Xorg doesn't try to use the highest resolution --- src/video/vid_ddc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/video/vid_ddc.c b/src/video/vid_ddc.c index f6c4d4dac..e6fc4f175 100644 --- a/src/video/vid_ddc.c +++ b/src/video/vid_ddc.c @@ -24,7 +24,7 @@ #include <86box/86box.h> #include <86box/i2c.h> -#define PIXEL_MM(px) ((uint16_t) (((px) *25.4) / 96)) +#define PIXEL_MM(px) (((px) * 25.4) / 96.0) #define STANDARD_TIMING(slot, width, aspect_ratio, refresh) \ do { \ edid->slot.horiz_pixels = ((width) >> 3) - 31; \ @@ -44,9 +44,9 @@ edid->slot.h_sync_pulse_lsb = (hsp) &0xff; \ edid->slot.v_front_porch_sync_pulse_lsb = (((vfp) &0x0f) << 4) | ((vsp) &0x0f); \ edid->slot.hv_front_porch_sync_pulse_msb = (((hfp) >> 2) & 0xc0) | (((hsp) >> 4) & 0x30) | (((vfp) >> 2) & 0x0c) | (((vsp) >> 4) & 0x03); \ - edid->slot.h_size_lsb = horiz_mm & 0xff; \ - edid->slot.v_size_lsb = vert_mm & 0xff; \ - edid->slot.hv_size_msb = ((horiz_mm >> 4) & 0xf0) | ((vert_mm >> 8) & 0x0f); \ + edid->slot.h_size_lsb = (uint8_t) horiz_mm; \ + edid->slot.v_size_lsb = (uint8_t) vert_mm; \ + edid->slot.hv_size_msb = ((((uint16_t) horiz_mm) >> 4) & 0xf0) | ((((uint16_t) vert_mm) >> 8) & 0x0f); \ } while (0) enum { @@ -133,7 +133,7 @@ ddc_init(void *i2c) memset(edid, 0, sizeof(edid_t)); uint8_t *edid_bytes = (uint8_t *) edid; - uint16_t horiz_mm = PIXEL_MM(1366), vert_mm = PIXEL_MM(768); + double horiz_mm = PIXEL_MM(800), vert_mm = PIXEL_MM(600); memset(&edid->magic[1], 0xff, sizeof(edid->magic) - 2); @@ -142,11 +142,11 @@ ddc_init(void *i2c) edid->mfg_week = 48; edid->mfg_year = 2020 - 1990; edid->edid_version = 0x01; - edid->edid_rev = 0x03; /* EDID 1.3 */ + edid->edid_rev = 0x04; /* EDID 1.4, required for Xorg on Linux to use the preferred mode timing */ edid->input_params = 0x0e; /* analog input; separate sync; composite sync; sync on green */ - edid->horiz_size = horiz_mm / 10; - edid->vert_size = vert_mm / 10; + edid->horiz_size = round(horiz_mm / 10.0); + edid->vert_size = round(vert_mm / 10.0); edid->features = 0xeb; /* DPMS standby/suspend/active-off; RGB color; first timing is preferred; GTF/CVT */ edid->red_green_lsb = 0x81; From cfbd2ef139de0491e4aa065c4976fcbf9d41078e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 11 Apr 2023 20:19:06 -0300 Subject: [PATCH 7/8] qt: Fix build with libxkbcommon but no libxkbcommon-x11 --- src/qt/xkbcommon_keyboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/xkbcommon_keyboard.cpp b/src/qt/xkbcommon_keyboard.cpp index 788087998..d370757e2 100644 --- a/src/qt/xkbcommon_keyboard.cpp +++ b/src/qt/xkbcommon_keyboard.cpp @@ -15,7 +15,7 @@ * Copyright 2023 RichardG. */ extern "C" { -#include +#include }; #include From 0763475c00c2bb17658a30e68339071929e94909 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 11 Apr 2023 20:38:03 -0300 Subject: [PATCH 8/8] qt: Attempt fix for Qt5 private headers on certain environments --- src/qt/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 614da7a00..944b3359a 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -385,6 +385,7 @@ if (UNIX AND NOT APPLE AND NOT HAIKU) target_compile_definitions(ui PRIVATE XKBCOMMON_X11) target_link_libraries(ui PRIVATE X11::xcb PUBLIC PkgConfig::XKBCOMMON_X11) target_sources(ui PRIVATE xkbcommon_x11_keyboard.cpp) + set(QT5_PRIVATE_HEADERS ON) endif() endif() endif() @@ -406,9 +407,18 @@ if (UNIX AND NOT APPLE AND NOT HAIKU) target_sources(ui PRIVATE xkbcommon_wl_keyboard.cpp) endif() target_compile_definitions(ui PRIVATE WAYLAND) + set(QT5_PRIVATE_HEADERS ON) endif() endif() endif() + + # Add private headers for Qt5 if required. + if (NOT USE_QT6 AND DEFINED QT5_PRIVATE_HEADERS) + find_package(Qt${QT_MAJOR}Gui) + if (Qt${QT_MAJOR}Gui_FOUND) + include_directories(${Qt${QT_MAJOR}Gui_PRIVATE_INCLUDE_DIRS}) + endif() + endif() endif() set(QM_FILES) file(GLOB po_files "${CMAKE_CURRENT_SOURCE_DIR}/languages/*.po")