From e7d09a31a43a3364f08d2367aeb1c0979b514e89 Mon Sep 17 00:00:00 2001 From: klaas Date: Sat, 2 Apr 2022 15:38:37 +0019 Subject: [PATCH 01/20] linux blocks until a packet arrives which the rest of the code does not expect --- src/network/net_pcap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index 52573907b..114fb72b0 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -122,6 +122,9 @@ static const unsigned char *(*f_pcap_next)(void *,void *); static int (*f_pcap_sendpacket)(void *,const unsigned char *,int); static void (*f_pcap_close)(void *); +#ifdef __linux__ +static int (*f_pcap_setnonblock)(void*, int, char*); +#endif static dllimp_t pcap_imports[] = { { "pcap_lib_version", &f_pcap_lib_version }, { "pcap_findalldevs", &f_pcap_findalldevs }, @@ -132,6 +135,9 @@ static dllimp_t pcap_imports[] = { { "pcap_next", &f_pcap_next }, { "pcap_sendpacket", &f_pcap_sendpacket }, { "pcap_close", &f_pcap_close }, +#ifdef __linux__ + { "pcap_setnonblock", &f_pcap_setnonblock }, +#endif { NULL, NULL }, }; @@ -382,6 +388,11 @@ net_pcap_reset(const netcard_t *card, uint8_t *mac) pcap_log(" Unable to open device: %s!\n", network_host); return(-1); } +#ifdef __linux__ + if (f_pcap_setnonblock((void*)pcap, 1, errbuf) != 0) + pcap_log("PCAP: failed nonblock %s\n", errbuf); +#endif + pcap_log("PCAP: interface: %s\n", network_host); /* Create a MAC address based packet filter. */ From 093eddf5f13fcb26854989b4274d14a3b3eb073f Mon Sep 17 00:00:00 2001 From: klaas Date: Sat, 2 Apr 2022 15:46:19 +0019 Subject: [PATCH 02/20] network.c: fix log statement --- src/network/network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/network.c b/src/network/network.c index a02000372..6caf10393 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -541,12 +541,12 @@ network_reset(void) network_log("NETWORK: set up for %s, card='%s'\n", (network_type==NET_TYPE_SLIRP)?"SLiRP":"Pcap", - net_cards[network_card].name); + net_cards[network_card].device->name); /* Add the (new?) card to the I/O system. */ if (net_cards[network_card].device) { network_log("NETWORK: adding device '%s'\n", - net_cards[network_card].name); + net_cards[network_card].device->name); device_add(net_cards[network_card].device); } } From 3772aa312b019ca6c42bb93164beab7bcbbf3d8b Mon Sep 17 00:00:00 2001 From: klaas Date: Tue, 5 Apr 2022 10:29:26 +0019 Subject: [PATCH 03/20] Apply for Mac OS too. --- src/network/net_pcap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index 114fb72b0..f3921a658 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -122,7 +122,7 @@ static const unsigned char *(*f_pcap_next)(void *,void *); static int (*f_pcap_sendpacket)(void *,const unsigned char *,int); static void (*f_pcap_close)(void *); -#ifdef __linux__ +#ifndef _WIN32 static int (*f_pcap_setnonblock)(void*, int, char*); #endif static dllimp_t pcap_imports[] = { @@ -135,7 +135,7 @@ static dllimp_t pcap_imports[] = { { "pcap_next", &f_pcap_next }, { "pcap_sendpacket", &f_pcap_sendpacket }, { "pcap_close", &f_pcap_close }, -#ifdef __linux__ +#ifndef _WIN32 { "pcap_setnonblock", &f_pcap_setnonblock }, #endif { NULL, NULL }, @@ -388,7 +388,7 @@ net_pcap_reset(const netcard_t *card, uint8_t *mac) pcap_log(" Unable to open device: %s!\n", network_host); return(-1); } -#ifdef __linux__ +#ifndef _WIN32 if (f_pcap_setnonblock((void*)pcap, 1, errbuf) != 0) pcap_log("PCAP: failed nonblock %s\n", errbuf); #endif From 100eaf70ee3ea340b89426b0f0ef2c5fa53864b2 Mon Sep 17 00:00:00 2001 From: Didiet Date: Sat, 16 Apr 2022 13:12:38 +0700 Subject: [PATCH 04/20] Fixing GdbStub Code to make it compiled with Clang (#2292) - Fix the switch scoping preventing declaration - Adding stdint.h as inclusion to make uint*_t works --- src/gdbstub.c | 9 ++++++++- src/include/86box/gdbstub.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gdbstub.c b/src/gdbstub.c index 20103c4cd..7ce2f360f 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -27,6 +27,7 @@ #else # include # include +# include #endif #define HAVE_STDARG_H #include <86box/86box.h> @@ -954,7 +955,7 @@ e14: /* Add our supported features to the end. */ if (client->response_pos < (sizeof(client->response) - 1)) client->response_pos += snprintf(&client->response[client->response_pos], sizeof(client->response) - client->response_pos, - "PacketSize=%X;swbreak+;hwbreak+;qXfer:features:read+", sizeof(client->packet) - 1); + "PacketSize=%lX;swbreak+;hwbreak+;qXfer:features:read+", sizeof(client->packet) - 1); break; } else if (!strcmp(client->response, "Xfer")) { /* Read the transfer object. */ @@ -1101,6 +1102,7 @@ unknown: case 'z': /* remove break/watchpoint */ case 'Z': /* insert break/watchpoint */ + { gdbstub_breakpoint_t *breakpoint, *prev_breakpoint = NULL, **first_breakpoint; /* Parse breakpoint type. */ @@ -1222,6 +1224,7 @@ unknown: /* Respond positively. */ goto ok; + } } end: /* Send response. */ @@ -1655,7 +1658,11 @@ gdbstub_init() .sin_port = htons(port) }; if (bind(gdbstub_socket, (struct sockaddr *) &bind_addr, sizeof(bind_addr)) == -1) { +#ifdef _WIN32 pclog("GDB Stub: Failed to bind on port %d (%d)\n", port, WSAGetLastError()); +#else + pclog("GDB Stup: Failed to bind on port %d (%d)\n", port, errno); +#endif gdbstub_socket = -1; return; } diff --git a/src/include/86box/gdbstub.h b/src/include/86box/gdbstub.h index 49eed2c45..4b2f8630a 100644 --- a/src/include/86box/gdbstub.h +++ b/src/include/86box/gdbstub.h @@ -16,6 +16,7 @@ */ #ifndef EMU_GDBSTUB_H #define EMU_GDBSTUB_H +#include #include <86box/mem.h> #define GDBSTUB_MEM_READ 0 From 12b30a81870be2640a7d4d23b492915d824549c3 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sat, 16 Apr 2022 19:24:30 -0400 Subject: [PATCH 05/20] Inconsistency fixes --- src/machine/machine_table.c | 72 ++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 67a7b2641..373b75bb2 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -211,28 +211,28 @@ const machine_t machines[] = { { "[8088] VTech Laser Turbo XT", "ltxt", MACHINE_TYPE_8088, MACHINE_CHIPSET_DISCRETE, machine_xt_laserxt_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_FLAGS_NONE, 256, 640, 256, 0,NULL, NULL }, #endif /* Has a standard PS/2 KBC (so, use IBM PS/2 Type 1). */ - { "[8088] Xi8088", "xi8088", MACHINE_TYPE_8088, MACHINE_CHIPSET_DISCRETE, machine_xt_xi8088_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_FLAGS_NONE, 64, 1024, 128, 127, xi8088_get_device}, + { "[8088] Xi8088", "xi8088", MACHINE_TYPE_8088, MACHINE_CHIPSET_DISCRETE, machine_xt_xi8088_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_FLAGS_NONE, 64, 1024, 128, 127, xi8088_get_device, NULL }, { "[8088] Z-NIX PC-1600", "znic", MACHINE_TYPE_8088, MACHINE_CHIPSET_DISCRETE, machine_xt_znic_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_FLAGS_NONE, 64, 640, 64, 0, NULL, NULL }, { "[8088] Zenith Data Systems Z-151/152/161", "zdsz151", MACHINE_TYPE_8088, MACHINE_CHIPSET_DISCRETE, machine_xt_z151_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_FLAGS_NONE, 128, 640, 64, 0, NULL, NULL }, { "[8088] Zenith Data Systems Z-159", "zdsz159", MACHINE_TYPE_8088, MACHINE_CHIPSET_DISCRETE, machine_xt_z159_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_FLAGS_NONE, 128, 640, 64, 0, NULL, NULL }, - { "[8088] Zenith Data Systems SupersPort (Z-184)", "zdsupers", MACHINE_TYPE_8088, MACHINE_CHIPSET_DISCRETE, machine_xt_z184_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED, 128, 640, 128, 0, z184_get_device}, + { "[8088] Zenith Data Systems SupersPort (Z-184)", "zdsupers", MACHINE_TYPE_8088, MACHINE_CHIPSET_DISCRETE, machine_xt_z184_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED, 128, 640, 128, 0, z184_get_device, NULL }, { "[GC100A] Philips P3120", "p3120", MACHINE_TYPE_8088, MACHINE_CHIPSET_GC100A, machine_xt_p3120_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8088, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_XTA, 256, 768, 256, 0, NULL, NULL }, /* 8086 Machines */ - { "[8086] Amstrad PC1512", "pc1512", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc1512_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 8000000, 8000000, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 512, 640, 128, 63, pc1512_get_device}, - { "[8086] Amstrad PC1640", "pc1640", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc1640_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 640, 63, pc1640_get_device}, - { "[8086] Amstrad PC2086", "pc2086", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc2086_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 640, 63, pc2086_get_device}, - { "[8086] Amstrad PC3086", "pc3086", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc3086_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 640, 63, pc3086_get_device}, - { "[8086] Amstrad PC20(0)", "pc200", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc200_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, pc200_get_device}, - { "[8086] Amstrad PPC512/640", "ppc512", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_ppc512_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, ppc512_get_device}, + { "[8086] Amstrad PC1512", "pc1512", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc1512_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 8000000, 8000000, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 512, 640, 128, 63, pc1512_get_device, NULL }, + { "[8086] Amstrad PC1640", "pc1640", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc1640_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 640, 63, pc1640_get_device, NULL }, + { "[8086] Amstrad PC2086", "pc2086", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc2086_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 640, 63, pc2086_get_device, NULL }, + { "[8086] Amstrad PC3086", "pc3086", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc3086_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 640, 63, pc3086_get_device, NULL }, + { "[8086] Amstrad PC20(0)", "pc200", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_pc200_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, pc200_get_device, NULL }, + { "[8086] Amstrad PPC512/640", "ppc512", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_ppc512_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, ppc512_get_device, NULL }, { "[8086] Compaq Deskpro", "deskpro", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_xt_compaq_deskpro_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_FLAGS_NONE, 128, 640, 128, 0, NULL, NULL }, - { "[8086] Olivetti M21/24/24SP", "m24", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_xt_m24_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO | MACHINE_MOUSE, 128, 640, 128, 0, m24_get_device}, + { "[8086] Olivetti M21/24/24SP", "m24", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_xt_m24_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO | MACHINE_MOUSE, 128, 640, 128, 0, m24_get_device, NULL }, /* Has Olivetti KBC firmware. */ { "[8086] Olivetti M240", "m240", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_xt_m240_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_FLAGS_NONE, 128, 640, 128, 0, NULL, NULL }, { "[8086] Schetmash Iskra-3104", "iskra3104", MACHINE_TYPE_8086, MACHINE_CHIPSET_DISCRETE, machine_xt_iskra3104_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_FLAGS_NONE, 128, 640, 128, 0, NULL, NULL }, - { "[8086] Tandy 1000 SL/2", "tandy1000sl2", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_tandy1000sl2_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED, 512, 768, 128, 0, tandy1k_sl_get_device}, + { "[8086] Tandy 1000 SL/2", "tandy1000sl2", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_tandy1000sl2_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO_FIXED, 512, 768, 128, 0, tandy1k_sl_get_device, NULL }, { "[8086] Victor V86P", "v86p", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_v86p_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO, 512, 1024, 128, 127, NULL, NULL }, - { "[8086] Toshiba T1200", "t1200", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_xt_t1200_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO, 1024, 2048,1024, 63, t1200_get_device}, + { "[8086] Toshiba T1200", "t1200", MACHINE_TYPE_8086, MACHINE_CHIPSET_PROPRIETARY, machine_xt_t1200_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_VIDEO, 1024, 2048,1024, 63, t1200_get_device, NULL }, #if defined(DEV_BRANCH) && defined(USE_LASERXT) { "[8086] VTech Laser XT3", "lxt3", MACHINE_TYPE_8086, MACHINE_CHIPSET_DISCRETE, machine_xt_lxt3_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_8086, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PC, MACHINE_FLAGS_NONE, 256, 640, 256, 0, NULL, NULL }, @@ -255,7 +255,7 @@ const machine_t machines[] = { /* Uses Compaq KBC firmware. */ { "[ISA] Compaq Portable II", "portableii", MACHINE_TYPE_286, MACHINE_CHIPSET_PROPRIETARY, machine_at_portableii_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_286, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_FLAGS_NONE, 640, 16384, 128, 127, NULL, NULL }, /* Uses Compaq KBC firmware. */ - { "[ISA] Compaq Portable III", "portableiii", MACHINE_TYPE_286, MACHINE_CHIPSET_PROPRIETARY, machine_at_portableiii_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_286, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_VIDEO, 640, 16384, 128, 127, at_cpqiii_get_device }, + { "[ISA] Compaq Portable III", "portableiii", MACHINE_TYPE_286, MACHINE_CHIPSET_PROPRIETARY, machine_at_portableiii_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_286, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_VIDEO, 640, 16384, 128, 127, at_cpqiii_get_device, NULL }, /* Has IBM AT KBC firmware. */ { "[ISA] MR BIOS 286 clone", "mr286", MACHINE_TYPE_286, MACHINE_CHIPSET_DISCRETE, machine_at_mr286_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_286, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_IDE, 512, 16384, 128, 127, NULL, NULL }, /* Has IBM AT KBC firmware. */ @@ -322,7 +322,7 @@ const machine_t machines[] = { /* Has an AMI KBC firmware, the only photo of this is too low resolution for me to read what's on the KBC chip, so I'm going to assume AMI 'F' based on the other known HT18 AMI BIOS strings. */ - { "[ALi M1217] Flytech 386", "flytech386", MACHINE_TYPE_386SX, MACHINE_CHIPSET_ALI_M1217, machine_at_flytech386_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 1024, 16384, 1024, 127, at_flytech386_get_device }, + { "[ALi M1217] Flytech 386", "flytech386", MACHINE_TYPE_386SX, MACHINE_CHIPSET_ALI_M1217, machine_at_flytech386_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 1024, 16384, 1024, 127, at_flytech386_get_device, NULL }, /* I'm going to assume this has a standard/generic IBM-compatible AT KBC firmware until the board is identified. */ { "[ALi M1217] MR BIOS 386SX clone", "mr1217", MACHINE_TYPE_386SX, MACHINE_CHIPSET_ALI_M1217, machine_at_mr1217_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 1024, 16384, 1024, 127, NULL, NULL }, @@ -333,7 +333,7 @@ const machine_t machines[] = { /* Has an AMI KBC firmware, the only photo of this is too low resolution for me to read what's on the KBC chip, so I'm going to assume AMI 'F' based on the other known HT18 AMI BIOS strings. */ - { "[HT18] AMA-932J", "ama932j", MACHINE_TYPE_386SX, MACHINE_CHIPSET_HT18, machine_at_ama932j_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_IDE | MACHINE_VIDEO, 512, 8192, 128, 127, at_ama932j_get_device }, + { "[HT18] AMA-932J", "ama932j", MACHINE_TYPE_386SX, MACHINE_CHIPSET_HT18, machine_at_ama932j_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_IDE | MACHINE_VIDEO, 512, 8192, 128, 127, at_ama932j_get_device, NULL }, /* Has an unknown KBC firmware with commands B8 and BB in the style of Phoenix MultiKey and AMIKey-3(!), but also commands E1 and EA with unknown functions. */ @@ -351,13 +351,13 @@ const machine_t machines[] = { /* Uses Commodore (CBM) KBC firmware, to be implemented as identical to the IBM PS/2 Type 1 KBC firmware unless evidence emerges of any proprietary commands. */ - { "[SCAMP] Commodore SL386SX-25", "cmdsl386sx25", MACHINE_TYPE_386SX, MACHINE_CHIPSET_VLSI_SCAMP, machine_at_cmdsl386sx25_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 1024, 8192, 512, 127, at_cmdsl386sx25_get_device }, + { "[SCAMP] Commodore SL386SX-25", "cmdsl386sx25", MACHINE_TYPE_386SX, MACHINE_CHIPSET_VLSI_SCAMP, machine_at_cmdsl386sx25_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 1024, 8192, 512, 127, at_cmdsl386sx25_get_device, NULL }, /* The closest BIOS string I find to this one's, differs only in one part, and ends in -8, so I'm going to assume that this, too, has an AMI '8' (AMI Keyboard BIOS Plus) KBC firmware. */ { "[SCAMP] DataExpert 386SX", "dataexpert386sx", MACHINE_TYPE_386SX, MACHINE_CHIPSET_VLSI_SCAMP, machine_at_dataexpert386sx_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 10000000, 25000000, 0, 0, 0, 0, MACHINE_AT, MACHINE_FLAGS_NONE, 1024, 16384, 1024, 127, NULL, NULL }, /* Has IBM PS/2 Type 1 KBC firmware. */ - { "[SCAMP] Samsung SPC-6033P", "spc6033p", MACHINE_TYPE_386SX, MACHINE_CHIPSET_VLSI_SCAMP, machine_at_spc6033p_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 2048, 12288, 2048, 127, at_spc6033p_get_device }, + { "[SCAMP] Samsung SPC-6033P", "spc6033p", MACHINE_TYPE_386SX, MACHINE_CHIPSET_VLSI_SCAMP, machine_at_spc6033p_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 2048, 12288, 2048, 127, at_spc6033p_get_device, NULL }, /* Has an unknown AMI KBC firmware, I'm going to assume 'F' until a photo or real hardware BIOS string is found. */ { "[SCAT] KMX-C-02", "kmxc02", MACHINE_TYPE_386SX, MACHINE_CHIPSET_SCAT, machine_at_kmxc02_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386SX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_FLAGS_NONE, 512, 16384, 512, 127, NULL, NULL }, @@ -383,7 +383,7 @@ const machine_t machines[] = { #if defined(DEV_BRANCH) && defined(USE_DESKPRO386) { "[ISA] Compaq Deskpro 386", "deskpro386", MACHINE_TYPE_386DX, MACHINE_CHIPSET_DISCRETE, machine_at_deskpro386_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386DX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_IDE, 1024, 14336, 1024, 127, NULL, NULL }, #endif - { "[ISA] Compaq Portable III (386)", "portableiii386", MACHINE_TYPE_386DX, MACHINE_CHIPSET_DISCRETE, machine_at_portableiii386_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386DX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_IDE | MACHINE_VIDEO, 1024, 14336, 1024, 127, at_cpqiii_get_device }, + { "[ISA] Compaq Portable III (386)", "portableiii386", MACHINE_TYPE_386DX, MACHINE_CHIPSET_DISCRETE, machine_at_portableiii386_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386DX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_IDE | MACHINE_VIDEO, 1024, 14336, 1024, 127, at_cpqiii_get_device, NULL }, /* Has IBM AT KBC firmware. */ { "[ISA] Micronics 09-00021", "micronics386", MACHINE_TYPE_386DX, MACHINE_CHIPSET_DISCRETE, machine_at_micronics386_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_386DX, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_AT, MACHINE_FLAGS_NONE, 512, 8192, 128, 127, NULL, NULL }, /* Has AMIKey F KBC firmware. */ @@ -437,9 +437,9 @@ const machine_t machines[] = { /* According to Deksor on the Win3x.org forum, the BIOS string ends in a -0, indicating an unknown KBC firmware. But it does send the AMIKey get version command, so it must expect an AMIKey. */ - { "[VLSI 82C480] HP Vectra 486VL", "vect486vl", MACHINE_TYPE_486, MACHINE_CHIPSET_VLSI_VL82C480, machine_at_vect486vl_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET1, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 2048, 32768, 2048, 127, at_vect486vl_get_device }, + { "[VLSI 82C480] HP Vectra 486VL", "vect486vl", MACHINE_TYPE_486, MACHINE_CHIPSET_VLSI_VL82C480, machine_at_vect486vl_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET1, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 2048, 32768, 2048, 127, at_vect486vl_get_device, NULL }, /* Has a standard IBM PS/2 KBC firmware or a clone thereof. */ - { "[VLSI 82C481] Siemens Nixdorf D824", "d824", MACHINE_TYPE_486, MACHINE_CHIPSET_VLSI_VL82C481, machine_at_d824_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET1, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 2048, 32768, 2048, 127, at_d824_get_device }, + { "[VLSI 82C481] Siemens Nixdorf D824", "d824", MACHINE_TYPE_486, MACHINE_CHIPSET_VLSI_VL82C481, machine_at_d824_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET1, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 2048, 32768, 2048, 127, at_d824_get_device, NULL }, /* 486 machines - Socket 2 */ /* 486 machines with just the ISA slot */ @@ -447,7 +447,7 @@ const machine_t machines[] = { command C7 (OR input byte with received data byte). */ { "[ACC 2168] Packard Bell PB410A", "pb410a", MACHINE_TYPE_486_S2, MACHINE_CHIPSET_ACC_2168, machine_at_pb410a_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET3, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE | MACHINE_VIDEO, 4096, 36864, 1024, 127, NULL, NULL }, /* Uses an ACER/NEC 90M002A (UPD82C42C, 8042 clone) with unknown firmware (V4.01H). */ - { "[ALi M1429G] Acer A1G", "acera1g", MACHINE_TYPE_486_S2, MACHINE_CHIPSET_ALI_M1429G, machine_at_acera1g_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET3, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE_DUAL | MACHINE_VIDEO, 4096, 36864, 1024, 127, at_acera1g_get_device }, + { "[ALi M1429G] Acer A1G", "acera1g", MACHINE_TYPE_486_S2, MACHINE_CHIPSET_ALI_M1429G, machine_at_acera1g_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET3, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2, MACHINE_IDE_DUAL | MACHINE_VIDEO, 4096, 36864, 1024, 127, at_acera1g_get_device, NULL }, /* This has an AMIKey-2, which is an updated version of type 'H'. */ { "[ALi M1429G] Kaimei SA-486 VL-BUS M.B.", "win486", MACHINE_TYPE_486_S2, MACHINE_CHIPSET_ALI_M1429G, machine_at_winbios1429_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET3, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_VLB, MACHINE_IDE, 1024, 32768, 1024, 127, NULL, NULL }, /* Uses an Intel KBC with Phoenix MultiKey KBC firmware. */ @@ -483,7 +483,7 @@ const machine_t machines[] = { /* 486 machines which utilize the PCI bus */ /* This has an AMIKey-2, which is an updated version of type 'H'. */ - { "[ALi M1489] AAEON SBC-490", "sbc490", MACHINE_TYPE_486_S3, MACHINE_CHIPSET_ALI_M1489, machine_at_sbc490_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET3, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 1024, 65536, 1024, 255, at_sbc490_get_device }, + { "[ALi M1489] AAEON SBC-490", "sbc490", MACHINE_TYPE_486_S3, MACHINE_CHIPSET_ALI_M1489, machine_at_sbc490_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET3, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 1024, 65536, 1024, 255, at_sbc490_get_device, NULL }, /* Has the ALi M1487/9's on-chip keyboard controller which clones a standard AT KBC. */ { "[ALi M1489] ABIT AB-PB4", "abpb4", MACHINE_TYPE_486_S3, MACHINE_CHIPSET_ALI_M1489, machine_at_abpb4_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET3, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_PCI, MACHINE_IDE_DUAL, 1024, 65536, 1024, 255, NULL, NULL }, @@ -593,7 +593,7 @@ const machine_t machines[] = { /* Has AMI MegaKey KBC firmware. */ { "[i430LX] Micro Star 586MC1", "586mc1", MACHINE_TYPE_SOCKET4, MACHINE_CHIPSET_INTEL_430LX, machine_at_586mc1_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET4, CPU_BLOCK_NONE, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 2048, 131072, 2048, 127, NULL, NULL }, /* This has the Phoenix MultiKey KBC firmware. */ - { "[i430LX] Packard Bell PB520R", "pb520r", MACHINE_TYPE_SOCKET4, MACHINE_CHIPSET_INTEL_430LX, machine_at_pb520r_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET4, CPU_BLOCK_NONE, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 139264, 2048, 127, at_pb520r_get_device }, + { "[i430LX] Packard Bell PB520R", "pb520r", MACHINE_TYPE_SOCKET4, MACHINE_CHIPSET_INTEL_430LX, machine_at_pb520r_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET4, CPU_BLOCK_NONE, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 139264, 2048, 127, at_pb520r_get_device, NULL }, /* OPTi 596/597 */ /* This uses an AMI KBC firmware in PS/2 mode (it sends command A5 with the @@ -666,24 +666,24 @@ const machine_t machines[] = { { "[i430FX] Gateway 2000 Thor", "gw2katx", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_gw2katx_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, NULL, NULL }, /* The BIOS does not send a single non-standard KBC command, but the board has a SMC Super I/O chip with on-chip KBC and AMI MegaKey KBC firmware. */ - { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_vectra54_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 511, at_vectra54_get_device }, + { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_vectra54_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 511, at_vectra54_get_device, NULL }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the PC87306 Super I/O chip, command 0xA1 returns '5'. Command 0xA0 copyright string: (C)1994 AMI . */ - { "[i430FX] Intel Advanced/ATX", "thor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_thor_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_thor_get_device }, + { "[i430FX] Intel Advanced/ATX", "thor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_thor_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_thor_get_device, NULL }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the PC87306 Super I/O chip, command 0xA1 returns '5'. Command 0xA0 copyright string: (C)1994 AMI . */ - { "[i430FX] Intel Advanced/ATX (MR BIOS)", "mrthor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_mrthor_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, at_mrthor_get_device }, + { "[i430FX] Intel Advanced/ATX (MR BIOS)", "mrthor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_mrthor_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, at_mrthor_get_device, NULL }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the PC87306 Super I/O chip, command 0xA1 returns '5'. Command 0xA0 copyright string: (C)1994 AMI . */ - { "[i430FX] Intel Advanced/EV", "endeavor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_endeavor_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_endeavor_get_device }, + { "[i430FX] Intel Advanced/EV", "endeavor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_endeavor_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_endeavor_get_device, NULL }, /* This has an AMIKey-2, which is an updated version of type 'H'. */ { "[i430FX] MSI MS-5119", "ms5119", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_ms5119_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 2500, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, NULL, NULL }, /* This most likely uses AMI MegaKey KBC firmware as well due to having the same Super I/O chip (that has the KBC firmware on it) as eg. the Advanced/EV. */ - { "[i430FX] Packard Bell PB640", "pb640", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_pb640_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_pb640_get_device }, + { "[i430FX] Packard Bell PB640", "pb640", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_pb640_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_pb640_get_device, NULL }, /* Has an AMI 'H' KBC firmware (1992). */ { "[i430FX] QDI FMB", "fmb", MACHINE_TYPE_SOCKET7_3V, MACHINE_CHIPSET_INTEL_430FX, machine_at_fmb_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_QDI_FMB, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, NULL, NULL }, @@ -748,9 +748,9 @@ const machine_t machines[] = { { "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, MACHINE_CHIPSET_INTEL_430VX, machine_at_8500tvxa_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 2600, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, NULL, NULL }, /* The BIOS does not send a single non-standard KBC command, but the board has a SMC Super I/O chip with on-chip KBC and AMI MegaKey KBC firmware. */ - { "[i430VX] Compaq Presario 2240", "presario2240", MACHINE_TYPE_SOCKET7, MACHINE_CHIPSET_INTEL_430VX, machine_at_presario2240_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_presario2240_get_device }, + { "[i430VX] Compaq Presario 2240", "presario2240", MACHINE_TYPE_SOCKET7, MACHINE_CHIPSET_INTEL_430VX, machine_at_presario2240_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_presario2240_get_device, NULL }, /* This most likely has AMI MegaKey as above. */ - { "[i430VX] Compaq Presario 4500", "presario4500", MACHINE_TYPE_SOCKET7, MACHINE_CHIPSET_INTEL_430VX, machine_at_presario4500_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_presario4500_get_device }, + { "[i430VX] Compaq Presario 4500", "presario4500", MACHINE_TYPE_SOCKET7, MACHINE_CHIPSET_INTEL_430VX, machine_at_presario4500_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, at_presario4500_get_device, NULL }, /* The BIOS sends KBC command CB which is an AMI KBC command, so it has an AMI KBC firmware. */ { "[i430VX] Epox P55-VA", "p55va", MACHINE_TYPE_SOCKET7, MACHINE_CHIPSET_INTEL_430VX, machine_at_p55va_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET5_7, CPU_BLOCK_NONE, 50000000, 66666667, 2500, 3520, 1.5, 3.0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, NULL, NULL }, /* The BIOS does not send a single non-standard KBC command. */ @@ -905,7 +905,7 @@ const machine_t machines[] = { { "[i440BX] HP Vectra VEi 8", "vei8", MACHINE_TYPE_SLOT1, MACHINE_CHIPSET_INTEL_440BX, machine_at_vei8_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK_NONE, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, NULL, NULL }, /* Has a National Semiconductors PC87309 Super I/O chip with on-chip KBC with most likely AMIKey-2 KBC firmware. */ - { "[i440BX] Tyan Tsunami ATX", "s1846", MACHINE_TYPE_SLOT1, MACHINE_CHIPSET_INTEL_440BX, machine_at_s1846_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK_NONE, 66666667, 112121212, 1800, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL | MACHINE_SOUND, 8192,1048576, 8192, 255, at_s1846_get_device }, + { "[i440BX] Tyan Tsunami ATX", "s1846", MACHINE_TYPE_SLOT1, MACHINE_CHIPSET_INTEL_440BX, machine_at_s1846_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK_NONE, 66666667, 112121212, 1800, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL | MACHINE_SOUND, 8192,1048576, 8192, 255, at_s1846_get_device, NULL }, /* Has a Winbond W83977TF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ { "[i440BX] Supermicro P6SBA", "p6sba", MACHINE_TYPE_SLOT1, MACHINE_CHIPSET_INTEL_440BX, machine_at_p6sba_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK_NONE, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, NULL, NULL }, @@ -913,10 +913,10 @@ const machine_t machines[] = { /* 440ZX */ /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440ZX] MSI MS-6168", "ms6168", MACHINE_TYPE_SLOT1, MACHINE_CHIPSET_INTEL_440ZX, machine_at_ms6168_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK_NONE, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL | MACHINE_AV, 8192, 524288, 8192, 255, at_ms6168_get_device }, + { "[i440ZX] MSI MS-6168", "ms6168", MACHINE_TYPE_SLOT1, MACHINE_CHIPSET_INTEL_440ZX, machine_at_ms6168_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK_NONE, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL | MACHINE_AV, 8192, 524288, 8192, 255, at_ms6168_get_device, NULL }, /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440ZX] Packard Bell Bora Pro", "borapro", MACHINE_TYPE_SLOT1, MACHINE_CHIPSET_INTEL_440ZX, machine_at_borapro_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK_NONE, 66666667, 66666667, 1800, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL | MACHINE_AV, 8192, 524288, 8192, 255, at_borapro_get_device }, + { "[i440ZX] Packard Bell Bora Pro", "borapro", MACHINE_TYPE_SLOT1, MACHINE_CHIPSET_INTEL_440ZX, machine_at_borapro_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK_NONE, 66666667, 66666667, 1800, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL | MACHINE_AV, 8192, 524288, 8192, 255, at_borapro_get_device, NULL }, /* SMSC VictoryBX-66 */ /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC @@ -944,7 +944,7 @@ const machine_t machines[] = { /* 440BX */ /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440BX] Tyan Trinity 371", "s1857", MACHINE_TYPE_SLOT1_370, MACHINE_CHIPSET_INTEL_440BX, machine_at_s1857_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1 | CPU_PKG_SOCKET370, CPU_BLOCK_NONE, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, at_s1857_get_device }, + { "[i440BX] Tyan Trinity 371", "s1857", MACHINE_TYPE_SLOT1_370, MACHINE_CHIPSET_INTEL_440BX, machine_at_s1857_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1 | CPU_PKG_SOCKET370, CPU_BLOCK_NONE, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, at_s1857_get_device, NULL }, /* Slot 2 machines */ /* 440GX */ @@ -994,17 +994,17 @@ const machine_t machines[] = { { "[VIA Apollo Pro 133A] Acorp 6VIA90AP", "6via90ap", MACHINE_TYPE_SOCKET370, MACHINE_CHIPSET_VIA_APOLLO_PRO_133A, machine_at_6via90ap_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET370, CPU_BLOCK_NONE, 66666667, 150000000, 1300, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_PS2_A97, MACHINE_IDE_DUAL | MACHINE_AG, 16384, 3145728, 8192, 255, NULL, NULL }, /* Has the VIA VT82C686B southbridge with on-chip KBC identical to the VIA VT82C42N. */ - { "[VIA Apollo Pro 133A] ASUS CUV4X-LS", "cuv4xls", MACHINE_TYPE_SOCKET370, MACHINE_CHIPSET_VIA_APOLLO_PRO_133A, machine_at_cuv4xls_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET370, CPU_BLOCK_NONE, 66666667, 150000000, 1300, 3500, 1.5, 8.0, MACHINE_PS2_NOI97, MACHINE_IDE_DUAL | MACHINE_SOUND, 16384, 4194304, 8192, 255, at_cuv4xls_get_device }, + { "[VIA Apollo Pro 133A] ASUS CUV4X-LS", "cuv4xls", MACHINE_TYPE_SOCKET370, MACHINE_CHIPSET_VIA_APOLLO_PRO_133A, machine_at_cuv4xls_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET370, CPU_BLOCK_NONE, 66666667, 150000000, 1300, 3500, 1.5, 8.0, MACHINE_PS2_NOI97, MACHINE_IDE_DUAL | MACHINE_SOUND, 16384, 4194304, 8192, 255, at_cuv4xls_get_device, NULL }, /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[VIA Apollo Pro 133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, MACHINE_CHIPSET_VIA_APOLLO_PRO_133A, machine_at_gt694va_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET370, CPU_BLOCK_NONE, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL | MACHINE_SOUND, 16384, 3145728, 8192, 255, at_gt694va_get_device }, + { "[VIA Apollo Pro 133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, MACHINE_CHIPSET_VIA_APOLLO_PRO_133A, machine_at_gt694va_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SOCKET370, CPU_BLOCK_NONE, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_PS2_AGP, MACHINE_IDE_DUAL | MACHINE_SOUND, 16384, 3145728, 8192, 255, at_gt694va_get_device, NULL }, /* Miscellaneous/Fake/Hypervisor machines */ /* Has a Winbond W83977F Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ { "[i440BX] Microsoft Virtual PC 2007", "vpc2007", MACHINE_TYPE_MISC, MACHINE_CHIPSET_INTEL_440BX, machine_at_vpc2007_init, 0, 0, MACHINE_AVAILABLE, 0 , CPU_PKG_SLOT1, CPU_BLOCK(CPU_PENTIUM2, CPU_CYRIX3S), 0, 66666667, 0, 0, 0, 0, MACHINE_PS2_PCI, MACHINE_IDE_DUAL, 8192, 1048576, 8192, 255, NULL, NULL }, - { NULL, NULL, MACHINE_TYPE_NONE, MACHINE_CHIPSET_NONE, NULL, 0, 0, MACHINE_AVAILABLE, 0 , 0, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_BUS_NONE, MACHINE_FLAGS_NONE, 0, 0, 0, 0, NULL } + { NULL, NULL, MACHINE_TYPE_NONE, MACHINE_CHIPSET_NONE, NULL, 0, 0, MACHINE_AVAILABLE, 0 , 0, CPU_BLOCK_NONE, 0, 0, 0, 0, 0, 0, MACHINE_BUS_NONE, MACHINE_FLAGS_NONE, 0, 0, 0, 0, NULL, NULL } }; int From d30a5c7ef30fe9fa06fcb7705e31a0660ff88ea5 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 18 Apr 2022 21:49:26 +0200 Subject: [PATCH 06/20] Removed a debug fatal() that should have been removed ages ago. --- src/cpu/x86seg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/cpu/x86seg.c b/src/cpu/x86seg.c index f4f343f4f..67cf04222 100644 --- a/src/cpu/x86seg.c +++ b/src/cpu/x86seg.c @@ -258,9 +258,6 @@ do_seg_load(x86seg *s, uint16_t *segdat) else cpu_cur_status |= CPU_STATUS_NOTFLATSS; } - - if (s->base == 0xffffffff) - fatal("do_seg_load(): %04X%04X%04X%04X\n", segdat[3], segdat[2], segdat[1], segdat[0]); } From 27c78d40c51e9a8423e24b7892546a56741749d5 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Tue, 19 Apr 2022 18:36:30 -0400 Subject: [PATCH 07/20] Reorganise --- src/win/Makefile.mingw | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index f23bd97d3..d956b4586 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -64,6 +64,9 @@ ifeq ($(DEV_BUILD), y) ifndef MGA MGA := y endif + ifndef OLIVETTI + OLIVETTI := y + endif ifndef OPEN_AT OPEN_AT := y endif @@ -73,18 +76,15 @@ ifeq ($(DEV_BUILD), y) ifndef SIO_DETECT SIO_DETECT := y endif - ifndef VGAWONDER - VGAWONDER := y - endif ifndef TANDY_ISA TANDY_ISA := y endif + ifndef VGAWONDER + VGAWONDER := y + endif ifndef XL24 XL24 := y endif - ifndef OLIVETTI - OLIVETTI := y - endif ifndef NEW_KBC NEW_KBC := n endif @@ -125,6 +125,9 @@ else ifndef MGA MGA := n endif + ifndef OLIVETTI + OLIVETTI := n + endif ifndef OPEN_AT OPEN_AT := n endif @@ -134,18 +137,15 @@ else ifndef SIO_DETECT SIO_DETECT := n endif - ifndef VGAWONDER - VGAWONDER := n - endif ifndef TANDY_ISA TANDY_ISA := n endif + ifndef VGAWONDER + VGAWONDER := n + endif ifndef XL24 XL24 := n endif - ifndef OLIVETTI - OLIVETTI := n - endif ifndef NEW_KBC NEW_KBC := n endif From e60af6c29d87b1cd1e58a8435d9ca97567af2912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Tue, 19 Apr 2022 23:06:39 +0200 Subject: [PATCH 08/20] Clean up plat.h a bit --- src/86box.c | 32 +++++++++-------- src/cdrom/cdrom_image.c | 3 +- src/cdrom/cdrom_image_backend.c | 5 +-- src/config.c | 9 ++--- src/disk/hdd_image.c | 9 ++--- src/disk/mo.c | 3 +- src/floppy/fdd.c | 3 +- src/floppy/fdd_img.c | 3 +- src/gdbstub.c | 1 + src/include/86box/path.h | 7 ++++ src/include/86box/plat.h | 50 -------------------------- src/include/86box/thread.h | 46 ++++++++++++++++++++++++ src/mem/rom.c | 11 +++--- src/network/net_pcap.c | 1 + src/network/net_slirp.c | 1 + src/network/network.c | 1 + src/nvr.c | 3 +- src/printer/prt_escp.c | 9 ++--- src/printer/prt_ps.c | 9 ++--- src/printer/prt_text.c | 5 +-- src/qt/qt_platform.cpp | 21 +++++------ src/sound/midi_fluidsynth.c | 1 + src/sound/midi_mt32.c | 1 + src/sound/sound.c | 1 + src/thread.cpp | 1 + src/unix/unix.c | 24 +++++++------ src/unix/unix_thread.c | 1 + src/video/vid_ati_mach64.c | 1 + src/video/vid_im1024.c | 1 + src/video/vid_mga.c | 1 + src/video/vid_pgc.c | 1 + src/video/vid_s3.c | 1 + src/video/vid_s3_virge.c | 1 + src/video/vid_voodoo.c | 1 + src/video/vid_voodoo_banshee.c | 1 + src/video/vid_voodoo_banshee_blitter.c | 1 + src/video/vid_voodoo_blitter.c | 1 + src/video/vid_voodoo_display.c | 1 + src/video/vid_voodoo_fb.c | 1 + src/video/vid_voodoo_fifo.c | 1 + src/video/vid_voodoo_reg.c | 1 + src/video/vid_voodoo_render.c | 1 + src/video/vid_voodoo_setup.c | 1 + src/video/vid_voodoo_texture.c | 1 + src/video/video.c | 6 ++-- src/win/win.c | 18 +++++----- src/win/win_icon.c | 11 +++--- src/win/win_opengl.c | 1 + src/win/win_thread.c | 1 + 49 files changed, 184 insertions(+), 131 deletions(-) create mode 100644 src/include/86box/path.h create mode 100644 src/include/86box/thread.h diff --git a/src/86box.c b/src/86box.c index 8011b7e7c..4d59d9e13 100644 --- a/src/86box.c +++ b/src/86box.c @@ -91,7 +91,9 @@ #include <86box/snd_speaker.h> #include <86box/video.h> #include <86box/ui.h> +#include <86box/path.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/version.h> #include <86box/gdbstub.h> @@ -411,14 +413,14 @@ pc_init(int argc, char *argv[]) /* Grab the executable's full path. */ plat_get_exe_name(exe_path, sizeof(exe_path)-1); - p = plat_get_filename(exe_path); + p = path_get_filename(exe_path); *p = '\0'; #if !defined(_WIN32) && !defined(__APPLE__) /* Grab the actual path if we are an AppImage. */ appimage = getenv("APPIMAGE"); if (appimage && (appimage[0] != '\0')) { - plat_get_dirname(exe_path, appimage); + path_get_dirname(exe_path, appimage); } #endif @@ -557,8 +559,8 @@ usage: if (c != argc) goto usage; - plat_path_slash(usr_path); - plat_path_slash(rom_path); + path_slash(usr_path); + path_slash(rom_path); /* * If the user provided a path for files, use that @@ -567,7 +569,7 @@ usage: * make it absolute. */ if (ppath != NULL) { - if (! plat_path_abs(ppath)) { + if (! path_abs(ppath)) { /* * This looks like a relative path. * @@ -590,11 +592,11 @@ usage: } // Add the VM-local ROM path. - plat_append_filename(temp, usr_path, "roms"); + path_append_filename(temp, usr_path, "roms"); rom_add_path(temp); // Add the standard ROM path in the same directory as the executable. - plat_append_filename(temp, exe_path, "roms"); + path_append_filename(temp, exe_path, "roms"); rom_add_path(temp); plat_init_rom_paths(); @@ -606,7 +608,7 @@ usage: * make it absolute. */ if (rpath != NULL) { - if (! plat_path_abs(rpath)) { + if (! path_abs(rpath)) { /* * This looks like a relative path. * @@ -641,7 +643,7 @@ usage: * This can happen when people load a config * file using the UI, for example. */ - p = plat_get_filename(cfg); + p = path_get_filename(cfg); if (cfg != p) { /* * OK, the configuration file name has a @@ -656,19 +658,19 @@ usage: * Otherwise, assume the pathname given is * relative to whatever the usr_path is. */ - if (plat_path_abs(cfg)) + if (path_abs(cfg)) strcpy(usr_path, cfg); else strcat(usr_path, cfg); } /* Make sure we have a trailing backslash. */ - plat_path_slash(usr_path); + path_slash(usr_path); if (rom_path[0] != '\0') - plat_path_slash(rom_path); + path_slash(rom_path); /* At this point, we can safely create the full path name. */ - plat_append_filename(cfg_path, usr_path, p); + path_append_filename(cfg_path, usr_path, p); /* * Get the current directory's name @@ -679,8 +681,8 @@ usage: */ if (strlen(vm_name) == 0) { char ltemp[1024] = { '\0'}; - plat_get_dirname(ltemp, usr_path); - strcpy(vm_name, plat_get_filename(ltemp)); + path_get_dirname(ltemp, usr_path); + strcpy(vm_name, path_get_filename(ltemp)); } /* diff --git a/src/cdrom/cdrom_image.c b/src/cdrom/cdrom_image.c index 582b0631b..9a653b310 100644 --- a/src/cdrom/cdrom_image.c +++ b/src/cdrom/cdrom_image.c @@ -26,6 +26,7 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/config.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/scsi_device.h> #include <86box/cdrom_image_backend.h> @@ -286,7 +287,7 @@ cdrom_image_open(cdrom_t *dev, const char *fn) return image_open_abort(dev); /* All good, reset state. */ - if (! strcasecmp(plat_get_extension((char *) fn), "ISO")) + if (! strcasecmp(path_get_extension((char *) fn), "ISO")) dev->cd_status = CD_STATUS_DATA_ONLY; else dev->cd_status = CD_STATUS_STOPPED; diff --git a/src/cdrom/cdrom_image_backend.c b/src/cdrom/cdrom_image_backend.c index 19f790cf3..72c49304a 100644 --- a/src/cdrom/cdrom_image_backend.c +++ b/src/cdrom/cdrom_image_backend.c @@ -33,6 +33,7 @@ #include #define HAVE_STDARG_H #include <86box/86box.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/cdrom_image_backend.h> @@ -831,7 +832,7 @@ cdi_load_cue(cd_img_t *cdi, const char *cuefile) /* Get a copy of the filename into pathname, we need it later. */ memset(pathname, 0, MAX_FILENAME_LENGTH * sizeof(char)); - plat_get_dirname(pathname, cuefile); + path_get_dirname(pathname, cuefile); /* Open the file. */ fp = plat_fopen(cuefile, "r"); @@ -986,7 +987,7 @@ cdi_load_cue(cd_img_t *cdi, const char *cuefile) if (!strcmp(type, "BINARY")) { memset(temp, 0, MAX_FILENAME_LENGTH * sizeof(char)); - plat_append_filename(filename, pathname, ansi); + path_append_filename(filename, pathname, ansi); trk.file = track_file_init(filename, &error); } if (error) { diff --git a/src/config.c b/src/config.c index 27f0fb9ee..556a13b09 100644 --- a/src/config.c +++ b/src/config.c @@ -63,6 +63,7 @@ #include <86box/midi.h> #include <86box/snd_mpu401.h> #include <86box/video.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/plat_dir.h> #include <86box/ui.h> @@ -1422,12 +1423,12 @@ load_hard_disks(void) wcsncpy(hdd[c].fn, &wp[wcslen(usr_path)], sizeof_w(hdd[c].fn)); } else #endif - if (plat_path_abs(p)) { + if (path_abs(p)) { strncpy(hdd[c].fn, p, sizeof(hdd[c].fn) - 1); } else { - plat_append_filename(hdd[c].fn, usr_path, p); + path_append_filename(hdd[c].fn, usr_path, p); } - plat_path_normalize(hdd[c].fn); + path_normalize(hdd[c].fn); /* If disk is empty or invalid, mark it for deletion. */ if (! hdd_is_valid(c)) { @@ -2841,7 +2842,7 @@ save_hard_disks(void) sprintf(temp, "hdd_%02i_fn", c+1); if (hdd_is_valid(c) && (strlen(hdd[c].fn) != 0)) { - plat_path_normalize(hdd[c].fn); + path_normalize(hdd[c].fn); if (!strnicmp(hdd[c].fn, usr_path, strlen(usr_path))) config_set_string(cat, temp, &hdd[c].fn[strlen(usr_path)]); else diff --git a/src/disk/hdd_image.c b/src/disk/hdd_image.c index d0ec68fc4..eff860804 100644 --- a/src/disk/hdd_image.c +++ b/src/disk/hdd_image.c @@ -27,6 +27,7 @@ #include #define HAVE_STDARG_H #include <86box/86box.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/random.h> #include <86box/hdd.h> @@ -76,7 +77,7 @@ hdd_image_log(const char *fmt, ...) int image_is_hdi(const char *s) { - if (! strcasecmp(plat_get_extension((char *) s), "HDI")) + if (! strcasecmp(path_get_extension((char *) s), "HDI")) return 1; else return 0; @@ -90,7 +91,7 @@ image_is_hdx(const char *s, int check_signature) uint64_t filelen; uint64_t signature; - if (! strcasecmp(plat_get_extension((char *) s), "HDX")) { + if (! strcasecmp(path_get_extension((char *) s), "HDX")) { if (check_signature) { f = plat_fopen(s, "rb"); if (!f) @@ -124,7 +125,7 @@ image_is_vhd(const char *s, int check_signature) { FILE* f; - if (! strcasecmp(plat_get_extension((char *) s), "VHD")) { + if (! strcasecmp(path_get_extension((char *) s), "VHD")) { if (check_signature) { f = plat_fopen(s, "rb"); if (!f) @@ -251,7 +252,7 @@ hdd_image_load(int id) memset(empty_sector, 0, sizeof(empty_sector)); if (fn) { - plat_path_normalize(fn); + path_normalize(fn); } diff --git a/src/disk/mo.c b/src/disk/mo.c index a07349e59..d30cf9d94 100644 --- a/src/disk/mo.c +++ b/src/disk/mo.c @@ -33,6 +33,7 @@ #include <86box/device.h> #include <86box/scsi_device.h> #include <86box/nvr.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/ui.h> #include <86box/hdc.h> @@ -332,7 +333,7 @@ mo_load_abort(mo_t *dev) int image_is_mdi(const char *s) { - if (! strcasecmp(plat_get_extension((char *) s), "MDI")) + if (! strcasecmp(path_get_extension((char *) s), "MDI")) return 1; else return 0; diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 1344c3f02..2f3dd4fc9 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -26,6 +26,7 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/timer.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/ui.h> #include <86box/fdd.h> @@ -485,7 +486,7 @@ fdd_load(int drive, char *fn) if (!fn) return; - p = plat_get_extension(fn); + p = path_get_extension(fn); if (!p) return; f = plat_fopen(fn, "rb"); diff --git a/src/floppy/fdd_img.c b/src/floppy/fdd_img.c index a8704e7ff..722a25af9 100644 --- a/src/floppy/fdd_img.c +++ b/src/floppy/fdd_img.c @@ -33,6 +33,7 @@ #include <86box/86box.h> #include <86box/timer.h> #include <86box/config.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/fdd.h> #include <86box/fdd_86f.h> @@ -644,7 +645,7 @@ img_load(int drive, char *fn) int size; int i; - ext = plat_get_extension(fn); + ext = path_get_extension(fn); d86f_unregister(drive); diff --git a/src/gdbstub.c b/src/gdbstub.c index 7ce2f360f..8ef15d7c8 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -38,6 +38,7 @@ #include <86box/io.h> #include <86box/mem.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/gdbstub.h> #define FAST_RESPONSE(s) \ diff --git a/src/include/86box/path.h b/src/include/86box/path.h new file mode 100644 index 000000000..85cb0814d --- /dev/null +++ b/src/include/86box/path.h @@ -0,0 +1,7 @@ +extern void path_get_dirname(char *dest, const char *path); +extern char *path_get_filename(char *s); +extern char *path_get_extension(char *s); +extern void path_append_filename(char *dest, const char *s1, const char *s2); +extern void path_slash(char *path); +extern void path_normalize(char *path); +extern int path_abs(char *path); \ No newline at end of file diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index ad7006165..1f787da9e 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -105,15 +105,6 @@ extern int plat_chdir(char *path); extern void plat_tempfile(char *bufp, char *prefix, char *suffix); extern void plat_get_exe_name(char *s, int size); extern void plat_init_rom_paths(); -extern char *plat_get_basename(const char *path); -extern void plat_get_dirname(char *dest, const char *path); -extern char *plat_get_filename(char *s); -extern char *plat_get_extension(char *s); -extern void plat_append_filename(char *dest, const char *s1, const char *s2); -extern void plat_put_backslash(char *s); -extern void plat_path_slash(char *path); -extern void plat_path_normalize(char *path); -extern int plat_path_abs(char *path); extern int plat_dir_check(char *path); extern int plat_dir_create(char *path); extern void *plat_mmap(size_t size, uint8_t executable); @@ -169,47 +160,6 @@ extern int ioctl_open(uint8_t id, char d); extern void ioctl_reset(uint8_t id); extern void ioctl_close(uint8_t id); -#ifdef __APPLE__ -#define thread_t plat_thread_t -#define event_t plat_event_t -#define mutex_t plat_mutex_t - -#define thread_create plat_thread_create -#define thread_wait plat_thread_wait -#define thread_create_event plat_thread_create_event -#define thread_set_event plat_thread_set_event -#define thread_reset_event plat_thread_reset_event -#define thread_wait_event plat_thread_wait_event -#define thread_destroy_event plat_thread_destroy_event - -#define thread_create_mutex plat_thread_create_mutex -#define thread_create_mutex_with_spin_count plat_thread_create_mutex_with_spin_count -#define thread_close_mutex plat_thread_close_mutex -#define thread_wait_mutex plat_thread_wait_mutex -#define thread_release_mutex plat_thread_release_mutex -#endif - -/* Thread support. */ -typedef void thread_t; -typedef void event_t; -typedef void mutex_t; - -extern thread_t *thread_create(void (*thread_func)(void *param), void *param); -extern int thread_wait(thread_t *arg); -extern event_t *thread_create_event(void); -extern void thread_set_event(event_t *arg); -extern void thread_reset_event(event_t *arg); -extern int thread_wait_event(event_t *arg, int timeout); -extern void thread_destroy_event(event_t *arg); - -#define MUTEX_DEFAULT_SPIN_COUNT 1024 - -extern mutex_t *thread_create_mutex(void); -extern void thread_close_mutex(mutex_t *arg); -extern int thread_test_mutex(mutex_t *arg); -extern int thread_wait_mutex(mutex_t *arg); -extern int thread_release_mutex(mutex_t *mutex); - /* Other stuff. */ extern void startblit(void); extern void endblit(void); diff --git a/src/include/86box/thread.h b/src/include/86box/thread.h new file mode 100644 index 000000000..a34dbefb5 --- /dev/null +++ b/src/include/86box/thread.h @@ -0,0 +1,46 @@ +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __APPLE__ +#define thread_t plat_thread_t +#define event_t plat_event_t +#define mutex_t plat_mutex_t + +#define thread_create plat_thread_create +#define thread_wait plat_thread_wait +#define thread_create_event plat_thread_create_event +#define thread_set_event plat_thread_set_event +#define thread_reset_event plat_thread_reset_event +#define thread_wait_event plat_thread_wait_event +#define thread_destroy_event plat_thread_destroy_event + +#define thread_create_mutex plat_thread_create_mutex +#define thread_create_mutex_with_spin_count plat_thread_create_mutex_with_spin_count +#define thread_close_mutex plat_thread_close_mutex +#define thread_wait_mutex plat_thread_wait_mutex +#define thread_release_mutex plat_thread_release_mutex +#endif + +/* Thread support. */ +typedef void thread_t; +typedef void event_t; +typedef void mutex_t; + +extern thread_t *thread_create(void (*thread_func)(void *param), void *param); +extern int thread_wait(thread_t *arg); +extern event_t *thread_create_event(void); +extern void thread_set_event(event_t *arg); +extern void thread_reset_event(event_t *arg); +extern int thread_wait_event(event_t *arg, int timeout); +extern void thread_destroy_event(event_t *arg); + +extern mutex_t *thread_create_mutex(void); +extern void thread_close_mutex(mutex_t *arg); +extern int thread_test_mutex(mutex_t *arg); +extern int thread_wait_mutex(mutex_t *arg); +extern int thread_release_mutex(mutex_t *mutex); + +#ifdef __cplusplus +} +#endif diff --git a/src/mem/rom.c b/src/mem/rom.c index 3373ca530..62b03bc11 100644 --- a/src/mem/rom.c +++ b/src/mem/rom.c @@ -33,6 +33,7 @@ #include "cpu.h" #include <86box/mem.h> #include <86box/rom.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/machine.h> #include <86box/m_xt_xi8088.h> @@ -76,16 +77,16 @@ rom_add_path(const char* path) } // Save the path, turning it into absolute if needed. - if (!plat_path_abs((char*) path)) { + if (!path_abs((char*) path)) { plat_getcwd(cwd, sizeof(cwd)); - plat_path_slash(cwd); + path_slash(cwd); snprintf(rom_path->path, sizeof(rom_path->path), "%s%s", cwd, path); } else { snprintf(rom_path->path, sizeof(rom_path->path), "%s", path); } // Ensure the path ends with a separator. - plat_path_slash(rom_path->path); + path_slash(rom_path->path); } @@ -99,7 +100,7 @@ rom_fopen(char *fn, char *mode) if (strstr(fn, "roms/") == fn) { /* Relative path */ for (rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) { - plat_append_filename(temp, rom_path->path, fn + 5); + path_append_filename(temp, rom_path->path, fn + 5); if ((fp = plat_fopen(temp, mode)) != NULL) { return fp; @@ -123,7 +124,7 @@ rom_getfile(char *fn, char *s, int size) if (strstr(fn, "roms/") == fn) { /* Relative path */ for (rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) { - plat_append_filename(temp, rom_path->path, fn + 5); + path_append_filename(temp, rom_path->path, fn + 5); if (rom_present(temp)) { strncpy(s, temp, size); diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index 52573907b..049cd661a 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -55,6 +55,7 @@ #include <86box/device.h> #include <86box/plat.h> #include <86box/plat_dynld.h> +#include <86box/thread.h> #include <86box/network.h> diff --git a/src/network/net_slirp.c b/src/network/net_slirp.c index fc4afcf78..bc7c68783 100644 --- a/src/network/net_slirp.c +++ b/src/network/net_slirp.c @@ -30,6 +30,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/network.h> #include <86box/machine.h> #include <86box/timer.h> diff --git a/src/network/network.c b/src/network/network.c index 8f84be44e..49915024a 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -61,6 +61,7 @@ #include <86box/device.h> #include <86box/timer.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/ui.h> #include <86box/network.h> #include <86box/net_3c503.h> diff --git a/src/nvr.c b/src/nvr.c index 7f44981c2..b73aa6fa7 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -58,6 +58,7 @@ #include <86box/machine.h> #include <86box/mem.h> #include <86box/timer.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/nvr.h> @@ -213,7 +214,7 @@ nvr_path(char *str) plat_dir_create(temp); /* Now append the actual filename. */ - plat_path_slash(temp); + path_slash(temp); strcat(temp, str); return(temp); diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index e5f43257c..ec07dc95f 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -63,6 +63,7 @@ #include <86box/mem.h> #include <86box/rom.h> #include <86box/pit.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/plat_dynld.h> #include <86box/ui.h> @@ -596,7 +597,7 @@ update_font(escp_t *dev) /* Create a full pathname for the ROM file. */ strcpy(path, dev->fontpath); - plat_path_slash(path); + path_slash(path); strcat(path, fn); escp_log("Temp file=%s\n", path); @@ -2062,14 +2063,14 @@ escp_init(void *lpt) } strcpy(dev->fontpath, exe_path); - plat_path_slash(dev->fontpath); + path_slash(dev->fontpath); strcat(dev->fontpath, "roms/printer/fonts/"); /* Create the full path for the page images. */ - plat_append_filename(dev->pagepath, usr_path, "printer"); + path_append_filename(dev->pagepath, usr_path, "printer"); if (! plat_dir_check(dev->pagepath)) plat_dir_create(dev->pagepath); - plat_path_slash(dev->pagepath); + path_slash(dev->pagepath); dev->page_width = PAGE_WIDTH; dev->page_height = PAGE_HEIGHT; diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index e90e19e82..231707897 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -27,6 +27,7 @@ #include <86box/lpt.h> #include <86box/timer.h> #include <86box/pit.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/plat_dynld.h> #include <86box/ui.h> @@ -152,7 +153,7 @@ convert_to_pdf(ps_t *dev) char input_fn[1024], output_fn[1024], *gsargv[9]; strcpy(input_fn, dev->printer_path); - plat_path_slash(input_fn); + path_slash(input_fn); strcat(input_fn, dev->filename); strcpy(output_fn, input_fn); @@ -206,7 +207,7 @@ write_buffer(ps_t *dev, bool finish) plat_tempfile(dev->filename, NULL, ".ps"); strcpy(path, dev->printer_path); - plat_path_slash(path); + path_slash(path); strcat(path, dev->filename); fp = plat_fopen(path, "a"); @@ -365,10 +366,10 @@ ps_init(void *lpt) /* Cache print folder path. */ memset(dev->printer_path, 0x00, sizeof(dev->printer_path)); - plat_append_filename(dev->printer_path, usr_path, "printer"); + path_append_filename(dev->printer_path, usr_path, "printer"); if (!plat_dir_check(dev->printer_path)) plat_dir_create(dev->printer_path); - plat_path_slash(dev->printer_path); + path_slash(dev->printer_path); timer_add(&dev->pulse_timer, pulse_timer, dev, 0); timer_add(&dev->timeout_timer, timeout_timer, dev, 0); diff --git a/src/printer/prt_text.c b/src/printer/prt_text.c index 7c791227f..c57a4fef3 100644 --- a/src/printer/prt_text.c +++ b/src/printer/prt_text.c @@ -60,6 +60,7 @@ #include <86box/device.h> #include <86box/timer.h> #include <86box/pit.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/lpt.h> #include <86box/printer.h> @@ -150,10 +151,10 @@ dump_page(prnt_t *dev) /* Create the full path for this file. */ memset(path, 0x00, sizeof(path)); - plat_append_filename(path, usr_path, "printer"); + path_append_filename(path, usr_path, "printer"); if (! plat_dir_check(path)) plat_dir_create(path); - plat_path_slash(path); + path_slash(path); strcat(path, dev->filename); /* Create the file. */ diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 366e05970..499c6bbac 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -88,6 +88,7 @@ extern "C" { #include <86box/gameport.h> #include <86box/timer.h> #include <86box/nvr.h> +#include <86box/path.h> #include <86box/plat_dynld.h> #include <86box/mem.h> #include <86box/rom.h> @@ -140,7 +141,7 @@ void plat_get_exe_name(char *s, int size) memcpy(s, exepath_temp.data(), std::min((qsizetype)exepath_temp.size(),(qsizetype)size)); - plat_path_slash(s); + path_slash(s); } uint32_t @@ -188,14 +189,14 @@ plat_getcwd(char *bufp, int max) } void -plat_get_dirname(char *dest, const char *path) +path_get_dirname(char *dest, const char *path) { QFileInfo fi(path); CharPointer(dest, -1) = fi.dir().path().toUtf8(); } char * -plat_get_extension(char *s) +path_get_extension(char *s) { auto len = strlen(s); auto idx = QByteArray::fromRawData(s, len).lastIndexOf('.'); @@ -206,7 +207,7 @@ plat_get_extension(char *s) } char * -plat_get_filename(char *s) +path_get_filename(char *s) { #ifdef Q_OS_WINDOWS int c = strlen(s) - 1; @@ -228,7 +229,7 @@ plat_get_filename(char *s) } int -plat_path_abs(char *path) +path_abs(char *path) { #ifdef Q_OS_WINDOWS if ((path[1] == ':') || (path[0] == '\\') || (path[0] == '/')) @@ -241,7 +242,7 @@ plat_path_abs(char *path) } void -plat_path_normalize(char* path) +path_normalize(char* path) { #ifdef Q_OS_WINDOWS while (*path++ != 0) @@ -252,7 +253,7 @@ plat_path_normalize(char* path) } void -plat_path_slash(char *path) +path_slash(char *path) { auto len = strlen(path); auto separator = '/'; @@ -260,14 +261,14 @@ plat_path_slash(char *path) path[len] = separator; path[len+1] = 0; } - plat_path_normalize(path); + path_normalize(path); } void -plat_append_filename(char *dest, const char *s1, const char *s2) +path_append_filename(char *dest, const char *s1, const char *s2) { strcpy(dest, s1); - plat_path_slash(dest); + path_slash(dest); strcat(dest, s2); } diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 7f3d39383..749c74b9f 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -15,6 +15,7 @@ # include <86box/midi.h> # include <86box/plat.h> # include <86box/plat_dynld.h> +# include <86box/thread.h> # include <86box/sound.h> # include <86box/ui.h> diff --git a/src/sound/midi_mt32.c b/src/sound/midi_mt32.c index 87255e319..bb86210f3 100644 --- a/src/sound/midi_mt32.c +++ b/src/sound/midi_mt32.c @@ -9,6 +9,7 @@ #include <86box/mem.h> #include <86box/midi.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/rom.h> #include <86box/sound.h> #include <86box/ui.h> diff --git a/src/sound/sound.c b/src/sound/sound.c index 5110b9c59..ec9e51f91 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -33,6 +33,7 @@ #include <86box/machine.h> #include <86box/midi.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/snd_ac97.h> #include <86box/snd_azt2316a.h> #include <86box/timer.h> diff --git a/src/thread.cpp b/src/thread.cpp index 1003dd871..6a7af25b8 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -3,6 +3,7 @@ #include #include <86box/plat.h> +#include <86box/thread.h> struct event_cpp11_t { diff --git a/src/unix/unix.c b/src/unix/unix.c index e4be19e05..a7ef1abe7 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -27,8 +27,10 @@ #include <86box/keyboard.h> #include <86box/mouse.h> #include <86box/config.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/plat_dynld.h> +#include <86box/thread.h> #include <86box/device.h> #include <86box/gameport.h> #include <86box/unix_sdl.h> @@ -293,24 +295,24 @@ plat_fopen64(const char *path, const char *mode) } int -plat_path_abs(char *path) +path_abs(char *path) { return path[0] == '/'; } void -plat_path_normalize(char* path) +path_normalize(char* path) { /* No-op. */ } void -plat_path_slash(char *path) +path_slash(char *path) { if ((path[strlen(path)-1] != '/')) { strcat(path, "/"); } - plat_path_normalize(path); + path_normalize(path); } void @@ -337,7 +339,7 @@ plat_get_basename(const char *path) return((char *)path); } char * -plat_get_filename(char *s) +path_get_filename(char *s) { int c = strlen(s) - 1; @@ -352,7 +354,7 @@ plat_get_filename(char *s) char * -plat_get_extension(char *s) +path_get_extension(char *s) { int c = strlen(s) - 1; @@ -370,10 +372,10 @@ plat_get_extension(char *s) void -plat_append_filename(char *dest, const char *s1, const char *s2) +path_append_filename(char *dest, const char *s1, const char *s2) { strcpy(dest, s1); - plat_path_slash(dest); + path_slash(dest); strcat(dest, s2); } @@ -485,7 +487,7 @@ ui_sb_update_text() } void -plat_get_dirname(char *dest, const char *path) +path_get_dirname(char *dest, const char *path) { int c = (int)strlen(path); char *ptr; @@ -758,7 +760,7 @@ plat_init_rom_paths() if (getenv("XDG_DATA_HOME")) { char xdg_rom_path[1024] = { 0 }; strncpy(xdg_rom_path, getenv("XDG_DATA_HOME"), 1024); - plat_path_slash(xdg_rom_path); + path_slash(xdg_rom_path); strncat(xdg_rom_path, "86Box/", 1024); if (!plat_dir_check(xdg_rom_path)) @@ -791,7 +793,7 @@ plat_init_rom_paths() while ((cur_xdg_rom_path = local_strsep(&xdg_rom_paths, ";")) != NULL) { char real_xdg_rom_path[1024] = { '\0' }; strcat(real_xdg_rom_path, cur_xdg_rom_path); - plat_path_slash(real_xdg_rom_path); + path_slash(real_xdg_rom_path); strcat(real_xdg_rom_path, "86Box/roms/"); rom_add_path(real_xdg_rom_path); } diff --git a/src/unix/unix_thread.c b/src/unix/unix_thread.c index 564b1943b..dc7625e12 100644 --- a/src/unix/unix_thread.c +++ b/src/unix/unix_thread.c @@ -5,6 +5,7 @@ #include #include <86box/86box.h> #include <86box/plat.h> +#include <86box/thread.h> typedef struct event_pthread_t diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 3caa710e7..2fe70c322 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -31,6 +31,7 @@ #include <86box/pci.h> #include <86box/rom.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/i2c.h> #include <86box/vid_ddc.h> diff --git a/src/video/vid_im1024.c b/src/video/vid_im1024.c index 96ce1ce6a..932faecb7 100644 --- a/src/video/vid_im1024.c +++ b/src/video/vid_im1024.c @@ -62,6 +62,7 @@ #include <86box/device.h> #include <86box/pit.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_pgc.h> diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index bfb83d9c2..87ed16ba5 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -27,6 +27,7 @@ #include <86box/device.h> #include <86box/dma.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/i2c.h> #include <86box/vid_ddc.h> diff --git a/src/video/vid_pgc.c b/src/video/vid_pgc.c index 3d64b9eaf..e956cb12e 100644 --- a/src/video/vid_pgc.c +++ b/src/video/vid_pgc.c @@ -87,6 +87,7 @@ #include <86box/device.h> #include <86box/pit.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_cga.h> #include <86box/vid_pgc.h> diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index ba86de08a..406f6a20e 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -30,6 +30,7 @@ #include <86box/pci.h> #include <86box/rom.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/i2c.h> #include <86box/vid_ddc.h> diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index 9aa5b0973..dd1c03fa4 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -32,6 +32,7 @@ #include <86box/rom.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/i2c.h> #include <86box/vid_ddc.h> diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index 7631dcf8f..df3d59076 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -32,6 +32,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index 48d14a5b6..020cb65a4 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -32,6 +32,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/i2c.h> #include <86box/vid_ddc.h> diff --git a/src/video/vid_voodoo_banshee_blitter.c b/src/video/vid_voodoo_banshee_blitter.c index 4d8ba2518..4062acb3a 100644 --- a/src/video/vid_voodoo_banshee_blitter.c +++ b/src/video/vid_voodoo_banshee_blitter.c @@ -24,6 +24,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_blitter.c b/src/video/vid_voodoo_blitter.c index f60ed2c0b..94fb9dfa1 100644 --- a/src/video/vid_voodoo_blitter.c +++ b/src/video/vid_voodoo_blitter.c @@ -30,6 +30,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_display.c b/src/video/vid_voodoo_display.c index a52249bee..8e4e952d2 100644 --- a/src/video/vid_voodoo_display.c +++ b/src/video/vid_voodoo_display.c @@ -29,6 +29,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_fb.c b/src/video/vid_voodoo_fb.c index b9ccad399..3ab482bff 100644 --- a/src/video/vid_voodoo_fb.c +++ b/src/video/vid_voodoo_fb.c @@ -29,6 +29,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_fifo.c b/src/video/vid_voodoo_fifo.c index fcc87af11..013c21db3 100644 --- a/src/video/vid_voodoo_fifo.c +++ b/src/video/vid_voodoo_fifo.c @@ -29,6 +29,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_reg.c b/src/video/vid_voodoo_reg.c index 796f0aac7..797fa130f 100644 --- a/src/video/vid_voodoo_reg.c +++ b/src/video/vid_voodoo_reg.c @@ -29,6 +29,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_render.c b/src/video/vid_voodoo_render.c index 751c91d09..362f45abe 100644 --- a/src/video/vid_voodoo_render.c +++ b/src/video/vid_voodoo_render.c @@ -29,6 +29,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_setup.c b/src/video/vid_voodoo_setup.c index e8722608f..92a984c87 100644 --- a/src/video/vid_voodoo_setup.c +++ b/src/video/vid_voodoo_setup.c @@ -29,6 +29,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/vid_voodoo_texture.c b/src/video/vid_voodoo_texture.c index 80bf53d23..784ea17fe 100644 --- a/src/video/vid_voodoo_texture.c +++ b/src/video/vid_voodoo_texture.c @@ -29,6 +29,7 @@ #include <86box/timer.h> #include <86box/device.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> #include <86box/vid_voodoo_common.h> diff --git a/src/video/video.c b/src/video/video.c index a950369c4..f58b29c84 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -66,7 +66,9 @@ #include <86box/rom.h> #include <86box/config.h> #include <86box/timer.h> +#include <86box/path.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/vid_svga.h> @@ -404,12 +406,12 @@ video_screenshot(uint32_t *buf, int start_x, int start_y, int row_len) memset(fn, 0, sizeof(fn)); memset(path, 0, sizeof(path)); - plat_append_filename(path, usr_path, SCREENSHOT_PATH); + path_append_filename(path, usr_path, SCREENSHOT_PATH); if (! plat_dir_check(path)) plat_dir_create(path); - plat_path_slash(path); + path_slash(path); plat_tempfile(fn, NULL, ".png"); strcat(path, fn); diff --git a/src/win/win.c b/src/win/win.c index 18f3a1697..cd938217e 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -47,8 +47,10 @@ #include <86box/video.h> #include <86box/mem.h> #include <86box/rom.h> +#include <86box/path.h> #define GLOBAL #include <86box/plat.h> +#include <86box/thread.h> #include <86box/ui.h> #ifdef USE_VNC # include <86box/vnc.h> @@ -736,14 +738,14 @@ plat_remove(char *path) } void -plat_path_normalize(char* path) +path_normalize(char* path) { /* No-op */ } /* Make sure a path ends with a trailing (back)slash. */ void -plat_path_slash(char *path) +path_slash(char *path) { if ((path[strlen(path)-1] != '\\') && (path[strlen(path)-1] != '/')) { @@ -754,7 +756,7 @@ plat_path_slash(char *path) /* Check if the given path is absolute or not. */ int -plat_path_abs(char *path) +path_abs(char *path) { if ((path[1] == ':') || (path[0] == '\\') || (path[0] == '/')) return(1); @@ -781,7 +783,7 @@ plat_get_basename(const char *path) /* Return the 'directory' element of a pathname. */ void -plat_get_dirname(char *dest, const char *path) +path_get_dirname(char *dest, const char *path) { int c = (int)strlen(path); char *ptr; @@ -804,7 +806,7 @@ plat_get_dirname(char *dest, const char *path) char * -plat_get_filename(char *s) +path_get_filename(char *s) { int c = strlen(s) - 1; @@ -819,7 +821,7 @@ plat_get_filename(char *s) char * -plat_get_extension(char *s) +path_get_extension(char *s) { int c = strlen(s) - 1; @@ -837,10 +839,10 @@ plat_get_extension(char *s) void -plat_append_filename(char *dest, const char *s1, const char *s2) +path_append_filename(char *dest, const char *s1, const char *s2) { strcpy(dest, s1); - plat_path_slash(dest); + path_slash(dest); strcat(dest, s2); } diff --git a/src/win/win_icon.c b/src/win/win_icon.c index e118276f1..c11125ecd 100644 --- a/src/win/win_icon.c +++ b/src/win/win_icon.c @@ -23,6 +23,7 @@ #include #include <86box/86box.h> #include <86box/config.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/ui.h> #include <86box/win.h> @@ -116,10 +117,10 @@ void win_get_icons_path(char* path_root) if (rom_path[0]) strcpy(roms_root, rom_path); else - plat_append_filename(roms_root, exe_path, "roms"); + path_append_filename(roms_root, exe_path, "roms"); - plat_append_filename(path_root, roms_root, "icons"); - plat_path_slash(path_root); + path_append_filename(path_root, roms_root, "icons"); + path_slash(path_root); } void win_load_icon_set() @@ -137,13 +138,13 @@ void win_load_icon_set() win_get_icons_path(path_root); strcat(path_root, icon_set); - plat_path_slash(path_root); + path_slash(path_root); int i, count = sizeof(icon_files) / sizeof(_ICON_DATA), x = win_get_system_metrics(SM_CXSMICON, dpi), y = win_get_system_metrics(SM_CYSMICON, dpi); for (i = 0; i < count; i++) { - plat_append_filename(temp, path_root, icon_files[i].filename); + path_append_filename(temp, path_root, icon_files[i].filename); mbstoc16s(wtemp, temp, strlen(temp) + 1); HICON ictemp; diff --git a/src/win/win_opengl.c b/src/win/win_opengl.c index 5670fafa2..b1dab78ca 100644 --- a/src/win/win_opengl.c +++ b/src/win/win_opengl.c @@ -54,6 +54,7 @@ typedef LONG atomic_flag; #include <86box/86box.h> #include <86box/plat.h> +#include <86box/thread.h> #include <86box/video.h> #include <86box/win.h> #include <86box/language.h> diff --git a/src/win/win_thread.c b/src/win/win_thread.c index 2bb8a6cf5..1ad0fc469 100644 --- a/src/win/win_thread.c +++ b/src/win/win_thread.c @@ -29,6 +29,7 @@ #include #include <86box/86box.h> #include <86box/plat.h> +#include <86box/thread.h> typedef struct { From 60d70da4b94a086bcb5bdfb8b213c73ce9339d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Tue, 19 Apr 2022 23:24:49 +0200 Subject: [PATCH 09/20] Make sure `exe_path` ends with a slash --- src/86box.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/86box.c b/src/86box.c index 4d59d9e13..a98a69993 100644 --- a/src/86box.c +++ b/src/86box.c @@ -424,6 +424,8 @@ pc_init(int argc, char *argv[]) } #endif + path_slash(exe_path); + /* * Get the current working directory. * From 11a1cd4d87ccbb665329cf78d69e3b8e33d2b70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Wed, 20 Apr 2022 01:02:21 +0200 Subject: [PATCH 10/20] Hide the `-E` parameter as it is not implemented yet --- src/86box.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/86box.c b/src/86box.c index a98a69993..4b647afed 100644 --- a/src/86box.c +++ b/src/86box.c @@ -448,6 +448,8 @@ usage: printf("-C or --config path - set 'path' to be config file\n"); #ifdef _WIN32 printf("-D or --debug - force debug output logging\n"); +#endif +#if 0 printf("-E or --nographic - forces the old behavior\n"); #endif printf("-F or --fullscreen - start in fullscreen mode\n"); From 6a4b3fc7bb2801b6470f44c6a1c9d8b38edb53b5 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 20 Apr 2022 01:16:16 +0200 Subject: [PATCH 11/20] Enabled the non-blocking stuff for Windows as well. --- src/network/net_pcap.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index b1541cdc6..c76b62581 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -123,9 +123,7 @@ static const unsigned char *(*f_pcap_next)(void *,void *); static int (*f_pcap_sendpacket)(void *,const unsigned char *,int); static void (*f_pcap_close)(void *); -#ifndef _WIN32 static int (*f_pcap_setnonblock)(void*, int, char*); -#endif static dllimp_t pcap_imports[] = { { "pcap_lib_version", &f_pcap_lib_version }, { "pcap_findalldevs", &f_pcap_findalldevs }, @@ -136,9 +134,7 @@ static dllimp_t pcap_imports[] = { { "pcap_next", &f_pcap_next }, { "pcap_sendpacket", &f_pcap_sendpacket }, { "pcap_close", &f_pcap_close }, -#ifndef _WIN32 { "pcap_setnonblock", &f_pcap_setnonblock }, -#endif { NULL, NULL }, }; @@ -389,10 +385,8 @@ net_pcap_reset(const netcard_t *card, uint8_t *mac) pcap_log(" Unable to open device: %s!\n", network_host); return(-1); } -#ifndef _WIN32 if (f_pcap_setnonblock((void*)pcap, 1, errbuf) != 0) pcap_log("PCAP: failed nonblock %s\n", errbuf); -#endif pcap_log("PCAP: interface: %s\n", network_host); From 7e9dbffc3bc99162a9c7c8e9d0db1ec27ce1caa0 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 13:27:57 -0300 Subject: [PATCH 12/20] macOS: Change exe_path to be next to the .app bundle --- src/86box.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/86box.c b/src/86box.c index 4b647afed..720e33279 100644 --- a/src/86box.c +++ b/src/86box.c @@ -398,9 +398,6 @@ pc_init(int argc, char *argv[]) { char *ppath = NULL, *rpath = NULL; char *cfg = NULL, *p; -#if !defined(__APPLE__) && !defined(_WIN32) - char *appimage; -#endif char temp[2048]; struct tm *info; time_t now; @@ -413,15 +410,20 @@ pc_init(int argc, char *argv[]) /* Grab the executable's full path. */ plat_get_exe_name(exe_path, sizeof(exe_path)-1); - p = path_get_filename(exe_path); + p = path_get_filename(exe_path); *p = '\0'; - -#if !defined(_WIN32) && !defined(__APPLE__) - /* Grab the actual path if we are an AppImage. */ - appimage = getenv("APPIMAGE"); - if (appimage && (appimage[0] != '\0')) { - path_get_dirname(exe_path, appimage); +#if defined(__APPLE__) + c = strlen(exe_path); + if ((c >= 16) && !strcmp(&exe_path[c - 16], "/Contents/MacOS/")) { + exe_path[c - 16] = '\0'; + p = path_get_filename(exe_path); + *p = '\0'; } +#elif !defined(_WIN32) + /* Grab the actual path if we are an AppImage. */ + p = getenv("APPIMAGE"); + if (p && (p[0] != '\0')) + path_get_dirname(exe_path, p); #endif path_slash(exe_path); From de82cf8bf1d3c281edaa2240a99c004ba209bf7a Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 13:35:14 -0300 Subject: [PATCH 13/20] macOS: Fix plat_getcwd on .app bundle --- src/qt/qt_platform.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 499c6bbac..9a2f2d8a2 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -184,7 +184,12 @@ plat_dir_check(char *path) int plat_getcwd(char *bufp, int max) { +#ifdef __APPLE__ + /* Working directory for .app bundles is undefined. */ + strncpy(bufp, exe_path, max); +#else CharPointer(bufp, max) = QDir::currentPath().toUtf8(); +#endif return 0; } From 0208555e8c37bc15c2a56bc4528cf8b3dd219cb6 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 14:01:38 -0300 Subject: [PATCH 14/20] Jenkins: Cache Linux library downloads and change rtmidi URL --- .ci/build.sh | 55 ++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 590119cc4..5442a512f 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -568,59 +568,64 @@ then fi else cwd_root=$(pwd) + cache_dir="$HOME/86box-build-cache" + [ ! -d "$cache_dir" ] && mkdir -p "$cache_dir" if grep -q "OPENAL:BOOL=ON" build/CMakeCache.txt then # Build openal-soft 1.21.1 manually to fix audio issues. This is a temporary # workaround until a newer version of openal-soft trickles down to Debian repos. - if [ -d "openal-soft-1.21.1" ] + prefix="$cache_dir/openal-soft-1.21.1" + if [ -d "$prefix" ] then - rm -rf openal-soft-1.21.1/build + rm -rf "$prefix/build" else - wget -qO - https://github.com/kcat/openal-soft/archive/refs/tags/1.21.1.tar.gz | tar zxf - + wget -qO - https://github.com/kcat/openal-soft/archive/refs/tags/1.21.1.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix" fi - cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$cwd_root/toolchain.cmake" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S openal-soft-1.21.1 -B openal-soft-1.21.1/build || exit 99 - cmake --build openal-soft-1.21.1/build -j$(nproc) || exit 99 - cmake --install openal-soft-1.21.1/build || exit 99 + cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$cwd_root/toolchain.cmake" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix/build" || exit 99 + cmake --build "$prefix/build" -j$(nproc) || exit 99 + cmake --install "$prefix/build" || exit 99 # Build SDL2 without sound systems. sdl_ss=OFF else # Build FAudio 22.03 manually to remove the dependency on GStreamer. This is a temporary # workaround until a newer version of FAudio trickles down to Debian repos. - if [ -d "FAudio-22.03" ] + prefix="$cache_dir/FAudio-22.03" + if [ -d "$prefix" ] then - rm -rf FAudio-22.03/build + rm -rf "$prefix/build" else - wget -qO - https://github.com/FNA-XNA/FAudio/archive/refs/tags/22.03.tar.gz | tar zxf - + wget -qO - https://github.com/FNA-XNA/FAudio/archive/refs/tags/22.03.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix" fi - cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$cwd_root/toolchain.cmake" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S FAudio-22.03 -B FAudio-22.03/build || exit 99 - cmake --build FAudio-22.03/build -j$(nproc) || exit 99 - cmake --install FAudio-22.03/build || exit 99 + cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$cwd_root/toolchain.cmake" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix/build" || exit 99 + cmake --build "$prefix/build" -j$(nproc) || exit 99 + cmake --install "$prefix/build" || exit 99 # Build SDL2 with sound systems. sdl_ss=ON fi # Build rtmidi without JACK support to remove the dependency on libjack. - if [ -d "rtmidi-4.0.0" ] + prefix="$cache_dir/rtmidi-4.0.0" + if [ -d "$prefix" ] then - rm -rf rtmidi-4.0.0/build + rm -rf "$prefix/build" else - wget -qO - http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-4.0.0.tar.gz | tar zxf - + wget -qO - https://github.com/thestk/rtmidi/archive/refs/tags/4.0.0.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix" fi - cmake -G Ninja -D RTMIDI_API_JACK=OFF -D "CMAKE_TOOLCHAIN_FILE=$cwd_root/toolchain.cmake" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S rtmidi-4.0.0 -B rtmidi-4.0.0/build || exit 99 - cmake --build rtmidi-4.0.0/build -j$(nproc) || exit 99 - cmake --install rtmidi-4.0.0/build || exit 99 + cmake -G Ninja -D RTMIDI_API_JACK=OFF -D "CMAKE_TOOLCHAIN_FILE=$cwd_root/toolchain.cmake" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix/build" || exit 99 + cmake --build "$prefix/build" -j$(nproc) || exit 99 + cmake --install "$prefix/build" || exit 99 # Build SDL2 for joystick and FAudio support, with most components # disabled to remove the dependencies on PulseAudio and libdrm. - if [ ! -d "SDL2-2.0.20" ] + prefix="$cache_dir/SDL2-2.0.20" + if [ ! -d "$prefix" ] then - wget -qO - https://www.libsdl.org/release/SDL2-2.0.20.tar.gz | tar zxf - + wget -qO - https://www.libsdl.org/release/SDL2-2.0.20.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix" fi - rm -rf sdlbuild - mkdir sdlbuild + rm -rf "$cache_dir/sdlbuild" cmake -G Ninja -D SDL_DISKAUDIO=OFF -D SDL_DIRECTFB_SHARED=OFF -D SDL_OPENGL=OFF -D SDL_OPENGLES=OFF -D SDL_OSS=OFF -D SDL_ALSA=$sdl_ss \ -D SDL_ALSA_SHARED=$sdl_ss -D SDL_JACK=$sdl_ss -D SDL_JACK_SHARED=$sdl_ss -D SDL_ESD=OFF -D SDL_ESD_SHARED=OFF -D SDL_PIPEWIRE=$sdl_ss \ -D SDL_PIPEWIRE_SHARED=$sdl_ss -D SDL_PULSEAUDIO=$sdl_ss -D SDL_PULSEAUDIO_SHARED=$sdl_ss -D SDL_ARTS=OFF -D SDL_ARTS_SHARED=OFF \ @@ -628,10 +633,10 @@ else -D SDL_FUSIONSOUND_SHARED=OFF -D SDL_LIBSAMPLERATE=$sdl_ss -D SDL_LIBSAMPLERATE_SHARED=$sdl_ss -D SDL_X11=OFF -D SDL_X11_SHARED=OFF \ -D SDL_WAYLAND=OFF -D SDL_WAYLAND_SHARED=OFF -D SDL_WAYLAND_LIBDECOR=OFF -D SDL_WAYLAND_LIBDECOR_SHARED=OFF -D SDL_WAYLAND_QT_TOUCH=OFF \ -D SDL_RPI=OFF -D SDL_VIVANTE=OFF -D SDL_VULKAN=OFF -D SDL_KMSDRM=OFF -D SDL_KMSDRM_SHARED=OFF -D SDL_OFFSCREEN=OFF \ - -D SDL_HIDAPI_JOYSTICK=ON -D SDL_VIRTUAL_JOYSTICK=ON -D SDL_SHARED=ON -D SDL_STATIC=OFF -S SDL2-2.0.20 -B sdlbuild \ + -D SDL_HIDAPI_JOYSTICK=ON -D SDL_VIRTUAL_JOYSTICK=ON -D SDL_SHARED=ON -D SDL_STATIC=OFF -S "$prefix" -B "$cache_dir/sdlbuild" \ -D "CMAKE_TOOLCHAIN_FILE=$cwd_root/toolchain.cmake" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" || exit 99 - cmake --build sdlbuild -j$(nproc) || exit 99 - cmake --install sdlbuild || exit 99 + cmake --build "$cache_dir/sdlbuild" -j$(nproc) || exit 99 + cmake --install "$cache_dir/sdlbuild" || exit 99 # Archive Discord Game SDK library. 7z e -y -o"archive_tmp/usr/lib" discord_game_sdk.zip "lib/$arch_discord/discord_game_sdk.so" From a62e3aff238d519e93c46d29872619d9968f6bcf Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 20:51:39 -0300 Subject: [PATCH 15/20] Selectable mouse type on Linux, part 1 --- src/qt/qt_rendererstack.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qt/qt_rendererstack.hpp b/src/qt/qt_rendererstack.hpp index 9133a4927..eb3adf894 100644 --- a/src/qt/qt_rendererstack.hpp +++ b/src/qt/qt_rendererstack.hpp @@ -64,6 +64,11 @@ public: rendererWindow->onResize(width, height); } + void (*mouse_init)() = nullptr; + void (*mouse_poll)() = nullptr; + void (*mouse_capture)(QWindow *window) = nullptr; + void (*mouse_uncapture)() = nullptr; + signals: void blitToRenderer(int buf_idx, int x, int y, int w, int h); void rendererChanged(); From 5f070c8f745daa4177ca21310ddec25283c41926 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 20:54:41 -0300 Subject: [PATCH 16/20] Selectable mouse type on Linux, part 2 --- src/qt/qt_rendererstack.cpp | 58 +++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index 88b2395d5..9186ee86f 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -50,21 +50,43 @@ RendererStack::RendererStack(QWidget *parent) ui->setupUi(this); #if defined __unix__ && !defined __HAIKU__ -# ifdef WAYLAND - if (QApplication::platformName().contains("wayland")) { - wl_init(); + char *mouse_type = getenv("EMU86BOX_MOUSE"), auto_mouse_type[16]; + if (!mouse_type || (mouse_type[0] == '\0') || !stricmp(mouse_type, "auto")) { + if (QApplication::platformName().contains("wayland")) + strcpy(auto_mouse_type, "wayland"); + else if (QApplication::platformName() == "eglfs") + strcpy(auto_mouse_type, "evdev"); + else if (QApplication::platformName() == "xcb") + strcpy(auto_mouse_type, "xinput2"); + else + auto_mouse_type[0] = '\0'; + mouse_type = auto_mouse_type; } + +# ifdef WAYLAND + if (!stricmp(mouse_type, "wayland")) { + this->mouse_init = wl_init; + this->mouse_poll = wl_mouse_poll; + this->mouse_capture = wl_mouse_capture; + this->mouse_uncapture = wl_mouse_uncapture; + } else # endif # ifdef EVDEV_INPUT - if (QApplication::platformName() == "eglfs") { - evdev_init(); - } + if (!stricmp(mouse_type, "evdev")) { + this->mouse_init = evdev_init; + this->mouse_poll = evdev_mouse_poll; + } else # endif - if (QApplication::platformName() == "xcb") { + if (!stricmp(mouse_type, "xinput2")) { extern void xinput2_init(); - xinput2_init(); + extern void xinput2_poll(); + this->mouse_init = xinput2_init; + this->mouse_poll = xinput2_poll; } #endif + + if (this->mouse_init) + this->mouse_init(); } RendererStack::~RendererStack() @@ -104,23 +126,9 @@ RendererStack::mousePoll() mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0; mouse_buttons = mousedata.mousebuttons; -# if defined __unix__ && !defined __HAIKU__ -# ifdef WAYLAND - if (QApplication::platformName().contains("wayland")) - wl_mouse_poll(); -# endif - -# ifdef EVDEV_INPUT - if (QApplication::platformName() == "eglfs") - evdev_mouse_poll(); - else -# endif - if (QApplication::platformName() == "xcb") { - extern void xinput2_poll(); - xinput2_poll(); - } -# endif /* defined __unix__ */ -#endif /* !defined __APPLE__ */ + if (this->mouse_poll) + this->mouse_poll(); +#endif /* !defined __APPLE__ */ } int ignoreNextMouseEvent = 1; From 5810f39f4d502a1040b35a8c7f132d5aec04a8ff Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 20:55:26 -0300 Subject: [PATCH 17/20] Selectable mouse type on Linux, part 3 --- src/qt/qt_mainwindow.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 09676ee34..6a55d6f6a 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -207,18 +207,12 @@ MainWindow::MainWindow(QWidget *parent) : qt_mouse_capture(mouse_capture); if (mouse_capture) { this->grabKeyboard(); -#ifdef WAYLAND - if (QGuiApplication::platformName().contains("wayland")) { - wl_mouse_capture(this->windowHandle()); - } -#endif + if (ui->stackedWidget->mouse_capture) + ui->stackedWidget->mouse_capture(this->windowHandle()); } else { this->releaseKeyboard(); -#ifdef WAYLAND - if (QGuiApplication::platformName().contains("wayland")) { - wl_mouse_uncapture(); - } -#endif + if (ui->stackedWidget->mouse_uncapture) + ui->stackedWidget->mouse_uncapture(); } }); From f6e3c0d02996bf3c5c6ba97208070023f4edc191 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 21:37:38 -0300 Subject: [PATCH 18/20] Selectable mouse type on Linux, part 4 --- src/qt/qt_rendererstack.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/qt_rendererstack.hpp b/src/qt/qt_rendererstack.hpp index eb3adf894..89f300ada 100644 --- a/src/qt/qt_rendererstack.hpp +++ b/src/qt/qt_rendererstack.hpp @@ -68,6 +68,7 @@ public: void (*mouse_poll)() = nullptr; void (*mouse_capture)(QWindow *window) = nullptr; void (*mouse_uncapture)() = nullptr; + void (*mouse_exit)() = nullptr; signals: void blitToRenderer(int buf_idx, int x, int y, int w, int h); From 0af6605042d73004713797e7176c313a7522cc57 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 21:38:57 -0300 Subject: [PATCH 19/20] Selectable mouse type on Linux, part 5 --- src/qt/qt_rendererstack.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index 9186ee86f..3e20f1f40 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -80,8 +80,10 @@ RendererStack::RendererStack(QWidget *parent) if (!stricmp(mouse_type, "xinput2")) { extern void xinput2_init(); extern void xinput2_poll(); + extern void xinput2_exit(); this->mouse_init = xinput2_init; this->mouse_poll = xinput2_poll; + this->mouse_exit = xinput2_exit; } #endif From 7d6ad0d6504cdcf62d40079611e6d37731d2c426 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Wed, 20 Apr 2022 21:39:57 -0300 Subject: [PATCH 20/20] Selectable mouse type on Linux, part 6 --- src/qt/qt_mainwindow.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 6a55d6f6a..3058ca59f 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -509,10 +509,8 @@ void MainWindow::closeEvent(QCloseEvent *event) { } qt_nvr_save(); config_save(); -#if defined __unix__ && !defined __HAIKU__ - extern void xinput2_exit(); - if (QApplication::platformName() == "xcb") xinput2_exit(); -#endif + if (ui->stackedWidget->mouse_exit) + ui->stackedWidget->mouse_exit(); event->accept(); }