mirror of
https://github.com/holub/mame
synced 2025-06-01 02:21:48 +03:00
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.
This commit is contained in:
parent
3195b9fcc1
commit
4565368984
File diff suppressed because it is too large
Load Diff
@ -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<m68000_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<software_list_device>("flop_mac35_orig")->set_filter("MC68000,mac128k");
|
||||
subdevice<software_list_device>("flop_mac35_clean")->set_filter("MC68000,mac128k");
|
||||
subdevice<software_list_device>("flop35_list")->set_filter("MC68000,mac128k");
|
||||
}
|
||||
|
||||
void mac128_state::mac512k(machine_config &config)
|
||||
{
|
||||
mac128k(config);
|
||||
m_ram->set_default_size("512K");
|
||||
|
||||
subdevice<software_list_device>("flop_mac35_orig")->set_filter("MC68000,mac512k");
|
||||
subdevice<software_list_device>("flop_mac35_clean")->set_filter("MC68000,mac512k");
|
||||
subdevice<software_list_device>("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<software_list_device>("flop_mac35_orig")->set_filter("MC68000,macplus");
|
||||
subdevice<software_list_device>("flop_mac35_clean")->set_filter("MC68000,macplus");
|
||||
subdevice<software_list_device>("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<software_list_device>("flop_mac35_orig")->set_filter("MC68000,macse");
|
||||
subdevice<software_list_device>("flop_mac35_clean")->set_filter("MC68000,macse");
|
||||
subdevice<software_list_device>("flop35_list")->set_filter("MC68000,macse");
|
||||
subdevice<software_list_device>("hdd_list")->set_filter("MC68000,macse");
|
||||
subdevice<software_list_device>("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<software_list_device>("flop_mac35_orig")->set_filter("MC68000,macclasc");
|
||||
subdevice<software_list_device>("flop_mac35_clean")->set_filter("MC68000,macclasc");
|
||||
subdevice<software_list_device>("flop35_list")->set_filter("MC68000,macclasc");
|
||||
subdevice<software_list_device>("hdd_list")->set_filter("MC68000,macclasc");
|
||||
subdevice<software_list_device>("cd_list")->set_filter("MC68000,macclasc");
|
||||
subdevice<software_list_device>("flop35hd_list")->set_filter("MC68000,macclasc");
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( macplus )
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -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;
|
||||
|
@ -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<int> head;
|
||||
std::atomic<int> tail;
|
||||
uint8_t m_packets[32][1600];
|
||||
int m_packetlens[32];
|
||||
std::atomic<int> m_head;
|
||||
std::atomic<int> 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<const u_char *>(buf), len);
|
||||
int ret = (*m_module.pcap_sendpacket_dl)(m_p, reinterpret_cast<const u_char *>(buf), len);
|
||||
printf("sent packet length %d, returned %d\n", len, ret);
|
||||
return ret ? len : 0;
|
||||
//return (!pcap_sendpacket_dl(m_p, reinterpret_cast<const u_char *>(buf), len))?len:0;
|
||||
//return (!pcap_sendpacket_dl(m_p, reinterpret_cast<const u_char *>(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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user