From accce358e8231aca604336df4925d2b643a7e6af Mon Sep 17 00:00:00 2001 From: rushieda <185547947+rushieda@users.noreply.github.com> Date: Wed, 21 May 2025 12:04:55 +0300 Subject: [PATCH 1/6] Fix the Password "Disabled by Jumper" error on Dimension XPS Pxxx and Pxxxa/Mxxxa --- src/device/kbc_at.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index 7413b45cf..60ca29fc1 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -1106,6 +1106,14 @@ write64_generic(void *priv, uint8_t val) */ uint8_t p1 = 0x30; kbc_delay_to_ob(dev, p1, 0, 0x00); + } else if (!strcmp(machine_get_internal_name(), "dellplato") | !strcmp(machine_get_internal_name(), "dellhannibalp")) { + /* + Dell Dimension XPS Pxxx & Pxxxa/Mxxxa: + - Bit 3: Password disable jumper (must be clear); + - Bit 4: Clear CMOS jumper (must be set); + */ + uint8_t p1 = 0x10; + kbc_delay_to_ob(dev, p1, 0, 0x00); } else { /* (B0 or F0) | (0x08 or 0x0c) */ uint8_t p1_out = ((dev->p1 | fixed_bits) & 0xf0) | From b18f69c037060ae0ccc79457a138da0d52c061b0 Mon Sep 17 00:00:00 2001 From: rushieda <185547947+rushieda@users.noreply.github.com> Date: Wed, 21 May 2025 12:18:54 +0300 Subject: [PATCH 2/6] Fix a small typo that causes some checks to fail --- src/device/kbc_at.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index 60ca29fc1..7b6bea0c4 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -1106,7 +1106,7 @@ write64_generic(void *priv, uint8_t val) */ uint8_t p1 = 0x30; kbc_delay_to_ob(dev, p1, 0, 0x00); - } else if (!strcmp(machine_get_internal_name(), "dellplato") | !strcmp(machine_get_internal_name(), "dellhannibalp")) { + } else if (!strcmp(machine_get_internal_name(), "dellplato") || !strcmp(machine_get_internal_name(), "dellhannibalp")) { /* Dell Dimension XPS Pxxx & Pxxxa/Mxxxa: - Bit 3: Password disable jumper (must be clear); From e76a89bcc80cb693efaa9f6165df8868add35f11 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 21 May 2025 13:32:17 +0200 Subject: [PATCH 3/6] Windows: Change cursor clipping from cursor warping to ClipCursor(), fixes #5498. --- src/qt/qt_rendererstack.cpp | 16 +++++++++++++++- src/qt/qt_ui.cpp | 23 +++++++++++++++++++++++ src/qt/qt_winrawinputfilter.cpp | 4 ++-- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index 79fa78097..c210f4dc2 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -61,6 +61,11 @@ struct mouseinputdata { static mouseinputdata mousedata; extern MainWindow *main_window; + +#ifdef Q_OS_WINDOWS +HWND rw_hwnd; +#endif + RendererStack::RendererStack(QWidget *parent, int monitor_index) : QStackedWidget(parent) , ui(new Ui::RendererStack) @@ -251,7 +256,9 @@ RendererStack::mouseMoveEvent(QMouseEvent *event) leaveEvent((QEvent *) event); ignoreNextMouseEvent--; } +#if !defined _WIN32 QCursor::setPos(mapToGlobal(QPoint(width() / 2, height() / 2))); +#endif ignoreNextMouseEvent = 2; oldPos = event->pos(); #endif @@ -405,8 +412,15 @@ RendererStack::createRenderer(Renderer renderer) } #endif } - if (current.get() == nullptr) + if (current.get() == nullptr) { +#ifdef Q_OS_WINDOWS + rw_hwnd = NULL; +#endif return; + } +#ifdef Q_OS_WINDOWS + rw_hwnd = (HWND) this->winId(); +#endif current->setFocusPolicy(Qt::NoFocus); current->setFocusProxy(this); current->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); diff --git a/src/qt/qt_ui.cpp b/src/qt/qt_ui.cpp index 5a6bda852..e54d64269 100644 --- a/src/qt/qt_ui.cpp +++ b/src/qt/qt_ui.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "qt_mainwindow.hpp" #include "qt_machinestatus.hpp" @@ -122,6 +123,8 @@ plat_resize(int w, int h, int monitor_index) main_window->resizeContents(w, h); } +extern HWND rw_hwnd; + void plat_mouse_capture(int on) { @@ -129,6 +132,26 @@ plat_mouse_capture(int on) return; main_window->setMouseCapture(on > 0 ? true : false); + +#if defined _WIN32 + if (on) { + QCursor cursor(Qt::BlankCursor); + + QApplication::setOverrideCursor(cursor); + QApplication::changeOverrideCursor(cursor); + + RECT rect; + + GetWindowRect(rw_hwnd, &rect); + + ClipCursor(&rect); + + } else { + ClipCursor(NULL); + + QApplication::restoreOverrideCursor(); + } +#endif } int diff --git a/src/qt/qt_winrawinputfilter.cpp b/src/qt/qt_winrawinputfilter.cpp index e94101a77..a62d71920 100644 --- a/src/qt/qt_winrawinputfilter.cpp +++ b/src/qt/qt_winrawinputfilter.cpp @@ -395,7 +395,7 @@ WindowsRawInputFilter::mouse_handle(PRAWINPUT raw) mouse_scale(delta_x, delta_y); - HWND wnd = (HWND)window->winId(); + /* HWND wnd = (HWND)window->winId(); RECT rect; @@ -404,5 +404,5 @@ WindowsRawInputFilter::mouse_handle(PRAWINPUT raw) int left = rect.left + (rect.right - rect.left) / 2; int top = rect.top + (rect.bottom - rect.top) / 2; - SetCursorPos(left, top); + SetCursorPos(left, top); */ } From 75e76899da86b832e9d6631bf1a5c9a4d4cc1e5b Mon Sep 17 00:00:00 2001 From: TC1995 Date: Wed, 21 May 2025 13:43:23 +0200 Subject: [PATCH 4/6] S3 911/924 high color: check if rd_mask is not 0 (May 21st, 2025) This fixes wrong colors in certain instances of Windows 95 builds' 911/924 drivers. --- src/video/vid_s3.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 683d2be34..99521f061 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -8042,7 +8042,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, voi s3->accel.sy = s3->accel.maj_axis_pcnt; if ((s3->bpp == 0) && s3->color_16bit) { - s3->accel.rd_mask_16bit_check = ((rd_mask & 0xff00) != 0xff00); + s3->accel.rd_mask_16bit_check = ((rd_mask & 0xff00) != 0xff00) && rd_mask; if (s3->accel.rd_mask_16bit_check) { if ((s3->accel.cur_x_overflow & 0xc00) == 0xc00) s3->accel.start = 1; @@ -8353,7 +8353,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, voi s3->accel.dest = dstbase + s3->accel.cy * s3->width; if ((s3->bpp == 0) && s3->color_16bit) { - s3->accel.rd_mask_16bit_check = ((rd_mask & 0xff00) != 0xff00); + s3->accel.rd_mask_16bit_check = ((rd_mask & 0xff00) != 0xff00) && rd_mask; if (s3->accel.rd_mask_16bit_check) { if (s3->accel.cmd == 0x41b3) { if (frgd_mix == 0) { @@ -8478,9 +8478,10 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, voi if ((s3_cpu_src(s3)) && !(s3->accel.cmd & 0x200)) { s3_log("FIXME: S3 911/924 15/16bpp documentation needed.\n"); } else { - if (!cpu_input && (s3->accel.cur_x & 0x400)) + if (!cpu_input && (s3->accel.cur_x & 0x400)) { + s3_log("No Input.\n"); break; - else if (cpu_input && (s3->accel.cmd == 0x53b3) && (s3->accel.cur_x & 0x400)) + } else if (cpu_input && (s3->accel.cmd == 0x53b3) && (s3->accel.cur_x & 0x400)) break; } } @@ -8756,7 +8757,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, voi s3->accel.cy = s3->accel.cur_y & 0xfff; if ((s3->bpp == 0) && s3->color_16bit) { - s3->accel.rd_mask_16bit_check = ((rd_mask & 0xff00) != 0xff00); + s3->accel.rd_mask_16bit_check = ((rd_mask & 0xff00) != 0xff00) && rd_mask; if (s3->accel.rd_mask_16bit_check) { if (!(clip_r & 0x400)) s3->accel.start = 1; @@ -8805,7 +8806,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, voi s3_log("CMDFULL=%04x, FRGDSEL=%x, BKGDSEL=%x, FRGDMIX=%02x, BKGDMIX=%02x, MASKCHECK=%x, RDMASK=%04x, MINUS=%d, WRTMASK=%04X, MIX=%04x, CX=%d, CY=%d, DX=%d, DY=%d, SX=%d, SY=%d, PIXCNTL=%02x, 16BITCOLOR=%x, RDCHECK=%x, CLIPL=%d, CLIPR=%d, OVERFLOW=%d, pitch=%d.\n", s3->accel.cmd, frgd_mix, bkgd_mix, s3->accel.frgd_mix & 0x0f, s3->accel.bkgd_mix & 0x0f, s3->accel.rd_mask_16bit_check, rd_mask, s3->accel.minus, wrt_mask, mix_dat & 0xffff, s3->accel.cx, s3->accel.cy, s3->accel.dx, s3->accel.dy, s3->accel.sx, s3->accel.sy, s3->accel.multifunc[0x0a] & 0xc4, s3->accel.color_16bit_check, s3->accel.rd_mask_16bit_check, clip_l, clip_r, (s3->accel.destx_overflow & 0xc00) == 0xc00, s3->width); if (!cpu_input && (frgd_mix == 3) && !vram_mask && !(s3->accel.multifunc[0xe] & 0x100) && ((s3->accel.cmd & 0xa0) == 0xa0) && ((s3->accel.frgd_mix & 0xf) == 7) && ((s3->accel.bkgd_mix & 0xf) == 7)) { - pclog("Special BitBLT.\n"); + s3_log("Special BitBLT.\n"); while (1) { if ((s3->accel.dx >= clip_l) && (s3->accel.dx <= clip_r) && (s3->accel.dy >= clip_t) && (s3->accel.dy <= clip_b)) { READ(s3->accel.src + s3->accel.cx - s3->accel.minus, src_dat); From 05ac5b62b0364019a7e229f81d05685c0dd9e719 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 21 May 2025 13:45:12 +0200 Subject: [PATCH 5/6] Add some forgotten #ifdef. --- src/qt/qt_ui.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/qt_ui.cpp b/src/qt/qt_ui.cpp index e54d64269..6e0b3cfbb 100644 --- a/src/qt/qt_ui.cpp +++ b/src/qt/qt_ui.cpp @@ -123,7 +123,9 @@ plat_resize(int w, int h, int monitor_index) main_window->resizeContents(w, h); } +#if defined _WIN32 extern HWND rw_hwnd; +#endif void plat_mouse_capture(int on) From 07c1bb5534d92694e4441d0e835722711c6c986b Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 22 May 2025 00:19:57 +0600 Subject: [PATCH 6/6] Fix cursor clipping on Windows --- src/qt/qt_rendererstack.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index c210f4dc2..31cc495b0 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -663,6 +663,14 @@ RendererStack::setFocusRenderer() void RendererStack::onResize(int width, int height) { +#ifdef Q_OS_WINDOWS + if (mouse_capture) { + RECT rect; + if (GetWindowRect((HWND)this->winId(), &rect)) { + ClipCursor(&rect); + } + } +#endif if (rendererWindow) { rendererWindow->r_monitor_index = m_monitor_index; rendererWindow->onResize(width, height);