From 4565368984afd6d058c7b3cc9c0c822083b1f9ee Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 25 Apr 2025 04:48:11 +1000 Subject: [PATCH] Fixed up some stuff: * apple/mac128.cpp, apple/macii.cpp: Added CPU family filters to floppy and hard disk lists. * apple/mac128.cpp: Added fine-grained model filters to software lists because of badly behaved booters. * mac_flop_orig.xml: Fixed compatibility filters for '000 booters (ignoring the Portable/PB100 for now). * netdev/pcap.cpp: Don't return a pointer to a buffer on the stack that's about to be unwound. * seta/ssv.cpp: Fixed width of DSP RAM acccess handlers. --- hash/mac_flop_orig.xml | 352 ++++++++++++++++++-------------- src/mame/apple/mac128.cpp | 53 +++-- src/mame/seta/ssv.cpp | 6 +- src/mame/seta/ssv.h | 4 +- src/osd/modules/netdev/pcap.cpp | 57 +++--- 5 files changed, 267 insertions(+), 205 deletions(-) diff --git a/hash/mac_flop_orig.xml b/hash/mac_flop_orig.xml index 1f6ff9281f0..352604a7ac6 100644 --- a/hash/mac_flop_orig.xml +++ b/hash/mac_flop_orig.xml @@ -13,7 +13,7 @@ license:CC0-1.0 - + @@ -30,7 +30,8 @@ license:CC0-1.0 - + + @@ -47,7 +48,7 @@ license:CC0-1.0 - + @@ -64,7 +65,8 @@ license:CC0-1.0 - + + @@ -82,7 +84,8 @@ license:CC0-1.0 - + + @@ -115,7 +118,8 @@ license:CC0-1.0 Mindscape - + + @@ -139,7 +143,8 @@ license:CC0-1.0 - + + @@ -195,7 +200,8 @@ license:CC0-1.0 Activision - + + @@ -211,7 +217,7 @@ license:CC0-1.0 Mindscape - + @@ -243,7 +249,7 @@ license:CC0-1.0 Mindscape - + @@ -260,7 +266,8 @@ license:CC0-1.0 - + + @@ -277,7 +284,8 @@ license:CC0-1.0 - + + @@ -311,7 +319,8 @@ license:CC0-1.0 Miles Computing - + + @@ -329,7 +338,7 @@ license:CC0-1.0 - + @@ -403,7 +412,8 @@ license:CC0-1.0 - + + @@ -500,7 +510,8 @@ license:CC0-1.0 - + + @@ -516,7 +527,8 @@ license:CC0-1.0 BLUE WHALE gameworks - + + @@ -591,7 +603,7 @@ license:CC0-1.0 - + @@ -608,7 +620,7 @@ license:CC0-1.0 - + @@ -625,7 +637,7 @@ license:CC0-1.0 - + @@ -642,7 +654,7 @@ license:CC0-1.0 - + @@ -725,9 +737,9 @@ license:CC0-1.0 1984 Infocom - + - + @@ -742,9 +754,9 @@ license:CC0-1.0 1984 Infocom - + - + @@ -759,9 +771,9 @@ license:CC0-1.0 1983 Infocom - + - + @@ -776,9 +788,9 @@ license:CC0-1.0 1984 Infocom - + - + @@ -793,9 +805,9 @@ license:CC0-1.0 1984 Infocom - + - + @@ -810,9 +822,9 @@ license:CC0-1.0 1984 Infocom - + - + @@ -827,9 +839,9 @@ license:CC0-1.0 1985 Infocom - + - + @@ -844,9 +856,9 @@ license:CC0-1.0 1985 Infocom - + - + @@ -861,9 +873,9 @@ license:CC0-1.0 1985 Infocom - + - + @@ -878,9 +890,9 @@ license:CC0-1.0 1986 Infocom - + - + @@ -895,9 +907,9 @@ license:CC0-1.0 1987 Infocom - + - + @@ -912,9 +924,9 @@ license:CC0-1.0 1987 Infocom - + - + @@ -932,7 +944,7 @@ license:CC0-1.0 - + @@ -963,7 +975,7 @@ license:CC0-1.0 - + @@ -1017,7 +1029,7 @@ license:CC0-1.0 - + @@ -1065,7 +1077,7 @@ license:CC0-1.0 1990 Brøderbund Software - + @@ -1095,9 +1107,9 @@ license:CC0-1.0 1985 Electronic Arts - + - + @@ -1112,7 +1124,7 @@ license:CC0-1.0 1987 Silicon Beach Software - + @@ -1129,8 +1141,8 @@ license:CC0-1.0 1990 Sir-Tech Software - - + + @@ -1192,8 +1204,8 @@ license:CC0-1.0 1984 Silicon Beach Software - - + + @@ -1208,9 +1220,10 @@ license:CC0-1.0 1985 Videx - + - + + @@ -1225,8 +1238,9 @@ license:CC0-1.0 1985 Telarium - - + + + @@ -1248,7 +1262,7 @@ license:CC0-1.0 1986 Innovative Data Design - + @@ -1272,9 +1286,9 @@ license:CC0-1.0 1984 Human Edge Software - + - + @@ -1289,9 +1303,10 @@ license:CC0-1.0 1986 Brøderbund Software - + - + + @@ -1319,9 +1334,9 @@ license:CC0-1.0 1985 PBI Software - + - + @@ -1336,9 +1351,9 @@ license:CC0-1.0 1984 Continental Software - + - + @@ -1353,7 +1368,7 @@ license:CC0-1.0 1987 Epyx - + @@ -1369,8 +1384,9 @@ license:CC0-1.0 1987 Applications Plus - - + + + @@ -1386,9 +1402,10 @@ license:CC0-1.0 Rainbird - + - + + @@ -1403,8 +1420,9 @@ license:CC0-1.0 1986 Miles Computing - - + + + @@ -1419,9 +1437,9 @@ license:CC0-1.0 1984 Monogram Publishing - + - + @@ -1461,8 +1479,8 @@ license:CC0-1.0 Activision - - + + @@ -1478,7 +1496,7 @@ license:CC0-1.0 Penguin Software - + @@ -1496,7 +1514,8 @@ license:CC0-1.0 - + + @@ -1512,8 +1531,8 @@ license:CC0-1.0 Activision - - + + @@ -1529,9 +1548,9 @@ license:CC0-1.0 Penguin Software - + - + @@ -1546,8 +1565,8 @@ license:CC0-1.0 1985 Sierra On-Line - - + + @@ -1562,8 +1581,8 @@ license:CC0-1.0 1985 Gamestar - - + + @@ -1578,8 +1597,8 @@ license:CC0-1.0 1985 Mindscape - - + + @@ -1594,7 +1613,7 @@ license:CC0-1.0 1987 Mindscape - + @@ -1610,8 +1629,9 @@ license:CC0-1.0 1986 Mindscape - - + + + @@ -1626,9 +1646,9 @@ license:CC0-1.0 1984 THINK Technologies - + - + @@ -1643,9 +1663,9 @@ license:CC0-1.0 1985 Miles Computing - + - + @@ -1660,9 +1680,10 @@ license:CC0-1.0 1986 QWare - + - + + @@ -1677,9 +1698,10 @@ license:CC0-1.0 1985 Davidson & Associates - + - + + @@ -1694,9 +1716,10 @@ license:CC0-1.0 1986 COMPUTER:applications, Inc. - + - + + @@ -1711,9 +1734,10 @@ license:CC0-1.0 1987 Digidesign, Inc. - + - + + @@ -1735,9 +1759,10 @@ license:CC0-1.0 1987 Altsys - + - + + @@ -1752,9 +1777,9 @@ license:CC0-1.0 1984 Mark of the Unicorn - + - + @@ -1769,8 +1794,8 @@ license:CC0-1.0 1985 Mindscape - - + + @@ -1785,8 +1810,9 @@ license:CC0-1.0 1986 Activision - - + + + @@ -1803,7 +1829,7 @@ license:CC0-1.0 - + @@ -1820,7 +1846,7 @@ license:CC0-1.0 - + @@ -1835,8 +1861,9 @@ license:CC0-1.0 1985 Mindscape - - + + + @@ -1858,7 +1885,7 @@ license:CC0-1.0 1988 Mindscape - + @@ -1911,7 +1938,8 @@ license:CC0-1.0 - + + @@ -1944,7 +1972,7 @@ license:CC0-1.0 Origin Systems - + @@ -1961,7 +1989,7 @@ license:CC0-1.0 1990 Inline Design - + @@ -1978,7 +2006,7 @@ license:CC0-1.0 1989 Brøderbund Software - + @@ -2002,7 +2030,7 @@ license:CC0-1.0 1988 Brøderbund Software - + @@ -2019,9 +2047,10 @@ license:CC0-1.0 1986 Brøderbund Software - + - + + @@ -2043,9 +2072,10 @@ license:CC0-1.0 1989 Brøderbund Software - + - + + @@ -2060,9 +2090,10 @@ license:CC0-1.0 1989 Maxis - + - + + @@ -2077,8 +2108,8 @@ license:CC0-1.0 1984 Thunder Mountain - - + + @@ -2111,7 +2142,8 @@ license:CC0-1.0 - + + @@ -2128,7 +2160,8 @@ license:CC0-1.0 - + + @@ -2162,7 +2195,8 @@ license:CC0-1.0 - + + @@ -2180,7 +2214,7 @@ license:CC0-1.0 - + @@ -2197,7 +2231,8 @@ license:CC0-1.0 - + + @@ -2214,7 +2249,8 @@ license:CC0-1.0 - + + @@ -2236,9 +2272,9 @@ license:CC0-1.0 1988 Miles Computing - + - + @@ -2262,7 +2298,7 @@ license:CC0-1.0 - + @@ -2294,7 +2330,8 @@ license:CC0-1.0 Unicorn Software - + + @@ -2311,7 +2348,6 @@ license:CC0-1.0 - @@ -3287,9 +3323,10 @@ license:CC0-1.0 1986 Ann Arbor Softworks - + - + + @@ -3304,8 +3341,9 @@ license:CC0-1.0 1989 Accolade - - + + + @@ -3322,7 +3360,7 @@ license:CC0-1.0 - + @@ -3338,8 +3376,8 @@ license:CC0-1.0 Activision - - + + @@ -3354,9 +3392,10 @@ license:CC0-1.0 1986 Bullseye Software - + - + + @@ -3371,8 +3410,9 @@ license:CC0-1.0 1986 Accolade - - + + + @@ -3389,7 +3429,7 @@ license:CC0-1.0 - + diff --git a/src/mame/apple/mac128.cpp b/src/mame/apple/mac128.cpp index a09b36d2a39..aecf22610e2 100644 --- a/src/mame/apple/mac128.cpp +++ b/src/mame/apple/mac128.cpp @@ -164,15 +164,15 @@ public: { } - void mac512ke(machine_config &config); - void mac128k(machine_config &config); - void mac512k(machine_config &config); - void macplus(machine_config &config); - void macse(machine_config &config); - void macsefd(machine_config &config); - void macclasc(machine_config &config); + void mac512ke(machine_config &config) ATTR_COLD; + void mac128k(machine_config &config) ATTR_COLD; + void mac512k(machine_config &config) ATTR_COLD; + void macplus(machine_config &config) ATTR_COLD; + void macse(machine_config &config) ATTR_COLD; + void macsefd(machine_config &config) ATTR_COLD; + void macclasc(machine_config &config) ATTR_COLD; - void mac_driver_init(); + void mac_driver_init() ATTR_COLD; private: required_device m_maincpu; @@ -1125,9 +1125,9 @@ void mac128_state::mac512ke(machine_config &config) MACPDS_SLOT(config, "pds", "macpds", mac_pds_cards, nullptr); // software list - SOFTWARE_LIST(config, "flop_mac35_orig").set_original("mac_flop_orig"); - SOFTWARE_LIST(config, "flop_mac35_clean").set_original("mac_flop_clcracked"); - SOFTWARE_LIST(config, "flop35_list").set_original("mac_flop"); + SOFTWARE_LIST(config, "flop_mac35_orig").set_original("mac_flop_orig").set_filter("MC68000,mac512ke"); + SOFTWARE_LIST(config, "flop_mac35_clean").set_original("mac_flop_clcracked").set_filter("MC68000,mac512ke"); + SOFTWARE_LIST(config, "flop35_list").set_original("mac_flop").set_filter("MC68000,mac512ke"); } void mac128_state::mac128k(machine_config &config) @@ -1143,12 +1143,20 @@ void mac128_state::mac128k(machine_config &config) applefdintf_device::add_35_sd(config, m_floppy[0]); applefdintf_device::add_35_sd(config, m_floppy[1]); + + subdevice("flop_mac35_orig")->set_filter("MC68000,mac128k"); + subdevice("flop_mac35_clean")->set_filter("MC68000,mac128k"); + subdevice("flop35_list")->set_filter("MC68000,mac128k"); } void mac128_state::mac512k(machine_config &config) { mac128k(config); m_ram->set_default_size("512K"); + + subdevice("flop_mac35_orig")->set_filter("MC68000,mac512k"); + subdevice("flop_mac35_clean")->set_filter("MC68000,mac512k"); + subdevice("flop35_list")->set_filter("MC68000,mac512k"); } void mac128_state::macplus(machine_config &config) @@ -1183,8 +1191,11 @@ void mac128_state::macplus(machine_config &config) adapter.drq_handler().set(*this, FUNC(mac128_state::scsi_drq_w)); }); - SOFTWARE_LIST(config, "hdd_list").set_original("mac_hdd"); - SOFTWARE_LIST(config, "cd_list").set_original("mac_cdrom").set_filter("MC68000"); + subdevice("flop_mac35_orig")->set_filter("MC68000,macplus"); + subdevice("flop_mac35_clean")->set_filter("MC68000,macplus"); + subdevice("flop35_list")->set_filter("MC68000,macplus"); + SOFTWARE_LIST(config, "hdd_list").set_original("mac_hdd").set_filter("MC68000,macplus"); + SOFTWARE_LIST(config, "cd_list").set_original("mac_cdrom").set_filter("MC68000,macplus"); /* internal ram */ m_ram->set_default_size("4M"); @@ -1199,6 +1210,7 @@ static void mac_sepds_cards(device_slot_interface &device) void mac128_state::macse(machine_config &config) { macplus(config); + M68000(config.replace(), m_maincpu, C7M); m_maincpu->set_addrmap(AS_PROGRAM, &mac128_state::macse_map); m_maincpu->set_dasm_override(std::function(&mac68k_dasm_override), "mac68k_dasm_override"); @@ -1250,6 +1262,12 @@ void mac128_state::macse(machine_config &config) MACPDS(config, "sepds", "maincpu"); MACPDS_SLOT(config, "pds", "sepds", mac_sepds_cards, nullptr); + + subdevice("flop_mac35_orig")->set_filter("MC68000,macse"); + subdevice("flop_mac35_clean")->set_filter("MC68000,macse"); + subdevice("flop35_list")->set_filter("MC68000,macse"); + subdevice("hdd_list")->set_filter("MC68000,macse"); + subdevice("cd_list")->set_filter("MC68000,macse"); } void mac128_state::macsefd(machine_config &config) @@ -1263,7 +1281,7 @@ void mac128_state::macsefd(machine_config &config) applefdintf_device::add_35_hd(config, m_floppy[0]); applefdintf_device::add_35_hd(config, m_floppy[1]); - SOFTWARE_LIST(config, "flop35hd_list").set_original("mac_hdflop"); + SOFTWARE_LIST(config, "flop35hd_list").set_original("mac_hdflop").set_filter("MC68000,macse"); } void mac128_state::macclasc(machine_config &config) @@ -1278,6 +1296,13 @@ void mac128_state::macclasc(machine_config &config) adapter.irq_handler().set(*this, FUNC(mac128_state::scsi_irq_w)); adapter.drq_handler().set(m_scsihelp, FUNC(mac_scsi_helper_device::drq_w)); }); + + subdevice("flop_mac35_orig")->set_filter("MC68000,macclasc"); + subdevice("flop_mac35_clean")->set_filter("MC68000,macclasc"); + subdevice("flop35_list")->set_filter("MC68000,macclasc"); + subdevice("hdd_list")->set_filter("MC68000,macclasc"); + subdevice("cd_list")->set_filter("MC68000,macclasc"); + subdevice("flop35hd_list")->set_filter("MC68000,macclasc"); } static INPUT_PORTS_START( macplus ) diff --git a/src/mame/seta/ssv.cpp b/src/mame/seta/ssv.cpp index baae2f7f768..693ff7056c1 100644 --- a/src/mame/seta/ssv.cpp +++ b/src/mame/seta/ssv.cpp @@ -347,17 +347,17 @@ void drifto94_state::dsp_data_map(address_map &map) map(0x0000, 0x07ff).rom().region("dspdata", 0); } -uint16_t drifto94_state::dsp_r(offs_t offset) +uint8_t drifto94_state::dsp_r(offs_t offset) { const uint16_t temp = m_dsp->dataram_r(offset / 2); const uint8_t shift = BIT(offset, 0) << 3; return (temp >> shift) & 0xff; } -void drifto94_state::dsp_w(offs_t offset, uint16_t data) +void drifto94_state::dsp_w(offs_t offset, uint8_t data) { const uint8_t shift = BIT(offset, 0) << 3; - m_dsp->dataram_w(offset / 2, (data & 0xff) << shift, 0xff << shift); + m_dsp->dataram_w(offset / 2, (uint16_t(data) << 8) | data, uint16_t(0xff) << shift); } /*************************************************************************** diff --git a/src/mame/seta/ssv.h b/src/mame/seta/ssv.h index ae2124b2804..136bb54afce 100644 --- a/src/mame/seta/ssv.h +++ b/src/mame/seta/ssv.h @@ -162,8 +162,8 @@ public: void twineag2(machine_config &config); private: - uint16_t dsp_r(offs_t offset); - void dsp_w(offs_t offset, uint16_t data); + uint8_t dsp_r(offs_t offset); + void dsp_w(offs_t offset, uint8_t data); uint16_t drifto94_unknown_r(); void drifto94_map(address_map &map) ATTR_COLD; diff --git a/src/osd/modules/netdev/pcap.cpp b/src/osd/modules/netdev/pcap.cpp index 8b5e20077fc..8ad62773d58 100644 --- a/src/osd/modules/netdev/pcap.cpp +++ b/src/osd/modules/netdev/pcap.cpp @@ -135,11 +135,12 @@ private: uint8_t *pkt; int len; pcap_t *p; + uint8_t m_pktbuf[2048]; - uint8_t packets[32][1600]; - int packetlens[32]; - std::atomic head; - std::atomic tail; + uint8_t m_packets[32][1600]; + int m_packetlens[32]; + std::atomic m_head; + std::atomic m_tail; static void pcap_handler(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes); static void *pcap_blocker(void *arg); @@ -154,16 +155,16 @@ void pcap_module::netdev_pcap::pcap_handler(u_char *user, const struct pcap_pkth if (!ctx->p) return; - int const curr = ctx->head; + int const curr = ctx->m_head.load(std::memory_order_relaxed); int const next = (curr + 1) & 0x1f; - if (ctx->tail.load(std::memory_order_acquire) == next) + if (ctx->m_tail.load(std::memory_order_acquire) == next) { printf("buffer full, dropping packet\n"); return; } - memcpy(ctx->packets[curr], bytes, h->len); - ctx->packetlens[curr] = h->len; - ctx->head.store(next, std::memory_order_release); + memcpy(ctx->m_packets[curr], bytes, h->len); + ctx->m_packetlens[curr] = h->len; + ctx->m_head.store(next, std::memory_order_release); } void *pcap_module::netdev_pcap::pcap_blocker(void *arg) @@ -202,8 +203,8 @@ pcap_module::netdev_pcap::netdev_pcap(pcap_module &module, const char *name, net } #ifdef SDLMAME_MACOSX - head = 0; - tail = 0; + m_head = 0; + m_tail = 0; p = m_p; pthread_create(&m_thread, nullptr, &netdev_pcap::pcap_blocker, this); #endif @@ -211,40 +212,36 @@ pcap_module::netdev_pcap::netdev_pcap(pcap_module &module, const char *name, net int pcap_module::netdev_pcap::send(void const *buf, int len) { - int ret; - if(!m_p) { + if (!m_p) + { printf("send invoked, but no pcap context\n"); return 0; } - ret = (*m_module.pcap_sendpacket_dl)(m_p, reinterpret_cast(buf), len); + int ret = (*m_module.pcap_sendpacket_dl)(m_p, reinterpret_cast(buf), len); printf("sent packet length %d, returned %d\n", len, ret); return ret ? len : 0; - //return (!pcap_sendpacket_dl(m_p, reinterpret_cast(buf), len))?len:0; + //return (!pcap_sendpacket_dl(m_p, reinterpret_cast(buf), len)) ? len : 0; } int pcap_module::netdev_pcap::recv_dev(uint8_t **buf) { -#ifdef SDLMAME_MACOSX - uint8_t pktbuf[2048]; - int ret; - // no device open? - if(!m_p) return 0; - - // Empty - - int const curr = tail; - if (head.load(std::memory_order_acquire) == curr) + if (!m_p) return 0; - memcpy(pktbuf, packets[curr], packetlens[curr]); - ret = packetlens[curr]; - tail.store((curr + 1) & 0x1f, std::memory_order_release); - *buf = pktbuf; +#ifdef SDLMAME_MACOSX + // Empty + int const curr = m_tail.load(std::memory_order_relaxed); + if (m_head.load(std::memory_order_acquire) == curr) + return 0; + + memcpy(m_pktbuf, m_packets[curr], m_packetlens[curr]); + int ret = m_packetlens[curr]; + m_tail.store((curr + 1) & 0x1f, std::memory_order_release); + *buf = m_pktbuf; return ret; #else struct pcap_pkthdr *header; - if(!m_p) return 0; return ((*m_module.pcap_next_ex_dl)(m_p, &header, (const u_char **)buf) == 1)?header->len:0; #endif }