From a6cdd2086d6a5c686b2a346575fabef7bb6ee5f3 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 27 Aug 2020 00:50:26 +1000 Subject: [PATCH] audio/cinemat.cpp: small cleanup/safety improvement --- src/mame/audio/cinemat.cpp | 50 +++++++++++++-------------- src/mame/audio/cinemat.h | 38 ++++++++++---------- src/mame/drivers/galaxian.cpp | 2 +- src/mame/machine/bacta_datalogger.cpp | 20 +++++------ 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/mame/audio/cinemat.cpp b/src/mame/audio/cinemat.cpp index 70491dce09d..c7b75f31311 100644 --- a/src/mame/audio/cinemat.cpp +++ b/src/mame/audio/cinemat.cpp @@ -45,7 +45,7 @@ * *************************************/ -cinemat_audio_device::cinemat_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale) +cinemat_audio_device_base::cinemat_audio_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale) : device_t(mconfig, type, tag, owner, clock) , m_out_input(*this, "sound_nl:out_%u", 0) , m_inputs_mask(inputs_mask) @@ -54,25 +54,25 @@ cinemat_audio_device::cinemat_audio_device(const machine_config &mconfig, device { } -void cinemat_audio_device::configure_latch_inputs(ls259_device &latch, u8 mask) +void cinemat_audio_device_base::configure_latch_inputs(ls259_device &latch, u8 mask) { if (mask == 0) mask = m_inputs_mask; if (BIT(mask, 0)) - latch.q_out_cb<0>().set(write_line_delegate(*this, FUNC(cinemat_audio_device::sound_w<0>))); + latch.q_out_cb<0>().set(write_line_delegate(*this, FUNC(cinemat_audio_device_base::sound_w<0>))); if (BIT(mask, 1)) - latch.q_out_cb<1>().set(write_line_delegate(*this, FUNC(cinemat_audio_device::sound_w<1>))); + latch.q_out_cb<1>().set(write_line_delegate(*this, FUNC(cinemat_audio_device_base::sound_w<1>))); if (BIT(mask, 2)) - latch.q_out_cb<2>().set(write_line_delegate(*this, FUNC(cinemat_audio_device::sound_w<2>))); + latch.q_out_cb<2>().set(write_line_delegate(*this, FUNC(cinemat_audio_device_base::sound_w<2>))); if (BIT(mask, 3)) - latch.q_out_cb<3>().set(write_line_delegate(*this, FUNC(cinemat_audio_device::sound_w<3>))); + latch.q_out_cb<3>().set(write_line_delegate(*this, FUNC(cinemat_audio_device_base::sound_w<3>))); if (BIT(mask, 4)) - latch.q_out_cb<4>().set(write_line_delegate(*this, FUNC(cinemat_audio_device::sound_w<4>))); + latch.q_out_cb<4>().set(write_line_delegate(*this, FUNC(cinemat_audio_device_base::sound_w<4>))); if (BIT(mask, 7)) - latch.q_out_cb<7>().set(write_line_delegate(*this, FUNC(cinemat_audio_device::sound_w<7>))); + latch.q_out_cb<7>().set(write_line_delegate(*this, FUNC(cinemat_audio_device_base::sound_w<7>))); } -void cinemat_audio_device::device_add_mconfig(machine_config &config) +void cinemat_audio_device_base::device_add_mconfig(machine_config &config) { SPEAKER(config, "mono").front_center(); @@ -99,14 +99,14 @@ void cinemat_audio_device::device_add_mconfig(machine_config &config) } } -void cinemat_audio_device::device_start() +void cinemat_audio_device_base::device_start() { #if ENABLE_NETLIST_LOGGING m_logfile = fopen("cinemat.csv", "w"); #endif } -void cinemat_audio_device::device_stop() +void cinemat_audio_device_base::device_stop() { #if ENABLE_NETLIST_LOGGING if (m_logfile != nullptr) @@ -114,7 +114,7 @@ void cinemat_audio_device::device_stop() #endif } -void cinemat_audio_device::input_set(int bit, int state) +void cinemat_audio_device_base::input_set(int bit, int state) { u8 oldvals = m_inputs; m_inputs = (m_inputs & ~(1 << bit)) | ((state & 1) << bit); @@ -145,7 +145,7 @@ void cinemat_audio_device::input_set(int bit, int state) DEFINE_DEVICE_TYPE(SPACE_WARS_AUDIO, spacewar_audio_device, "spacewar_audio", "Space Wars Sound Board") spacewar_audio_device::spacewar_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, SPACE_WARS_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(spacewar), 150000.0) + : cinemat_audio_device_base(mconfig, SPACE_WARS_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(spacewar), 150000.0) { } @@ -160,7 +160,7 @@ spacewar_audio_device::spacewar_audio_device(const machine_config &mconfig, cons DEFINE_DEVICE_TYPE(BARRIER_AUDIO, barrier_audio_device, "barrier_audio", "Barrier Sound Board") barrier_audio_device::barrier_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, BARRIER_AUDIO, tag, owner, clock, 0x07, NETLIST_NAME(barrier), 200000.0) + : cinemat_audio_device_base(mconfig, BARRIER_AUDIO, tag, owner, clock, 0x07, NETLIST_NAME(barrier), 200000.0) { } @@ -175,7 +175,7 @@ barrier_audio_device::barrier_audio_device(const machine_config &mconfig, const DEFINE_DEVICE_TYPE(SPEED_FREAK_AUDIO, speedfrk_audio_device, "speedfrk_audio", "Speed Freak Sound Board") speedfrk_audio_device::speedfrk_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, SPEED_FREAK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(speedfrk), 12000.0) + : cinemat_audio_device_base(mconfig, SPEED_FREAK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(speedfrk), 12000.0) { } @@ -190,7 +190,7 @@ speedfrk_audio_device::speedfrk_audio_device(const machine_config &mconfig, cons DEFINE_DEVICE_TYPE(STAR_HAWK_AUDIO, starhawk_audio_device, "starhawk_audio", "Star Hawk Sound Board") starhawk_audio_device::starhawk_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, STAR_HAWK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(starhawk), 50000.0) + : cinemat_audio_device_base(mconfig, STAR_HAWK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(starhawk), 50000.0) { } @@ -205,7 +205,7 @@ starhawk_audio_device::starhawk_audio_device(const machine_config &mconfig, cons DEFINE_DEVICE_TYPE(SUNDANCE_AUDIO, sundance_audio_device, "sundance_audio", "Sundance Sound Board") sundance_audio_device::sundance_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, SUNDANCE_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(sundance), 45000.0) + : cinemat_audio_device_base(mconfig, SUNDANCE_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(sundance), 45000.0) { } @@ -220,7 +220,7 @@ sundance_audio_device::sundance_audio_device(const machine_config &mconfig, cons DEFINE_DEVICE_TYPE(TAIL_GUNNER_AUDIO, tailg_audio_device, "tailg_audio", "Tail Gunner Sound Board") tailg_audio_device::tailg_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, TAIL_GUNNER_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(tailg), 75000.0) + : cinemat_audio_device_base(mconfig, TAIL_GUNNER_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(tailg), 75000.0) { } @@ -235,7 +235,7 @@ tailg_audio_device::tailg_audio_device(const machine_config &mconfig, const char DEFINE_DEVICE_TYPE(WARRIOR_AUDIO, warrior_audio_device, "warrior_audio", "Warrior Sound Board") warrior_audio_device::warrior_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, WARRIOR_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(warrior), 50000.0) + : cinemat_audio_device_base(mconfig, WARRIOR_AUDIO, tag, owner, clock, 0x1f, NETLIST_NAME(warrior), 50000.0) { } @@ -250,7 +250,7 @@ warrior_audio_device::warrior_audio_device(const machine_config &mconfig, const DEFINE_DEVICE_TYPE(ARMOR_ATTACK_AUDIO, armora_audio_device, "armora_audio", "Armor Atrack Sound Board") armora_audio_device::armora_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, ARMOR_ATTACK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(armora), 5000.0) + : cinemat_audio_device_base(mconfig, ARMOR_ATTACK_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(armora), 5000.0) { } @@ -265,7 +265,7 @@ armora_audio_device::armora_audio_device(const machine_config &mconfig, const ch DEFINE_DEVICE_TYPE(RIPOFF_AUDIO, ripoff_audio_device, "ripoff_audio", "Rip Off Sound Board") ripoff_audio_device::ripoff_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, RIPOFF_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(ripoff), 20000.0) + : cinemat_audio_device_base(mconfig, RIPOFF_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(ripoff), 20000.0) { } @@ -280,7 +280,7 @@ ripoff_audio_device::ripoff_audio_device(const machine_config &mconfig, const ch DEFINE_DEVICE_TYPE(STAR_CASTLE_AUDIO, starcas_audio_device, "starcas_audio", "Star Castle Sound Board") starcas_audio_device::starcas_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, STAR_CASTLE_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(starcas), 5000.0) + : cinemat_audio_device_base(mconfig, STAR_CASTLE_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(starcas), 5000.0) { } @@ -295,7 +295,7 @@ starcas_audio_device::starcas_audio_device(const machine_config &mconfig, const DEFINE_DEVICE_TYPE(SOLAR_QUEST_AUDIO, solarq_audio_device, "solarq_audio", "Solar Quest Sound Board") solarq_audio_device::solarq_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, SOLAR_QUEST_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(solarq), 5000.0) + : cinemat_audio_device_base(mconfig, SOLAR_QUEST_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(solarq), 5000.0) { } @@ -310,7 +310,7 @@ solarq_audio_device::solarq_audio_device(const machine_config &mconfig, const ch DEFINE_DEVICE_TYPE(BOXING_BUGS_AUDIO, boxingb_audio_device, "boxingb_audio", "Boxing Bugs Sound Board") boxingb_audio_device::boxingb_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, BOXING_BUGS_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(boxingb), 5000.0) + : cinemat_audio_device_base(mconfig, BOXING_BUGS_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(boxingb), 5000.0) { } @@ -325,7 +325,7 @@ boxingb_audio_device::boxingb_audio_device(const machine_config &mconfig, const DEFINE_DEVICE_TYPE(WAR_OF_THE_WORLDS_AUDIO, wotw_audio_device, "wotw_audio", "War of the Worlds Sound Board") wotw_audio_device::wotw_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : cinemat_audio_device(mconfig, WAR_OF_THE_WORLDS_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(wotw), 5000.0) + : cinemat_audio_device_base(mconfig, WAR_OF_THE_WORLDS_AUDIO, tag, owner, clock, 0x9f, NETLIST_NAME(wotw), 5000.0) { } diff --git a/src/mame/audio/cinemat.h b/src/mame/audio/cinemat.h index b3f4f397485..6859154850d 100644 --- a/src/mame/audio/cinemat.h +++ b/src/mame/audio/cinemat.h @@ -13,14 +13,14 @@ #define ENABLE_NETLIST_LOGGING (0) -class cinemat_audio_device : public device_t +class cinemat_audio_device_base : public device_t { public: - cinemat_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale); - void configure_latch_inputs(ls259_device &latch, u8 mask = 0); protected: + cinemat_audio_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale); + virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; virtual void device_stop() override; @@ -32,9 +32,9 @@ protected: private: u8 m_inputs = 0xff; - u8 m_inputs_mask = 0xff; - void (*m_netlist)(netlist::nlparse_t &) = nullptr; - double m_output_scale = 0; + u8 const m_inputs_mask; + void (*const m_netlist)(netlist::nlparse_t &); + double const m_output_scale; #if ENABLE_NETLIST_LOGGING FILE *m_logfile = nullptr; @@ -43,91 +43,91 @@ private: }; -class spacewar_audio_device : public cinemat_audio_device +class spacewar_audio_device : public cinemat_audio_device_base { public: spacewar_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class barrier_audio_device : public cinemat_audio_device +class barrier_audio_device : public cinemat_audio_device_base { public: barrier_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class speedfrk_audio_device : public cinemat_audio_device +class speedfrk_audio_device : public cinemat_audio_device_base { public: speedfrk_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class starhawk_audio_device : public cinemat_audio_device +class starhawk_audio_device : public cinemat_audio_device_base { public: starhawk_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class sundance_audio_device : public cinemat_audio_device +class sundance_audio_device : public cinemat_audio_device_base { public: sundance_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class tailg_audio_device : public cinemat_audio_device +class tailg_audio_device : public cinemat_audio_device_base { public: tailg_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class warrior_audio_device : public cinemat_audio_device +class warrior_audio_device : public cinemat_audio_device_base { public: warrior_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class armora_audio_device : public cinemat_audio_device +class armora_audio_device : public cinemat_audio_device_base { public: armora_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class ripoff_audio_device : public cinemat_audio_device +class ripoff_audio_device : public cinemat_audio_device_base { public: ripoff_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class starcas_audio_device : public cinemat_audio_device +class starcas_audio_device : public cinemat_audio_device_base { public: starcas_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class solarq_audio_device : public cinemat_audio_device +class solarq_audio_device : public cinemat_audio_device_base { public: solarq_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class boxingb_audio_device : public cinemat_audio_device +class boxingb_audio_device : public cinemat_audio_device_base { public: boxingb_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; -class wotw_audio_device : public cinemat_audio_device +class wotw_audio_device : public cinemat_audio_device_base { public: wotw_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index 4c17f8e0bce..b5c515b2342 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -13284,7 +13284,7 @@ GAME( 1981?,spctbird, mooncrst, mooncrst, eagle2, galaxian_state, init_ GAME( 1980?,smooncrs, mooncrst, mooncrst, smooncrs, galaxian_state, init_mooncrsu, ROT90, "bootleg (Gremlin)", "Super Moon Cresta (Gremlin, bootleg)", MACHINE_SUPPORTS_SAVE ) // Probably a bootleg, still has the 'POR' text in the bottom right corner that the Sonic version has?! GAME( 1980, mooncrstso, mooncrst, mooncrst, mooncptc, galaxian_state, init_mooncrsu, ROT90, "bootleg (Sonic)", "Moon Cresta (SegaSA / Sonic)", MACHINE_SUPPORTS_SAVE ) GAME( 1980?,mooncptc, mooncrst, mooncrst, mooncptc, galaxian_state, init_mooncrsu, ROT90, "bootleg (Petaco S.A.)", "Moon Cresta (Petaco S.A. Spanish bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1980?,sirio2, mooncrst, mooncrst, mooncptc, galaxian_state, init_mooncrsu, ROT90, "bootleg (Calfesa S.L.)", "Sirio II (Calfesa S.L. Spanish Moon Cresta bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1980?,sirio2, mooncrst, mooncrst, mooncptc, galaxian_state, init_mooncrsu, ROT90, "bootleg (Calfesa S.L.)", "Sirio II (Calfesa S.L. Spanish Moon Cresta bootleg)", MACHINE_SUPPORTS_SAVE ) GAME( 1980?,ataqandr, mooncrst, mooncrst, mooncptc, galaxian_state, init_mooncrsu, ROT90, "bootleg (FAR S.A.)", "Ataque Androide - Moon Cresta (FAR S.A. Spanish bootleg)", MACHINE_SUPPORTS_SAVE ) // There may be an alternate version called "Star Crest" according to flyers; is it the same? GAME( 1980?,sstarcrs, mooncrst, mooncrst, mooncrsg, galaxian_state, init_mooncrsu, ROT90, "bootleg (Taito do Brasil)", "Super Star Crest", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/machine/bacta_datalogger.cpp b/src/mame/machine/bacta_datalogger.cpp index b7ffc7b6d13..de229723505 100644 --- a/src/mame/machine/bacta_datalogger.cpp +++ b/src/mame/machine/bacta_datalogger.cpp @@ -16,7 +16,7 @@ BACTA Datalogger emulation The British Amusement and Catering Trade Association created a standard for the tracking of statistics and other features on British AWPs across hardware manufacturers. - The specification is very simple, a 1200 baud null modem connection via RS232, with the logger sending an + The specification is very simple, a 1200 Baud null modem connection via RS232, with the logger sending an ACK command (0x06) on receipt of a valid character, and NAK (0x15) on error. In this emulation, the simplest possible device is simulated here, derived from the RS232 null_modem. We only handle the feedback for acknowledgment, and limited logging. @@ -29,13 +29,13 @@ DEFINE_DEVICE_TYPE(BACTA_DATALOGGER, bacta_datalogger_device, "bacta_datalogger" // bacta_datalogger_device - constructor //------------------------------------------------- -bacta_datalogger_device::bacta_datalogger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : bacta_datalogger_device(mconfig, BACTA_DATALOGGER, tag, owner, clock) +bacta_datalogger_device::bacta_datalogger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + bacta_datalogger_device(mconfig, BACTA_DATALOGGER, tag, owner, clock) { } -bacta_datalogger_device::bacta_datalogger_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, BACTA_DATALOGGER, tag, owner, clock), +bacta_datalogger_device::bacta_datalogger_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, BACTA_DATALOGGER, tag, owner, clock), device_serial_interface(mconfig, *this), m_rxd_handler(*this), m_last_input(-1), @@ -95,7 +95,7 @@ void bacta_datalogger_device::rcv_complete() receive_register_extract(); - data = get_received_char(); + data = get_received_char(); if (data != 0x00) { if (data > 0x80) @@ -106,7 +106,7 @@ void bacta_datalogger_device::rcv_complete() LOGDATA("Retransmission of %x\n",data); } m_last_input = data; - } + } switch (data) { case 0x01: @@ -199,7 +199,7 @@ void bacta_datalogger_device::rcv_complete() case 0x7f: LOGDATA("(%c) User defined message (0x%x), next byte is message length\n",data,data); break; - + default: LOGDATA("(%c) Received: %02x\n",data, data); break; @@ -208,8 +208,8 @@ void bacta_datalogger_device::rcv_complete() tx_queue(); } else - { - if (data != 0x00) + { + if (data != 0x00) { m_output_char = 0x15;//NAK tx_queue();