mirror of
https://github.com/holub/mame
synced 2025-04-18 22:49:58 +03:00
Adjustments to option priority interactions:
emu/sound.cpp: Made -volume in source file INI or higher priority context take precedence over volume read from CFG file. This matches behaviour of -bgfx_screen_chains. emu/input.cpp: Made explicit -no{mouse|joystick|lightgun} take precedence over -{mouse|trackball|adstick|paddle}_device etc. from lower priority levels. Alos got rid of a bunch of unnecessary simple_list.
This commit is contained in:
parent
743ac098e4
commit
82394e8569
@ -2977,11 +2977,14 @@ Core Sound Options
|
||||
|
||||
**-volume** / **-vol** *<value>*
|
||||
|
||||
Sets the startup volume. It can later be changed with the user interface
|
||||
(see Keys section). The volume is an attenuation in dB: e.g.,
|
||||
"**-volume -12**" will start with -12dB attenuation.
|
||||
Sets the initial sound volume. It can be changed later with the user
|
||||
interface (see Keys section). The volume is an attenuation in decibels:
|
||||
e.g. "**-volume -12**" will start with -12 dB attenuation. Note that if the
|
||||
volume is changed in the user interface it will be saved to the
|
||||
configuration file for the system. The value from the configuration file
|
||||
for the system has priority over ``volume`` settings in general INI files.
|
||||
|
||||
The default is ``0``.
|
||||
The default is ``0`` (no attenuation, or full volume).
|
||||
|
||||
Example:
|
||||
.. code-block:: bash
|
||||
@ -3053,11 +3056,11 @@ Core Sound Options
|
||||
|
||||
The default is ``1``.
|
||||
|
||||
| For PortAudio, see the section on :ref:`-pa_latency <mame-commandline-palatency>`.
|
||||
| XAudio2 calculates audio_latency as 10ms steps.
|
||||
| DSound calculates audio_latency as 10ms steps.
|
||||
| CoreAudio calculates audio_latency as 25ms steps.
|
||||
| SDL calculates audio_latency as Xms steps.
|
||||
* For PortAudio, see the section on :ref:`-pa_latency <mame-commandline-palatency>`.
|
||||
* XAudio2 calculates audio_latency as 10ms steps.
|
||||
* DSound calculates audio_latency as 10ms steps.
|
||||
* CoreAudio calculates audio_latency as 25ms steps.
|
||||
* SDL calculates audio_latency as Xms steps.
|
||||
|
||||
Example:
|
||||
.. code-block:: bash
|
||||
@ -3559,11 +3562,13 @@ Core Input Automatic Enable Options
|
||||
:ref:`-mouse <mame-commandline-nomouse>`, :ref:`-joystick
|
||||
<mame-commandline-nojoystick>` and/or :ref:`-lightgun
|
||||
<mame-commandline-nolightgun>` depending on the type of inputs present on
|
||||
the emulated system.
|
||||
the emulated system. Note that these options *will not* override explicit
|
||||
**-nomouse**, **-nojoystick** and/or **-nolightgun** settings at a higher
|
||||
priority level (e.g. in a more specific INI file or on the command line).
|
||||
|
||||
For example, if you specify the option **-paddle_device mouse**, then mouse
|
||||
controls will automatically be enabled when you run a game that has paddle
|
||||
controls (e.g. Super Breakout), even if you specified **-nomouse**.
|
||||
controls (e.g. Super Breakout), even if you specified **-nomouse** .
|
||||
|
||||
The default is to automatically enable mouse controls when running emulated
|
||||
systems with mouse inputs (**-mouse_device mouse**).
|
||||
|
@ -78,7 +78,6 @@ apricot_expansion_bus_device::apricot_expansion_bus_device(const machine_config
|
||||
|
||||
apricot_expansion_bus_device::~apricot_expansion_bus_device()
|
||||
{
|
||||
m_dev.detach_all();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -103,7 +102,7 @@ void apricot_expansion_bus_device::device_start()
|
||||
void apricot_expansion_bus_device::add_card(device_apricot_expansion_card_interface *card)
|
||||
{
|
||||
card->set_bus_device(this);
|
||||
m_dev.append(*card);
|
||||
m_dev.emplace_back(*card);
|
||||
}
|
||||
|
||||
// callbacks from slot device to the host
|
||||
@ -137,8 +136,7 @@ void apricot_expansion_bus_device::install_ram(offs_t addrstart, offs_t addrend,
|
||||
|
||||
device_apricot_expansion_card_interface::device_apricot_expansion_card_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_interface(device, "apricotexp"),
|
||||
m_bus(nullptr),
|
||||
m_next(nullptr)
|
||||
m_bus(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
@ -75,7 +78,7 @@ public:
|
||||
protected:
|
||||
apricot_expansion_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
};
|
||||
|
||||
@ -116,7 +119,8 @@ public:
|
||||
|
||||
void install_ram(offs_t addrstart, offs_t addrend, void *baseptr);
|
||||
|
||||
template<typename T> void install_io_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(class address_map &map), uint64_t unitmask = ~u64(0))
|
||||
template <typename T>
|
||||
void install_io_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(class address_map &map), uint64_t unitmask = ~u64(0))
|
||||
{
|
||||
m_io->install_device(addrstart, addrend, device, map, unitmask);
|
||||
|
||||
@ -125,11 +129,13 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
simple_list<device_apricot_expansion_card_interface> m_dev;
|
||||
using card_vector = std::vector<std::reference_wrapper<device_apricot_expansion_card_interface> >;
|
||||
|
||||
card_vector m_dev;
|
||||
|
||||
// address spaces we have access to
|
||||
required_address_space m_program;
|
||||
@ -153,22 +159,16 @@ DECLARE_DEVICE_TYPE(APRICOT_EXPANSION_BUS, apricot_expansion_bus_device)
|
||||
|
||||
class device_apricot_expansion_card_interface : public device_interface
|
||||
{
|
||||
template <class ElementType> friend class simple_list;
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
virtual ~device_apricot_expansion_card_interface();
|
||||
|
||||
void set_bus_device(apricot_expansion_bus_device *bus);
|
||||
|
||||
device_apricot_expansion_card_interface *next() const { return m_next; }
|
||||
|
||||
protected:
|
||||
device_apricot_expansion_card_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
apricot_expansion_bus_device *m_bus;
|
||||
|
||||
device_apricot_expansion_card_interface *m_next;
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ DEFINE_DEVICE_TYPE(ECONET_SLOT, econet_slot_device, "econet_slot", "Econet stati
|
||||
//-------------------------------------------------
|
||||
|
||||
device_econet_interface::device_econet_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_interface(device, "econet"), m_econet(nullptr), m_address(0), m_next(nullptr)
|
||||
device_interface(device, "econet"), m_econet(nullptr), m_address(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -56,8 +56,9 @@ device_econet_interface::device_econet_interface(const machine_config &mconfig,
|
||||
|
||||
econet_slot_device::econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, ECONET_SLOT, tag, owner, clock),
|
||||
device_slot_interface(mconfig, *this),
|
||||
m_address(0), m_econet(*this, finder_base::DUMMY_TAG)
|
||||
device_single_card_slot_interface<device_econet_interface>(mconfig, *this),
|
||||
m_address(0),
|
||||
m_econet(*this, finder_base::DUMMY_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
@ -68,8 +69,9 @@ econet_slot_device::econet_slot_device(const machine_config &mconfig, const char
|
||||
|
||||
void econet_slot_device::device_start()
|
||||
{
|
||||
device_econet_interface *dev = dynamic_cast<device_econet_interface *>(get_card_device());
|
||||
if (dev) m_econet->add_device(get_card_device(), m_address);
|
||||
device_econet_interface *dev = get_card_device();
|
||||
if (dev)
|
||||
m_econet->add_device(*dev, m_address);
|
||||
}
|
||||
|
||||
|
||||
@ -97,21 +99,17 @@ inline void econet_device::set_signal(device_t *device, int signal, int state)
|
||||
}
|
||||
else
|
||||
{
|
||||
daisy_entry *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
for (auto &entry : m_device_list)
|
||||
{
|
||||
if (!strcmp(entry->m_device->tag(), device->tag()))
|
||||
if (!strcmp(entry.device().tag(), device->tag()))
|
||||
{
|
||||
if (entry->m_line[signal] != state)
|
||||
if (entry.m_line[signal] != state)
|
||||
{
|
||||
if (LOG) logerror("Econet: '%s' %s %u\n", device->tag(), SIGNAL_NAME[signal], state);
|
||||
entry->m_line[signal] = state;
|
||||
entry.m_line[signal] = state;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
entry = entry->next();
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,22 +121,18 @@ inline void econet_device::set_signal(device_t *device, int signal, int state)
|
||||
case DATA: m_write_data(state); break;
|
||||
}
|
||||
|
||||
daisy_entry *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
for (auto &entry : m_device_list)
|
||||
{
|
||||
switch (signal)
|
||||
{
|
||||
case CLK:
|
||||
entry->m_interface->econet_clk(state);
|
||||
entry.interface().econet_clk(state);
|
||||
break;
|
||||
|
||||
case DATA:
|
||||
entry->m_interface->econet_data(state);
|
||||
entry.interface().econet_data(state);
|
||||
break;
|
||||
}
|
||||
|
||||
entry = entry->next();
|
||||
}
|
||||
|
||||
if (LOG) logerror("Econet: CLK %u DATA %u\n", get_signal(CLK), get_signal(DATA));
|
||||
@ -156,17 +150,13 @@ inline int econet_device::get_signal(int signal)
|
||||
|
||||
if (state)
|
||||
{
|
||||
daisy_entry *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
for (auto &entry : m_device_list)
|
||||
{
|
||||
if (!entry->m_line[signal])
|
||||
if (!entry.m_line[signal])
|
||||
{
|
||||
state = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
entry = entry->next();
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,7 +203,7 @@ void econet_device::device_start()
|
||||
|
||||
void econet_device::device_stop()
|
||||
{
|
||||
m_device_list.reset();
|
||||
m_device_list.clear();
|
||||
}
|
||||
|
||||
|
||||
@ -221,14 +211,12 @@ void econet_device::device_stop()
|
||||
// add_device -
|
||||
//-------------------------------------------------
|
||||
|
||||
void econet_device::add_device(device_t *target, int address)
|
||||
void econet_device::add_device(device_econet_interface &target, int address)
|
||||
{
|
||||
auto entry = new daisy_entry(target);
|
||||
target.m_econet = this;
|
||||
target.m_address = address;
|
||||
|
||||
entry->m_interface->m_econet = this;
|
||||
entry->m_interface->m_address = address;
|
||||
|
||||
m_device_list.append(*entry);
|
||||
m_device_list.emplace_back(target);
|
||||
}
|
||||
|
||||
|
||||
@ -236,17 +224,12 @@ void econet_device::add_device(device_t *target, int address)
|
||||
// daisy_entry - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
econet_device::daisy_entry::daisy_entry(device_t *device) :
|
||||
m_next(nullptr),
|
||||
m_device(device),
|
||||
m_interface(nullptr)
|
||||
econet_device::daisy_entry::daisy_entry(device_econet_interface &device) :
|
||||
m_device(&device.device()),
|
||||
m_interface(&device)
|
||||
{
|
||||
for (auto & elem : m_line)
|
||||
{
|
||||
for (auto &elem : m_line)
|
||||
elem = 1;
|
||||
}
|
||||
|
||||
device->interface(m_interface);
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
@ -31,7 +32,7 @@ public:
|
||||
auto clk_wr_callback() { return m_write_clk.bind(); }
|
||||
auto data_wr_callback() { return m_write_data.bind(); }
|
||||
|
||||
void add_device(device_t *target, int address);
|
||||
void add_device(device_econet_interface &target, int address);
|
||||
|
||||
// writes for host (driver_device)
|
||||
DECLARE_WRITE_LINE_MEMBER( host_clk_w );
|
||||
@ -49,31 +50,33 @@ protected:
|
||||
SIGNAL_COUNT
|
||||
};
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_stop() override;
|
||||
|
||||
class daisy_entry
|
||||
{
|
||||
public:
|
||||
daisy_entry(device_t *device);
|
||||
daisy_entry *next() const { return m_next; }
|
||||
daisy_entry(device_econet_interface &device);
|
||||
|
||||
daisy_entry * m_next; // next device
|
||||
device_t * m_device; // associated device
|
||||
device_econet_interface * m_interface; // associated device's daisy interface
|
||||
device_t &device() { return *m_device; }
|
||||
device_econet_interface &interface() { return *m_interface; }
|
||||
|
||||
int m_line[SIGNAL_COUNT];
|
||||
|
||||
private:
|
||||
device_t * m_device; // associated device
|
||||
device_econet_interface * m_interface; // associated device's daisy interface
|
||||
};
|
||||
|
||||
simple_list<daisy_entry> m_device_list;
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
virtual void device_stop() override;
|
||||
|
||||
std::vector<daisy_entry> m_device_list;
|
||||
|
||||
private:
|
||||
devcb_write_line m_write_clk;
|
||||
devcb_write_line m_write_data;
|
||||
|
||||
inline void set_signal(device_t *device, int signal, int state);
|
||||
inline int get_signal(int signal);
|
||||
void set_signal(device_t *device, int signal, int state);
|
||||
int get_signal(int signal);
|
||||
|
||||
int m_line[SIGNAL_COUNT];
|
||||
};
|
||||
@ -81,8 +84,7 @@ private:
|
||||
|
||||
// ======================> econet_slot_device
|
||||
|
||||
class econet_slot_device : public device_t,
|
||||
public device_slot_interface
|
||||
class econet_slot_device : public device_t, public device_single_card_slot_interface<device_econet_interface>
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
@ -115,11 +117,8 @@ private:
|
||||
class device_econet_interface : public device_interface
|
||||
{
|
||||
friend class econet_device;
|
||||
template <class ElementType> friend class simple_list;
|
||||
|
||||
public:
|
||||
device_econet_interface *next() const { return m_next; }
|
||||
|
||||
virtual void econet_clk(int state) = 0;
|
||||
virtual void econet_data(int state) = 0;
|
||||
|
||||
@ -129,9 +128,6 @@ protected:
|
||||
|
||||
econet_device *m_econet;
|
||||
uint8_t m_address;
|
||||
|
||||
private:
|
||||
device_econet_interface *m_next;
|
||||
};
|
||||
|
||||
|
||||
|
@ -70,7 +70,6 @@ nasbus_device::nasbus_device(const machine_config &mconfig, const char *tag, dev
|
||||
|
||||
nasbus_device::~nasbus_device()
|
||||
{
|
||||
m_dev.detach_all();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -98,7 +97,7 @@ void nasbus_device::device_reset()
|
||||
void nasbus_device::add_card(device_nasbus_card_interface &card)
|
||||
{
|
||||
card.set_nasbus_device(*this);
|
||||
m_dev.append(card);
|
||||
m_dev.emplace_back(card);
|
||||
}
|
||||
|
||||
// callbacks from slot device to the host
|
||||
@ -115,8 +114,7 @@ WRITE_LINE_MEMBER( nasbus_device::ram_disable_w ) { m_ram_disable_handler(state)
|
||||
|
||||
device_nasbus_card_interface::device_nasbus_card_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_interface(device, "nasbus"),
|
||||
m_nasbus(nullptr),
|
||||
m_next(nullptr)
|
||||
m_nasbus(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -125,7 +128,7 @@ public:
|
||||
protected:
|
||||
nasbus_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
@ -156,17 +159,19 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( ram_disable_w );
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
private:
|
||||
using card_vector = std::vector<std::reference_wrapper<device_nasbus_card_interface> >;
|
||||
|
||||
required_address_space m_program;
|
||||
required_address_space m_io;
|
||||
|
||||
simple_list<device_nasbus_card_interface> m_dev;
|
||||
|
||||
devcb_write_line m_ram_disable_handler;
|
||||
|
||||
card_vector m_dev;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
@ -176,15 +181,12 @@ DECLARE_DEVICE_TYPE(NASBUS, nasbus_device)
|
||||
|
||||
class device_nasbus_card_interface : public device_interface
|
||||
{
|
||||
template <class ElementType> friend class simple_list;
|
||||
public:
|
||||
// construction/destruction
|
||||
virtual ~device_nasbus_card_interface();
|
||||
|
||||
void set_nasbus_device(nasbus_device &nasbus);
|
||||
|
||||
device_nasbus_card_interface *next() const { return m_next; }
|
||||
|
||||
protected:
|
||||
device_nasbus_card_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
@ -197,8 +199,6 @@ protected:
|
||||
|
||||
private:
|
||||
nasbus_device *m_nasbus;
|
||||
|
||||
device_nasbus_card_interface *m_next;
|
||||
};
|
||||
|
||||
// include here so drivers don't need to
|
||||
|
@ -34,7 +34,6 @@ svi_slot_bus_device::svi_slot_bus_device(const machine_config &mconfig, const ch
|
||||
|
||||
svi_slot_bus_device::~svi_slot_bus_device()
|
||||
{
|
||||
m_dev.detach_all();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -56,7 +55,7 @@ void svi_slot_bus_device::device_start()
|
||||
void svi_slot_bus_device::add_card(device_svi_slot_interface &card)
|
||||
{
|
||||
card.set_bus_device(*this);
|
||||
m_dev.append(card);
|
||||
m_dev.emplace_back(card);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -65,14 +64,10 @@ void svi_slot_bus_device::add_card(device_svi_slot_interface &card)
|
||||
|
||||
uint8_t svi_slot_bus_device::mreq_r(offs_t offset)
|
||||
{
|
||||
device_svi_slot_interface *entry = m_dev.first();
|
||||
uint8_t data = 0xff;
|
||||
|
||||
while (entry)
|
||||
{
|
||||
data &= entry->mreq_r(offset);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_svi_slot_interface &entry : m_dev)
|
||||
data &= entry.mreq_r(offset);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -83,13 +78,8 @@ uint8_t svi_slot_bus_device::mreq_r(offs_t offset)
|
||||
|
||||
void svi_slot_bus_device::mreq_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
device_svi_slot_interface *entry = m_dev.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->mreq_w(offset, data);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_svi_slot_interface &entry : m_dev)
|
||||
entry.mreq_w(offset, data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -98,14 +88,10 @@ void svi_slot_bus_device::mreq_w(offs_t offset, uint8_t data)
|
||||
|
||||
uint8_t svi_slot_bus_device::iorq_r(offs_t offset)
|
||||
{
|
||||
device_svi_slot_interface *entry = m_dev.first();
|
||||
uint8_t data = 0xff;
|
||||
|
||||
while (entry)
|
||||
{
|
||||
data &= entry->iorq_r(offset);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_svi_slot_interface &entry : m_dev)
|
||||
data &= entry.iorq_r(offset);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -116,13 +102,8 @@ uint8_t svi_slot_bus_device::iorq_r(offs_t offset)
|
||||
|
||||
void svi_slot_bus_device::iorq_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
device_svi_slot_interface *entry = m_dev.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->iorq_w(offset, data);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_svi_slot_interface &entry : m_dev)
|
||||
entry.iorq_w(offset, data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -131,13 +112,8 @@ void svi_slot_bus_device::iorq_w(offs_t offset, uint8_t data)
|
||||
|
||||
WRITE_LINE_MEMBER( svi_slot_bus_device::bk21_w )
|
||||
{
|
||||
device_svi_slot_interface *entry = m_dev.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->bk21_w(state);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_svi_slot_interface &entry : m_dev)
|
||||
entry.bk21_w(state);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -146,13 +122,8 @@ WRITE_LINE_MEMBER( svi_slot_bus_device::bk21_w )
|
||||
|
||||
WRITE_LINE_MEMBER( svi_slot_bus_device::bk22_w )
|
||||
{
|
||||
device_svi_slot_interface *entry = m_dev.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->bk22_w(state);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_svi_slot_interface &entry : m_dev)
|
||||
entry.bk22_w(state);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -161,13 +132,8 @@ WRITE_LINE_MEMBER( svi_slot_bus_device::bk22_w )
|
||||
|
||||
WRITE_LINE_MEMBER( svi_slot_bus_device::bk31_w )
|
||||
{
|
||||
device_svi_slot_interface *entry = m_dev.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->bk31_w(state);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_svi_slot_interface &entry : m_dev)
|
||||
entry.bk31_w(state);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -176,13 +142,8 @@ WRITE_LINE_MEMBER( svi_slot_bus_device::bk31_w )
|
||||
|
||||
WRITE_LINE_MEMBER( svi_slot_bus_device::bk32_w )
|
||||
{
|
||||
device_svi_slot_interface *entry = m_dev.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->bk32_w(state);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_svi_slot_interface &entry : m_dev)
|
||||
entry.bk32_w(state);
|
||||
}
|
||||
|
||||
|
||||
@ -225,8 +186,7 @@ void svi_slot_device::device_start()
|
||||
|
||||
device_svi_slot_interface::device_svi_slot_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_interface(device, "svi3x8slot"),
|
||||
m_bus(nullptr),
|
||||
m_next(nullptr)
|
||||
m_bus(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -80,10 +83,12 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( bk32_w );
|
||||
|
||||
private:
|
||||
// device-level overrides
|
||||
using card_vector = std::vector<std::reference_wrapper<device_svi_slot_interface> >;
|
||||
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
simple_list<device_svi_slot_interface> m_dev;
|
||||
card_vector m_dev;
|
||||
|
||||
devcb_write_line m_int_handler;
|
||||
devcb_write_line m_romdis_handler;
|
||||
@ -115,7 +120,7 @@ public:
|
||||
template <typename T> void set_bus(T &&tag) { m_bus.set_tag(std::forward<T>(tag)); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
// configuration
|
||||
@ -129,15 +134,12 @@ DECLARE_DEVICE_TYPE(SVI_SLOT, svi_slot_device)
|
||||
|
||||
class device_svi_slot_interface : public device_interface
|
||||
{
|
||||
template <class ElementType> friend class simple_list;
|
||||
public:
|
||||
// construction/destruction
|
||||
virtual ~device_svi_slot_interface();
|
||||
|
||||
void set_bus_device(svi_slot_bus_device &bus);
|
||||
|
||||
device_svi_slot_interface *next() const { return m_next; }
|
||||
|
||||
virtual uint8_t mreq_r(offs_t offset) { return 0xff; }
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) { }
|
||||
virtual uint8_t iorq_r(offs_t offset) { return 0xff; }
|
||||
@ -152,9 +154,6 @@ protected:
|
||||
device_svi_slot_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
svi_slot_bus_device *m_bus;
|
||||
|
||||
private:
|
||||
device_svi_slot_interface *m_next;
|
||||
};
|
||||
|
||||
// include here so drivers don't need to
|
||||
|
@ -63,6 +63,10 @@ tiki100_bus_device::tiki100_bus_device(const machine_config &mconfig, const char
|
||||
{
|
||||
}
|
||||
|
||||
tiki100_bus_device::~tiki100_bus_device()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
@ -85,7 +89,7 @@ void tiki100_bus_device::device_start()
|
||||
|
||||
void tiki100_bus_device::add_card(device_tiki100bus_card_interface &card)
|
||||
{
|
||||
m_device_list.append(card);
|
||||
m_device_list.emplace_back(card);
|
||||
|
||||
card.m_bus = this;
|
||||
}
|
||||
@ -97,13 +101,8 @@ void tiki100_bus_device::add_card(device_tiki100bus_card_interface &card)
|
||||
|
||||
uint8_t tiki100_bus_device::mrq_r(offs_t offset, uint8_t data, bool &mdis)
|
||||
{
|
||||
device_tiki100bus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
data &= entry->mrq_r(offset, data, mdis);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_tiki100bus_card_interface &entry : m_device_list)
|
||||
data &= entry.mrq_r(offset, data, mdis);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -115,13 +114,8 @@ uint8_t tiki100_bus_device::mrq_r(offs_t offset, uint8_t data, bool &mdis)
|
||||
|
||||
void tiki100_bus_device::mrq_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
device_tiki100bus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->mrq_w(offset, data);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_tiki100bus_card_interface &entry : m_device_list)
|
||||
entry.mrq_w(offset, data);
|
||||
}
|
||||
|
||||
|
||||
@ -131,13 +125,8 @@ void tiki100_bus_device::mrq_w(offs_t offset, uint8_t data)
|
||||
|
||||
uint8_t tiki100_bus_device::iorq_r(offs_t offset, uint8_t data)
|
||||
{
|
||||
device_tiki100bus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
data &= entry->iorq_r(offset, data);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_tiki100bus_card_interface &entry : m_device_list)
|
||||
data &= entry.iorq_r(offset, data);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -149,13 +138,8 @@ uint8_t tiki100_bus_device::iorq_r(offs_t offset, uint8_t data)
|
||||
|
||||
void tiki100_bus_device::iorq_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
device_tiki100bus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->iorq_w(offset, data);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_tiki100bus_card_interface &entry : m_device_list)
|
||||
entry.iorq_w(offset, data);
|
||||
}
|
||||
|
||||
|
||||
@ -165,13 +149,8 @@ void tiki100_bus_device::iorq_w(offs_t offset, uint8_t data)
|
||||
|
||||
WRITE_LINE_MEMBER( tiki100_bus_device::busak_w )
|
||||
{
|
||||
device_tiki100bus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->busak_w(state);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_tiki100bus_card_interface &entry : m_device_list)
|
||||
entry.busak_w(state);
|
||||
}
|
||||
|
||||
|
||||
@ -187,8 +166,7 @@ WRITE_LINE_MEMBER( tiki100_bus_device::busak_w )
|
||||
device_tiki100bus_card_interface::device_tiki100bus_card_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_interface(device, "tiki100bus"),
|
||||
m_bus(nullptr),
|
||||
m_busak(CLEAR_LINE),
|
||||
m_next(nullptr)
|
||||
m_busak(CLEAR_LINE)
|
||||
{
|
||||
m_slot = dynamic_cast<tiki100_bus_slot_device *>(device.owner());
|
||||
}
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
#include "machine/z80daisy.h"
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -33,11 +36,8 @@ class tiki100_bus_slot_device;
|
||||
class device_tiki100bus_card_interface : public device_interface
|
||||
{
|
||||
friend class tiki100_bus_device;
|
||||
template <class ElementType> friend class simple_list;
|
||||
|
||||
public:
|
||||
device_tiki100bus_card_interface *next() const { return m_next; }
|
||||
|
||||
// memory access
|
||||
virtual uint8_t mrq_r(offs_t offset, uint8_t data, bool &mdis) { mdis = 1; return data; }
|
||||
virtual void mrq_w(offs_t offset, uint8_t data) { }
|
||||
@ -62,9 +62,6 @@ protected:
|
||||
tiki100_bus_device *m_bus;
|
||||
tiki100_bus_slot_device *m_slot;
|
||||
int m_busak;
|
||||
|
||||
private:
|
||||
device_tiki100bus_card_interface *m_next;
|
||||
};
|
||||
|
||||
|
||||
@ -92,10 +89,10 @@ public:
|
||||
template <typename T> void set_bus(T &&tag) { m_bus.set_tag(std::forward<T>(tag)); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_z80daisy_interface overrides
|
||||
// device_z80daisy_interface implementation
|
||||
virtual int z80daisy_irq_state() override { return get_card_device() ? m_card->z80daisy_irq_state() : 0; }
|
||||
virtual int z80daisy_irq_ack() override { return get_card_device() ? m_card->z80daisy_irq_ack() : 0; }
|
||||
virtual void z80daisy_irq_reti() override { if (get_card_device()) m_card->z80daisy_irq_reti(); }
|
||||
@ -118,7 +115,7 @@ class tiki100_bus_device : public device_t
|
||||
public:
|
||||
// construction/destruction
|
||||
tiki100_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
~tiki100_bus_device() { m_device_list.detach_all(); }
|
||||
~tiki100_bus_device();
|
||||
|
||||
auto irq_wr_callback() { return m_irq_cb.bind(); }
|
||||
auto nmi_wr_callback() { return m_nmi_cb.bind(); }
|
||||
@ -145,17 +142,19 @@ public:
|
||||
void exin_mrq_w(offs_t offset, uint8_t data) { m_out_mrq_cb(offset, data); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
using card_vector = std::vector<std::reference_wrapper<device_tiki100bus_card_interface> >;
|
||||
|
||||
devcb_write_line m_irq_cb;
|
||||
devcb_write_line m_nmi_cb;
|
||||
devcb_write_line m_busrq_cb;
|
||||
devcb_read8 m_in_mrq_cb;
|
||||
devcb_write8 m_out_mrq_cb;
|
||||
|
||||
simple_list<device_tiki100bus_card_interface> m_device_list;
|
||||
card_vector m_device_list;
|
||||
};
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ wangpcbus_slot_device::wangpcbus_slot_device(const machine_config &mconfig, cons
|
||||
|
||||
void wangpcbus_slot_device::device_start()
|
||||
{
|
||||
device_wangpcbus_card_interface *dev = get_card_device();
|
||||
device_wangpcbus_card_interface *const dev = get_card_device();
|
||||
if (dev)
|
||||
m_bus->add_card(*dev, m_sid);
|
||||
}
|
||||
@ -66,6 +66,10 @@ wangpcbus_device::wangpcbus_device(const machine_config &mconfig, const char *ta
|
||||
{
|
||||
}
|
||||
|
||||
wangpcbus_device::~wangpcbus_device()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
@ -93,7 +97,7 @@ void wangpcbus_device::device_start()
|
||||
|
||||
void wangpcbus_device::add_card(device_wangpcbus_card_interface &card, int sid)
|
||||
{
|
||||
m_device_list.append(card);
|
||||
m_device_list.emplace_back(card);
|
||||
|
||||
card.m_bus = this;
|
||||
card.m_sid = sid;
|
||||
@ -108,13 +112,8 @@ uint16_t wangpcbus_device::mrdc_r(offs_t offset, uint16_t mem_mask)
|
||||
{
|
||||
uint16_t data = 0xffff;
|
||||
|
||||
device_wangpcbus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
data &= entry->wangpcbus_mrdc_r(offset + 0x40000/2, mem_mask);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_wangpcbus_card_interface &entry : m_device_list)
|
||||
data &= entry.wangpcbus_mrdc_r(offset + 0x40000/2, mem_mask);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -126,13 +125,8 @@ uint16_t wangpcbus_device::mrdc_r(offs_t offset, uint16_t mem_mask)
|
||||
|
||||
void wangpcbus_device::amwc_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||
{
|
||||
device_wangpcbus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->wangpcbus_amwc_w(offset + 0x40000/2, mem_mask, data);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_wangpcbus_card_interface &entry : m_device_list)
|
||||
entry.wangpcbus_amwc_w(offset + 0x40000/2, mem_mask, data);
|
||||
}
|
||||
|
||||
|
||||
@ -144,13 +138,8 @@ uint16_t wangpcbus_device::sad_r(offs_t offset, uint16_t mem_mask)
|
||||
{
|
||||
uint16_t data = 0xffff;
|
||||
|
||||
device_wangpcbus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
data &= entry->wangpcbus_iorc_r(offset + 0x1100/2, mem_mask);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_wangpcbus_card_interface &entry : m_device_list)
|
||||
data &= entry.wangpcbus_iorc_r(offset + 0x1100/2, mem_mask);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -162,13 +151,8 @@ uint16_t wangpcbus_device::sad_r(offs_t offset, uint16_t mem_mask)
|
||||
|
||||
void wangpcbus_device::sad_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||
{
|
||||
device_wangpcbus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->wangpcbus_aiowc_w(offset + 0x1100/2, mem_mask, data);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_wangpcbus_card_interface &entry : m_device_list)
|
||||
entry.wangpcbus_aiowc_w(offset + 0x1100/2, mem_mask, data);
|
||||
}
|
||||
|
||||
|
||||
@ -179,17 +163,14 @@ void wangpcbus_device::sad_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||
uint8_t wangpcbus_device::dack_r(int line)
|
||||
{
|
||||
uint8_t retVal = 0xff;
|
||||
device_wangpcbus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
for (device_wangpcbus_card_interface &entry : m_device_list)
|
||||
{
|
||||
if (entry->wangpcbus_have_dack(line))
|
||||
if (entry.wangpcbus_have_dack(line))
|
||||
{
|
||||
retVal = entry->wangpcbus_dack_r(line);
|
||||
retVal = entry.wangpcbus_dack_r(line);
|
||||
break;
|
||||
}
|
||||
|
||||
entry = entry->next();
|
||||
}
|
||||
|
||||
return retVal;
|
||||
@ -202,16 +183,10 @@ uint8_t wangpcbus_device::dack_r(int line)
|
||||
|
||||
void wangpcbus_device::dack_w(int line, uint8_t data)
|
||||
{
|
||||
device_wangpcbus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
for (device_wangpcbus_card_interface &entry : m_device_list)
|
||||
{
|
||||
if (entry->wangpcbus_have_dack(line))
|
||||
{
|
||||
entry->wangpcbus_dack_w(line, data);
|
||||
}
|
||||
|
||||
entry = entry->next();
|
||||
if (entry.wangpcbus_have_dack(line))
|
||||
entry.wangpcbus_dack_w(line, data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,13 +197,8 @@ void wangpcbus_device::dack_w(int line, uint8_t data)
|
||||
|
||||
WRITE_LINE_MEMBER( wangpcbus_device::tc_w )
|
||||
{
|
||||
device_wangpcbus_card_interface *entry = m_device_list.first();
|
||||
|
||||
while (entry)
|
||||
{
|
||||
entry->wangpcbus_tc_w(state);
|
||||
entry = entry->next();
|
||||
}
|
||||
for (device_wangpcbus_card_interface &entry : m_device_list)
|
||||
entry.wangpcbus_tc_w(state);
|
||||
}
|
||||
|
||||
|
||||
@ -242,9 +212,11 @@ WRITE_LINE_MEMBER( wangpcbus_device::tc_w )
|
||||
//-------------------------------------------------
|
||||
|
||||
device_wangpcbus_card_interface::device_wangpcbus_card_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_interface(device, "wangpcbus"), m_bus(nullptr), m_sid(0), m_next(nullptr)
|
||||
device_interface(device, "wangpcbus"),
|
||||
m_bus(nullptr),
|
||||
m_slot(dynamic_cast<wangpcbus_slot_device *>(device.owner())),
|
||||
m_sid(0)
|
||||
{
|
||||
m_slot = dynamic_cast<wangpcbus_slot_device *>(device.owner());
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
@ -49,7 +51,7 @@ public:
|
||||
void set_bus_slot(int sid) { m_sid = sid; }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
@ -70,7 +72,7 @@ class wangpcbus_device : public device_t
|
||||
public:
|
||||
// construction/destruction
|
||||
wangpcbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
~wangpcbus_device() { m_device_list.detach_all(); }
|
||||
~wangpcbus_device();
|
||||
|
||||
auto irq2_wr_callback() { return m_write_irq2.bind(); }
|
||||
auto irq3_wr_callback() { return m_write_irq3.bind(); }
|
||||
@ -119,10 +121,12 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( ioerror_w ) { m_write_ioerror(state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// devicedevice_t implementation
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
using card_vector = std::vector<std::reference_wrapper<device_wangpcbus_card_interface> >;
|
||||
|
||||
devcb_write_line m_write_irq2;
|
||||
devcb_write_line m_write_irq3;
|
||||
devcb_write_line m_write_irq4;
|
||||
@ -134,7 +138,7 @@ private:
|
||||
devcb_write_line m_write_drq3;
|
||||
devcb_write_line m_write_ioerror;
|
||||
|
||||
simple_list<device_wangpcbus_card_interface> m_device_list;
|
||||
card_vector m_device_list;
|
||||
};
|
||||
|
||||
|
||||
@ -148,11 +152,8 @@ DECLARE_DEVICE_TYPE(WANGPC_BUS, wangpcbus_device)
|
||||
class device_wangpcbus_card_interface : public device_interface
|
||||
{
|
||||
friend class wangpcbus_device;
|
||||
template <class ElementType> friend class simple_list;
|
||||
|
||||
public:
|
||||
device_wangpcbus_card_interface *next() const { return m_next; }
|
||||
|
||||
// memory access
|
||||
virtual uint16_t wangpcbus_mrdc_r(offs_t offset, uint16_t mem_mask) { return 0; }
|
||||
virtual void wangpcbus_amwc_w(offs_t offset, uint16_t mem_mask, uint16_t data) { }
|
||||
@ -175,12 +176,9 @@ protected:
|
||||
virtual void interface_pre_start() override;
|
||||
|
||||
wangpcbus_device *m_bus;
|
||||
wangpcbus_slot_device *m_slot;
|
||||
wangpcbus_slot_device *const m_slot;
|
||||
|
||||
int m_sid;
|
||||
|
||||
private:
|
||||
device_wangpcbus_card_interface *m_next;
|
||||
};
|
||||
|
||||
|
||||
|
@ -37,8 +37,8 @@ public:
|
||||
}
|
||||
|
||||
// line handlers
|
||||
inline DECLARE_WRITE_LINE_MEMBER(cmd_w);
|
||||
inline DECLARE_READ_LINE_MEMBER(data_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(cmd_w);
|
||||
DECLARE_READ_LINE_MEMBER(data_r);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -75,13 +75,13 @@ extern void wy60_keyboards(device_slot_interface &slot);
|
||||
// INLINE FUNCTIONS
|
||||
//**************************************************************************
|
||||
|
||||
WRITE_LINE_MEMBER(wyse_keyboard_port_device::cmd_w)
|
||||
inline WRITE_LINE_MEMBER(wyse_keyboard_port_device::cmd_w)
|
||||
{
|
||||
if (m_kbd != nullptr)
|
||||
m_kbd->wysekbd_write_cmd(state);
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER(wyse_keyboard_port_device::data_r)
|
||||
inline READ_LINE_MEMBER(wyse_keyboard_port_device::data_r)
|
||||
{
|
||||
if (m_kbd != nullptr)
|
||||
return m_kbd->wysekbd_read_data();
|
||||
|
@ -1846,14 +1846,14 @@ time_t ioport_manager::initialize()
|
||||
port.second->init_live_state();
|
||||
|
||||
// handle autoselection of devices
|
||||
init_autoselect_devices(IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick");
|
||||
init_autoselect_devices(IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle");
|
||||
init_autoselect_devices(IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal");
|
||||
init_autoselect_devices(IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun");
|
||||
init_autoselect_devices(IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional");
|
||||
init_autoselect_devices(IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial");
|
||||
init_autoselect_devices(IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball");
|
||||
init_autoselect_devices(IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse");
|
||||
init_autoselect_devices({ IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z }, OPTION_ADSTICK_DEVICE, "analog joystick");
|
||||
init_autoselect_devices({ IPT_PADDLE, IPT_PADDLE_V }, OPTION_PADDLE_DEVICE, "paddle");
|
||||
init_autoselect_devices({ IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3 }, OPTION_PEDAL_DEVICE, "pedal");
|
||||
init_autoselect_devices({ IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y }, OPTION_LIGHTGUN_DEVICE, "lightgun");
|
||||
init_autoselect_devices({ IPT_POSITIONAL, IPT_POSITIONAL_V }, OPTION_POSITIONAL_DEVICE, "positional");
|
||||
init_autoselect_devices({ IPT_DIAL, IPT_DIAL_V }, OPTION_DIAL_DEVICE, "dial");
|
||||
init_autoselect_devices({ IPT_TRACKBALL_X, IPT_TRACKBALL_Y }, OPTION_TRACKBALL_DEVICE, "trackball");
|
||||
init_autoselect_devices({ IPT_MOUSE_X, IPT_MOUSE_Y }, OPTION_MOUSE_DEVICE, "mouse");
|
||||
|
||||
// look for 4-way diagonal joysticks and change the default map if we find any
|
||||
const char *joystick_map_default = machine().options().joystick_map();
|
||||
@ -1911,39 +1911,71 @@ void ioport_manager::init_port_types()
|
||||
// in and the corresponding option
|
||||
//-------------------------------------------------
|
||||
|
||||
void ioport_manager::init_autoselect_devices(int type1, int type2, int type3, const char *option, const char *ananame)
|
||||
void ioport_manager::init_autoselect_devices(std::initializer_list<ioport_type> types, std::string_view option, std::string_view ananame)
|
||||
{
|
||||
static std::pair<char const *, char const *> const CLASS_OPTIONS[] = {
|
||||
{ "mouse", OPTION_MOUSE },
|
||||
{ "joystick", OPTION_JOYSTICK },
|
||||
{ "lightgun", OPTION_LIGHTGUN } };
|
||||
|
||||
// if nothing specified, ignore the option
|
||||
const char *stemp = machine().options().value(option);
|
||||
if (stemp[0] == 0 || strcmp(stemp, "none") == 0)
|
||||
auto const autooption = machine().options().get_entry(option);
|
||||
char const *const autoclass = autooption->value();
|
||||
if (!autoclass || !*autoclass || !std::strcmp(autoclass, "none"))
|
||||
return;
|
||||
|
||||
// extract valid strings
|
||||
// if the device class is enabled anyway or disabled at a higher priority level, do nothing
|
||||
auto const classname = std::find_if(
|
||||
std::begin(CLASS_OPTIONS),
|
||||
std::end(CLASS_OPTIONS),
|
||||
[&autoclass] (auto const &x) { return !std::strcmp(autoclass, x.first); });
|
||||
if (std::end(CLASS_OPTIONS) != classname)
|
||||
{
|
||||
if (machine().options().bool_value(classname->second))
|
||||
return;
|
||||
|
||||
auto const classoption = machine().options().get_entry(classname->second);
|
||||
if (classoption->priority() > autooption->priority())
|
||||
{
|
||||
osd_printf_verbose("Input: Won't autoenable %s in presence of a %s as it's disabled at a higher priority\n", autoclass, ananame);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// find matching device class
|
||||
input_class *autoenable_class = nullptr;
|
||||
for (input_device_class devclass = DEVICE_CLASS_FIRST_VALID; devclass <= DEVICE_CLASS_LAST_VALID; ++devclass)
|
||||
if (strcmp(stemp, machine().input().device_class(devclass).name()) == 0)
|
||||
{
|
||||
if (!std::strcmp(autoclass, machine().input().device_class(devclass).name()))
|
||||
{
|
||||
autoenable_class = &machine().input().device_class(devclass);
|
||||
break;
|
||||
}
|
||||
if (autoenable_class == nullptr)
|
||||
}
|
||||
if (!autoenable_class)
|
||||
{
|
||||
osd_printf_error("Invalid %s value %s; reverting to keyboard\n", option, stemp);
|
||||
osd_printf_error("Invalid %s value %s; reverting to keyboard\n", option, autoclass);
|
||||
autoenable_class = &machine().input().device_class(DEVICE_CLASS_KEYBOARD);
|
||||
}
|
||||
|
||||
// only scan the list if we haven't already enabled this class of control
|
||||
if (!autoenable_class->enabled())
|
||||
for (auto &port : m_portlist)
|
||||
for (ioport_field const &field : port.second->fields())
|
||||
// nothing to do if the class is already enabled
|
||||
if (autoenable_class->enabled())
|
||||
return;
|
||||
|
||||
// if this port type is in use, apply the autoselect criteria
|
||||
if ((type1 != 0 && field.type() == type1) || (type2 != 0 && field.type() == type2) || (type3 != 0 && field.type() == type3))
|
||||
{
|
||||
osd_printf_verbose("Input: Autoenabling %s due to presence of a %s\n", autoenable_class->name(), ananame);
|
||||
autoenable_class->enable();
|
||||
break;
|
||||
}
|
||||
// scan the port list
|
||||
for (auto &port : m_portlist)
|
||||
{
|
||||
for (ioport_field const &field : port.second->fields())
|
||||
{
|
||||
// if this port type is in use, apply the autoselect criteria
|
||||
if (std::find(std::begin(types), std::end(types), field.type()) != std::end(types))
|
||||
{
|
||||
osd_printf_verbose("Input: Autoenabling %s due to presence of a %s\n", autoenable_class->name(), ananame);
|
||||
autoenable_class->enable();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <initializer_list>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@ -961,7 +962,7 @@ public:
|
||||
private:
|
||||
// internal helpers
|
||||
void init_port_types();
|
||||
void init_autoselect_devices(int type1, int type2, int type3, const char *option, const char *ananame);
|
||||
void init_autoselect_devices(std::initializer_list<ioport_type> types, std::string_view option, std::string_view ananame);
|
||||
|
||||
void frame_update_callback();
|
||||
void frame_update();
|
||||
|
@ -1377,7 +1377,12 @@ void sound_manager::config_load(config_type cfg_type, config_level cfg_level, ut
|
||||
|
||||
// master volume attenuation
|
||||
if (util::xml::data_node const *node = parentnode->get_child("attenuation"))
|
||||
set_attenuation(std::clamp(int(node->get_attribute_int("value", 0)), -32, 0));
|
||||
{
|
||||
// treat source INI files or more specific as higher priority than CFG
|
||||
// FIXME: leaky abstraction - this depends on a front-end implementation detail
|
||||
if ((OPTION_PRIORITY_NORMAL + 5) > machine().options().get_entry(OPTION_VOLUME)->priority())
|
||||
set_attenuation(std::clamp(int(node->get_attribute_int("value", 0)), -32, 0));
|
||||
}
|
||||
|
||||
// iterate over channel nodes
|
||||
for (util::xml::data_node const *channelnode = parentnode->get_child("channel"); channelnode != nullptr; channelnode = channelnode->get_next_sibling("channel"))
|
||||
|
Loading…
Reference in New Issue
Block a user