From e3a3b8f0863b02fe7bd40c18e951b8ba4992dec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=B2=99=E5=AE=AE=E7=B4=97=E5=A4=9C?= <117635969+kzmidze@users.noreply.github.com> Date: Sun, 27 Aug 2023 13:40:57 +0800 Subject: [PATCH 1/6] Update language module --- src/win/languages/zh-CN.rc | 2 +- src/win/languages/zh-TW.rc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/win/languages/zh-CN.rc b/src/win/languages/zh-CN.rc index 93e8ca49b..a6d86b6c0 100644 --- a/src/win/languages/zh-CN.rc +++ b/src/win/languages/zh-CN.rc @@ -480,7 +480,7 @@ BEGIN IDS_2125 "关于 86Box" IDS_2126 "86Box v" EMU_VERSION - IDS_2127 "一个旧式计算机模拟器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\nWith previous core contributions from Sarah Walker、leilei、JohnElliott、greatpsycho 等人。\n\n本软件依据 GNU 通用公共许可证第二版或更新版本发布。详情见 LICENSE 文件。" + IDS_2127 "一个旧式计算机模拟器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\n本软件依据 GNU 通用公共许可证第二版或更新版本发布。详情见 LICENSE 文件。" IDS_2128 "确定" IDS_2129 "硬件不可用" #ifdef _WIN32 diff --git a/src/win/languages/zh-TW.rc b/src/win/languages/zh-TW.rc index ae6e43a6f..039993e5d 100644 --- a/src/win/languages/zh-TW.rc +++ b/src/win/languages/zh-TW.rc @@ -480,7 +480,7 @@ BEGIN IDS_2125 "關於 86Box" IDS_2126 "86Box v" EMU_VERSION - IDS_2127 "一個舊式電腦模擬器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\nWith previous core contributions from Sarah Walker、leilei、JohnElliott、greatpsycho 等人。\n\n本軟體依據 GNU 通用公共授權第二版或更新版本發布。詳情見 LICENSE 檔案。" + IDS_2127 "一個舊式電腦模擬器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\n本軟體依據 GNU 通用公共授權第二版或更新版本發布。詳情見 LICENSE 檔案。" IDS_2128 "確定" IDS_2129 "硬體不可用" #ifdef _WIN32 From f21ab681a9ec21905b7e62e9bf9f4a75c523679f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=B2=99=E5=AE=AE=E7=B4=97=E5=A4=9C?= <117635969+kzmidze@users.noreply.github.com> Date: Sun, 27 Aug 2023 13:42:34 +0800 Subject: [PATCH 2/6] Update language module --- src/qt/languages/zh-CN.po | 2 +- src/qt/languages/zh-TW.po | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index c4e331aca..3598da0fc 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -854,7 +854,7 @@ msgid "86Box v" msgstr "86Box v" msgid "An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information." -msgstr "一个旧式计算机模拟器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\nWith previous core contributions from Sarah Walker、leilei、JohnElliott、greatpsycho 等人。\n\n本软件依据 GNU 通用公共许可证第二版或更新版本发布。详情见 LICENSE 文件。" +msgstr "一个旧式计算机模拟器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\n本软件依据 GNU 通用公共许可证第二版或更新版本发布。详情见 LICENSE 文件。" msgid "Hardware not available" msgstr "硬件不可用" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 1941e7286..d10b45628 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -854,7 +854,7 @@ msgid "86Box v" msgstr "86Box v" msgid "An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information." -msgstr "一個舊式電腦模擬器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\nWith previous core contributions from Sarah Walker、leilei、JohnElliott、greatpsycho 等人。\n\n本軟體依據 GNU 通用公共授權第二版或更新版本發布。詳情見 LICENSE 檔案。" +msgstr "一個舊式電腦模擬器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\n本軟體依據 GNU 通用公共授權第二版或更新版本發布。詳情見 LICENSE 檔案。" msgid "Hardware not available" msgstr "硬體不可用" From 68b6a58cc2694c913166ad6d8e8a43fc0318093d Mon Sep 17 00:00:00 2001 From: Davidson Francis Date: Wed, 30 Aug 2023 00:34:49 -0300 Subject: [PATCH 3/6] Bug Fix: Fix GDB stub builds due to undeclared symbol This commit fixes a build issue that occurred when compiling with GDBSTUB support (-DGDBSTUB=ON). The issue was introduced in commit 565421a, which commented out the GDB_REG_FS_BASE and GDB_REG_GS_BASE registers, but did not remove the code snippets that referenced them in gdbstub_client_write_reg(). This commit comments out those code snippets as well. Additionally, this commit removes the fs_base and gs_base registers from the XML file, to ensure the correct numbering of the registers for the GDB. --- src/gdbstub.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gdbstub.c b/src/gdbstub.c index 30785eeac..14e75b4e0 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -222,8 +222,10 @@ static char target_xml[] = /* QEMU gdb-xml/i386-32bit.xml with modificati "" "" "" +#if 0 "" "" +#endif "" "" "" @@ -548,10 +550,12 @@ gdbstub_client_write_reg(int index, uint8_t *buf) flushmmucache(); break; +#if 0 case GDB_REG_FS_BASE ... GDB_REG_GS_BASE: /* Do what qemu does and just load the base. */ segment_regs[(index - 16) + (GDB_REG_FS - GDB_REG_CS)]->base = *((uint32_t *) buf); break; +#endif case GDB_REG_CR0 ... GDB_REG_CR4: *cr_regs[index - GDB_REG_CR0] = *((uint32_t *) buf); From e6e8784769bef7b4e552768473fce1edb02c3188 Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Thu, 31 Aug 2023 06:13:04 +0500 Subject: [PATCH 4/6] Revert the GUS to use edge-triggered IRQs Fixes #3645 --- src/sound/snd_gus.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index aa9eeca40..90f5dba7f 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -211,16 +211,16 @@ gus_update_int_status(gus_t *gus) if (gus->irq != -1) { if (intr_pending) - picintlevel(1 << gus->irq, &gus->irq_state); + picint(1 << gus->irq); else - picintclevel(1 << gus->irq, &gus->irq_state); + picintc(1 << gus->irq); } if ((gus->irq_midi != -1) && (gus->irq_midi != gus->irq)) { if (midi_intr_pending) - picintlevel(1 << gus->irq_midi, &gus->midi_irq_state); + picint(1 << gus->irq_midi); else - picintclevel(1 << gus->irq_midi, &gus->midi_irq_state); + picintc(1 << gus->irq_midi); } } From ce8b1c4c81aabfb471d57dac1a743f729c9c7715 Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Thu, 31 Aug 2023 06:16:55 +0500 Subject: [PATCH 5/6] Dev branch: Fix the GUS type selector not working --- src/sound/snd_gus.c | 74 ++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index 90f5dba7f..ce4947e3f 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -16,7 +16,9 @@ #include <86box/pic.h> #include <86box/sound.h> #include <86box/timer.h> -#include <86box/snd_ad1848.h> +#if defined(DEV_BRANCH) && defined(USE_GUSMAX) +# include <86box/snd_ad1848.h> +#endif #include <86box/plat_fallthrough.h> #include <86box/plat_unused.h> @@ -104,6 +106,8 @@ typedef struct gus_t { pc_timer_t timer_1; pc_timer_t timer_2; + uint8_t type; + int irq; int dma; int irq_midi; @@ -139,9 +143,9 @@ typedef struct gus_t { uint8_t usrr; +#if defined(DEV_BRANCH) && defined(USE_GUSMAX) uint8_t max_ctrl; -#if defined(DEV_BRANCH) && defined(USE_GUSMAX) ad1848_t ad1848; #endif } gus_t; @@ -589,14 +593,16 @@ writegus(uint16_t addr, uint8_t val, void *priv) } else gus->irq_midi = gus_midi_irqs[(val >> 3) & 7]; #if defined(DEV_BRANCH) && defined(USE_GUSMAX) - ad1848_setirq(&gus->ad1848, gus->irq); + if (gus->type == GUS_MAX) + ad1848_setirq(&gus->ad1848, gus->irq); #endif gus->sb_nmi = val & 0x80; } else { gus->dma = gus_dmas[val & 7]; #if defined(DEV_BRANCH) && defined(USE_GUSMAX) - ad1848_setdma(&gus->ad1848, gus->dma); + if (gus->type == GUS_MAX) + ad1848_setdma(&gus->ad1848, gus->dma); #endif } break; @@ -655,20 +661,22 @@ writegus(uint16_t addr, uint8_t val, void *priv) break; case 0x306: case 0x706: - if (gus->dma >= 4) - val |= 0x30; - gus->max_ctrl = (val >> 6) & 1; #if defined(DEV_BRANCH) && defined(USE_GUSMAX) - if (val & 0x40) { - if ((val & 0xF) != ((addr >> 4) & 0xF)) { - csioport = 0x30c | ((addr >> 4) & 0xf); - io_removehandler(csioport, 4, - ad1848_read, NULL, NULL, - ad1848_write, NULL, NULL, &gus->ad1848); - csioport = 0x30c | ((val & 0xf) << 4); - io_sethandler(csioport, 4, - ad1848_read, NULL, NULL, - ad1848_write, NULL, NULL, &gus->ad1848); + if (gus->type == GUS_MAX) { + if (gus->dma >= 4) + val |= 0x30; + gus->max_ctrl = (val >> 6) & 1; + if (val & 0x40) { + if ((val & 0xF) != ((addr >> 4) & 0xF)) { + csioport = 0x30c | ((addr >> 4) & 0xf); + io_removehandler(csioport, 4, + ad1848_read, NULL, NULL, + ad1848_write, NULL, NULL, &gus->ad1848); + csioport = 0x30c | ((val & 0xf) << 4); + io_sethandler(csioport, 4, + ad1848_read, NULL, NULL, + ad1848_write, NULL, NULL, &gus->ad1848); + } } } #endif @@ -723,9 +731,11 @@ readgus(uint16_t addr, void *priv) return val; case 0x20F: - if (gus->max_ctrl) +#if defined(DEV_BRANCH) && defined(USE_GUSMAX) + if (gus->type == GUS_MAX) val = 0x02; else +#endif val = 0x00; break; @@ -844,9 +854,11 @@ readgus(uint16_t addr, void *priv) break; case 0x306: case 0x706: - if (gus->max_ctrl) +#if defined(DEV_BRANCH) && defined(USE_GUSMAX) + if (gus->type == GUS_MAX) val = 0x0a; /* GUS MAX */ else +#endif val = 0xff; /*Pre 3.7 - no mixer*/ break; @@ -1128,21 +1140,21 @@ gus_get_buffer(int32_t *buffer, int len, void *priv) gus_t *gus = (gus_t *) priv; #if defined(DEV_BRANCH) && defined(USE_GUSMAX) - if (gus->max_ctrl) + if ((gus->type == GUS_MAX) && (gus->max_ctrl)) ad1848_update(&gus->ad1848); #endif gus_update(gus); for (int c = 0; c < len * 2; c++) { #if defined(DEV_BRANCH) && defined(USE_GUSMAX) - if (gus->max_ctrl) + if ((gus->type == GUS_MAX) && (gus->max_ctrl)) buffer[c] += (int32_t) (gus->ad1848.buffer[c] / 2); #endif buffer[c] += (int32_t) gus->buffer[c & 1][c >> 1]; } #if defined(DEV_BRANCH) && defined(USE_GUSMAX) - if (gus->max_ctrl) + if ((gus->type == GUS_MAX) && (gus->max_ctrl)) gus->ad1848.pos = 0; #endif gus->pos = 0; @@ -1277,7 +1289,9 @@ gus_reset(void *priv) gus->usrr = 0; +#if defined(DEV_BRANCH) && defined(USE_GUSMAX) gus->max_ctrl = 0; +#endif gus->irq_state = 0; gus->midi_irq_state = 0; @@ -1317,6 +1331,8 @@ gus_init(UNUSED(const device_t *info)) gus->uart_out = 1; + gus->type = device_get_config_int("type"); + gus->base = device_get_config_hex16("base"); io_sethandler(gus->base, 0x0010, readgus, NULL, NULL, writegus, NULL, NULL, gus); @@ -1325,11 +1341,13 @@ gus_init(UNUSED(const device_t *info)) io_sethandler(0x0388, 0x0002, readgus, NULL, NULL, writegus, NULL, NULL, gus); #if defined(DEV_BRANCH) && defined(USE_GUSMAX) - ad1848_init(&gus->ad1848, AD1848_TYPE_CS4231); - ad1848_setirq(&gus->ad1848, 5); - ad1848_setdma(&gus->ad1848, 3); - io_sethandler(0x10C + gus->base, 4, - ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &gus->ad1848); + if (gus->type == GUS_MAX) { + ad1848_init(&gus->ad1848, AD1848_TYPE_CS4231); + ad1848_setirq(&gus->ad1848, 5); + ad1848_setdma(&gus->ad1848, 3); + io_sethandler(0x10C + gus->base, 4, + ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &gus->ad1848); + } #endif timer_add(&gus->samp_timer, gus_poll_wave, gus, 1); @@ -1364,7 +1382,7 @@ gus_speed_changed(void *priv) gus->samp_latch = (uint64_t) (TIMER_USEC * (1000000.0 / gusfreqs[gus->voices - 14])); #if defined(DEV_BRANCH) && defined(USE_GUSMAX) - if (gus->max_ctrl) + if ((gus->type == GUS_MAX) && (gus->max_ctrl)) ad1848_speed_changed(&gus->ad1848); #endif } From 4bde11c290bdf9dc111b913ef95a0ef670ebe3d0 Mon Sep 17 00:00:00 2001 From: Davidson Francis Date: Thu, 31 Aug 2023 14:11:27 -0300 Subject: [PATCH 6/6] GDB stub small fixes: out-of-bounds and wrong packet reply in 'qfThreadInfo' (#3666) * Fix out-of-bounds access on gdbstub_client_respond() The issue happens when the ENABLE_GDBSTUB_LOG flag is set, more specifically within the gdbstub_client_respond() function. This is due to the fact that the string 'GDB Stub: Sending response: ' and the newline character '\n' total 29 characters. When combined with the 995 characters of client->response, the total is 1024 bytes. However, the pclog_ex() buffer size is also 1024 bytes, leaving no room for the null terminator '\0'. As a result, when attempting to print the text on the screen, a segmentation fault occurs. This commit fixes this by decreasing the response text's size by one byte. * Remove extra space in 'qfThreadInfo' packet response in gdbstub.c When GDB sends the 'qfThreadInfo' packet, one of the possible responses is 'm thread-id', as specified in [1]. However, contrary to what the documentation implies, there is no space between 'm' and the thread-id. In the current approach, GDB isn't even able to recognize that there's any active thread, as the code sends "m 1" instead of "m1". This commit addresses this by removing the space in the response. Ref: [1]: https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html --- src/gdbstub.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gdbstub.c b/src/gdbstub.c index 14e75b4e0..d2bb5364b 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -631,10 +631,10 @@ gdbstub_client_respond(gdbstub_client_t *client) /* Send response packet. */ client->response[client->response_pos] = '\0'; #ifdef ENABLE_GDBSTUB_LOG - i = client->response[995]; /* pclog_ex buffer too small */ - client->response[995] = '\0'; + i = client->response[994]; /* pclog_ex buffer too small */ + client->response[994] = '\0'; gdbstub_log("GDB Stub: Sending response: %s\n", client->response); - client->response[995] = i; + client->response[994] = i; #endif send(client->socket, "$", 1, 0); send(client->socket, client->response, client->response_pos, 0); @@ -1100,7 +1100,7 @@ e00: } else if (!strcmp(client->response, "C")) { FAST_RESPONSE("QC1"); } else if (!strcmp(client->response, "fThreadInfo")) { - FAST_RESPONSE("m 1"); + FAST_RESPONSE("m1"); } else if (!strcmp(client->response, "sThreadInfo")) { FAST_RESPONSE("l"); } else if (!strcmp(client->response, "Rcmd")) {