From e580818ba6d4650a84d9325a177a0167a4ffd970 Mon Sep 17 00:00:00 2001 From: pankozaC++ <77279607+pankoza2-pl@users.noreply.github.com> Date: Sun, 1 Jun 2025 11:58:21 +0200 Subject: [PATCH 01/22] Rename the Olivetti M24 and M240 to add the names of their AT&T counterparts --- src/machine/machine_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index a961e9997..e54a00bd4 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -2377,7 +2377,7 @@ const machine_t machines[] = { .net_device = NULL }, { - .name = "[8086] Olivetti M21/24/24SP", + .name = "[8086] Olivetti M21/24/24SP/AT&T PC 6300", .internal_name = "m24", .type = MACHINE_TYPE_8086, .chipset = MACHINE_CHIPSET_PROPRIETARY, @@ -2417,7 +2417,7 @@ const machine_t machines[] = { }, /* Has Olivetti KBC firmware. */ { - .name = "[8086] Olivetti M240", + .name = "[8086] Olivetti M240/AT&T PC 6300 WGS", .internal_name = "m240", .type = MACHINE_TYPE_8086, .chipset = MACHINE_CHIPSET_PROPRIETARY, From e3c825fce7489b34fc7396467adababdaa8fcea2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 6 Jun 2025 15:54:04 +0200 Subject: [PATCH 02/22] (S)VGA: Fix overscan, closes #5651. --- src/video/vid_svga.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 86a57c00e..b4ae192da 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -691,11 +691,11 @@ svga_recalctimings(svga_t *svga) double _dispontime_xga = 0.0; double _dispofftime_xga = 0.0; double disptime_xga = 0.0; + int vblankend; + int hdispend; #ifdef ENABLE_SVGA_LOG int vsyncend; - int vblankend; int hdispstart; - int hdispend; int hsyncstart; int hsyncend; #endif @@ -911,7 +911,19 @@ svga_recalctimings(svga_t *svga) if (xga_active && (svga->xga != NULL)) xga_recalctimings(svga); - if (!svga->hoverride) { + vblankend = (svga->vblankstart & 0xffffff80) | (svga->crtc[0x16] & 0x7f); + if (vblankend <= svga->vblankstart) + vblankend += 0x00000080; + + hdispend = svga->crtc[1] + 1; + + if (svga->hoverride) { + if (svga->hdisp >= 2048) + svga->monitor->mon_overscan_x = 0; + + svga->y_add = (svga->monitor->mon_overscan_y >> 1); + svga->x_add = (svga->monitor->mon_overscan_x >> 1); + } else { uint32_t dot = svga->hblankstart; uint32_t adj_dot = svga->hblankstart; /* Verified with both the Voodoo 3 and the S3 cards: compare 7 bits if bit 7 is set, @@ -938,6 +950,17 @@ svga_recalctimings(svga_t *svga) } svga->hdisp -= (svga->hblank_sub * svga->dots_per_clock); + + svga->y_add = svga->vtotal + vblankend + 1; + svga->monitor->mon_overscan_y = svga->y_add + svga->vblankstart - svga->dispend; + + if (svga->hdisp >= 2048) { + svga->x_add = 0; + svga->monitor->mon_overscan_x = 0; + } else { + svga->x_add = (svga->htotal + svga->hblank_end_val - 1) * svga->dots_per_clock; + svga->monitor->mon_overscan_x = svga->x_add + ((svga->hblankstart - hdispend) * svga->dots_per_clock); + } } #ifdef TBD @@ -967,12 +990,6 @@ svga_recalctimings(svga_t *svga) } #endif - if (svga->hdisp >= 2048) - svga->monitor->mon_overscan_x = 0; - - svga->y_add = (svga->monitor->mon_overscan_y >> 1); - svga->x_add = (svga->monitor->mon_overscan_x >> 1); - if (svga->vblankstart < svga->dispend) { svga_log("DISPEND > VBLANKSTART.\n"); svga->dispend = svga->vblankstart; @@ -992,12 +1009,8 @@ svga_recalctimings(svga_t *svga) vsyncend = (svga->vsyncstart & 0xfffffff0) | (svga->crtc[0x11] & 0x0f); if (vsyncend <= svga->vsyncstart) vsyncend += 0x00000010; - vblankend = (svga->vblankstart & 0xffffff80) | (svga->crtc[0x16] & 0x7f); - if (vblankend <= svga->vblankstart) - vblankend += 0x00000080; hdispstart = ((svga->crtc[3] >> 5) & 3); - hdispend = svga->crtc[1] + 1; hsyncstart = svga->crtc[4] + ((svga->crtc[5] >> 5) & 3) + 1; hsyncend = (hsyncstart & 0xffffffe0) | (svga->crtc[5] & 0x1f); if (hsyncend <= hsyncstart) From a1a94076298f52b24be35268bec8e62c4cce97de Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 6 Jun 2025 20:05:04 +0200 Subject: [PATCH 03/22] (S)VGA: Fix overscan. --- src/include/86box/vid_svga.h | 1 + src/video/vid_svga.c | 45 ++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/include/86box/vid_svga.h b/src/include/86box/vid_svga.h index 6de73f9f9..6b817f0ee 100644 --- a/src/include/86box/vid_svga.h +++ b/src/include/86box/vid_svga.h @@ -116,6 +116,7 @@ typedef struct svga_t { int lastline_draw; int displine; int fullchange; + int left_overscan; int x_add; int y_add; int pan; diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index b4ae192da..8f5907c3f 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -692,9 +692,9 @@ svga_recalctimings(svga_t *svga) double _dispofftime_xga = 0.0; double disptime_xga = 0.0; int vblankend; - int hdispend; #ifdef ENABLE_SVGA_LOG int vsyncend; + int hdispend; int hdispstart; int hsyncstart; int hsyncend; @@ -915,14 +915,12 @@ svga_recalctimings(svga_t *svga) if (vblankend <= svga->vblankstart) vblankend += 0x00000080; - hdispend = svga->crtc[1] + 1; - if (svga->hoverride) { if (svga->hdisp >= 2048) svga->monitor->mon_overscan_x = 0; svga->y_add = (svga->monitor->mon_overscan_y >> 1); - svga->x_add = (svga->monitor->mon_overscan_x >> 1); + svga->left_overscan = svga->x_add = (svga->monitor->mon_overscan_x >> 1); } else { uint32_t dot = svga->hblankstart; uint32_t adj_dot = svga->hblankstart; @@ -931,7 +929,9 @@ svga_recalctimings(svga_t *svga) uint32_t eff_mask = (svga->hblank_end_val & ~0x0000003f) ? svga->hblank_end_mask : 0x0000003f; svga->hblank_sub = 0; - svga_log("HDISP=%d, CRTC1+1=%d, Blank: %04i-%04i, Total: %04i, Mask: %02X, ADJ_DOT=%04i.\n", svga->hdisp, svga->crtc[1] + 1, svga->hblankstart, svga->hblank_end_val, + svga_log("HDISP=%d, CRTC1+1=%d, Blank: %04i-%04i, Total: %04i, " + "Mask: %02X, ADJ_DOT=%04i.\n", svga->hdisp, svga->crtc[1] + 1, + svga->hblankstart, svga->hblank_end_val, svga->htotal, eff_mask, adj_dot); while (adj_dot < (svga->htotal << 1)) { @@ -941,7 +941,10 @@ svga_recalctimings(svga_t *svga) if (adj_dot >= svga->htotal) svga->hblank_sub++; - svga_log("Loop: adjdot=%d, htotal=%d, dotmask=%02x, hblankendvalmask=%02x, blankendval=%02x.\n", adj_dot, svga->htotal, dot & eff_mask, svga->hblank_end_val & eff_mask, svga->hblank_end_val); + svga_log("Loop: adjdot=%d, htotal=%d, dotmask=%02x, " + "hblankendvalmask=%02x, blankendval=%02x.\n", adj_dot, + svga->htotal, dot & eff_mask, svga->hblank_end_val & eff_mask, + svga->hblank_end_val); if ((dot & eff_mask) == (svga->hblank_end_val & eff_mask)) break; @@ -949,17 +952,23 @@ svga_recalctimings(svga_t *svga) adj_dot++; } + uint32_t hd = svga->hdisp; svga->hdisp -= (svga->hblank_sub * svga->dots_per_clock); - svga->y_add = svga->vtotal + vblankend + 1; - svga->monitor->mon_overscan_y = svga->y_add + svga->vblankstart - svga->dispend; + svga->left_overscan = svga->x_add = (svga->htotal - adj_dot - 1) * svga->dots_per_clock; + svga->monitor->mon_overscan_x = svga->x_add + (svga->hblankstart * svga->dots_per_clock) - hd; - if (svga->hdisp >= 2048) { - svga->x_add = 0; + if ((svga->hdisp >= 2048) || (svga->left_overscan < 0)) { + svga->left_overscan = svga->x_add = 0; svga->monitor->mon_overscan_x = 0; - } else { - svga->x_add = (svga->htotal + svga->hblank_end_val - 1) * svga->dots_per_clock; - svga->monitor->mon_overscan_x = svga->x_add + ((svga->hblankstart - hdispend) * svga->dots_per_clock); + } + + svga->y_add = svga->vtotal - vblankend + 1; + svga->monitor->mon_overscan_y = svga->y_add + abs(svga->vblankstart - svga->dispend); + + if ((svga->dispend >= 2048) || (svga->y_add < 0)) { + svga->y_add = 0; + svga->monitor->mon_overscan_y = 0; } } @@ -1010,6 +1019,7 @@ svga_recalctimings(svga_t *svga) if (vsyncend <= svga->vsyncstart) vsyncend += 0x00000010; + hdispend = svga->crtc[1] + 1; hdispstart = ((svga->crtc[3] >> 5) & 3); hsyncstart = svga->crtc[4] + ((svga->crtc[5] >> 5) & 3) + 1; hsyncend = (hsyncstart & 0xffffffe0) | (svga->crtc[5] & 0x1f); @@ -1191,10 +1201,10 @@ svga_do_render(svga_t *svga) if (!svga->override) { svga->render(svga); - svga->x_add = (svga->monitor->mon_overscan_x >> 1); + svga->x_add = svga->left_overscan; svga_render_overscan_left(svga); svga_render_overscan_right(svga); - svga->x_add = (svga->monitor->mon_overscan_x >> 1) - svga->scrollcache; + svga->x_add = svga->left_overscan - svga->scrollcache; } if (svga->overlay_on) { @@ -1373,7 +1383,7 @@ svga_poll(void *priv) svga->sc = 0; if (svga->attrregs[0x10] & 0x20) { svga->scrollcache = 0; - svga->x_add = (svga->monitor->mon_overscan_x >> 1); + svga->x_add = svga->left_overscan; } } } @@ -1479,7 +1489,7 @@ svga_poll(void *priv) if ((svga->seqregs[1] & 8) || (svga->render == svga_render_8bpp_lowres)) svga->scrollcache <<= 1; - svga->x_add = (svga->monitor->mon_overscan_x >> 1) - svga->scrollcache; + svga->x_add = svga->left_overscan - svga->scrollcache; svga->linecountff = 0; @@ -1529,6 +1539,7 @@ svga_init(const device_t *info, svga_t *svga, void *priv, int memsize, svga->attrregs[0x11] = 0; svga->overscan_color = 0x000000; + svga->left_overscan = 8; svga->monitor->mon_overscan_x = 16; svga->monitor->mon_overscan_y = 32; svga->x_add = 8; From c6e374158b041b50ca2741d37e69fab1fb689179 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 6 Jun 2025 20:09:36 +0200 Subject: [PATCH 04/22] Fix it in svga_doblit() as well. --- src/video/vid_svga.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 8f5907c3f..0c9c24241 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -1997,9 +1997,15 @@ svga_doblit(int wx, int wy, svga_t *svga) y_add = enable_overscan ? svga->monitor->mon_overscan_y : 0; x_add = enable_overscan ? svga->monitor->mon_overscan_x : 0; +#ifdef USE_OLD_CALCULATION y_start = enable_overscan ? 0 : (svga->monitor->mon_overscan_y >> 1); x_start = enable_overscan ? 0 : (svga->monitor->mon_overscan_x >> 1); bottom = (svga->monitor->mon_overscan_y >> 1); +#else + y_start = enable_overscan ? 0 : svga->y_add; + x_start = enable_overscan ? 0 : svga->left_overscan; + bottom = svga->monitor->mon_overscan_y - svga->y_add; +#endif if (svga->vertical_linedbl) { y_add <<= 1; From d55f6b28875a7f4ffc94d0303a49835ea13dc9de Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 4 May 2025 18:06:07 -0400 Subject: [PATCH 05/22] Some cleanups in isamem and isartc --- src/device/isamem.c | 4 ++-- src/device/isartc.c | 4 ++-- src/include/86box/isamem.h | 8 +------- src/include/86box/isartc.h | 5 +---- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/device/isamem.c b/src/device/isamem.c index 62fb96f5d..b1095da1f 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -2165,12 +2165,12 @@ isamem_get_internal_name(int board) } int -isamem_get_from_internal_name(const char *s) +isamem_get_from_internal_name(const char *str) { int c = 0; while (boards[c].dev != NULL) { - if (!strcmp(boards[c].dev->internal_name, s)) + if (!strcmp(boards[c].dev->internal_name, str)) return c; c++; } diff --git a/src/device/isartc.c b/src/device/isartc.c index 5d6b4aea4..b5bbda7b0 100644 --- a/src/device/isartc.c +++ b/src/device/isartc.c @@ -919,12 +919,12 @@ isartc_get_internal_name(int board) } int -isartc_get_from_internal_name(char *s) +isartc_get_from_internal_name(const char *str) { int c = 0; while (boards[c].dev != NULL) { - if (!strcmp(boards[c].dev->internal_name, s)) + if (!strcmp(boards[c].dev->internal_name, str)) return c; c++; } diff --git a/src/include/86box/isamem.h b/src/include/86box/isamem.h index 51fe50e33..93f417e3e 100644 --- a/src/include/86box/isamem.h +++ b/src/include/86box/isamem.h @@ -42,7 +42,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #ifndef EMU_ISAMEM_H #define EMU_ISAMEM_H @@ -52,17 +51,12 @@ extern "C" { #endif -/* Global variables. */ -extern const device_t isamem_device; -extern const device_t isamem_brat80_device; -extern const device_t isamem_ev159_device; - /* Functions. */ extern void isamem_reset(void); extern const char *isamem_get_name(int t); extern const char *isamem_get_internal_name(int t); -extern int isamem_get_from_internal_name(const char *s); +extern int isamem_get_from_internal_name(const char *str); extern const device_t *isamem_get_device(int t); extern int isamem_has_config(int board); diff --git a/src/include/86box/isartc.h b/src/include/86box/isartc.h index 0224180b3..815daa5d6 100644 --- a/src/include/86box/isartc.h +++ b/src/include/86box/isartc.h @@ -42,7 +42,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #ifndef EMU_ISARTC_H #define EMU_ISARTC_H @@ -50,13 +49,11 @@ extern "C" { #endif -/* Global variables. */ - /* Functions. */ extern void isartc_reset(void); extern const char *isartc_get_internal_name(int t); -extern int isartc_get_from_internal_name(char *s); +extern int isartc_get_from_internal_name(const char *str); extern const device_t *isartc_get_device(int t); extern int isartc_has_config(int board); From c992a44b44b8a298b3cbbdebf7cb473b8cc4788b Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 4 May 2025 19:30:48 -0400 Subject: [PATCH 06/22] Clean QT Other Peripherals UI --- src/qt/qt_settingsotherperipherals.cpp | 161 +++++++++++++------------ src/qt/qt_settingsotherperipherals.hpp | 23 ++-- src/qt/qt_settingsotherperipherals.ui | 140 ++++++++++----------- 3 files changed, 164 insertions(+), 160 deletions(-) diff --git a/src/qt/qt_settingsotherperipherals.cpp b/src/qt/qt_settingsotherperipherals.cpp index e1920bf47..b8a347f25 100644 --- a/src/qt/qt_settingsotherperipherals.cpp +++ b/src/qt/qt_settingsotherperipherals.cpp @@ -11,8 +11,10 @@ * * * Authors: Joakim L. Gilje + * Jasmine Iwanek * * Copyright 2021 Joakim L. Gilje + * Copyright 2025 Jasmine Iwanek */ #include "qt_settingsotherperipherals.hpp" #include "ui_qt_settingsotherperipherals.h" @@ -44,84 +46,86 @@ SettingsOtherPeripherals::onCurrentMachineChanged(int machineId) this->machineId = machineId; bool machineHasIsa = (machine_has_bus(machineId, MACHINE_BUS_ISA) > 0); + + ui->pushButtonConfigureRTC->setEnabled(machineHasIsa); + ui->comboBoxRTC->setEnabled(machineHasIsa); + ui->checkBoxISABugger->setEnabled(machineHasIsa); + ui->pushButtonConfigureUT->setEnabled(unittester_enabled > 0); + ui->checkBoxKeyCard->setEnabled(machineHasIsa); + ui->pushButtonConfigureKeyCard->setEnabled(novell_keycard_enabled > 0); + ui->checkBoxISABugger->setChecked((machineHasIsa && (bugger_enabled > 0)) ? true : false); ui->checkBoxPOSTCard->setChecked(postcard_enabled > 0 ? true : false); ui->checkBoxUnitTester->setChecked(unittester_enabled > 0 ? true : false); ui->checkBoxKeyCard->setChecked((machineHasIsa && (novell_keycard_enabled > 0)) ? true : false); - ui->checkBoxISABugger->setEnabled(machineHasIsa); - ui->checkBoxKeyCard->setEnabled(machineHasIsa); - ui->pushButtonConfigureKeyCard->setEnabled(novell_keycard_enabled > 0); - ui->pushButtonConfigureUT->setEnabled(unittester_enabled > 0); - ui->comboBoxRTC->setEnabled(machineHasIsa); - ui->pushButtonConfigureRTC->setEnabled(machineHasIsa); - ui->comboBoxCard1->clear(); - ui->comboBoxCard2->clear(); - ui->comboBoxCard3->clear(); - ui->comboBoxCard4->clear(); ui->comboBoxRTC->clear(); - auto *model = ui->comboBoxRTC->model(); - int d = 0; + for (uint8_t i = 0; i < ISAMEM_MAX; ++i) + if (auto *cb = findChild(QString("comboBoxIsaMemCard%1").arg(i + 1))) + cb->clear(); + + int c = 0; int selectedRow = 0; + + // ISA RTC Cards + auto *model = ui->comboBoxRTC->model(); while (true) { - QString name = DeviceConfig::DeviceName(isartc_get_device(d), isartc_get_internal_name(d), 0); - if (name.isEmpty()) { + const QString name = DeviceConfig::DeviceName(isartc_get_device(c), isartc_get_internal_name(c), 0); + if (name.isEmpty()) break; - } - if (!device_is_valid(isartc_get_device(d), machineId)) { + if (!device_is_valid(isartc_get_device(c), machineId)) break; - } - int row = Models::AddEntry(model, name, d); - if (d == isartc_type) { + int row = Models::AddEntry(model, name, c); + if (c == isartc_type) selectedRow = row; - } - ++d; + + ++c; } ui->comboBoxRTC->setCurrentIndex(selectedRow); ui->pushButtonConfigureRTC->setEnabled((isartc_type != 0) && isartc_has_config(isartc_type) && machineHasIsa); - // ISA Memory Expansion Card - QComboBox * cbox[ISAMEM_MAX] = { 0 }; - QAbstractItemModel *models[ISAMEM_MAX] = { 0 }; - int removeRows_[ISAMEM_MAX] = { 0 }; - int selectedRows[ISAMEM_MAX] = { 0 }; + // ISA Memory Expansion Cards + QComboBox *isamem_cbox[ISAMEM_MAX] = { 0 }; + QAbstractItemModel *isamem_models[ISAMEM_MAX] = { 0 }; + int isamem_removeRows_[ISAMEM_MAX] = { 0 }; + int isamem_selectedRows[ISAMEM_MAX] = { 0 }; - for (uint8_t c = 0; c < ISAMEM_MAX; ++c) { - cbox[c] = findChild(QString("comboBoxCard%1").arg(c + 1)); - models[c] = cbox[c]->model(); - removeRows_[c] = models[c]->rowCount(); + for (uint8_t i = 0; i < ISAMEM_MAX; ++i) { + isamem_cbox[i] = findChild(QString("comboBoxIsaMemCard%1").arg(i + 1)); + isamem_models[i] = isamem_cbox[i]->model(); + isamem_removeRows_[i] = isamem_models[i]->rowCount(); } - d = 0; + c = 0; while (true) { - const QString name = DeviceConfig::DeviceName(isamem_get_device(d), - isamem_get_internal_name(d), 0); + const QString name = DeviceConfig::DeviceName(isamem_get_device(c), + isamem_get_internal_name(c), 0); if (name.isEmpty()) break; - if (device_is_valid(isamem_get_device(d), machineId)) { - for (uint8_t c = 0; c < ISAMEM_MAX; ++c) { - int row = Models::AddEntry(models[c], name, d); + if (device_is_valid(isamem_get_device(c), machineId)) { + for (uint8_t i = 0; i < ISAMEM_MAX; ++i) { + int row = Models::AddEntry(isamem_models[i], name, c); - if (d == isamem_type[c]) - selectedRows[c] = row - removeRows_[c]; + if (c == isamem_type[i]) + isamem_selectedRows[i] = row - isamem_removeRows_[i]; } } - d++; + c++; } - for (uint8_t c = 0; c < ISAMEM_MAX; ++c) { - models[c]->removeRows(0, removeRows_[c]); - cbox[c]->setEnabled(models[c]->rowCount() > 1); - cbox[c]->setCurrentIndex(-1); - cbox[c]->setCurrentIndex(selectedRows[c]); - findChild(QString("pushButtonConfigureCard%1").arg(c + 1))->setEnabled((isamem_type[c] != 0) && - isamem_has_config(isamem_type[c]) && machineHasIsa); + for (uint8_t i = 0; i < ISAMEM_MAX; ++i) { + isamem_models[i]->removeRows(0, isamem_removeRows_[i]); + isamem_cbox[i]->setEnabled(isamem_models[i]->rowCount() > 1); + isamem_cbox[i]->setCurrentIndex(-1); + isamem_cbox[i]->setCurrentIndex(isamem_selectedRows[i]); + findChild(QString("pushButtonConfigureIsaMemCard%1").arg(i + 1))->setEnabled((isamem_type[i] != 0) && + isamem_has_config(isamem_type[i]) && machineHasIsa); } } @@ -134,15 +138,15 @@ void SettingsOtherPeripherals::save() { /* Other peripherals category */ + isartc_type = ui->comboBoxRTC->currentData().toInt(); bugger_enabled = ui->checkBoxISABugger->isChecked() ? 1 : 0; postcard_enabled = ui->checkBoxPOSTCard->isChecked() ? 1 : 0; unittester_enabled = ui->checkBoxUnitTester->isChecked() ? 1 : 0; novell_keycard_enabled = ui->checkBoxKeyCard->isChecked() ? 1 : 0; - isartc_type = ui->comboBoxRTC->currentData().toInt(); /* ISA memory boards. */ for (int i = 0; i < ISAMEM_MAX; i++) { - auto *cbox = findChild(QString("comboBoxCard%1").arg(i + 1)); + auto *cbox = findChild(QString("comboBoxIsaMemCard%1").arg(i + 1)); isamem_type[i] = cbox->currentData().toInt(); } } @@ -150,9 +154,9 @@ SettingsOtherPeripherals::save() void SettingsOtherPeripherals::on_comboBoxRTC_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + ui->pushButtonConfigureRTC->setEnabled((index != 0) && isartc_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } @@ -163,63 +167,63 @@ SettingsOtherPeripherals::on_pushButtonConfigureRTC_clicked() } void -SettingsOtherPeripherals::on_comboBoxCard1_currentIndexChanged(int index) +SettingsOtherPeripherals::on_comboBoxIsaMemCard1_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } - ui->pushButtonConfigureCard1->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); + + ui->pushButtonConfigureIsaMemCard1->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void -SettingsOtherPeripherals::on_pushButtonConfigureCard1_clicked() +SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard1_clicked() { - DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard1->currentData().toInt()), 1); + DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard1->currentData().toInt()), 1); } void -SettingsOtherPeripherals::on_comboBoxCard2_currentIndexChanged(int index) +SettingsOtherPeripherals::on_comboBoxIsaMemCard2_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } - ui->pushButtonConfigureCard2->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); + + ui->pushButtonConfigureIsaMemCard2->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void -SettingsOtherPeripherals::on_pushButtonConfigureCard2_clicked() +SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard2_clicked() { - DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard2->currentData().toInt()), 2); + DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard2->currentData().toInt()), 2); } void -SettingsOtherPeripherals::on_comboBoxCard3_currentIndexChanged(int index) +SettingsOtherPeripherals::on_comboBoxIsaMemCard3_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } - ui->pushButtonConfigureCard3->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); + + ui->pushButtonConfigureIsaMemCard3->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void -SettingsOtherPeripherals::on_pushButtonConfigureCard3_clicked() +SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard3_clicked() { - DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard3->currentData().toInt()), 3); + DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard3->currentData().toInt()), 3); } void -SettingsOtherPeripherals::on_comboBoxCard4_currentIndexChanged(int index) +SettingsOtherPeripherals::on_comboBoxIsaMemCard4_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } - ui->pushButtonConfigureCard4->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); + + ui->pushButtonConfigureIsaMemCard4->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void -SettingsOtherPeripherals::on_pushButtonConfigureCard4_clicked() +SettingsOtherPeripherals::on_pushButtonConfigureIsaMemCard4_clicked() { - DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxCard4->currentData().toInt()), 4); + DeviceConfig::ConfigureDevice(isamem_get_device(ui->comboBoxIsaMemCard4->currentData().toInt()), 4); } void @@ -234,13 +238,12 @@ SettingsOtherPeripherals::on_pushButtonConfigureUT_clicked() DeviceConfig::ConfigureDevice(&unittester_device); } -void SettingsOtherPeripherals::on_pushButtonConfigureKeyCard_clicked() -{ - DeviceConfig::ConfigureDevice(&novell_keycard_device); -} - void SettingsOtherPeripherals::on_checkBoxKeyCard_stateChanged(int arg1) { ui->pushButtonConfigureKeyCard->setEnabled(arg1 != 0); } +void SettingsOtherPeripherals::on_pushButtonConfigureKeyCard_clicked() +{ + DeviceConfig::ConfigureDevice(&novell_keycard_device); +} diff --git a/src/qt/qt_settingsotherperipherals.hpp b/src/qt/qt_settingsotherperipherals.hpp index d5804a68b..e87219ab7 100644 --- a/src/qt/qt_settingsotherperipherals.hpp +++ b/src/qt/qt_settingsotherperipherals.hpp @@ -20,22 +20,23 @@ public slots: void onCurrentMachineChanged(int machineId); private slots: - void on_pushButtonConfigureCard4_clicked(); - void on_comboBoxCard4_currentIndexChanged(int index); - void on_pushButtonConfigureCard3_clicked(); - void on_comboBoxCard3_currentIndexChanged(int index); - void on_pushButtonConfigureCard2_clicked(); - void on_comboBoxCard2_currentIndexChanged(int index); - void on_pushButtonConfigureCard1_clicked(); - void on_comboBoxCard1_currentIndexChanged(int index); - void on_pushButtonConfigureRTC_clicked(); void on_comboBoxRTC_currentIndexChanged(int index); + void on_pushButtonConfigureRTC_clicked(); + + void on_comboBoxIsaMemCard1_currentIndexChanged(int index); + void on_pushButtonConfigureIsaMemCard1_clicked(); + void on_comboBoxIsaMemCard2_currentIndexChanged(int index); + void on_pushButtonConfigureIsaMemCard2_clicked(); + void on_comboBoxIsaMemCard3_currentIndexChanged(int index); + void on_pushButtonConfigureIsaMemCard3_clicked(); + void on_comboBoxIsaMemCard4_currentIndexChanged(int index); + void on_pushButtonConfigureIsaMemCard4_clicked(); + void on_checkBoxUnitTester_stateChanged(int arg1); void on_pushButtonConfigureUT_clicked(); - void on_pushButtonConfigureKeyCard_clicked(); - void on_checkBoxKeyCard_stateChanged(int arg1); + void on_pushButtonConfigureKeyCard_clicked(); private: Ui::SettingsOtherPeripherals *ui; diff --git a/src/qt/qt_settingsotherperipherals.ui b/src/qt/qt_settingsotherperipherals.ui index 41df2deac..81b0e0018 100644 --- a/src/qt/qt_settingsotherperipherals.ui +++ b/src/qt/qt_settingsotherperipherals.ui @@ -27,9 +27,9 @@ 0 - + - + ISA RTC: @@ -58,20 +58,74 @@ - + ISA Memory Expansion - - - + + + + + Card 1: + + + + + + + + 0 + 0 + + + + 30 + + + + + Configure + + + + Card 2: + + + - + + + + 0 + 0 + + + + 30 + + + + + + + Configure + + + + + + + Card 3: + + + + + 0 @@ -84,68 +138,21 @@ - + Configure - - + + - Card 2: - - - - - - - Card 3: - - - - - - - Configure - - - - - - - - 0 - 0 - - - - 30 - - - - - - - Card 1: - - - - - - - - 0 - 0 - - - - 30 + Card 4: - + 0 @@ -158,24 +165,17 @@ - + Configure - - - - Card 4: - - - - + @@ -193,7 +193,7 @@ - + @@ -217,7 +217,7 @@ - + 0 From dee023dc1c2ebb42d55cc488aca1fe5d82e28a33 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Tue, 6 May 2025 00:59:56 -0400 Subject: [PATCH 07/22] Segfault fixes in rom.c --- src/mem/rom.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mem/rom.c b/src/mem/rom.c index 666652d53..d22454983 100644 --- a/src/mem/rom.c +++ b/src/mem/rom.c @@ -97,7 +97,8 @@ rom_check(const char *fn) else { fp = fopen(fn, "rb"); ret = (fp != NULL); - fclose(fp); + if (fp != NULL) + fclose(fp); } return ret; @@ -134,6 +135,9 @@ rom_fopen(const char *fn, char *mode) char temp[1024]; FILE *fp = NULL; + if ((fn == NULL) || (mode == NULL)) + return NULL; + if (strstr(fn, "roms/") == fn) { /* Relative path */ for (rom_path_t *rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) { @@ -324,7 +328,8 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t } } - (void) fclose(fp); + if (fp != NULL) + (void) fclose(fp); return 1; } @@ -353,7 +358,8 @@ rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr) fatal("rom_load_linear(): Error reading data\n"); } - (void) fclose(fp); + if (fp != NULL) + (void) fclose(fp); return 1; } @@ -397,7 +403,8 @@ rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t } } - (void) fclose(fp); + if (fp != NULL) + (void) fclose(fp); return 1; } @@ -438,8 +445,10 @@ rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr, int sz, in } } - (void) fclose(fph); - (void) fclose(fpl); + if (fph != NULL) + (void) fclose(fph); + if (fpl != NULL) + (void) fclose(fpl); return 1; } From 577397b40bd0aaaa84d80b8a57e369d2b193c36f Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Tue, 6 May 2025 01:00:08 -0400 Subject: [PATCH 08/22] Typo fix in rom.c --- src/mem/rom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mem/rom.c b/src/mem/rom.c index d22454983..f7b2b2b0d 100644 --- a/src/mem/rom.c +++ b/src/mem/rom.c @@ -324,7 +324,7 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t } for (int i = 0; i < (sz >> 1); i++) { if (fread(ptr + (addr + (i << 1) + 1), 1, 1, fp) != 1) - fatal("rom_load_linear(): Error reading od data\n"); + fatal("rom_load_linear(): Error reading odd data\n"); } } From af93cd66ec25a895ef715f3ba35bb61aede81390 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Tue, 6 May 2025 02:33:15 -0400 Subject: [PATCH 09/22] Clean QT Sound UI --- src/qt/qt_settingssound.cpp | 49 ++++----- src/qt/qt_settingssound.hpp | 26 +++-- src/qt/qt_settingssound.ui | 199 ++++++++++++++++++------------------ 3 files changed, 133 insertions(+), 141 deletions(-) diff --git a/src/qt/qt_settingssound.cpp b/src/qt/qt_settingssound.cpp index e49e1ae27..57e278515 100644 --- a/src/qt/qt_settingssound.cpp +++ b/src/qt/qt_settingssound.cpp @@ -14,7 +14,7 @@ * Jasmine Iwanek * * Copyright 2021 Joakim L. Gilje - * Copyright 2022-2023 Jasmine Iwanek + * Copyright 2022-2025 Jasmine Iwanek */ #include "qt_settingssound.hpp" #include "ui_qt_settingssound.h" @@ -76,8 +76,8 @@ SettingsSound::onCurrentMachineChanged(const int machineId) int c; int selectedRow; - // Sound Card - QComboBox * cbox[SOUND_CARD_MAX] = { 0 }; + // Sound Cards + QComboBox *cbox[SOUND_CARD_MAX] = { 0 }; QAbstractItemModel *models[SOUND_CARD_MAX] = { 0 }; int removeRows_[SOUND_CARD_MAX] = { 0 }; int selectedRows[SOUND_CARD_MAX] = { 0 }; @@ -89,7 +89,7 @@ SettingsSound::onCurrentMachineChanged(const int machineId) removeRows_[i] = models[i]->rowCount(); } - c = 0; + c = 0; while (true) { const QString name = DeviceConfig::DeviceName(sound_card_getdevice(c), sound_card_get_internal_name(c), 1); @@ -110,7 +110,7 @@ SettingsSound::onCurrentMachineChanged(const int machineId) } } - c++; + c++; } for (uint8_t i = 0; i < SOUND_CARD_MAX; ++i) { @@ -122,21 +122,19 @@ SettingsSound::onCurrentMachineChanged(const int machineId) // Midi Out c = 0; - auto model = ui->comboBoxMidiOut->model(); + auto *model = ui->comboBoxMidiOut->model(); auto removeRows = model->rowCount(); selectedRow = 0; while (true) { const QString name = DeviceConfig::DeviceName(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0); - if (name.isEmpty()) { + if (name.isEmpty()) break; - } if (midi_out_device_available(c)) { int row = Models::AddEntry(model, name, c); - if (c == midi_output_device_current) { + if (c == midi_output_device_current) selectedRow = row - removeRows; - } } c++; @@ -155,15 +153,13 @@ SettingsSound::onCurrentMachineChanged(const int machineId) while (true) { const QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0); - if (name.isEmpty()) { + if (name.isEmpty()) break; - } if (midi_in_device_available(c)) { int row = Models::AddEntry(model, name, c); - if (c == midi_input_device_current) { + if (c == midi_input_device_current) selectedRow = row - removeRows; - } } c++; @@ -198,13 +194,11 @@ allowMpu401(Ui::SettingsSound *ui) QString midiOut = midi_out_device_get_internal_name(ui->comboBoxMidiOut->currentData().toInt()); QString midiIn = midi_in_device_get_internal_name(ui->comboBoxMidiIn->currentData().toInt()); - if (midiOut.isEmpty()) { + if (midiOut.isEmpty()) return false; - } - if (midiOut == QStringLiteral("none") && midiIn == QStringLiteral("none")) { + if (midiOut == QStringLiteral("none") && midiIn == QStringLiteral("none")) return false; - } return true; } @@ -212,9 +206,9 @@ allowMpu401(Ui::SettingsSound *ui) void SettingsSound::on_comboBoxSoundCard1_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + int sndCard = ui->comboBoxSoundCard1->currentData().toInt(); if (sndCard == SOUND_INTERNAL) @@ -238,9 +232,8 @@ SettingsSound::on_pushButtonConfigureSoundCard1_clicked() void SettingsSound::on_comboBoxSoundCard2_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } int sndCard = ui->comboBoxSoundCard2->currentData().toInt(); @@ -258,9 +251,8 @@ SettingsSound::on_pushButtonConfigureSoundCard2_clicked() void SettingsSound::on_comboBoxSoundCard3_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } int sndCard = ui->comboBoxSoundCard3->currentData().toInt(); @@ -279,9 +271,8 @@ SettingsSound::on_pushButtonConfigureSoundCard3_clicked() void SettingsSound::on_comboBoxSoundCard4_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } int sndCard = ui->comboBoxSoundCard4->currentData().toInt(); @@ -300,9 +291,8 @@ SettingsSound::on_pushButtonConfigureSoundCard4_clicked() void SettingsSound::on_comboBoxMidiOut_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } ui->pushButtonConfigureMidiOut->setEnabled(midi_out_device_has_config(ui->comboBoxMidiOut->currentData().toInt())); ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA))); @@ -318,9 +308,8 @@ SettingsSound::on_pushButtonConfigureMidiOut_clicked() void SettingsSound::on_comboBoxMidiIn_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } ui->pushButtonConfigureMidiIn->setEnabled(midi_in_device_has_config(ui->comboBoxMidiIn->currentData().toInt())); ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA))); diff --git a/src/qt/qt_settingssound.hpp b/src/qt/qt_settingssound.hpp index 92b700c92..cc2926d5d 100644 --- a/src/qt/qt_settingssound.hpp +++ b/src/qt/qt_settingssound.hpp @@ -20,20 +20,26 @@ public slots: void onCurrentMachineChanged(int machineId); private slots: - void on_pushButtonConfigureMPU401_clicked(); - void on_checkBoxMPU401_stateChanged(int arg1); - void on_pushButtonConfigureMidiIn_clicked(); - void on_pushButtonConfigureMidiOut_clicked(); - void on_comboBoxMidiIn_currentIndexChanged(int index); - void on_comboBoxMidiOut_currentIndexChanged(int index); - void on_pushButtonConfigureSoundCard1_clicked(); void on_comboBoxSoundCard1_currentIndexChanged(int index); - void on_pushButtonConfigureSoundCard2_clicked(); + void on_pushButtonConfigureSoundCard1_clicked(); + void on_comboBoxSoundCard2_currentIndexChanged(int index); - void on_pushButtonConfigureSoundCard3_clicked(); + void on_pushButtonConfigureSoundCard2_clicked(); + void on_comboBoxSoundCard3_currentIndexChanged(int index); - void on_pushButtonConfigureSoundCard4_clicked(); + void on_pushButtonConfigureSoundCard3_clicked(); + void on_comboBoxSoundCard4_currentIndexChanged(int index); + void on_pushButtonConfigureSoundCard4_clicked(); + + void on_comboBoxMidiOut_currentIndexChanged(int index); + void on_pushButtonConfigureMidiOut_clicked(); + + void on_comboBoxMidiIn_currentIndexChanged(int index); + void on_pushButtonConfigureMidiIn_clicked(); + + void on_checkBoxMPU401_stateChanged(int arg1); + void on_pushButtonConfigureMPU401_clicked(); private: Ui::SettingsSound *ui; diff --git a/src/qt/qt_settingssound.ui b/src/qt/qt_settingssound.ui index 1d5ab0050..97ef7c3ff 100644 --- a/src/qt/qt_settingssound.ui +++ b/src/qt/qt_settingssound.ui @@ -26,17 +26,23 @@ 0 - - + + - MIDI In Device: + Sound card #1: - - - - Sound card #1: + + + + 30 + + + + 0 + 0 + @@ -48,12 +54,25 @@ - + Sound card #2: + + + + 30 + + + + 0 + 0 + + + + @@ -62,12 +81,25 @@ - + Sound card #3: + + + + 30 + + + + 0 + 0 + + + + @@ -75,14 +107,26 @@ - - + Sound card #4: + + + + 30 + + + + 0 + 0 + + + + @@ -90,49 +134,13 @@ - - - - - - 30 - - - - 0 - 0 - - - - - + MIDI Out Device: - - - - Standalone MPU-401 - - - - - - - Configure - - - - - - - Configure - - - @@ -153,6 +161,47 @@ + + + + MIDI In Device: + + + + + + + 30 + + + + 0 + 0 + + + + + + + + Configure + + + + + + + Standalone MPU-401 + + + + + + + Configure + + + @@ -171,7 +220,7 @@ FM synth driver - + @@ -202,58 +251,6 @@ - - - - 30 - - - - 0 - 0 - - - - - - - - 30 - - - - 0 - 0 - - - - - - - - 30 - - - - 0 - 0 - - - - - - - - 30 - - - - 0 - 0 - - - - From 2181ed96ede886ac9eaed94c85e610eea34b3663 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 May 2025 20:45:24 -0400 Subject: [PATCH 10/22] Clean QT Display UI --- src/qt/qt_settingsdisplay.cpp | 42 +++++++++------- src/qt/qt_settingsdisplay.hpp | 23 +++++---- src/qt/qt_settingsdisplay.ui | 94 +++++++++++++++++------------------ 3 files changed, 84 insertions(+), 75 deletions(-) diff --git a/src/qt/qt_settingsdisplay.cpp b/src/qt/qt_settingsdisplay.cpp index fbe6ab5cc..300dae80e 100644 --- a/src/qt/qt_settingsdisplay.cpp +++ b/src/qt/qt_settingsdisplay.cpp @@ -51,22 +51,29 @@ SettingsDisplay::~SettingsDisplay() void SettingsDisplay::save() { - gfxcard[0] = ui->comboBoxVideo->currentData().toInt(); // TODO +#if 0 + for (uint8_t i = 0; i < GFXCARD_MAX; ++i) { + QComboBox *cbox = findChild(QString("comboBoxVideo%1").arg(i + 1)); + gfxcard[i] = cbox->currentData().toInt(); + } +#else + gfxcard[0] = ui->comboBoxVideo->currentData().toInt(); for (uint8_t i = 1; i < GFXCARD_MAX; i ++) - gfxcard[i] = ui->comboBoxVideoSecondary->currentData().toInt(); + gfxcard[i] = ui->comboBoxVideoSecondary->currentData().toInt(); +#endif voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0; ibm8514_standalone_enabled = ui->checkBox8514->isChecked() ? 1 : 0; xga_standalone_enabled = ui->checkBoxXga->isChecked() ? 1 : 0; - da2_standalone_enabled = ui->checkBoxDa2->isChecked() ? 1 : 0; + da2_standalone_enabled = ui->checkBoxDa2->isChecked() ? 1 : 0; } void SettingsDisplay::onCurrentMachineChanged(int machineId) { // win_settings_video_proc, WM_INITDIALOG - this->machineId = machineId; + this->machineId = machineId; auto curVideoCard = videoCard[0]; auto *model = ui->comboBoxVideo->model(); @@ -98,25 +105,26 @@ SettingsDisplay::onCurrentMachineChanged(int machineId) } model->removeRows(0, removeRows); + // TODO if (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0) { ui->comboBoxVideo->setEnabled(false); ui->comboBoxVideoSecondary->setEnabled(false); - ui->pushButtonConfigureSecondary->setEnabled(false); + ui->pushButtonConfigureVideoSecondary->setEnabled(false); selectedRow = 1; } else { ui->comboBoxVideo->setEnabled(true); ui->comboBoxVideoSecondary->setEnabled(true); - ui->pushButtonConfigureSecondary->setEnabled(true); + ui->pushButtonConfigureVideoSecondary->setEnabled(true); } ui->comboBoxVideo->setCurrentIndex(selectedRow); // TODO for (uint8_t i = 1; i < GFXCARD_MAX; i ++) if (gfxcard[i] == 0) - ui->pushButtonConfigureSecondary->setEnabled(false); + ui->pushButtonConfigureVideoSecondary->setEnabled(false); } void -SettingsDisplay::on_pushButtonConfigure_clicked() +SettingsDisplay::on_pushButtonConfigureVideo_clicked() { int videoCard = ui->comboBoxVideo->currentData().toInt(); auto *device = video_card_getdevice(videoCard); @@ -160,17 +168,17 @@ SettingsDisplay::on_pushButtonConfigureDa2_clicked() void SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + static QRegularExpression voodooRegex("3dfx|voodoo|banshee", QRegularExpression::CaseInsensitiveOption); auto curVideoCard_2 = videoCard[1]; videoCard[0] = ui->comboBoxVideo->currentData().toInt(); if (videoCard[0] == VID_INTERNAL) - ui->pushButtonConfigure->setEnabled(machine_has_flags(machineId, MACHINE_VIDEO) && - device_has_config(machine_get_vid_device(machineId))); + ui->pushButtonConfigureVideo->setEnabled(machine_has_flags(machineId, MACHINE_VIDEO) && + device_has_config(machine_get_vid_device(machineId))); else - ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0); + ui->pushButtonConfigureVideo->setEnabled(video_card_has_config(videoCard[0]) > 0); bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0; ui->pushButtonConfigureVoodoo->setEnabled(machineHasPci && ui->checkBoxVoodoo->isChecked()); @@ -233,7 +241,7 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index) if ((videoCard[1] == 0) || (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0)) { ui->comboBoxVideoSecondary->setCurrentIndex(0); - ui->pushButtonConfigureSecondary->setEnabled(false); + ui->pushButtonConfigureVideoSecondary->setEnabled(false); } // Is the currently selected video card a voodoo? @@ -287,15 +295,15 @@ void SettingsDisplay::on_comboBoxVideoSecondary_currentIndexChanged(int index) { if (index < 0) { - ui->pushButtonConfigureSecondary->setEnabled(false); + ui->pushButtonConfigureVideoSecondary->setEnabled(false); return; } videoCard[1] = ui->comboBoxVideoSecondary->currentData().toInt(); - ui->pushButtonConfigureSecondary->setEnabled(index != 0 && video_card_has_config(videoCard[1]) > 0); + ui->pushButtonConfigureVideoSecondary->setEnabled(index != 0 && video_card_has_config(videoCard[1]) > 0); } void -SettingsDisplay::on_pushButtonConfigureSecondary_clicked() +SettingsDisplay::on_pushButtonConfigureVideoSecondary_clicked() { auto *device = video_card_getdevice(ui->comboBoxVideoSecondary->currentData().toInt()); DeviceConfig::ConfigureDevice(device); diff --git a/src/qt/qt_settingsdisplay.hpp b/src/qt/qt_settingsdisplay.hpp index 854fce658..7eca7cc60 100644 --- a/src/qt/qt_settingsdisplay.hpp +++ b/src/qt/qt_settingsdisplay.hpp @@ -22,22 +22,23 @@ public slots: void onCurrentMachineChanged(int machineId); private slots: - void on_pushButtonConfigureSecondary_clicked(); - -private slots: - void on_comboBoxVideoSecondary_currentIndexChanged(int index); - -private slots: - void on_checkBoxVoodoo_stateChanged(int state); - void on_checkBox8514_stateChanged(int state); - void on_checkBoxXga_stateChanged(int state); - void on_checkBoxDa2_stateChanged(int state); void on_comboBoxVideo_currentIndexChanged(int index); + void on_pushButtonConfigureVideo_clicked(); + + void on_comboBoxVideoSecondary_currentIndexChanged(int index); + void on_pushButtonConfigureVideoSecondary_clicked(); + + void on_checkBoxVoodoo_stateChanged(int state); void on_pushButtonConfigureVoodoo_clicked(); + + void on_checkBox8514_stateChanged(int state); void on_pushButtonConfigure8514_clicked(); + + void on_checkBoxXga_stateChanged(int state); void on_pushButtonConfigureXga_clicked(); + + void on_checkBoxDa2_stateChanged(int state); void on_pushButtonConfigureDa2_clicked(); - void on_pushButtonConfigure_clicked(); private: Ui::SettingsDisplay *ui; diff --git a/src/qt/qt_settingsdisplay.ui b/src/qt/qt_settingsdisplay.ui index a8799204c..c5eba7adf 100644 --- a/src/qt/qt_settingsdisplay.ui +++ b/src/qt/qt_settingsdisplay.ui @@ -26,28 +26,8 @@ 0 - - - - - 0 - 0 - - - - Configure - - - - - - - XGA Graphics - - - - + 0 @@ -72,15 +52,21 @@ - - + + + + + 0 + 0 + + Configure - + 0 @@ -92,10 +78,23 @@ - - + + + + + 0 + 0 + + + + 30 + + + + + - IBM 8514/A Graphics + Configure @@ -106,6 +105,20 @@ + + + + Configure + + + + + + + IBM 8514/A Graphics + + + @@ -113,6 +126,13 @@ + + + + XGA Graphics + + + @@ -134,26 +154,6 @@ - - - - Configure - - - - - - - - 0 - 0 - - - - 30 - - - From c999797f501f3a55fca146ba6fa15d931ba63e17 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 May 2025 20:48:56 -0400 Subject: [PATCH 11/22] Clean QT Floppy/CD-ROM UI --- src/qt/qt_settingsfloppycdrom.cpp | 21 +++++++------ src/qt/qt_settingsfloppycdrom.hpp | 19 +++++++----- src/qt/qt_settingsfloppycdrom.ui | 50 +++++++++++++++---------------- 3 files changed, 46 insertions(+), 44 deletions(-) diff --git a/src/qt/qt_settingsfloppycdrom.cpp b/src/qt/qt_settingsfloppycdrom.cpp index 5e0ec7bed..bf1499076 100644 --- a/src/qt/qt_settingsfloppycdrom.cpp +++ b/src/qt/qt_settingsfloppycdrom.cpp @@ -359,9 +359,9 @@ SettingsFloppyCDROM::on_comboBoxSpeed_activated(int index) void SettingsFloppyCDROM::on_comboBoxBus_activated(int) { - auto i = ui->tableViewCDROM->selectionModel()->currentIndex().siblingAtColumn(0); + auto i = ui->tableViewCDROM->selectionModel()->currentIndex().siblingAtColumn(0); uint8_t bus_type = ui->comboBoxBus->currentData().toUInt(); - int cdromIdx = ui->tableViewCDROM->selectionModel()->currentIndex().data().toInt(); + int cdromIdx = ui->tableViewCDROM->selectionModel()->currentIndex().data().toInt(); Harddrives::busTrackClass->device_track(0, DEV_CDROM, ui->tableViewCDROM->model()->data(i, Qt::UserRole).toInt(), ui->tableViewCDROM->model()->data(i, @@ -384,9 +384,9 @@ SettingsFloppyCDROM::on_comboBoxBus_activated(int) auto *modelType = ui->comboBoxCDROMType->model(); int removeRows = modelType->rowCount(); - uint32_t j = 0; - int selectedTypeRow = 0; - int eligibleRows = 0; + uint32_t j = 0; + int selectedTypeRow = 0; + int eligibleRows = 0; while (cdrom_drive_types[j].bus_type != BUS_TYPE_NONE) { if (((bus_type == CDROM_BUS_ATAPI) || (bus_type == CDROM_BUS_SCSI)) && ((cdrom_drive_types[j].bus_type == bus_type) || @@ -414,11 +414,10 @@ void SettingsFloppyCDROM::enableCurrentlySelectedChannel() { const auto *item_model = qobject_cast(ui->comboBoxChannel->model()); - const auto index = ui->comboBoxChannel->currentIndex(); - auto *item = item_model->item(index); - if(item) { + const auto index = ui->comboBoxChannel->currentIndex(); + auto *item = item_model->item(index); + if(item) item->setEnabled(true); - } } void @@ -449,9 +448,9 @@ SettingsFloppyCDROM::on_comboBoxCDROMType_activated(int) ui->tableViewCDROM->resizeColumnsToContents(); ui->tableViewCDROM->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); - int speed = cdrom_get_speed(type); + int speed = cdrom_get_speed(type); if (speed == -1) { - speed = ui->comboBoxSpeed->currentData().toUInt(); + speed = ui->comboBoxSpeed->currentData().toUInt(); ui->comboBoxSpeed->setEnabled(true); } else ui->comboBoxSpeed->setEnabled(false); diff --git a/src/qt/qt_settingsfloppycdrom.hpp b/src/qt/qt_settingsfloppycdrom.hpp index 0a3424216..063942201 100644 --- a/src/qt/qt_settingsfloppycdrom.hpp +++ b/src/qt/qt_settingsfloppycdrom.hpp @@ -19,17 +19,20 @@ public: signals: void cdromChannelChanged(); + private slots: - void on_comboBoxCDROMType_activated(int index); - void on_comboBoxChannel_activated(int index); - void on_comboBoxBus_activated(int index); - void on_comboBoxSpeed_activated(int index); - void on_comboBoxBus_currentIndexChanged(int index); - void on_comboBoxFloppyType_activated(int index); - void on_checkBoxCheckBPB_stateChanged(int arg1); - void on_checkBoxTurboTimings_stateChanged(int arg1); void onFloppyRowChanged(const QModelIndex ¤t); + void on_comboBoxFloppyType_activated(int index); + void on_checkBoxTurboTimings_stateChanged(int arg1); + void on_checkBoxCheckBPB_stateChanged(int arg1); + void onCDROMRowChanged(const QModelIndex ¤t); + void on_comboBoxBus_activated(int index); + void on_comboBoxBus_currentIndexChanged(int index); + void on_comboBoxChannel_activated(int index); + void on_comboBoxSpeed_activated(int index); + void on_comboBoxCDROMType_activated(int index); + private: Ui::SettingsFloppyCDROM *ui; diff --git a/src/qt/qt_settingsfloppycdrom.ui b/src/qt/qt_settingsfloppycdrom.ui index b9a937d8d..7dde46631 100644 --- a/src/qt/qt_settingsfloppycdrom.ui +++ b/src/qt/qt_settingsfloppycdrom.ui @@ -27,7 +27,7 @@ 0 - + Floppy drives: @@ -68,7 +68,7 @@ - + Type: @@ -99,7 +99,7 @@ - + CD-ROM drives: @@ -140,33 +140,12 @@ - + Bus: - - - - Channel: - - - - - - - Speed: - - - - - - - Type: - - - @@ -174,6 +153,13 @@ + + + + Channel: + + + @@ -181,6 +167,13 @@ + + + + Speed: + + + @@ -188,6 +181,13 @@ + + + + Type: + + + From 8aae02244185decc1c380df7d55a7e087a923c6c Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 May 2025 20:52:03 -0400 Subject: [PATCH 12/22] Clean QT HDD UI --- src/qt/qt_settingsharddisks.cpp | 42 +++++++++++++-------------------- src/qt/qt_settingsharddisks.hpp | 7 +++--- src/qt/qt_settingsharddisks.ui | 2 +- 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/qt/qt_settingsharddisks.cpp b/src/qt/qt_settingsharddisks.cpp index 32b677888..6d82f2b77 100644 --- a/src/qt/qt_settingsharddisks.cpp +++ b/src/qt/qt_settingsharddisks.cpp @@ -49,9 +49,8 @@ static void normalize_hd_list() { hard_disk_t ihdd[HDD_NUM]; - int j; + int j = 0; - j = 0; memset(ihdd, 0x00, HDD_NUM * sizeof(hard_disk_t)); for (uint8_t i = 0; i < HDD_NUM; i++) { @@ -75,8 +74,8 @@ static void addRow(QAbstractItemModel *model, hard_disk_t *hd) { const QString userPath = usr_path; - int row = model->rowCount(); + model->insertRow(row); QString busName = Harddrives::BusChannelName(hd->bus_type, hd->channel); @@ -88,11 +87,11 @@ addRow(QAbstractItemModel *model, hard_disk_t *hd) model->setData(model->index(row, ColumnBus), hd->channel, DataBusChannelPrevious); Harddrives::busTrackClass->device_track(1, DEV_HDD, hd->bus_type, hd->channel); QString fileName = hd->fn; - if (fileName.startsWith(userPath, Qt::CaseInsensitive)) { + if (fileName.startsWith(userPath, Qt::CaseInsensitive)) model->setData(model->index(row, ColumnFilename), fileName.mid(userPath.size())); - } else { + else model->setData(model->index(row, ColumnFilename), fileName); - } + model->setData(model->index(row, ColumnFilename), fileName, Qt::UserRole); model->setData(model->index(row, ColumnCylinders), hd->tracks); @@ -120,9 +119,8 @@ SettingsHarddisks::SettingsHarddisks(QWidget *parent) ui->tableView->setModel(model); for (int i = 0; i < HDD_NUM; i++) { - if (hdd[i].bus_type > 0) { + if (hdd[i].bus_type > 0) addRow(model, &hdd[i]); - } } if (model->rowCount() == HDD_NUM) { ui->pushButtonNew->setEnabled(false); @@ -176,9 +174,8 @@ void SettingsHarddisks::reloadBusChannels() { void SettingsHarddisks::on_comboBoxBus_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } buschangeinprogress = true; auto idx = ui->tableView->selectionModel()->currentIndex(); @@ -226,9 +223,8 @@ SettingsHarddisks::on_comboBoxBus_currentIndexChanged(int index) void SettingsHarddisks::on_comboBoxChannel_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } auto idx = ui->tableView->selectionModel()->currentIndex(); if (idx.isValid()) { @@ -250,17 +246,15 @@ SettingsHarddisks::enableCurrentlySelectedChannel() const auto *item_model = qobject_cast(ui->comboBoxChannel->model()); const auto index = ui->comboBoxChannel->currentIndex(); auto *item = item_model->item(index); - if(item) { + if(item) item->setEnabled(true); - } } void SettingsHarddisks::on_comboBoxSpeed_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } auto idx = ui->tableView->selectionModel()->currentIndex(); if (idx.isValid()) { @@ -288,20 +282,19 @@ SettingsHarddisks::onTableRowChanged(const QModelIndex ¤t) auto *model = ui->comboBoxBus->model(); auto match = model->match(model->index(0, 0), Qt::UserRole, bus); - if (!match.isEmpty()) { + if (!match.isEmpty()) ui->comboBoxBus->setCurrentIndex(match.first().row()); - } + model = ui->comboBoxChannel->model(); match = model->match(model->index(0, 0), Qt::UserRole, busChannel); - if (!match.isEmpty()) { + if (!match.isEmpty()) ui->comboBoxChannel->setCurrentIndex(match.first().row()); - } model = ui->comboBoxSpeed->model(); match = model->match(model->index(0, 0), Qt::UserRole, speed); - if (!match.isEmpty()) { + if (!match.isEmpty()) ui->comboBoxSpeed->setCurrentIndex(match.first().row()); - } + reloadBusChannels(); } @@ -358,11 +351,10 @@ void SettingsHarddisks::on_pushButtonRemove_clicked() { auto idx = ui->tableView->selectionModel()->currentIndex(); - if (!idx.isValid()) { + if (!idx.isValid()) return; - } - auto *model = ui->tableView->model(); + auto *model = ui->tableView->model(); const auto col = idx.siblingAtColumn(ColumnBus); Harddrives::busTrackClass->device_track(0, DEV_HDD, model->data(col, DataBus).toInt(), model->data(col, DataBusChannel).toInt()); model->removeRow(idx.row()); diff --git a/src/qt/qt_settingsharddisks.hpp b/src/qt/qt_settingsharddisks.hpp index 4bd287d29..f892a79cd 100644 --- a/src/qt/qt_settingsharddisks.hpp +++ b/src/qt/qt_settingsharddisks.hpp @@ -21,14 +21,13 @@ signals: void driveChannelChanged(); private slots: + void on_comboBoxBus_currentIndexChanged(int index); void on_comboBoxChannel_currentIndexChanged(int index); void on_comboBoxSpeed_currentIndexChanged(int index); -private slots: - void on_pushButtonRemove_clicked(); - void on_pushButtonExisting_clicked(); void on_pushButtonNew_clicked(); - void on_comboBoxBus_currentIndexChanged(int index); + void on_pushButtonExisting_clicked(); + void on_pushButtonRemove_clicked(); void onTableRowChanged(const QModelIndex ¤t); diff --git a/src/qt/qt_settingsharddisks.ui b/src/qt/qt_settingsharddisks.ui index ea69edc5b..f996c76d1 100644 --- a/src/qt/qt_settingsharddisks.ui +++ b/src/qt/qt_settingsharddisks.ui @@ -46,7 +46,7 @@ - + From 59c3254daf3e89c2c1d6a44f836da4ee2b16cd8d Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 May 2025 21:01:54 -0400 Subject: [PATCH 13/22] Clean QT Input UI --- src/qt/qt_settingsinput.cpp | 236 ++++++++++++++++++------------------ src/qt/qt_settingsinput.hpp | 9 +- src/qt/qt_settingsinput.ui | 140 ++++++++++----------- 3 files changed, 191 insertions(+), 194 deletions(-) diff --git a/src/qt/qt_settingsinput.cpp b/src/qt/qt_settingsinput.cpp index a7000414c..6d89c511a 100644 --- a/src/qt/qt_settingsinput.cpp +++ b/src/qt/qt_settingsinput.cpp @@ -38,7 +38,7 @@ extern "C" { #include "qt_keybind.hpp" extern MainWindow *main_window; - + // Temporary working copy of key list accelKey acc_keys_t[NUM_ACCELS]; @@ -48,41 +48,40 @@ SettingsInput::SettingsInput(QWidget *parent) { ui->setupUi(this); - QStringList horizontalHeader; - QStringList verticalHeader; - - horizontalHeader.append(tr("Action")); + QStringList horizontalHeader; + QStringList verticalHeader; + + horizontalHeader.append(tr("Action")); horizontalHeader.append(tr("Keybind")); - QTableWidget *keyTable = ui->tableKeys; - keyTable->setRowCount(10); - keyTable->setColumnCount(3); - keyTable->setColumnHidden(2, true); - keyTable->setColumnWidth(0, 200); - keyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); - QStringList headers; - //headers << "Action" << "Bound key"; - keyTable->setHorizontalHeaderLabels(horizontalHeader); - keyTable->verticalHeader()->setVisible(false); - keyTable->setEditTriggers(QAbstractItemView::NoEditTriggers); - keyTable->setSelectionBehavior(QAbstractItemView::SelectRows); - keyTable->setSelectionMode(QAbstractItemView::SingleSelection); - keyTable->setShowGrid(true); - - // Make a working copy of acc_keys so we can check for dupes later without getting - // confused - for(int x=0;xtableKeys; + keyTable->setRowCount(10); + keyTable->setColumnCount(3); + keyTable->setColumnHidden(2, true); + keyTable->setColumnWidth(0, 200); + keyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + QStringList headers; + //headers << "Action" << "Bound key"; + keyTable->setHorizontalHeaderLabels(horizontalHeader); + keyTable->verticalHeader()->setVisible(false); + keyTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + keyTable->setSelectionBehavior(QAbstractItemView::SelectRows); + keyTable->setSelectionMode(QAbstractItemView::SingleSelection); + keyTable->setShowGrid(true); - refreshInputList(); + // Make a working copy of acc_keys so we can check for dupes later without getting + // confused + for(int x = 0; x < NUM_ACCELS; x++) { + strcpy(acc_keys_t[x].name, acc_keys[x].name); + strcpy(acc_keys_t[x].desc, acc_keys[x].desc); + strcpy(acc_keys_t[x].seq, acc_keys[x].seq); + } + + refreshInputList(); onCurrentMachineChanged(machine); } - SettingsInput::~SettingsInput() { delete ui; @@ -93,16 +92,16 @@ SettingsInput::save() { mouse_type = ui->comboBoxMouse->currentData().toInt(); joystick_type = ui->comboBoxJoystick->currentData().toInt(); - - // Copy accelerators from working set to global set - for(int x=0;xrowCount(); @@ -131,9 +128,8 @@ SettingsInput::onCurrentMachineChanged(int machineId) mouseModel->setData(idx, name, Qt::DisplayRole); mouseModel->setData(idx, i, Qt::UserRole); - if (i == mouse_type) { + if (i == mouse_type) selectedRow = row - removeRows; - } } mouseModel->removeRows(0, removeRows); ui->comboBoxMouse->setCurrentIndex(selectedRow); @@ -141,13 +137,12 @@ SettingsInput::onCurrentMachineChanged(int machineId) int i = 0; const char *joyName = joystick_get_name(i); auto *joystickModel = ui->comboBoxJoystick->model(); - removeRows = joystickModel->rowCount(); - selectedRow = 0; + removeRows = joystickModel->rowCount(); + selectedRow = 0; while (joyName) { int row = Models::AddEntry(joystickModel, tr(joyName).toUtf8().data(), i); - if (i == joystick_type) { + if (i == joystick_type) selectedRow = row - removeRows; - } ++i; joyName = joystick_get_name(i); @@ -159,95 +154,95 @@ SettingsInput::onCurrentMachineChanged(int machineId) void SettingsInput::refreshInputList() { - - for (int x=0;xtableKeys->setItem(x, 0, new QTableWidgetItem(tr(acc_keys_t[x].desc))); - ui->tableKeys->setItem(x, 1, new QTableWidgetItem(QKeySequence(acc_keys_t[x].seq, QKeySequence::PortableText).toString(QKeySequence::NativeText))); - ui->tableKeys->setItem(x, 2, new QTableWidgetItem(acc_keys_t[x].name)); - } + for (int x = 0; x < NUM_ACCELS; x++) { + ui->tableKeys->setItem(x, 0, new QTableWidgetItem(tr(acc_keys_t[x].desc))); + ui->tableKeys->setItem(x, 1, new QTableWidgetItem(QKeySequence(acc_keys_t[x].seq, QKeySequence::PortableText).toString(QKeySequence::NativeText))); + ui->tableKeys->setItem(x, 2, new QTableWidgetItem(acc_keys_t[x].name)); + } } void SettingsInput::on_tableKeys_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) { - // Enable/disable bind/clear buttons if user clicked valid row - QTableWidgetItem *cell = ui->tableKeys->item(currentRow,1); - if (!cell) - { - ui->pushButtonBind->setEnabled(false); - ui->pushButtonClearBind->setEnabled(false); - } - else - { - ui->pushButtonBind->setEnabled(true); - ui->pushButtonClearBind->setEnabled(true); - } + // Enable/disable bind/clear buttons if user clicked valid row + QTableWidgetItem *cell = ui->tableKeys->item(currentRow,1); + if (!cell) { + ui->pushButtonBind->setEnabled(false); + ui->pushButtonClearBind->setEnabled(false); + } else { + ui->pushButtonBind->setEnabled(true); + ui->pushButtonClearBind->setEnabled(true); + } } void SettingsInput::on_tableKeys_cellDoubleClicked(int row, int col) { - // Edit bind - QTableWidgetItem *cell = ui->tableKeys->item(row,1); - if (!cell) return; - - QKeySequence keyseq = KeyBinder::BindKey(this, cell->text()); - if (keyseq != false) { - // If no change was made, don't change anything. - if (keyseq.toString(QKeySequence::NativeText) == cell->text()) return; - - // Otherwise, check for conflicts. - // Check against the *working* copy - NOT the one in use by the app, - // so we don't test against shortcuts the user already changed. - for(int x=0;xshowMessage(MBX_ANSI & MBX_INFO, "Bind conflict", "This key combo is already in use", false); - return; - } - } - // If we made it here, there were no conflicts. - // Go ahead and apply the bind. - - // Find the correct accelerator key entry - int accKeyID = FindAccelerator(ui->tableKeys->item(row,2)->text().toUtf8().constData()); - if (accKeyID < 0) return; // this should never happen - - // Make the change - cell->setText(keyseq.toString(QKeySequence::NativeText)); - strcpy(acc_keys_t[accKeyID].seq, keyseq.toString(QKeySequence::PortableText).toUtf8().constData()); - - refreshInputList(); - } + // Edit bind + QTableWidgetItem *cell = ui->tableKeys->item(row,1); + if (!cell) + return; + + QKeySequence keyseq = KeyBinder::BindKey(this, cell->text()); + if (keyseq != false) { + // If no change was made, don't change anything. + if (keyseq.toString(QKeySequence::NativeText) == cell->text()) + return; + + // Otherwise, check for conflicts. + // Check against the *working* copy - NOT the one in use by the app, + // so we don't test against shortcuts the user already changed. + for(int x = 0; x < NUM_ACCELS; x++) { + if(QString::fromStdString(acc_keys_t[x].seq) == keyseq.toString(QKeySequence::PortableText)) { + // That key is already in use + main_window->showMessage(MBX_ANSI & MBX_INFO, "Bind conflict", "This key combo is already in use", false); + return; + } + } + // If we made it here, there were no conflicts. + // Go ahead and apply the bind. + + // Find the correct accelerator key entry + int accKeyID = FindAccelerator(ui->tableKeys->item(row,2)->text().toUtf8().constData()); + if (accKeyID < 0) + return; // this should never happen + + // Make the change + cell->setText(keyseq.toString(QKeySequence::NativeText)); + strcpy(acc_keys_t[accKeyID].seq, keyseq.toString(QKeySequence::PortableText).toUtf8().constData()); + + refreshInputList(); + } } void SettingsInput::on_pushButtonBind_clicked() { - // Edit bind - QTableWidgetItem *cell = ui->tableKeys->currentItem(); - if (!cell) return; - - on_tableKeys_cellDoubleClicked(cell->row(), cell->column()); + // Edit bind + QTableWidgetItem *cell = ui->tableKeys->currentItem(); + if (!cell) + return; + + on_tableKeys_cellDoubleClicked(cell->row(), cell->column()); } void SettingsInput::on_pushButtonClearBind_clicked() { - // Wipe bind - QTableWidgetItem *cell = ui->tableKeys->item(ui->tableKeys->currentRow(), 1); - if (!cell) return; - - cell->setText(""); - // Find the correct accelerator key entry - int accKeyID = FindAccelerator(ui->tableKeys->item(cell->row(),2)->text().toUtf8().constData()); - if (accKeyID < 0) return; // this should never happen - - // Make the change - cell->setText(""); - strcpy(acc_keys_t[accKeyID].seq, ""); + // Wipe bind + QTableWidgetItem *cell = ui->tableKeys->item(ui->tableKeys->currentRow(), 1); + if (!cell) + return; + + cell->setText(""); + // Find the correct accelerator key entry + int accKeyID = FindAccelerator(ui->tableKeys->item(cell->row(),2)->text().toUtf8().constData()); + if (accKeyID < 0) + return; // this should never happen + + // Make the change + cell->setText(""); + strcpy(acc_keys_t[accKeyID].seq, ""); } void @@ -263,9 +258,9 @@ SettingsInput::on_comboBoxJoystick_currentIndexChanged(int index) int joystickId = ui->comboBoxJoystick->currentData().toInt(); for (int i = 0; i < MAX_JOYSTICKS; ++i) { auto *btn = findChild(QString("pushButtonJoystick%1").arg(i + 1)); - if (btn == nullptr) { + if (btn == nullptr) continue; - } + btn->setEnabled(joystick_get_max_joysticks(joystickId) > i); } } @@ -283,9 +278,8 @@ get_axis(JoystickConfiguration &jc, int axis, int joystick_nr) int axis_sel = jc.selectedAxis(axis); int nr_axes = plat_joystick_state[joystick_state[0][joystick_nr].plat_joystick_nr - 1].nr_axes; - if (axis_sel < nr_axes) { + if (axis_sel < nr_axes) return axis_sel; - } axis_sel -= nr_axes; if (axis_sel & 1) diff --git a/src/qt/qt_settingsinput.hpp b/src/qt/qt_settingsinput.hpp index 742421f64..a51ad2564 100644 --- a/src/qt/qt_settingsinput.hpp +++ b/src/qt/qt_settingsinput.hpp @@ -26,17 +26,20 @@ public slots: void onCurrentMachineChanged(int machineId); private slots: - void on_pushButtonConfigureMouse_clicked(); - void on_comboBoxJoystick_currentIndexChanged(int index); void on_comboBoxMouse_currentIndexChanged(int index); + void on_pushButtonConfigureMouse_clicked(); + + void on_comboBoxJoystick_currentIndexChanged(int index); void on_pushButtonJoystick1_clicked(); void on_pushButtonJoystick2_clicked(); void on_pushButtonJoystick3_clicked(); void on_pushButtonJoystick4_clicked(); + void on_tableKeys_cellDoubleClicked(int row, int col); void on_tableKeys_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); - void on_pushButtonBind_clicked(); + void on_pushButtonClearBind_clicked(); + void on_pushButtonBind_clicked(); private: Ui::SettingsInput *ui; diff --git a/src/qt/qt_settingsinput.ui b/src/qt/qt_settingsinput.ui index b7074eeaa..6ac6cf38a 100644 --- a/src/qt/qt_settingsinput.ui +++ b/src/qt/qt_settingsinput.ui @@ -23,6 +23,13 @@ 0 + + + + Mouse: + + + @@ -36,75 +43,6 @@ - - - - Joystick 4... - - - - - - - Joystick 3... - - - - - - - false - - - Bind - - - - - - - Joystick 1... - - - - - - - 30 - - - - - - - Mouse: - - - - - - - false - - - Clear binding - - - - - - - Joystick: - - - - - - - Joystick 2... - - - @@ -118,8 +56,50 @@ + + + + Joystick: + + + + + + + 30 + + + + + + + Joystick 1... + + + + + + + Joystick 2... + + + + + + + Joystick 3... + + + + + + + Joystick 4... + + + - + Key Bindings: @@ -144,6 +124,26 @@ + + + + false + + + Clear binding + + + + + + + false + + + Bind + + + From a83fe67b21274df4423f010da400756f51faded1 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 May 2025 21:04:00 -0400 Subject: [PATCH 14/22] Clean QT Machine UI --- src/qt/qt_settingsmachine.cpp | 2 +- src/qt/qt_settingsmachine.hpp | 11 +---------- src/qt/qt_settingsmachine.ui | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/qt/qt_settingsmachine.cpp b/src/qt/qt_settingsmachine.cpp index 8548ca8cc..fb5576f69 100644 --- a/src/qt/qt_settingsmachine.cpp +++ b/src/qt/qt_settingsmachine.cpp @@ -358,4 +358,4 @@ void SettingsMachine::on_checkBoxFPUSoftfloat_stateChanged(int state) { ui->softFloatWarningIcon->setVisible(false); ui->softFloatWarningText->setVisible(false); } -} \ No newline at end of file +} diff --git a/src/qt/qt_settingsmachine.hpp b/src/qt/qt_settingsmachine.hpp index 7e89d7fa4..864894447 100644 --- a/src/qt/qt_settingsmachine.hpp +++ b/src/qt/qt_settingsmachine.hpp @@ -18,22 +18,13 @@ public: signals: void currentMachineChanged(int machineId); + private slots: void on_pushButtonConfigure_clicked(); - -private slots: void on_comboBoxFPU_currentIndexChanged(int index); - -private slots: void on_comboBoxSpeed_currentIndexChanged(int index); - -private slots: void on_comboBoxCPU_currentIndexChanged(int index); - -private slots: void on_comboBoxMachine_currentIndexChanged(int index); - -private slots: void on_comboBoxMachineType_currentIndexChanged(int index); void on_checkBoxFPUSoftfloat_stateChanged(int state); diff --git a/src/qt/qt_settingsmachine.ui b/src/qt/qt_settingsmachine.ui index 0c9c2708e..e3b3cdbde 100644 --- a/src/qt/qt_settingsmachine.ui +++ b/src/qt/qt_settingsmachine.ui @@ -41,6 +41,7 @@ 0 + @@ -48,6 +49,7 @@ + @@ -55,6 +57,7 @@ + @@ -62,6 +65,7 @@ + @@ -69,6 +73,7 @@ + @@ -79,6 +84,7 @@ + @@ -86,6 +92,7 @@ + @@ -93,6 +100,7 @@ + @@ -121,6 +129,7 @@ + @@ -131,6 +140,7 @@ + @@ -147,6 +157,7 @@ + @@ -154,6 +165,7 @@ + @@ -161,6 +173,7 @@ + @@ -183,6 +196,7 @@ + @@ -199,6 +213,7 @@ + @@ -253,6 +268,7 @@ + @@ -270,6 +286,7 @@ + @@ -285,6 +302,7 @@ + @@ -292,6 +310,7 @@ + @@ -314,6 +333,7 @@ + From 127580b71bbf374c28c8075b1c15e775d16a7fd4 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 May 2025 21:06:31 -0400 Subject: [PATCH 15/22] Clean QT Network UI --- src/qt/qt_settingsnetwork.cpp | 44 +-- src/qt/qt_settingsnetwork.ui | 513 ++++++++++++++++++---------------- 2 files changed, 288 insertions(+), 269 deletions(-) diff --git a/src/qt/qt_settingsnetwork.cpp b/src/qt/qt_settingsnetwork.cpp index 1ea48ee6b..2e64175eb 100644 --- a/src/qt/qt_settingsnetwork.cpp +++ b/src/qt/qt_settingsnetwork.cpp @@ -36,17 +36,17 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) auto *nic_cbox = findChild(QString("comboBoxNIC%1").arg(i + 1)); auto *net_type_cbox = findChild(QString("comboBoxNet%1").arg(i + 1)); - auto *intf_label = findChild(QString("interfaceLabel%1").arg(i + 1)); + auto *intf_label = findChild(QString("labelIntf%1").arg(i + 1)); auto *intf_cbox = findChild(QString("comboBoxIntf%1").arg(i + 1)); auto *conf_btn = findChild(QString("pushButtonConf%1").arg(i + 1)); // auto *net_type_conf_btn = findChild(QString("pushButtonNetTypeConf%1").arg(i + 1)); - auto *vde_socket_label = findChild(QString("socketVDELabel%1").arg(i + 1)); + auto *vde_socket_label = findChild(QString("labelSocketVDENIC%1").arg(i + 1)); auto *socket_line = findChild(QString("socketVDENIC%1").arg(i + 1)); - auto *option_list_label = findChild(QString("optionListLabel%1").arg(i + 1)); - auto *option_list_line = findChild(QString("optionListLine%1").arg(i + 1)); + auto *option_list_label = findChild(QString("labelOptionList%1").arg(i + 1)); + auto *option_list_line = findChild(QString("lineOptionList%1").arg(i + 1)); intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP); conf_btn->setEnabled(network_card_has_config(nic_cbox->currentData().toInt())); @@ -56,7 +56,6 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) option_list_label->setVisible(false); option_list_line->setVisible(false); - // VDE vde_socket_label->setVisible(false); socket_line->setVisible(false); @@ -70,21 +69,26 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) // Then only enable as needed based on network type switch (net_type_cbox->currentData().toInt()) { case NET_TYPE_VDE: - // option_list_label->setText("VDE Options"); + // option_list_label->setText("VDE Options"); option_list_label->setVisible(true); option_list_line->setVisible(true); vde_socket_label->setVisible(true); socket_line->setVisible(true); break; + case NET_TYPE_PCAP: - // option_list_label->setText("PCAP Options"); + // option_list_label->setText("PCAP Options"); option_list_label->setVisible(true); option_list_line->setVisible(true); intf_cbox->setVisible(true); intf_label->setVisible(true); break; + + case NET_TYPE_SLIRP: + default: + break; } } } @@ -124,11 +128,10 @@ SettingsNetwork::save() net_cards_conf[i].net_type = cbox->currentData().toInt(); cbox = findChild(QString("comboBoxIntf%1").arg(i + 1)); memset(net_cards_conf[i].host_dev_name, '\0', sizeof(net_cards_conf[i].host_dev_name)); - if (net_cards_conf[i].net_type == NET_TYPE_PCAP) { + if (net_cards_conf[i].net_type == NET_TYPE_PCAP) strncpy(net_cards_conf[i].host_dev_name, network_devs[cbox->currentData().toInt()].device, sizeof(net_cards_conf[i].host_dev_name) - 1); - } else if (net_cards_conf[i].net_type == NET_TYPE_VDE) { + else if (net_cards_conf[i].net_type == NET_TYPE_VDE) strncpy(net_cards_conf[i].host_dev_name, socket_line->text().toUtf8().constData(), sizeof(net_cards_conf[i].host_dev_name)); - } } } @@ -141,7 +144,7 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) int selectedRow = 0; // Network Card - QComboBox * cbox_[NET_CARD_MAX] = { 0 }; + QComboBox *cbox_[NET_CARD_MAX] = { 0 }; QAbstractItemModel *models[NET_CARD_MAX] = { 0 }; int removeRows_[NET_CARD_MAX] = { 0 }; int selectedRows[NET_CARD_MAX] = { 0 }; @@ -226,9 +229,8 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) void SettingsNetwork::on_comboIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } enableElements(ui); } @@ -236,8 +238,8 @@ SettingsNetwork::on_comboIndexChanged(int index) void SettingsNetwork::on_pushButtonConf1_clicked() { - int netCard = ui->comboBoxNIC1->currentData().toInt(); - auto *device = network_card_getdevice(netCard); + int netCard = ui->comboBoxNIC1->currentData().toInt(); + auto *device = network_card_getdevice(netCard); if (netCard == NET_INTERNAL) device = machine_get_net_device(machineId); DeviceConfig::ConfigureDevice(device, 1); @@ -246,23 +248,23 @@ SettingsNetwork::on_pushButtonConf1_clicked() void SettingsNetwork::on_pushButtonConf2_clicked() { - int netCard = ui->comboBoxNIC2->currentData().toInt(); - auto *device = network_card_getdevice(netCard); + int netCard = ui->comboBoxNIC2->currentData().toInt(); + auto *device = network_card_getdevice(netCard); DeviceConfig::ConfigureDevice(device, 2); } void SettingsNetwork::on_pushButtonConf3_clicked() { - int netCard = ui->comboBoxNIC3->currentData().toInt(); - auto *device = network_card_getdevice(netCard); + int netCard = ui->comboBoxNIC3->currentData().toInt(); + auto *device = network_card_getdevice(netCard); DeviceConfig::ConfigureDevice(device, 3); } void SettingsNetwork::on_pushButtonConf4_clicked() { - int netCard = ui->comboBoxNIC4->currentData().toInt(); - auto *device = network_card_getdevice(netCard); + int netCard = ui->comboBoxNIC4->currentData().toInt(); + auto *device = network_card_getdevice(netCard); DeviceConfig::ConfigureDevice(device, 4); } diff --git a/src/qt/qt_settingsnetwork.ui b/src/qt/qt_settingsnetwork.ui index 8fb048f71..0c0979c46 100644 --- a/src/qt/qt_settingsnetwork.ui +++ b/src/qt/qt_settingsnetwork.ui @@ -27,15 +27,29 @@ 0 - + 0 - + + Network Card #1 - + + + + + + 0 + 0 + + + + Mode: + + + @@ -50,7 +64,7 @@ - + 0 @@ -62,79 +76,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - Mode: - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - Configure - - - - - - - Options - - - - - - - - 0 - 0 - - - - Interface: - - - - - - - VDE Socket: - - - @@ -151,10 +92,43 @@ - - - - 127 + + + + + 0 + 0 + + + + Configure + + + + + + + Options + + + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + Interface: @@ -168,15 +142,22 @@ - - - - - Network Card #2 - - + + + + VDE Socket: + + + + + + + 127 + + + - + Qt::Vertical @@ -188,28 +169,16 @@ - - - - - 0 - 0 - - - - Interface: - - - - - - - Options - - - + + + + + + Network Card #2 + + - + 0 @@ -234,22 +203,8 @@ - - - - VDE Socket: - - - - - - - Qt::Horizontal - - - - + 0 @@ -261,6 +216,22 @@ + + + + + 0 + 0 + + + + QComboBox::AdjustToContents + + + 30 + + + @@ -274,25 +245,33 @@ - - - - 30 + + + + Options + + + + + + Qt::Horizontal + + + + + - + 0 0 - - QComboBox::AdjustToContents + + Interface: - - - @@ -303,13 +282,54 @@ + + + + VDE Socket: + + + + + + + 127 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + - + + Network Card #3 - + + + + + + 0 + 0 + + + + Mode: + + + @@ -323,17 +343,16 @@ - - - - VDE Socket: + + + + + 0 + 0 + - - - - - Options + Adapter: @@ -353,39 +372,6 @@ - - - - - 0 - 0 - - - - Interface: - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - Mode: - - - @@ -399,8 +385,22 @@ - - + + + + Options + + + + + + + Qt::Horizontal + + + + + 0 @@ -408,13 +408,10 @@ - Adapter: + Interface: - - - @@ -425,8 +422,22 @@ + + + + VDE Socket: + + + + + + + 127 + + + - + Qt::Vertical @@ -440,20 +451,14 @@ - + + Network Card #4 - - - - - Options - - - + - + 0 @@ -465,28 +470,21 @@ - - - - Qt::Vertical + + + + 30 - - - 20 - 40 - - - - - - - - VDE Socket: + + + 0 + 0 + - + 0 @@ -498,26 +496,6 @@ - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - Interface: - - - @@ -534,19 +512,6 @@ - - - - 30 - - - - 0 - 0 - - - - @@ -560,8 +525,32 @@ - - + + + + Options + + + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + Interface: + + @@ -573,8 +562,36 @@ + + + + VDE Socket: + + + + + + + 127 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + From 2641601ea21a52ce31d10c4ec40e5a1f46268d6c Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 May 2025 21:09:53 -0400 Subject: [PATCH 16/22] Clean QT Ports UI --- src/qt/qt_settingsports.cpp | 6 +- src/qt/qt_settingsports.hpp | 21 ++-- src/qt/qt_settingsports.ui | 192 ++++++++++++++++++------------------ 3 files changed, 111 insertions(+), 108 deletions(-) diff --git a/src/qt/qt_settingsports.cpp b/src/qt/qt_settingsports.cpp index 7e8f2aeda..ddebd28e8 100644 --- a/src/qt/qt_settingsports.cpp +++ b/src/qt/qt_settingsports.cpp @@ -51,7 +51,7 @@ SettingsPorts::save() { for (int i = 0; i < PARALLEL_MAX; i++) { auto *cbox = findChild(QString("comboBoxLpt%1").arg(i + 1)); - auto *checkBox = findChild(QString("checkBoxParallel%1").arg(i + 1)); + auto *checkBox = findChild(QString("checkBoxParallel%1").arg(i + 1)); if (cbox != NULL) lpt_ports[i].device = cbox->currentData().toInt(); if (checkBox != NULL) @@ -73,7 +73,7 @@ SettingsPorts::onCurrentMachineChanged(int machineId) { this->machineId = machineId; - int c = 0; + int c = 0; // LPT Device QComboBox * cbox[PARALLEL_MAX] = { 0 }; @@ -93,7 +93,7 @@ SettingsPorts::onCurrentMachineChanged(int machineId) if (lptName == nullptr) break; - const QString name = tr(lptName); + const QString name = tr(lptName); for (uint8_t i = 0; i < PARALLEL_MAX; ++i) { int row = Models::AddEntry(models[i], name, c); diff --git a/src/qt/qt_settingsports.hpp b/src/qt/qt_settingsports.hpp index 83560914f..8be1f0491 100644 --- a/src/qt/qt_settingsports.hpp +++ b/src/qt/qt_settingsports.hpp @@ -35,22 +35,25 @@ private slots: void on_checkBoxSerial7_stateChanged(int state); #endif void on_checkBoxSerialPassThru1_stateChanged(int state); + void on_pushButtonSerialPassThru1_clicked(); + void on_checkBoxSerialPassThru2_stateChanged(int state); + void on_pushButtonSerialPassThru2_clicked(); + void on_checkBoxSerialPassThru3_stateChanged(int state); + void on_pushButtonSerialPassThru3_clicked(); + void on_checkBoxSerialPassThru4_stateChanged(int state); + void on_pushButtonSerialPassThru4_clicked(); + #if 0 void on_checkBoxSerialPassThru5_stateChanged(int state); - void on_checkBoxSerialPassThru6_stateChanged(int state); - void on_checkBoxSerialPassThru7_stateChanged(int state); -#endif - - void on_pushButtonSerialPassThru1_clicked(); - void on_pushButtonSerialPassThru2_clicked(); - void on_pushButtonSerialPassThru3_clicked(); - void on_pushButtonSerialPassThru4_clicked(); -#if 0 void on_pushButtonSerialPassThru5_clicked(); + + void on_checkBoxSerialPassThru6_stateChanged(int state); void on_pushButtonSerialPassThru6_clicked(); + + void on_checkBoxSerialPassThru7_stateChanged(int state); void on_pushButtonSerialPassThru7_clicked(); #endif diff --git a/src/qt/qt_settingsports.ui b/src/qt/qt_settingsports.ui index bca870e5d..92420f2df 100644 --- a/src/qt/qt_settingsports.ui +++ b/src/qt/qt_settingsports.ui @@ -29,7 +29,7 @@ - + LPT1 Device: @@ -43,7 +43,7 @@ - + LPT2 Device: @@ -57,7 +57,7 @@ - + LPT3 Device: @@ -71,7 +71,7 @@ - + LPT4 Device: @@ -88,27 +88,6 @@ - - - - Parallel port 2 - - - - - - - Parallel port 3 - - - - - - - Serial port 3 - - - @@ -116,20 +95,6 @@ - - - - Parallel port 4 - - - - - - - Serial port 2 - - - @@ -137,6 +102,34 @@ + + + + Serial port 2 + + + + + + + Parallel port 2 + + + + + + + Serial port 3 + + + + + + + Parallel port 3 + + + @@ -144,13 +137,76 @@ + + + + Parallel port 4 + + + - + QLayout::SetDefaultConstraint + + + + Serial port passthrough 1 + + + + + + + Configure + + + + + + + Serial port passthrough 2 + + + + + + + Configure + + + + + + + Serial port passthrough 3 + + + + + + + Configure + + + + + + + Serial port passthrough 4 + + + + + + + Configure + + + @@ -164,13 +220,6 @@ - - - - Serial port passthrough 3 - - - @@ -184,55 +233,6 @@ - - - - Configure - - - - - - - Serial port passthrough 1 - - - - - - - Serial port passthrough 2 - - - - - - - Serial port passthrough 4 - - - - - - - Configure - - - - - - - Configure - - - - - - - Configure - - - From c0af5cea9983b2df0042d24967e6546347c89655 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 9 May 2025 21:12:19 -0400 Subject: [PATCH 17/22] Clean QT Storage Controllers UI --- src/qt/qt_settingsstoragecontrollers.cpp | 40 +++--- src/qt/qt_settingsstoragecontrollers.hpp | 38 ++--- src/qt/qt_settingsstoragecontrollers.ui | 170 +++++++++++------------ 3 files changed, 125 insertions(+), 123 deletions(-) diff --git a/src/qt/qt_settingsstoragecontrollers.cpp b/src/qt/qt_settingsstoragecontrollers.cpp index 48fa04892..2af7bd080 100644 --- a/src/qt/qt_settingsstoragecontrollers.cpp +++ b/src/qt/qt_settingsstoragecontrollers.cpp @@ -84,18 +84,16 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId) } QString name = DeviceConfig::DeviceName(hdc_get_device(c), hdc_get_internal_name(c), 1); - if (name.isEmpty()) { + if (name.isEmpty()) break; - } if (hdc_available(c)) { const device_t *hdc_dev = hdc_get_device(c); if (device_is_valid(hdc_dev, machineId)) { int row = Models::AddEntry(model, name, c); - if (c == hdc_current[0]) { + if (c == hdc_current[0]) selectedRow = row - removeRows; - } } } c++; @@ -105,7 +103,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId) ui->comboBoxHD->setCurrentIndex(-1); ui->comboBoxHD->setCurrentIndex(selectedRow); - /*FD controller config*/ + /* FD controller config */ model = ui->comboBoxFD->model(); removeRows = model->rowCount(); c = 0; @@ -143,11 +141,11 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId) /*CD interface controller config*/ #ifdef USE_CDROM_MITSUMI - ui->label_7->setVisible(true); + ui->labelCDInterface->setVisible(true); ui->comboBoxCDInterface->setVisible(true); ui->pushButtonCDInterface->setVisible(true); #else - ui->label_7->setVisible(false); + ui->labelCDInterface->setVisible(false); ui->comboBoxCDInterface->setVisible(false); ui->pushButtonCDInterface->setVisible(false); #endif @@ -242,27 +240,27 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId) void SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0); } void SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + ui->pushButtonFD->setEnabled(hdc_has_config(ui->comboBoxFD->currentData().toInt()) > 0); } void SettingsStorageControllers::on_comboBoxCDInterface_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + ui->pushButtonCDInterface->setEnabled(cdrom_interface_has_config(ui->comboBoxCDInterface->currentData().toInt()) > 0); } @@ -311,36 +309,36 @@ SettingsStorageControllers::on_pushButtonQuaternaryIDE_clicked() void SettingsStorageControllers::on_comboBoxSCSI1_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + ui->pushButtonSCSI1->setEnabled(scsi_card_has_config(ui->comboBoxSCSI1->currentData().toInt()) > 0); } void SettingsStorageControllers::on_comboBoxSCSI2_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + ui->pushButtonSCSI2->setEnabled(scsi_card_has_config(ui->comboBoxSCSI2->currentData().toInt()) > 0); } void SettingsStorageControllers::on_comboBoxSCSI3_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + ui->pushButtonSCSI3->setEnabled(scsi_card_has_config(ui->comboBoxSCSI3->currentData().toInt()) > 0); } void SettingsStorageControllers::on_comboBoxSCSI4_currentIndexChanged(int index) { - if (index < 0) { + if (index < 0) return; - } + ui->pushButtonSCSI4->setEnabled(scsi_card_has_config(ui->comboBoxSCSI4->currentData().toInt()) > 0); } diff --git a/src/qt/qt_settingsstoragecontrollers.hpp b/src/qt/qt_settingsstoragecontrollers.hpp index c50a94574..6774bb504 100644 --- a/src/qt/qt_settingsstoragecontrollers.hpp +++ b/src/qt/qt_settingsstoragecontrollers.hpp @@ -20,27 +20,31 @@ public slots: void onCurrentMachineChanged(int machineId); private slots: - void on_pushButtonSCSI4_clicked(); - void on_pushButtonSCSI3_clicked(); - void on_pushButtonSCSI2_clicked(); - void on_pushButtonSCSI1_clicked(); - void on_comboBoxSCSI4_currentIndexChanged(int index); - void on_comboBoxSCSI3_currentIndexChanged(int index); - void on_comboBoxSCSI2_currentIndexChanged(int index); - void on_comboBoxSCSI1_currentIndexChanged(int index); - void on_pushButtonQuaternaryIDE_clicked(); - void on_pushButtonTertiaryIDE_clicked(); - void on_pushButtonFD_clicked(); - void on_pushButtonHD_clicked(); - void on_pushButtonCDInterface_clicked(); - void on_checkBoxQuaternaryIDE_stateChanged(int arg1); - void on_checkBoxTertiaryIDE_stateChanged(int arg1); - void on_comboBoxFD_currentIndexChanged(int index); void on_comboBoxHD_currentIndexChanged(int index); + void on_pushButtonHD_clicked(); + + void on_comboBoxFD_currentIndexChanged(int index); + void on_pushButtonFD_clicked(); + void on_comboBoxCDInterface_currentIndexChanged(int index); + void on_pushButtonCDInterface_clicked(); + + void on_checkBoxTertiaryIDE_stateChanged(int arg1); + void on_pushButtonTertiaryIDE_clicked(); + + void on_checkBoxQuaternaryIDE_stateChanged(int arg1); + void on_pushButtonQuaternaryIDE_clicked(); + + void on_comboBoxSCSI1_currentIndexChanged(int index); + void on_pushButtonSCSI1_clicked(); + void on_comboBoxSCSI2_currentIndexChanged(int index); + void on_pushButtonSCSI2_clicked(); + void on_comboBoxSCSI3_currentIndexChanged(int index); + void on_pushButtonSCSI3_clicked(); + void on_comboBoxSCSI4_currentIndexChanged(int index); + void on_pushButtonSCSI4_clicked(); void on_checkBoxLbaEnhancer_stateChanged(int arg1); - void on_pushButtonConfigureLbaEnhancer_clicked(); private: diff --git a/src/qt/qt_settingsstoragecontrollers.ui b/src/qt/qt_settingsstoragecontrollers.ui index a167e5bc1..04a87c1d5 100644 --- a/src/qt/qt_settingsstoragecontrollers.ui +++ b/src/qt/qt_settingsstoragecontrollers.ui @@ -29,47 +29,12 @@ - + HD Controller: - - - - Configure - - - - - - - FD Controller: - - - - - - - CD-ROM Controller: - - - - - - - 30 - - - - - - - Configure - - - @@ -90,6 +55,13 @@ + + + + FD Controller: + + + @@ -97,6 +69,34 @@ + + + + Configure + + + + + + + CD-ROM Controller: + + + + + + + 30 + + + + + + + Configure + + + @@ -104,13 +104,6 @@ - - - - Quaternary IDE Controller - - - @@ -121,6 +114,13 @@ + + + + Quaternary IDE Controller + + + @@ -134,29 +134,15 @@ - + SCSI - - - + + + - Configure - - - - - - - Configure - - - - - - - Controller 3: + Controller 1: @@ -180,6 +166,13 @@ + + + + Controller 2: + + + @@ -193,6 +186,20 @@ + + + + Configure + + + + + + + Controller 3: + + + @@ -206,6 +213,20 @@ + + + + Configure + + + + + + + Controller 4: + + + @@ -219,29 +240,8 @@ - - - - Controller 1: - - - - - - - Controller 2: - - - - - - - Controller 4: - - - - - + + Configure From cdfb768ee8cd8e1f7563d3a50490a2559471b701 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sat, 10 May 2025 00:01:36 -0400 Subject: [PATCH 18/22] Clean QT Other Removable Devices UI --- src/qt/qt_settingsotherremovable.hpp | 32 ++++++++-------------------- src/qt/qt_settingsotherremovable.ui | 26 +++++++++++----------- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/src/qt/qt_settingsotherremovable.hpp b/src/qt/qt_settingsotherremovable.hpp index cea1d202b..1459ed043 100644 --- a/src/qt/qt_settingsotherremovable.hpp +++ b/src/qt/qt_settingsotherremovable.hpp @@ -21,33 +21,19 @@ public: signals: void moChannelChanged(); void zipChannelChanged(); -private slots: - void on_checkBoxZIP250_stateChanged(int arg1); - -private slots: - void on_comboBoxZIPChannel_activated(int index); - -private slots: - void on_comboBoxZIPBus_activated(int index); - -private slots: - void on_comboBoxZIPBus_currentIndexChanged(int index); - -private slots: - void on_comboBoxMOType_activated(int index); - -private slots: - void on_comboBoxMOChannel_activated(int index); - -private slots: - void on_comboBoxMOBus_activated(int index); - -private slots: - void on_comboBoxMOBus_currentIndexChanged(int index); private slots: void onMORowChanged(const QModelIndex ¤t); + void on_comboBoxMOBus_currentIndexChanged(int index); + void on_comboBoxMOBus_activated(int index); + void on_comboBoxMOChannel_activated(int index); + void on_comboBoxMOType_activated(int index); + void onZIPRowChanged(const QModelIndex ¤t); + void on_comboBoxZIPBus_currentIndexChanged(int index); + void on_comboBoxZIPBus_activated(int index); + void on_comboBoxZIPChannel_activated(int index); + void on_checkBoxZIP250_stateChanged(int arg1); private: Ui::SettingsOtherRemovable *ui; diff --git a/src/qt/qt_settingsotherremovable.ui b/src/qt/qt_settingsotherremovable.ui index 8962184fc..ae7839e54 100644 --- a/src/qt/qt_settingsotherremovable.ui +++ b/src/qt/qt_settingsotherremovable.ui @@ -27,7 +27,7 @@ 0 - + MO drives: @@ -68,19 +68,12 @@ - + Bus: - - - - Channel: - - - @@ -88,6 +81,13 @@ + + + + Channel: + + + @@ -96,7 +96,7 @@ - + Type: @@ -113,7 +113,7 @@ - + ZIP drives: @@ -154,7 +154,7 @@ - + Bus: @@ -168,7 +168,7 @@ - + Channel: From 35c77d798a72dd127d6ae270ce0d7f898572c4c4 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sat, 10 May 2025 02:39:31 -0400 Subject: [PATCH 19/22] Move FDC before HDC in settings->storagecontrollers --- src/qt/qt_settingsstoragecontrollers.cpp | 32 ++++++++--------- src/qt/qt_settingsstoragecontrollers.hpp | 6 ++-- src/qt/qt_settingsstoragecontrollers.ui | 46 ++++++++++++------------ 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/qt/qt_settingsstoragecontrollers.cpp b/src/qt/qt_settingsstoragecontrollers.cpp index 2af7bd080..b3d827fa2 100644 --- a/src/qt/qt_settingsstoragecontrollers.cpp +++ b/src/qt/qt_settingsstoragecontrollers.cpp @@ -56,8 +56,8 @@ SettingsStorageControllers::save() QComboBox *cbox = findChild(QString("comboBoxSCSI%1").arg(i + 1)); scsi_card_current[i] = cbox->currentData().toInt(); } - hdc_current[0] = ui->comboBoxHD->currentData().toInt(); fdc_current[0] = ui->comboBoxFD->currentData().toInt(); + hdc_current[0] = ui->comboBoxHD->currentData().toInt(); cdrom_interface_current = ui->comboBoxCDInterface->currentData().toInt(); ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0; ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0; @@ -237,15 +237,6 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId) ui->pushButtonConfigureLbaEnhancer->setEnabled(ui->checkBoxLbaEnhancer->isChecked()); } -void -SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index) -{ - if (index < 0) - return; - - ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0); -} - void SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index) { @@ -255,6 +246,15 @@ SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index) ui->pushButtonFD->setEnabled(hdc_has_config(ui->comboBoxFD->currentData().toInt()) > 0); } +void +SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index) +{ + if (index < 0) + return; + + ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0); +} + void SettingsStorageControllers::on_comboBoxCDInterface_currentIndexChanged(int index) { @@ -276,18 +276,18 @@ SettingsStorageControllers::on_checkBoxQuaternaryIDE_stateChanged(int arg1) ui->pushButtonQuaternaryIDE->setEnabled(arg1 == Qt::Checked); } -void -SettingsStorageControllers::on_pushButtonHD_clicked() -{ - DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD->currentData().toInt())); -} - void SettingsStorageControllers::on_pushButtonFD_clicked() { DeviceConfig::ConfigureDevice(fdc_card_getdevice(ui->comboBoxFD->currentData().toInt())); } +void +SettingsStorageControllers::on_pushButtonHD_clicked() +{ + DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD->currentData().toInt())); +} + void SettingsStorageControllers::on_pushButtonCDInterface_clicked() { diff --git a/src/qt/qt_settingsstoragecontrollers.hpp b/src/qt/qt_settingsstoragecontrollers.hpp index 6774bb504..7c1c56086 100644 --- a/src/qt/qt_settingsstoragecontrollers.hpp +++ b/src/qt/qt_settingsstoragecontrollers.hpp @@ -20,12 +20,12 @@ public slots: void onCurrentMachineChanged(int machineId); private slots: - void on_comboBoxHD_currentIndexChanged(int index); - void on_pushButtonHD_clicked(); - void on_comboBoxFD_currentIndexChanged(int index); void on_pushButtonFD_clicked(); + void on_comboBoxHD_currentIndexChanged(int index); + void on_pushButtonHD_clicked(); + void on_comboBoxCDInterface_currentIndexChanged(int index); void on_pushButtonCDInterface_clicked(); diff --git a/src/qt/qt_settingsstoragecontrollers.ui b/src/qt/qt_settingsstoragecontrollers.ui index 04a87c1d5..cd1bf9baf 100644 --- a/src/qt/qt_settingsstoragecontrollers.ui +++ b/src/qt/qt_settingsstoragecontrollers.ui @@ -29,13 +29,34 @@ + + + FD Controller: + + + + + + + 30 + + + + + + + Configure + + + + HD Controller: - + @@ -48,29 +69,8 @@ - - - - Configure - - - - - - - FD Controller: - - - - - - - 30 - - - - + Configure From b71e3212366b371f8758aa1a05e5467fff1ae9ee Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Tue, 27 May 2025 22:03:11 -0400 Subject: [PATCH 20/22] Assorted cleaning --- src/cdrom/cdrom.c | 24 +- src/floppy/fdd.c | 2 +- src/include/86box/cdrom.h | 16 +- src/include/86box/cdrom_image.h | 2 +- src/include/86box/hdd.h | 4 +- src/include/86box/mo.h | 14 +- src/include/86box/zip.h | 16 +- src/qt/qt_glsl_parser.cpp | 16 +- src/video/vid_ega.c | 125 +++++------ src/video/vid_ps55da2.c | 377 ++++++++++++++++---------------- src/video/video.c | 4 +- 11 files changed, 292 insertions(+), 308 deletions(-) diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index 44bf2811c..e0fa8b0b6 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -979,28 +979,28 @@ cdrom_toc_dump(cdrom_t *dev) uint8_t b[65536] = { 0 }; int len = cdrom_read_toc(dev, b, CD_TOC_RAW, 0, 0, 65536); const char *fn2 = "d:\\86boxnew\\toc_cue.dmp"; - FILE * f = fopen(fn2, "wb"); - fwrite(b, 1, len, f); - fflush(f); - fclose(f); + FILE * fp = fopen(fn2, "wb"); + fwrite(b, 1, len, fp); + fflush(fp); + fclose(fp); cdrom_log(dev->log, "Written TOC of %i bytes to %s\n", len, fn2); memset(b, 0x00, 65536); len = cdrom_read_toc(dev, b, CD_TOC_NORMAL, 0, 0, 65536); fn2 = "d:\\86boxnew\\toc_cue_cooked.dmp"; - f = fopen(fn2, "wb"); - fwrite(b, 1, len, f); - fflush(f); - fclose(f); + fp = fopen(fn2, "wb"); + fwrite(b, 1, len, fp); + fflush(fp); + fclose(fp); cdrom_log(dev->log, "Written cooked TOC of %i bytes to %s\n", len, fn2); memset(b, 0x00, 65536); len = cdrom_read_toc(dev, b, CD_TOC_SESSION, 0, 0, 65536); fn2 = "d:\\86boxnew\\toc_cue_session.dmp"; - f = fopen(fn2, "wb"); - fwrite(b, 1, len, f); - fflush(f); - fclose(f); + fp = fopen(fn2, "wb"); + fwrite(b, 1, len, fp); + fflush(fp); + fclose(fp); cdrom_log(dev->log, "Written session TOC of %i bytes to %s\n", len, fn2); } #endif diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index d3d513b9f..31811069f 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -467,7 +467,7 @@ fdd_load(int drive, char *fn) int c = 0; int size; const char *p; - FILE * fp; + FILE *fp; fdd_log("FDD: loading drive %d with '%s'\n", drive, fn); diff --git a/src/include/86box/cdrom.h b/src/include/86box/cdrom.h index 5ff4170a2..a962a8635 100644 --- a/src/include/86box/cdrom.h +++ b/src/include/86box/cdrom.h @@ -106,10 +106,10 @@ enum { #define CDV EMU_VERSION_EX static const struct cdrom_drive_types_s { - const char * vendor; - const char * model; - const char * revision; - const char * internal_name; + const char *vendor; + const char *model; + const char *revision; + const char *internal_name; const int bus_type; /* SCSI standard for SCSI (or both) devices, early for IDE. */ const int scsi_std; @@ -296,7 +296,7 @@ typedef struct cdrom { uint8_t speed; uint8_t cur_speed; - void * priv; + void *priv; char image_path[1024]; char prev_image_path[1280]; @@ -322,10 +322,10 @@ typedef struct cdrom { const cdrom_ops_t *ops; - char * image_history[CD_IMAGE_HISTORY]; + char *image_history[CD_IMAGE_HISTORY]; - void * local; - void * log; + void *local; + void *log; void (*insert)(void *priv); void (*close)(void *priv); diff --git a/src/include/86box/cdrom_image.h b/src/include/86box/cdrom_image.h index 84dd66f37..e0760ff7e 100644 --- a/src/include/86box/cdrom_image.h +++ b/src/include/86box/cdrom_image.h @@ -33,6 +33,6 @@ typedef struct track_file_t { int motorola; } track_file_t; -extern void * image_open(cdrom_t *dev, const char *path); +extern void *image_open(cdrom_t *dev, const char *path); #endif /*CDROM_IMAGE_H*/ diff --git a/src/include/86box/hdd.h b/src/include/86box/hdd.h index eda4396ef..53514740d 100644 --- a/src/include/86box/hdd.h +++ b/src/include/86box/hdd.h @@ -159,7 +159,7 @@ typedef struct hard_disk_t { uint8_t pad; uint8_t pad0; - void * priv; + void *priv; char fn[1024]; /* Name of current image file */ /* Differential VHD parent file */ @@ -185,7 +185,7 @@ typedef struct hard_disk_t { uint8_t max_multiple_block; uint8_t pad1[3]; - const char * model; + const char *model; hdd_zone_t zones[HDD_MAX_ZONES]; diff --git a/src/include/86box/mo.h b/src/include/86box/mo.h index f4e7e9809..fc297ffbb 100644 --- a/src/include/86box/mo.h +++ b/src/include/86box/mo.h @@ -110,13 +110,13 @@ typedef struct mo_drive_t { uint8_t pad; uint8_t pad0; - FILE * fp; - void * priv; + FILE *fp; + void *priv; char image_path[1024]; char prev_image_path[1024]; - char * image_history[MO_IMAGE_HISTORY]; + char *image_history[MO_IMAGE_HISTORY]; uint32_t type; uint32_t medium_size; @@ -129,16 +129,16 @@ typedef struct mo_drive_t { typedef struct mo_t { mode_sense_pages_t ms_pages_saved; - mo_drive_t * drv; + mo_drive_t *drv; #ifdef EMU_IDE_H - ide_tf_t * tf; + ide_tf_t *tf; #else - void * tf; + void *tf; #endif void * log; - uint8_t * buffer; + uint8_t *buffer; uint8_t atapi_cdb[16]; uint8_t current_cdb[16]; uint8_t sense[256]; diff --git a/src/include/86box/zip.h b/src/include/86box/zip.h index 443ab1327..969ce27f5 100644 --- a/src/include/86box/zip.h +++ b/src/include/86box/zip.h @@ -58,13 +58,13 @@ typedef struct zip_drive_t { uint8_t pad; uint8_t pad0; - FILE * fp; - void * priv; + FILE *fp; + void *priv; char image_path[1024]; char prev_image_path[1024]; - char * image_history[ZIP_IMAGE_HISTORY]; + char *image_history[ZIP_IMAGE_HISTORY]; uint32_t is_250; uint32_t medium_size; @@ -74,16 +74,16 @@ typedef struct zip_drive_t { typedef struct zip_t { mode_sense_pages_t ms_pages_saved; - zip_drive_t * drv; + zip_drive_t *drv; #ifdef EMU_IDE_H - ide_tf_t * tf; + ide_tf_t *tf; #else - void * tf; + void *tf; #endif - void * log; + void *log; - uint8_t * buffer; + uint8_t *buffer; uint8_t atapi_cdb[16]; uint8_t current_cdb[16]; uint8_t sense[256]; diff --git a/src/qt/qt_glsl_parser.cpp b/src/qt/qt_glsl_parser.cpp index 6e107bc19..599a95452 100644 --- a/src/qt/qt_glsl_parser.cpp +++ b/src/qt/qt_glsl_parser.cpp @@ -104,22 +104,22 @@ glsl_detect_bom(const char *fn) static char *load_file(const char *fn) { int bom = glsl_detect_bom(fn); - FILE *f = plat_fopen(fn, "rb"); - if (!f) + FILE *fp = plat_fopen(fn, "rb"); + if (!fp) return 0; - fseek(f, 0, SEEK_END); - long fsize = ftell(f); - fseek(f, 0, SEEK_SET); + fseek(fp, 0, SEEK_END); + long fsize = ftell(fp); + fseek(fp, 0, SEEK_SET); if (bom) { fsize -= 3; - fseek(f, 3, SEEK_SET); + fseek(fp, 3, SEEK_SET); } char *data = (char*)malloc(fsize + 1); - fread(data, fsize, 1, f); - fclose(f); + (void *) !fread(data, fsize, 1, fp); + fclose(fp); data[fsize] = 0; diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index b828239c0..1022bda88 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -47,7 +47,7 @@ void ega_doblit(int wx, int wy, ega_t *ega); static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 }; static uint8_t ega_rotate[8][256]; -static int active = 0; +static int active = 0; uint32_t pallook16[256]; uint32_t pallook64[256]; static int ega_type = EGA_TYPE_IBM; @@ -154,7 +154,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv) ega_recalctimings(ega); if ((type == EGA_TYPE_COMPAQ) && !(val & 0x02)) mem_mapping_disable(&ega->mapping); - else switch (ega->gdcreg[6] & 0xc) { + else switch (ega->gdcreg[6] & 0xc) { case 0x0: /*128k at A0000*/ mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000); break; @@ -225,7 +225,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv) case 6: if ((type == EGA_TYPE_COMPAQ) && !(ega->miscout & 0x02)) mem_mapping_disable(&ega->mapping); - else switch (val & 0xc) { + else switch (val & 0xc) { case 0x0: /*128k at A0000*/ mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000); break; @@ -289,7 +289,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv) if ((idx == 7) && (ega->crtc[0x11] & 0x80)) val = (ega->crtc[7] & ~0x10) | (val & 0x10); } - old = ega->crtc[idx]; + old = ega->crtc[idx]; ega->crtc[idx] = val; if (old != val) { if ((idx < 0xe) || (idx > 0x10)) { @@ -305,7 +305,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv) } break; - } default: + } + + default: break; } } @@ -313,7 +315,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv) uint8_t ega_in(uint16_t addr, void *priv) { - ega_t *ega = (ega_t *) priv; + ega_t *ega = (ega_t *) priv; uint8_t ret = 0xff; int type = ega_type; int atype = ega->actual_type; @@ -494,7 +496,7 @@ ega_in(uint16_t addr, void *priv) } break; case 0x7c6: - ret = 0xfd; /* EGA mode supported. */ + ret = 0xfd; /* EGA mode supported. */ break; case 0xbc6: /* 0000 = None; @@ -696,7 +698,7 @@ ega_recalctimings(ega_t *ega) timer_disable(&ega->dot_timer); timer_set_delay_u64(&ega->dot_timer, ega->dot_time); ega->cca = 0; - active = 1; + active = 1; ega->dot = 0; } @@ -708,30 +710,30 @@ ega_recalctimings(ega_t *ega) void ega_dot_poll(void *priv) { - ega_t *ega = (ega_t *) priv; - static uint8_t chr; - static uint8_t attr; - const bool doublewidth = ((ega->seqregs[1] & 8) != 0); - const bool attrblink = ((ega->attrregs[0x10] & 8) != 0); - const bool attrlinechars = (ega->attrregs[0x10] & 4); - const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0); - const bool seq9dot = ((ega->seqregs[1] & 1) == 0); - const bool blinked = ega->blink & 0x10; - const int dwshift = doublewidth ? 1 : 0; - const int dotwidth = 1 << dwshift; - const int charwidth = dotwidth * (seq9dot ? 9 : 8); - const int cursoron = (ega->sc == (ega->crtc[10] & 31)); - const int cursoraddr = (ega->crtc[0xe] << 8) | ega->crtc[0xf]; - uint32_t addr; - int drawcursor; - uint32_t charaddr; - static int fg = 0; - static int bg = 0; - static uint32_t dat = 0x00000000; - static int cclock = 0; - static int disptime; - static int _dispontime; - static int _dispofftime; + ega_t *ega = (ega_t *) priv; + static uint8_t chr; + static uint8_t attr; + const bool doublewidth = ((ega->seqregs[1] & 8) != 0); + const bool attrblink = ((ega->attrregs[0x10] & 8) != 0); + const bool attrlinechars = (ega->attrregs[0x10] & 4); + const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0); + const bool seq9dot = ((ega->seqregs[1] & 1) == 0); + const bool blinked = ega->blink & 0x10; + const int dwshift = doublewidth ? 1 : 0; + const int dotwidth = 1 << dwshift; + const int charwidth = dotwidth * (seq9dot ? 9 : 8); + const int cursoron = (ega->sc == (ega->crtc[10] & 31)); + const int cursoraddr = (ega->crtc[0xe] << 8) | ega->crtc[0xf]; + uint32_t addr; + int drawcursor; + uint32_t charaddr; + static int fg = 0; + static int bg = 0; + static uint32_t dat = 0x00000000; + static int cclock = 0; + static int disptime; + static int _dispontime; + static int _dispofftime; if (ega->seqregs[1] & 8) { disptime = ((ega->crtc[0] + 2) << 1); @@ -803,11 +805,9 @@ void ega_poll(void *priv) { ega_t *ega = (ega_t *) priv; - int x, y; int old_ma; int wx = 640; int wy = 350; - uint32_t blink_delay; if (!ega->linepos) { timer_advance_u64(&ega->timer, ega->dispofftime); @@ -826,7 +826,7 @@ ega_poll(void *priv) old_ma = ega->ma; ega->displine *= ega->vres + 1; ega->y_add *= ega->vres + 1; - for (y = 0; y <= ega->vres; y++) { + for (int y = 0; y <= ega->vres; y++) { /* Render scanline */ ega->render(ega); @@ -925,7 +925,7 @@ ega_poll(void *priv) } if (ega->vc == ega->dispend) { ega->dispon = 0; - blink_delay = (ega->crtc[11] & 0x60) >> 5; + uint32_t blink_delay = (ega->crtc[11] & 0x60) >> 5; if (ega->crtc[10] & 0x20) ega->cursoron = 0; else if (blink_delay == 2) @@ -946,14 +946,14 @@ ega_poll(void *priv) #if 0 picint(1 << 2); #endif - x = ega->hdisp; +// x = ega->hdisp; if (ega->interlace && !ega->oddeven) ega->lastline++; if (ega->interlace && ega->oddeven) ega->firstline--; - wx = x; + wx = ega->hdisp; if (ega->vres) { wy = (ega->lastline - ega->firstline) << 1; @@ -1024,9 +1024,6 @@ ega_doblit(int wx, int wy, ega_t *ega) int y_start = enable_overscan ? 0 : (unscaled_overscan_y >> 1); int x_start = enable_overscan ? 0 : (overscan_x >> 1); int bottom = (unscaled_overscan_y >> 1); - uint32_t *p; - int i; - int j; int xs_temp; int ys_temp; @@ -1073,17 +1070,17 @@ ega_doblit(int wx, int wy, ega_t *ega) if ((wx >= 160) && ((wy + 1) >= 120)) { /* Draw (overscan_size - scroll size) lines of overscan on top and bottom. */ - for (i = 0; i < ega->y_add; i++) { - p = &buffer32->line[i & 0x7ff][0]; + for (int i = 0; i < ega->y_add; i++) { + uint32_t *p = &buffer32->line[i & 0x7ff][0]; - for (j = 0; j < (xsize + x_add); j++) + for (int j = 0; j < (xsize + x_add); j++) p[j] = ega->overscan_color; } - for (i = 0; i < bottom; i++) { - p = &buffer32->line[(ysize + ega->y_add + i) & 0x7ff][0]; + for (int i = 0; i < bottom; i++) { + uint32_t *p = &buffer32->line[(ysize + ega->y_add + i) & 0x7ff][0]; - for (j = 0; j < (xsize + x_add); j++) + for (int j = 0; j < (xsize + x_add); j++) p[j] = ega->overscan_color; } } @@ -1107,12 +1104,11 @@ ega_remap_cpu_addr(uint32_t inaddr, ega_t *ega) // bit 2: 1 = 128K mapping, 0 = other mapping (from memory decode PROM) a0mux = 0; - if (ega->gdcreg[6] & 2) { + if (ega->gdcreg[6] & 2) a0mux |= 2; - } - if (ega->vram_limit <= 64 * 1024) { + + if (ega->vram_limit <= 64 * 1024) a0mux |= 1; - } switch (ega->gdcreg[6] & 0xC) { case 0x0: // 128K A000 @@ -1179,9 +1175,8 @@ ega_write(uint32_t addr, uint8_t val, void *priv) cycles -= video_timing_write_b; - if (ega->chain2_write) { + if (ega->chain2_write) writemask2 &= 0x5 << (addr & 1); - } addr = ega_remap_cpu_addr(addr, ega); @@ -1361,9 +1356,8 @@ ega_read(uint32_t addr, void *priv) cycles -= video_timing_read_b; - if (ega->chain2_read) { + if (ega->chain2_read) readplane = (readplane & 2) | (addr & 1); - } addr = ega_remap_cpu_addr(addr, ega); @@ -1401,23 +1395,19 @@ ega_read(uint32_t addr, void *priv) void ega_init(ega_t *ega, int monitor_type, int is_mono) { - int c; - int d; - int e; - ega->vram = malloc(0x40000); ega->vrammask = 0x3ffff; - for (c = 0; c < 256; c++) { - e = c; - for (d = 0; d < 8; d++) { + for (uint16_t c = 0; c < 256; c++) { + int e = c; + for (uint8_t d = 0; d < 8; d++) { ega_rotate[d][c] = e; e = (e >> 1) | ((e & 1) ? 0x80 : 0); } } if (is_mono) { - for (c = 0; c < 256; c++) { + for (uint16_t c = 0; c < 256; c++) { if (((c >> 3) & 3) == 0) pallook64[c] = pallook16[c] = makecol32(0, 0, 0); else @@ -1476,7 +1466,7 @@ ega_init(ega_t *ega, int monitor_type, int is_mono) io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); } else { - for (c = 0; c < 256; c++) { + for (uint16_t c = 0; c < 256; c++) { pallook64[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa); pallook64[c] += makecol32(((c >> 5) & 1) * 0x55, ((c >> 4) & 1) * 0x55, ((c >> 3) & 1) * 0x55); pallook16[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa); @@ -1562,11 +1552,9 @@ ega_set_type(void *priv, uint32_t local) static void * ega_standalone_init(const device_t *info) { - ega_t *ega = malloc(sizeof(ega_t)); + ega_t *ega = calloc(1, sizeof(ega_t)); int monitor_type; - memset(ega, 0x00, sizeof(ega_t)); - video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_ega); overscan_x = 16; @@ -1635,8 +1623,7 @@ ega_standalone_init(const device_t *info) if (ega->chipset) { io_sethandler(0x01ce, 0x0002, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); - ega->eeprom = malloc(sizeof(ati_eeprom_t)); - memset(ega->eeprom, 0, sizeof(ati_eeprom_t)); + ega->eeprom = calloc(1, sizeof(ati_eeprom_t)); ati_eeprom_load((ati_eeprom_t *) ega->eeprom, "egawonder800p.nvr", 0); } else if (info->local == EGA_COMPAQ) { io_sethandler(0x0084, 0x0001, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); diff --git a/src/video/vid_ps55da2.c b/src/video/vid_ps55da2.c index 9a95e6ce6..567d60347 100644 --- a/src/video/vid_ps55da2.c +++ b/src/video/vid_ps55da2.c @@ -310,16 +310,16 @@ typedef struct da2_t { uint8_t fctl[32]; uint16_t crtc[32]; uint16_t crtc_vpreg[128]; - uint8_t crtc_vpsel; + uint8_t crtc_vpsel; uint8_t gdcreg[64]; uint8_t reg3ee[16]; int gdcaddr; uint8_t attrc[0x40]; int attraddr, attrff; int attr_palette_enable; - int outflipflop; - int inflipflop; - int iolatch; + int outflipflop; + int inflipflop; + int iolatch; int ioctladdr; int fctladdr; @@ -385,8 +385,7 @@ typedef struct da2_t { card should not attempt to display anything */ int override; - struct - { + struct { int enable; mem_mapping_t mapping; uint8_t ram[DA2_SIZE_GAIJIRAM]; @@ -435,9 +434,9 @@ typedef struct da2_t { uint32_t mmrdbg_vidaddr; #endif - uint8_t pos_regs[8]; - svga_t *mb_vga; - uint8_t monitorid; + uint8_t pos_regs[8]; + svga_t *mb_vga; + uint8_t monitorid; pc_timer_t timer_vidupd; int old_pos2; @@ -520,7 +519,7 @@ da2_WritePlaneDataWithBitmask(uint32_t destaddr, const uint16_t mask, pixel32 *s da2->changedvram[(DA2_MASK_VRAMPLANE & destaddr) >> 9] = changeframecount; destaddr <<= 3; /* read destination data with big endian order */ - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) writepx[i] = da2_vram_r((destaddr + 24) | i, da2) | (da2_vram_r((destaddr + 16) | i, da2) << 8) | (da2_vram_r((destaddr + 8) | i, da2) << 16) @@ -532,7 +531,7 @@ da2_WritePlaneDataWithBitmask(uint32_t destaddr, const uint16_t mask, pixel32 *s mask32.b[3] = mask32in.b[0]; mask32.b[2] = mask32in.b[1]; mask32.d &= 0xffff0000; - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { if (da2->bitblt.bitshift_destr > 0) srcpx->p8[i] <<= 16 - da2->bitblt.bitshift_destr; // #ifdef ENABLE_DA2_DEBUGBLT @@ -560,7 +559,7 @@ da2_WritePlaneDataWithBitmask(uint32_t destaddr, const uint16_t mask, pixel32 *s break; } } - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { da2_vram_w(destaddr | i, (writepx[i] >> 24) & 0xff, da2); da2_vram_w((destaddr + 8) | i, (writepx[i] >> 16) & 0xff, da2); } @@ -571,7 +570,7 @@ da2_DrawColorWithBitmask(uint32_t destaddr, uint8_t color, uint16_t mask, da2_t { pixel32 srcpx; /* fill data with input color */ - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) srcpx.p8[i] = (color & (1 << i)) ? 0xffffffff : 0; /* read in word */ da2_WritePlaneDataWithBitmask(destaddr, mask, &srcpx, da2); @@ -582,7 +581,7 @@ da2_CopyPlaneDataWithBitmask(uint32_t srcaddr, uint32_t destaddr, uint16_t mask, pixel32 srcpx; srcaddr &= 0xfffffffe; srcaddr <<= 3; - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) srcpx.p8[i] = da2_vram_r((srcaddr + 24) | i, da2) | (da2_vram_r((srcaddr + 16) | i, da2) << 8) | (da2_vram_r((srcaddr + 8) | i, da2) << 16) @@ -592,9 +591,9 @@ da2_CopyPlaneDataWithBitmask(uint32_t srcaddr, uint32_t destaddr, uint16_t mask, } /* get font data for bitblt operation */ static uint32_t -getRAMFont(int32_t code, int line, int x, void *p) +getRAMFont(int32_t code, int line, int x, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; uint32_t font = 0; #ifdef RESERVED_FOR_FUTURE_USE int fline = line - 2; /* Start line of drawing character (line >= 1 AND line < 24 + 1 ) */ @@ -617,8 +616,7 @@ getRAMFont(int32_t code, int line, int x, void *p) font |= da2->mmio.ram[code + 2]; font <<= 8; font |= da2->mmio.ram[code + 3]; - } - else + } else font = 0; return font; } @@ -641,12 +639,12 @@ da2_PutcharWithBitmask(uint32_t codeIBMJ, int width, uint16_t attr, int line, ui uint32_t fontinv; if (width <= 2) { fontinv = ~font; - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { srcpx.p8[i] = (fg & (1 << i)) ? font >> 16 : 0; srcpx.p8[i] |= (bg & (1 << i)) ? fontinv >> 16 : 0; } da2_WritePlaneDataWithBitmask(destaddr, maskl, &srcpx, da2); - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { srcpx.p8[i] = (fg & (1 << i)) ? font : 0; srcpx.p8[i] |= (bg & (1 << i)) ? fontinv : 0; } @@ -654,12 +652,12 @@ da2_PutcharWithBitmask(uint32_t codeIBMJ, int width, uint16_t attr, int line, ui } else { font = (font & 0xfff80000) | ((font & 0x0000ffff) << 3); fontinv = ~font; - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { srcpx.p8[i] = (fg & (1 << i)) ? font >> 16 : 0; srcpx.p8[i] |= (bg & (1 << i)) ? fontinv >> 16 : 0; } da2_WritePlaneDataWithBitmask(destaddr, maskl, &srcpx, da2); - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { srcpx.p8[i] = (fg & (1 << i)) ? font : 0; srcpx.p8[i] |= (bg & (1 << i)) ? fontinv : 0; } @@ -667,7 +665,7 @@ da2_PutcharWithBitmask(uint32_t codeIBMJ, int width, uint16_t attr, int line, ui da2_WritePlaneDataWithBitmask(destaddr + 2, maskr, &srcpx, da2); } else { da2_WritePlaneDataWithBitmask(destaddr + 2, 0xffff, &srcpx, da2); - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { srcpx.p8[i] = (fg & (1 << i)) ? font << 16 : 0; srcpx.p8[i] |= (bg & (1 << i)) ? fontinv << 16 : 0; } @@ -680,8 +678,8 @@ static uint8_t pixel1tohex(uint32_t addr, int index, da2_t *da2) { uint8_t pixeldata = 0; - for (int j = 0; j < 8; j++) { - if (da2_vram_r(((addr << 3) | j) & (1 << (7 - index)), da2)) + for (uint8_t i = 0; i < 8; j++) { + if (da2_vram_r(((addr << 3) | i) & (1 << (7 - index)), da2)) pixeldata++; } return pixeldata; @@ -689,14 +687,14 @@ pixel1tohex(uint32_t addr, int index, da2_t *da2) static void print_pixelbyte(uint32_t addr, da2_t *da2) { - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { pclog("%X", pixel1tohex(addr, i, da2)); } } static void print_bytetobin(uint8_t b) { - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { if (b & 0x80) pclog("1"); else @@ -723,13 +721,13 @@ IBMJtoSJIS(uint16_t knj) knj -= 0x100; if (knj <= 0x1f7d) ; /* do nothing */ - else if (knj >= 0xb700 && knj <= 0xb75f) { + else if (knj >= 0xb700 && knj <= 0xb75f) knj -= 0x90ec; - } else if (knj >= 0xb3f0 && knj <= 0xb67f) { + else if (knj >= 0xb3f0 && knj <= 0xb67f) knj -= 0x906c; - } else if (knj >= 0x8000 && knj <= 0x8183) { + else if (knj >= 0x8000 && knj <= 0x8183) knj -= 0x5524; - } else + else return 0xffff; uint32_t knj1 = knj / 0xBC; uint32_t knj2 = knj - (knj1 * 0xBC); @@ -850,8 +848,7 @@ da2_bitblt_load(da2_t *da2) DOS/V Extension 1040x725 some DBCS uses 0xB0 others 0x90 */ da2->bitblt.destoption = da2->bitblt.reg[0x2F]; - if (da2->bitblt.destoption & 0x10) /* destaddr -= 2, length += 1; */ - { + if (da2->bitblt.destoption & 0x10) { /* destaddr -= 2, length += 1; */ da2->bitblt.destaddr -= 2; da2->bitblt.size_x += 1; da2->bitblt.destpitch -= 2; @@ -892,9 +889,9 @@ da2_bitblt_load(da2_t *da2) da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2), da2->bitblt.size_x, da2->bitblt.size_y); #endif - } + /* Draw a line */ - else if (da2->bitblt.reg[0x5] == 0x43) { + } else if (da2->bitblt.reg[0x5] == 0x43) { da2->bitblt.exec = DA2_BLT_CLINE; da2->bitblt.dest_x = (da2->bitblt.reg[0x32] & 0xffff); da2->bitblt.dest_y = (da2->bitblt.reg[0x34] & 0xffff); @@ -922,17 +919,17 @@ da2_bitblt_load(da2_t *da2) da2_log(" ux1=%d,ux2=%d,uy1=%d,uy2=%d\n", (da2->bitblt.reg[0x32] >> 16) & 0x7ff, (da2->bitblt.reg[0x33] >> 16) & 0x7ff, (da2->bitblt.reg[0x34] >> 16) & 0x7ff, (da2->bitblt.reg[0x35] >> 16) & 0x7ff); - } + /* Fill a rectangle (or draw a horizontal / vertical line) */ - else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x40 && da2->bitblt.reg[0x3D] == 0) { + } else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x40 && da2->bitblt.reg[0x3D] == 0) { da2_log("fillrect x=%d, y=%d, w=%d, h=%d, c=%d, 2f=%x, rowcount=%x\n", da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2), da2->bitblt.size_x, da2->bitblt.size_y, da2->bitblt.reg[0x0], da2->bitblt.reg[0x2F], da2->rowoffset * 2); da2->bitblt.exec = DA2_BLT_CFILLRECT; da2->bitblt.destaddr += 2; - } + /* Tiling a rectangle ??(transfer tile data multiple times) os/2 only */ - else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x0040 && da2->bitblt.reg[0x3D] == 0x40) { + } else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x0040 && da2->bitblt.reg[0x3D] == 0x40) { da2->bitblt.exec = DA2_BLT_CFILLTILE; da2->bitblt.destaddr += 2; da2->bitblt.srcaddr = da2->bitblt.reg[0x2B]; @@ -942,9 +939,9 @@ da2_bitblt_load(da2_t *da2) da2->bitblt.reg[0x2B] % (da2->rowoffset * 2), da2->bitblt.reg[0x2B] / (da2->rowoffset * 2), da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2), da2->bitblt.size_x, da2->bitblt.size_y); - } + /* Tiling a rectangle (transfer tile data multiple times) */ - else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1040 && da2->bitblt.reg[0x3D] == 0x40) { + } else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1040 && da2->bitblt.reg[0x3D] == 0x40) { da2->bitblt.exec = DA2_BLT_CFILLTILE; da2->bitblt.destaddr += 2; da2->bitblt.srcaddr = da2->bitblt.reg[0x2B]; @@ -954,9 +951,9 @@ da2_bitblt_load(da2_t *da2) da2->bitblt.reg[0x2B] % (da2->rowoffset * 2), da2->bitblt.reg[0x2B] / (da2->rowoffset * 2), da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2), da2->bitblt.size_x, da2->bitblt.size_y); - } + /* Block copy */ - else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1040 && da2->bitblt.reg[0x3D] == 0x00) { + } else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1040 && da2->bitblt.reg[0x3D] == 0x00) { da2->bitblt.exec = DA2_BLT_CCOPYF; da2->bitblt.srcaddr = da2->bitblt.reg[0x2A]; da2->bitblt.destaddr += 2; @@ -965,9 +962,9 @@ da2_bitblt_load(da2_t *da2) da2->bitblt.reg[0x2A] % (da2->rowoffset * 2), da2->bitblt.reg[0x2A] / (da2->rowoffset * 2), da2->bitblt.reg[0x29] % (da2->rowoffset * 2), da2->bitblt.reg[0x29] / (da2->rowoffset * 2), da2->bitblt.size_x, da2->bitblt.size_y); - } + /* Block copy but reversed direction */ - else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1140 && da2->bitblt.reg[0x3D] == 0x00) { + } else if ((da2->bitblt.reg[0x5] & 0xfff0) == 0x1140 && da2->bitblt.reg[0x3D] == 0x00) { da2->bitblt.exec = DA2_BLT_CCOPYR; da2->bitblt.srcaddr = da2->bitblt.reg[0x2A]; da2->bitblt.destaddr -= 2; @@ -980,9 +977,9 @@ da2_bitblt_load(da2_t *da2) } } static void -da2_bitblt_exec(void *p) +da2_bitblt_exec(void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; // timer_set_delay_u64(&da2->bitblt.timer, da2->bitblt.timerspeed); #ifdef ENABLE_DA2_DEBUGBLT_DETAIL if (!(da2->bitblt.debug_exesteps & 0xff)) @@ -1180,9 +1177,9 @@ da2_bitblt_dopayload(void *priv) } } static void -da2_bitblt_addpayload(uint8_t val, void *p) +da2_bitblt_addpayload(uint8_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2->bitblt.indata = 1; if (da2->bitblt.payload_addr >= DA2_BLT_MEMSIZE) da2_log("da2_mmio_write payload overflow! addr %x, val %x\n", da2->bitblt.payload_addr, val); @@ -1222,9 +1219,9 @@ da2_bitblt_addpayload(uint8_t val, void *p) } static void -da2_out(uint16_t addr, uint16_t val, void *p) +da2_out(uint16_t addr, uint16_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; int oldval; /* 3E0 3E1 Sequencer Registers (undoc) @@ -1403,7 +1400,7 @@ da2_out(uint16_t addr, uint16_t val, void *p) if (da2->attraddr < 16) da2->fullchange = changeframecount; if (da2->attraddr == LV_MODE_CONTROL || da2->attraddr < 0x10) { - for (int c = 0; c < 16; c++) { + for (uint8_t c = 0; c < 16; c++) { // if (da2->attrc[LV_MODE_CONTROL] & 0x80) da2->egapal[c] = (da2->attrc[c] & 0xf) | ((da2->attrc[0x14] & 0xf) << 4); // else da2->egapal[c] = (da2->attrc[c] & 0x3f) | ((da2->attrc[0x14] & 0xc) << 4); if (da2->attrc[LV_MODE_CONTROL] & 0x80) @@ -1486,9 +1483,9 @@ da2_out(uint16_t addr, uint16_t val, void *p) } static uint16_t -da2_in(uint16_t addr, void *p) +da2_in(uint16_t addr, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; uint16_t temp = 0xff; switch (addr) { @@ -1620,9 +1617,9 @@ da2_in(uint16_t addr, void *p) * out b(idx), in w(data) */ static void -da2_outb(uint16_t addr, uint8_t val, void *p) +da2_outb(uint16_t addr, uint8_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2_iolog("DA2 Outb addr %03X val %02X %04X:%04X es:di=%x:%x ds:si=%x:%x\n", addr, val, cs >> 4, cpu_state.pc, ES, DI, DS, SI); da2->inflipflop = 0; switch (addr) { @@ -1651,10 +1648,10 @@ da2_outb(uint16_t addr, uint8_t val, void *p) da2_out(addr, da2->iolatch, da2); } void -da2_outw(uint16_t addr, uint16_t val, void *p) +da2_outw(uint16_t addr, uint16_t val, void *priv) { da2_iolog("DA2 Outw addr %03X val %04X\n", addr, val); - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2->inflipflop = 0; switch (addr) { case LS_INDEX: @@ -1703,10 +1700,10 @@ da2_outw(uint16_t addr, uint16_t val, void *p) } } static uint8_t -da2_inb(uint16_t addr, void *p) +da2_inb(uint16_t addr, void *priv) { uint8_t temp; - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2->outflipflop = 0; switch (addr) { case LC_DATA: @@ -1736,10 +1733,10 @@ da2_inb(uint16_t addr, void *p) return temp; } static uint16_t -da2_inw(uint16_t addr, void *p) +da2_inw(uint16_t addr, void *priv) { uint16_t temp; - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2->inflipflop = 0; da2->outflipflop = 0; temp = da2_in(addr, da2); @@ -1748,9 +1745,9 @@ da2_inw(uint16_t addr, void *p) } /* IO 03DAh : Input Status Register 2 for DOSSHELL used by DOS J4.0 */ static uint8_t -da2_in_ISR(uint16_t addr, void *p) +da2_in_ISR(uint16_t addr, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; uint8_t temp = 0; if (addr == 0x3da) { if (da2->cgastat & 0x01) @@ -1764,9 +1761,9 @@ da2_in_ISR(uint16_t addr, void *p) } static void -da2_out_ISR(uint16_t addr, uint8_t val, void *p) +da2_out_ISR(uint16_t addr, uint8_t val, void *priv) { - // da2_t* da2 = (da2_t*)p; + // da2_t* da2 = (da2_t*) priv; da2_iolog("DA2D Out %04X %04X %04X:%04X\n", addr, val, cs >> 4, cpu_state.pc); } @@ -1872,9 +1869,9 @@ The Font ROM can be accessed via 128 KB memory window located at A0000-BFFFFh. /* Get character line pattern from jfont rom or gaiji volatile memory */ static uint32_t -getfont_ps55dbcs(int32_t code, int32_t line, void *p) +getfont_ps55dbcs(int32_t code, int32_t line, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; uint32_t font = 0; int32_t fline = line - 2; /* Start line of drawing character (line >= 1 AND line < 24 + 1 ) */ if (code >= 0x8000 && code <= 0x8183) @@ -2424,7 +2421,7 @@ da2_mapping_update(da2_t *da2) // da2_recalc_mapping(da2); if (da2->pos_regs[2] & 0x01) { da2_log("DA2 enable registers\n"); - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2_log("DA2 POS[%d]: %x\n", i, da2->pos_regs[i]); io_sethandler(0x03c0, 0x000a, da2_inb, da2_inw, NULL, da2_outb, da2_outw, NULL, da2); io_sethandler(0x03e0, 0x0010, da2_inb, da2_inw, NULL, da2_outb, da2_outw, NULL, da2); @@ -2444,16 +2441,16 @@ da2_mapping_update(da2_t *da2) } static uint8_t -da2_mca_read(int port, void *p) +da2_mca_read(int port, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; return da2->pos_regs[port & 7]; } static void -da2_mca_write(int port, uint8_t val, void *p) +da2_mca_write(int port, uint8_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2_log("da2_mca_write: port=%04x val=%02x\n", port, val); @@ -2473,9 +2470,9 @@ da2_mca_feedb(void *priv) } static void -da2_mca_reset(void *p) +da2_mca_reset(void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2_log("da2_mca_reset called.\n"); da2_reset(da2); da2_mca_write(0x102, 0, da2); @@ -2485,7 +2482,7 @@ da2_mca_reset(void *p) static void da2_gdcropB(uint32_t addr,uint8_t bitmask, da2_t *da2) { - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { if (da2->planemask & (1 << i)) { // da2_log("da2_gdcropB o%x a%x d%x p%d m%x\n", da2->gdcreg[LG_COMMAND] & 0x03, addr, da2->gdcinput[i], i, bitmask); switch (da2->gdcreg[LG_COMMAND] & 0x03) { @@ -2518,7 +2515,7 @@ da2_gdcropW(uint32_t addr, uint16_t bitmask, da2_t *da2) // if((addr & 8)) bitmask = da2_rightrotate(bitmask, 8); uint8_t bitmask_l = bitmask & 0xff; uint8_t bitmask_h = bitmask >> 8; - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { if (da2->planemask & (1 << i)) { // da2_log("da2_gdcropW m%x a%x d%x i%d ml%x mh%x\n", da2->gdcreg[LG_COMMAND] & 0x03, addr, da2->gdcinput[i], i, da2->gdcreg[LG_BIT_MASK_LOW], da2->gdcreg[LG_BIT_MASK_HIGH]); switch (da2->gdcreg[LG_COMMAND] & 0x03) { @@ -2556,9 +2553,9 @@ da2_gdcropW(uint32_t addr, uint16_t bitmask, da2_t *da2) } static uint8_t -da2_mmio_read(uint32_t addr, void *p) +da2_mmio_read(uint32_t addr, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; uint32_t index = 0; addr &= DA2_MASK_MMIO; if (da2->ioctl[LS_MMIO] & 0x10) { @@ -2604,14 +2601,14 @@ da2_mmio_read(uint32_t addr, void *p) } } else if (!(da2->ioctl[LS_MODE] & 1)) { /* 16 or 256 color mode */ cycles -= video_timing_read_b; - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2->gdcla[i] = da2->vram[(addr << 3) | i]; /* read in byte */ #ifdef ENABLE_DA2_DEBUGVRAM da2_log("da2_Rb: %05x=%02x\n", addr, da2->gdcla[da2->readplane]); #endif if (da2->gdcreg[LG_MODE] & 0x08) { /* compare data across planes if the read mode bit (3EB 05, bit 3) is 1 */ uint8_t ret = 0; - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { if (~da2->gdcreg[LG_COLOR_DONT_CARE] & (1 << i)) /* color don't care register */ ret |= da2->gdcla[i] ^ ((da2->gdcreg[LG_COLOR_COMPAREJ] & (1 << i)) ? 0xff : 0); } @@ -2624,9 +2621,9 @@ da2_mmio_read(uint32_t addr, void *p) } } static uint16_t -da2_mmio_readw(uint32_t addr, void *p) +da2_mmio_readw(uint32_t addr, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; // da2_log("da2_readW: %x %x %x %x %x\n", da2->ioctl[LS_MMIO], da2->fctl[LF_MMIO_SEL], da2->fctl[LF_MMIO_MODE], da2->fctl[LF_MMIO_ADDR], addr); // da2_log("da2_readW: %x %x %x %x %x CS:PC=%4x:%4x\n", da2->ioctl[LS_MMIO], da2->fctl[LF_MMIO_SEL], da2->fctl[LF_MMIO_MODE], da2->fctl[LF_MMIO_ADDR], addr, CS, cpu_state.pc); @@ -2635,7 +2632,7 @@ da2_mmio_readw(uint32_t addr, void *p) } else if (!(da2->ioctl[LS_MODE] & 1)) {/* 16 color or 256 color mode */ cycles -= video_timing_read_w; addr &= DA2_MASK_MMIO; - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2->gdcla[i] = (uint16_t) (da2->vram[(addr << 3) | i]) | ((uint16_t) (da2->vram[((addr << 3) + 8) | i]) << 8); /* read vram into latch */ #ifdef ENABLE_DA2_DEBUGVRAM @@ -2643,10 +2640,10 @@ da2_mmio_readw(uint32_t addr, void *p) // if (((int)addr - (int)da2->mmrdbg_vidaddr) > 2 || (((int)da2->mmrdbg_vidaddr - (int)addr) > 2) || da2->mmrdbg_vidaddr == addr) //{ // fprintf(da2->mmrdbg_fp, "\nR %x ", addr); - // for (int i = 0; i <= 0xb; i++) + // for (uint8_t i = 0; i <= 0xb; i++) // fprintf(da2->mmrdbg_fp, "%02x ", da2->gdcreg[i]); // } - // for (int i = 0; i < 16; i++) + // for (uint8_t i = 0; i < 16; i++) //{ // int pixeldata = 0; // if (da2->gdcla[da2->readplane] & (1 << (15 - i))) pixeldata = 1; @@ -2658,7 +2655,7 @@ da2_mmio_readw(uint32_t addr, void *p) if (da2->gdcreg[LG_MODE] & 0x08) { /* compare data across planes if the read mode bit (3EB 05, bit 3) is 1 */ uint16_t ret = 0; - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { if (~da2->gdcreg[LG_COLOR_DONT_CARE] & (1 << i)) /* color don't care register */ ret |= da2->gdcla[i] ^ ((da2->gdcreg[LG_COLOR_COMPAREJ] & (1 << i)) ? 0xffff : 0); } @@ -2674,9 +2671,9 @@ da2_mmio_readw(uint32_t addr, void *p) } } static void -da2_mmio_write(uint32_t addr, uint8_t val, void *p) +da2_mmio_write(uint32_t addr, uint8_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; uint32_t index = 0; // da2_log("da2_mmio_write %x %x\n", addr, val); // if ((addr & ~DA2_MASK_MMIO) != 0xA0000) @@ -2735,10 +2732,10 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p) //{ if (((int) addr - (int) da2->mmdbg_vidaddr) > 2 || (((int) da2->mmdbg_vidaddr - (int) addr) > 2) || da2->mmdbg_vidaddr == addr) { fprintf(da2->mmdbg_fp, "\nB %x %02x ", addr, val); - for (int i = 0; i <= 0xb; i++) + for (uint8_t i = 0; i <= 0xb; i++) fprintf(da2->mmdbg_fp, "%02x ", da2->gdcreg[i]); } - for (int i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 8; i++) { int pixeldata = 0; if (val & (1 << (7 - i))) pixeldata = (da2->planemask & 0xf); @@ -2751,14 +2748,14 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p) da2->changedvram[addr >> 9] = changeframecount;/* 0x1FFFF -> 0x1F */ addr <<= 3; - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2->gdcsrc[i] = da2->gdcla[i]; /* use latch */ // da2_log("da2_Wb m%02x r%02x %05x:%02x %x:%x\n", da2->gdcreg[0x5], da2->gdcreg[LG_COMMAND], addr >> 3, val, cs >> 4, cpu_state.pc); // da2_log("da2_Wb m%02x r%02x %05x:%02x=%02x%02x%02x%02x->", da2->gdcreg[0x5], da2->gdcreg[LG_COMMAND], addr >> 3, val, da2->vram[addr + 0], da2->vram[addr + 1], da2->vram[addr + 2], da2->vram[addr + 3]); if (!(da2->gdcreg[LG_COMMAND] & 0x08)) { - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i)) da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0; else if (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) @@ -2771,7 +2768,7 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p) switch (da2->writemode) { case 2: /* equiv to vga write mode 1 */ - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) if (da2->planemask & (1 << i)) da2_vram_w(addr | i, da2->gdcsrc[i], da2); break; @@ -2779,11 +2776,11 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p) if (da2->gdcreg[LG_DATA_ROTATION] & 7) val = svga_rotate[da2->gdcreg[LG_DATA_ROTATION] & 7][val]; if (bitmask == 0xff && !(da2->gdcreg[LG_COMMAND] & 0x03) && (!da2->gdcreg[LG_ENABLE_SRJ])) { - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) if (da2->planemask & (1 << i)) da2_vram_w(addr | i, val, da2); } else { - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i)) da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0; else @@ -2792,7 +2789,7 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p) } break; case 1:/* equiv to vga write mode 2 */ - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2->gdcinput[i] = ((val & (1 << i)) ? 0xff : 0); da2_gdcropB(addr, bitmask, da2); break; @@ -2801,7 +2798,7 @@ da2_mmio_write(uint32_t addr, uint8_t val, void *p) val = svga_rotate[da2->gdcreg[LG_DATA_ROTATION] & 7][val]; bitmask &= val; - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xff : 0; da2_gdcropB(addr, bitmask, da2); break; @@ -2818,9 +2815,9 @@ da2_rightrotate(uint16_t data, uint8_t count) return (data >> count) | (data << (sizeof(data) * 8 - count)); } static void -da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p) +da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; uint16_t bitmask; addr &= DA2_MASK_MMIO; bitmask = da2->gdcreg[LG_BIT_MASK_HIGH]; @@ -2832,10 +2829,10 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p) if (((int) addr - (int) da2->mmdbg_vidaddr) > 2 || (((int) da2->mmdbg_vidaddr - (int) addr) > 2) || da2->mmdbg_vidaddr == addr) { fprintf(da2->mmdbg_fp, "\nW %x %x ", addr, val); - for (int i = 0; i <= 0xb; i++) + for (uint8_t i = 0; i <= 0xb; i++) fprintf(da2->mmdbg_fp, "%02x ", da2->gdcreg[i]); } - for (int i = 0; i < 16; i++) { + for (uint8_t i = 0; i < 16; i++) { int pixeldata = 0; if (val & (1 << (15 - i))) pixeldata = (da2->planemask & 0xf); @@ -2851,11 +2848,11 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p) da2->changedvram[addr >> 9] = changeframecount; addr <<= 3; - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2->gdcsrc[i] = da2->gdcla[i]; /* use latch */ if (!(da2->gdcreg[LG_COMMAND] & 0x08)) { - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i)) da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0; else if (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) @@ -2869,7 +2866,7 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p) // , da2->vram[addr + 8], da2->vram[addr + 9], da2->vram[addr + 10], da2->vram[addr + 11]); switch (da2->writemode) { case 2: - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) if (da2->planemask & (1 << i)) { da2_vram_w(addr | i, da2->gdcsrc[i] & 0xff, da2); da2_vram_w((addr + 8) | i, da2->gdcsrc[i] >> 8, da2); @@ -2879,13 +2876,13 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p) if (da2->gdcreg[LG_DATA_ROTATION] & 15) val = da2_rightrotate(val, da2->gdcreg[LG_DATA_ROTATION] & 15); if (bitmask == 0xffff && !(da2->gdcreg[LG_COMMAND] & 0x03) && (!da2->gdcreg[LG_ENABLE_SRJ])) { - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) if (da2->planemask & (1 << i)) { da2_vram_w(addr | i, val & 0xff, da2); da2_vram_w((addr + 8) | i, val >> 8, da2); } } else { - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) if (da2->gdcreg[LG_ENABLE_SRJ] & (1 << i)) da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0; else @@ -2895,7 +2892,7 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p) } break; case 1: - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2->gdcinput[i] = ((val & (1 << i)) ? 0xffff : 0); da2_gdcropW(addr, bitmask, da2); break; @@ -2904,7 +2901,7 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p) val = da2_rightrotate(val, da2->gdcreg[LG_DATA_ROTATION] & 15); bitmask &= val; - for (int i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) da2->gdcinput[i] = (da2->gdcreg[LG_SET_RESETJ] & (1 << i)) ? 0xffff : 0; da2_gdcropW(addr, bitmask, da2); break; @@ -2913,9 +2910,9 @@ da2_mmio_gc_writeW(uint32_t addr, uint16_t val, void *p) // , da2->vram[addr + 8], da2->vram[addr + 9], da2->vram[addr + 10], da2->vram[addr + 11]); } static void -da2_mmio_writew(uint32_t addr, uint16_t val, void *p) +da2_mmio_writew(uint32_t addr, uint16_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; // if (da2->bitblt.exec != DA2_BLT_CIDLE) /* Bitblt is in operation. */ // return; // if ((addr & ~0x1ffff) != 0xA0000) return; @@ -2941,52 +2938,52 @@ da2_mmio_writew(uint32_t addr, uint16_t val, void *p) } static void -da2_code_write(uint32_t addr, uint8_t val, void *p) +da2_code_write(uint32_t addr, uint8_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; // if ((addr & ~0xfff) != 0xE0000) return; addr &= DA2_MASK_CRAM; da2->cram[addr] = val; da2->fullchange = 2; } static void -da2_code_writeb(uint32_t addr, uint8_t val, void *p) +da2_code_writeb(uint32_t addr, uint8_t val, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; // da2_log("DA2_code_writeb: Write to %x, val %x\n", addr, val); cycles -= video_timing_write_b; da2_code_write(addr, val, da2); } static void -da2_code_writew(uint32_t addr, uint16_t val, void *p) +da2_code_writew(uint32_t addr, uint16_t val, void *priv) { // da2_log("DA2_code_writ ew: Write to %x, val %x\n", addr, val); - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; cycles -= video_timing_write_w; da2_code_write(addr, val & 0xff, da2); da2_code_write(addr + 1, val >> 8, da2); } static uint8_t -da2_code_read(uint32_t addr, void *p) +da2_code_read(uint32_t addr, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; // if ((addr & ~DA2_MASK_CRAM) != 0xE0000) // return DA2_INVALIDACCESS8; addr &= DA2_MASK_CRAM; return da2->cram[addr]; } static uint8_t -da2_code_readb(uint32_t addr, void *p) +da2_code_readb(uint32_t addr, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; cycles -= video_timing_read_b; return da2_code_read(addr, da2); } static uint16_t -da2_code_readw(uint32_t addr, void *p) +da2_code_readw(uint32_t addr, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; cycles -= video_timing_read_w; return da2_code_read(addr, da2) | (da2_code_read(addr + 1, da2) << 8); } @@ -3153,9 +3150,9 @@ da2_poll(void *priv) } static void -da2_loadfont(char *fname, void *p) +da2_loadfont(char *fname, void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; uint8_t buf; uint64_t fsize; if (!fname) @@ -3239,7 +3236,7 @@ da2_reset(void *priv) da2->attr_palette_enable = 0; /* disable attribute generator */ /* Set default color palette (Windows 3.1 display driver won't reset palette) */ - for (int i = 0; i < 256; i++) { + for (uint16_t i = 0; i < 256; i++) { da2->vgapal[i].r = ps55_palette_color[i & 0x3F][0]; da2->vgapal[i].g = ps55_palette_color[i & 0x3F][1]; da2->vgapal[i].b = ps55_palette_color[i & 0x3F][2]; @@ -3320,95 +3317,95 @@ da2_available(void) } static void -da2_close(void *p) +da2_close(void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; /* dump mem for debug */ #ifdef ENABLE_DA2_LOG - FILE *f; - f = fopen("da2_cram.dmp", "wb"); - if (f != NULL) { - fwrite(da2->cram, DA2_SIZE_CRAM, 1, f); - fclose(f); + FILE *fp; + fp = fopen("da2_cram.dmp", "wb"); + if (fp != NULL) { + fwrite(da2->cram, DA2_SIZE_CRAM, 1, fp); + fclose(fp); } - f = fopen("da2_vram.dmp", "wb"); - if (f != NULL) { - fwrite(da2->vram, DA2_SIZE_VRAM, 1, f); - fclose(f); + fp = fopen("da2_vram.dmp", "wb"); + if (fp != NULL) { + fwrite(da2->vram, DA2_SIZE_VRAM, 1, fp); + fclose(fp); } - f = fopen("da2_gram.dmp", "wb"); - if (f != NULL) { - fwrite(da2->mmio.ram, DA2_SIZE_GAIJIRAM, 1, f); - fclose(f); + fp = fopen("da2_gram.dmp", "wb"); + if (fp != NULL) { + fwrite(da2->mmio.ram, DA2_SIZE_GAIJIRAM, 1, fp); + fclose(fp); } - f = fopen("da2_attrpal.dmp", "wb"); - if (f != NULL) { - fwrite(da2->attrc, 32, 1, f); - fclose(f); + fp = fopen("da2_attrpal.dmp", "wb"); + if (fp != NULL) { + fwrite(da2->attrc, 32, 1, fp); + fclose(fp); } - f = fopen("da2_dacrgb.dmp", "wb"); - if (f != NULL) { - fwrite(da2->vgapal, 3 * 256, 1, f); - fclose(f); + fp = fopen("da2_dacrgb.dmp", "wb"); + if (fp != NULL) { + fwrite(da2->vgapal, 3 * 256, 1, fp); + fclose(fp); } - f = fopen("da2_daregs.txt", "w"); - if (f != NULL) { - for (int i = 0; i < 0x10; i++) - fprintf(f, "3e1(ioctl) %02X: %4X\n", i, da2->ioctl[i]); - for (int i = 0; i < 0x20; i++) - fprintf(f, "3e3(fctl) %02X: %4X\n", i, da2->fctl[i]); - for (int i = 0; i < 0x20; i++) - fprintf(f, "3e5(crtc) %02X: %4X\n", i, da2->crtc[i]); - for (int i = 0; i < 0x40; i++) - fprintf(f, "3e8(attr) %02X: %4X\n", i, da2->attrc[i]); - for (int i = 0; i < 0x10; i++) - fprintf(f, "3eb(gcr) %02X: %4X\n", i, da2->gdcreg[i]); - for (int i = 0; i < 0x10; i++) - fprintf(f, "3ee(?) %02X: %4X\n", i, da2->reg3ee[i]); - for (int i = 0; i < 0x20; i++) { - fprintf(f, "vp %02X: %4X %4X %4X %4X\n", i, + fp = fopen("da2_daregs.txt", "w"); + if (fp != NULL) { + for (uint8_t i = 0; i < 0x10; i++) + fprintf(fp, "3e1(ioctl) %02X: %4X\n", i, da2->ioctl[i]); + for (uint8_t i = 0; i < 0x20; i++) + fprintf(fp, "3e3(fctl) %02X: %4X\n", i, da2->fctl[i]); + for (uint8_t i = 0; i < 0x20; i++) + fprintf(fp, "3e5(crtc) %02X: %4X\n", i, da2->crtc[i]); + for (uint8_t i = 0; i < 0x40; i++) + fprintf(fp, "3e8(attr) %02X: %4X\n", i, da2->attrc[i]); + for (uint8_t i = 0; i < 0x10; i++) + fprintf(fp, "3eb(gcr) %02X: %4X\n", i, da2->gdcreg[i]); + for (uint8_t i = 0; i < 0x10; i++) + fprintf(fp, "3ee(?) %02X: %4X\n", i, da2->reg3ee[i]); + for (uint8_t i = 0; i < 0x20; i++) { + fprintf(fp, "vp %02X: %4X %4X %4X %4X\n", i, da2->crtc_vpreg[0 + i], da2->crtc_vpreg[0x20 + i], da2->crtc_vpreg[0x40 + i], da2->crtc_vpreg[0x60 + i]); } - fclose(f); + fclose(fp); } - f = fopen("ram_low.dmp", "wb"); - if (f != NULL) { - fwrite(&ram[0x0], 0x100000, 1, f); - fclose(f); + fp = fopen("ram_low.dmp", "wb"); + if (fp != NULL) { + fwrite(&ram[0x0], 0x100000, 1, fp); + fclose(fp); } pclog("closed %04X:%04X DS %04X\n", cs >> 4, cpu_state.pc, DS); #endif #ifdef ENABLE_DA2_DEBUGBLT - f = fopen("da2_bltdump.csv", "w"); - if (f != NULL && da2->bitblt.debug_reg_ip > 0) { + fp = fopen("da2_bltdump.csv", "w"); + if (fp != NULL && da2->bitblt.debug_reg_ip > 0) { /* print header */ for (int y = 0; y < DA2_DEBUG_BLTLOG_SIZE; y++) { if (da2->bitblt.debug_reg[(da2->bitblt.debug_reg_ip - 1) * DA2_DEBUG_BLTLOG_SIZE + y] != DA2_DEBUG_BLT_NEVERUSED) - fprintf(f, "\"%02X\"\t", y); + fprintf(fp, "\"%02X\"\t", y); } - fprintf(f, "\n"); + fprintf(fp, "\n"); /* print data */ for (int x = 0; x < da2->bitblt.debug_reg_ip; x++) { for (int y = 0; y < DA2_DEBUG_BLTLOG_SIZE; y++) { if (da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y] == DA2_DEBUG_BLT_NEVERUSED) ; else if (da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y] == DA2_DEBUG_BLT_USEDRESET) - fprintf(f, "\"\"\t"); + fprintf(fp, "\"\"\t"); else { - fprintf(f, "\"%X\"\t", da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y]); + fprintf(fp, "\"%X\"\t", da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + y]); if (y == 0x12) { int chr = da2->bitblt.debug_reg[x * DA2_DEBUG_BLTLOG_SIZE + 0x12]; if ((chr >= 0x20) && (chr < 0x7f)) - fprintf(f, "\"%c\"\t", chr); + fprintf(fp, "\"%c\"\t", chr); else - fprintf(f, "\"\"\t"); + fprintf(fp, "\"\"\t"); } } } - fprintf(f, "\n"); + fprintf(fp, "\n"); } - fclose(f); + fclose(fp); } free(da2->bitblt.debug_reg); #endif @@ -3426,28 +3423,28 @@ da2_close(void *p) } static void -da2_speed_changed(void *p) +da2_speed_changed(void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2->da2const = (uint64_t) ((cpuclock / DA2_PIXELCLOCK) * (double) (1ull << 32)); da2_recalctimings(da2); } static void -da2_force_redraw(void *p) +da2_force_redraw(void *priv) { - da2_t *da2 = (da2_t *) p; + da2_t *da2 = (da2_t *) priv; da2->fullchange = changeframecount; } static const device_config_t da2_configuration[] = { // clang-format off { - .name = "charset", + .name = "charset", .description = "Charset", - .type = CONFIG_SELECTION, + .type = CONFIG_SELECTION, .default_int = DA2_DCONFIG_CHARSET_JPAN, - .selection = { + .selection = { { .description = "932 (Japanese)", .value = DA2_DCONFIG_CHARSET_JPAN @@ -3460,11 +3457,11 @@ static const device_config_t da2_configuration[] = { } }, { - .name = "montype", + .name = "montype", .description = "Monitor type", - .type = CONFIG_SELECTION, + .type = CONFIG_SELECTION, .default_int = DA2_DCONFIG_MONTYPE_COLOR, - .selection = { + .selection = { { .description = "Color", .value = DA2_DCONFIG_MONTYPE_COLOR diff --git a/src/video/video.c b/src/video/video.c index 11edbc3f4..785479e15 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -1017,8 +1017,8 @@ loadfont_common(FILE *fp, int format) for (uint8_t d = 0; d < 8; d++) fontdatm[c][d + 8] = fgetc(fp) & 0xff; (void) fseek(fp, 4096 + 2048, SEEK_SET); - for (uint16_t c = 0; c < 256; c++) - for (uint8_t d = 0; d < 8; d++) /* 8x8 CGA (thick, primary) */ + for (uint16_t c = 0; c < 256; c++) /* 8x8 CGA (thick, primary) */ + for (uint8_t d = 0; d < 8; d++) fontdat[c][d] = fgetc(fp) & 0xff; break; From 6f8571c0262c6ab856c0b7afd6c8ea2433e12d6d Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Mon, 26 May 2025 21:27:14 -0400 Subject: [PATCH 21/22] Fix a bug in EGA --- src/video/vid_ega.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 1022bda88..b0d58e0f6 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -282,7 +282,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv) val = (ega->crtc[7] & ~0x10) | (val & 0x10); } else { idx &= crtcmask; - if ((idx >= 0x19) & (idx <= 0xf6)) + if ((idx >= 0x19) && (idx <= 0xf6)) return; if ((idx < 7) && (ega->crtc[0x11] & 0x80)) return; From 1d23c60daf6cc9346fe04f9ba7aab44d9d0e06cf Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 7 Jun 2025 04:49:38 +0200 Subject: [PATCH 22/22] NEAT: Fix register 6Fh readout, fixes #5655. --- src/chipset/neat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chipset/neat.c b/src/chipset/neat.c index 0661f89ee..0aa6fe5b6 100644 --- a/src/chipset/neat.c +++ b/src/chipset/neat.c @@ -988,7 +988,7 @@ neat_read(uint16_t port, void *priv) if ((dev->indx >= 0x60) && (dev->indx <= 0x6e)) ret = dev->regs[dev->indx]; else if (dev->indx == 0x6f) - ret = (dev->regs[dev->indx] & 0xfd) | ~(mem_a20_alt & 0x02); + ret = (dev->regs[dev->indx] & 0xfd) | ((~mem_a20_alt) & 0x02); break; default: