From 8dc0beaeec0224ecb780e5e7ba7c35ed6b4bcab2 Mon Sep 17 00:00:00 2001 From: Dmitry Borisov Date: Sun, 5 Jan 2025 12:15:01 +0600 Subject: [PATCH 1/5] pc87307: Fix GPIO base address configuration Don't clobber the GPIO I/O Base value. According to the PC87307 datasheet, port 0x60 bits [2:7] are read-only for the Parallel Port (4) device and cannot be altered by software. For others devices, the 0x60 port may be written with any value. The SGI firmware emits the following PC87307 initialization sequence after each reset: /* Select the GPIO device (7) */ SIO IDX: 2E <-- 07 SIO DAT: 2F <-- 07 /* I/O Base MSB = 0x0F */ SIO IDX: 2E <-- 60 SIO DAT: 2F <-- 0F /* I/O Base LSB = 0xC0 */ SIO IDX: 2E <-- 61 SIO DAT: 2F <-- C0 /* Enable address decoding (I/O Base = 0xFC0) */ SIO IDX: 2E <-- 30 SIO DAT: 2F <-- 01 The GPIO I/O Base is erroneously assigned to 0x7C0. Fix by removing the 0x07 mask. --- src/sio/sio_pc87307.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sio/sio_pc87307.c b/src/sio/sio_pc87307.c index 63e19c03d..cb772aa5b 100644 --- a/src/sio/sio_pc87307.c +++ b/src/sio/sio_pc87307.c @@ -34,6 +34,7 @@ #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/sio.h> +#include <86box/plat_fallthrough.h> typedef struct pc87307_t { uint8_t id; @@ -323,8 +324,12 @@ pc87307_write(uint16_t port, uint8_t val, void *priv) } break; case 0x60: + if (dev->regs[0x07] == 0x04) { + val &= 0x03; + } + fallthrough; case 0x62: - dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0x07; + dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val; if ((dev->cur_reg == 0x62) && (dev->regs[0x07] != 0x07)) break; switch (dev->regs[0x07]) { From eaa4f1637978e89df820a4e3f3e5fed7c9d18544 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 5 Jan 2025 16:42:24 +0100 Subject: [PATCH 2/5] Windows hook input: Remove an excessive log line. --- src/qt/qt_main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index c61fa1960..f77370574 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -240,7 +240,6 @@ emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) lpKdhs->flags &= ~LLKHF_EXTENDED; } else if (!(lpKdhs->flags & LLKHF_EXTENDED) && (lpKdhs->vkCode == 0x00000013)) { /* Pause - send E1 1D. */ - pclog("Send E1 1D\n"); win_keyboard_handle(0xe1, 0, 0, 0); win_keyboard_handle(0x1d, LLKHF_UP, 0, 0); } From 3226999246af7afc6d3d9e988b5cedd947a4fe80 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 5 Jan 2025 14:47:39 -0500 Subject: [PATCH 3/5] Fix wrong sample rate of ES1370 software synth playback Fixes low pitch problems when MIDI is played back through the software synth. Co-Authored-By: Cacodemon345 <38420290+Cacodemon345@users.noreply.github.com> --- src/sound/snd_audiopci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index ec3501f81..62a8e0056 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -423,9 +423,9 @@ es1370_calc_sample_rate(es137x_t *dev) dev->calc_sample_rate = 5512; } - dev->calc_sample_rate_synth = 44100 / (1 << ((dev->int_ctrl >> 12) & 3)); - dev->interp_factor_synth = 1. / (double) (1 << ((dev->int_ctrl >> 12) & 3)); - dev->interp_step_synth = (1 << ((dev->int_ctrl >> 12) & 3)); + dev->calc_sample_rate_synth = 44100 / (1 << (((dev->int_ctrl >> 12) & 3) ^ 3)); + dev->interp_factor_synth = 1. / (double) ((1 << ((dev->int_ctrl >> 12) & 3) ^ 3)); + dev->interp_step_synth = (1 << (((dev->int_ctrl >> 12) & 3) ^ 3)); } static void From ee099eba07eab2245345eafcafaf13eedb1f41ca Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 5 Jan 2025 16:16:12 -0500 Subject: [PATCH 4/5] Add CT1297 to CT5880, seen on the CT4810 --- src/sound/snd_audiopci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index ec3501f81..92ec5a8f4 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -2828,6 +2828,10 @@ static const device_config_t ct5880_config[] = { .description = "SigmaTel STAC9721T (stereo)", .value = AC97_CODEC_STAC9721 }, + { + .description = "TriTech TR28023 / Creative CT1297", + .value = AC97_CODEC_TR28023 + }, { .description = "" } }, .default_int = AC97_CODEC_STAC9708 From 6b05602ea4d1593edf8d0fff17e733b182e94637 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 5 Jan 2025 22:35:50 +0100 Subject: [PATCH 5/5] QT: Increase buffer size and improve sanity checking when removing an image. --- src/qt/qt_mediahistorymanager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/qt/qt_mediahistorymanager.cpp b/src/qt/qt_mediahistorymanager.cpp index 2acdc8e5b..d548c0779 100644 --- a/src/qt/qt_mediahistorymanager.cpp +++ b/src/qt/qt_mediahistorymanager.cpp @@ -336,16 +336,20 @@ MediaHistoryManager::removeMissingImages(device_index_list_t &device_history) continue; } - char temp[MAX_IMAGE_PATH_LEN -1] = { 0 }; + char temp[MAX_IMAGE_PATH_LEN * 2] = { 0 }; if (path_abs(checked_path.toUtf8().data())) { if (checked_path.length() > (MAX_IMAGE_PATH_LEN - 1)) - fatal("removeMissingImages(): checked_path.length() > 2047\n"); + fatal("removeMissingImages(): checked_path.length() > %i\n", MAX_IMAGE_PATH_LEN - 1); else snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s", checked_path.toUtf8().constData()); - } else - snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path, - path_get_slash(usr_path), checked_path.toUtf8().constData()); + } else { + if ((strlen(usr_path) + strlen(path_get_slash(usr_path)) + checked_path.length()) > (MAX_IMAGE_PATH_LEN - 1)) + fatal("removeMissingImages(): Combined absolute path length > %i\n", MAX_IMAGE_PATH_LEN - 1); + else + snprintf(temp, (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path, + path_get_slash(usr_path), checked_path.toUtf8().constData()); + } path_normalize(temp); QString qstr = QString::fromUtf8(temp);