From b2d602267fd401e909fbf6eb6607ede1e740b3d9 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 31 May 2024 13:36:38 +1000 Subject: Various cleanups: * tools/aueffectutil.mm: Fixed more deprecation warnings. * Got rid of some sprintf and strcat (generates warnings on macOS). * cpu/mipsx: Got stuff out of headers that shouldn't be there. --- src/devices/cpu/mipsx/mipsx.h | 2 +- src/devices/cpu/mipsx/mipsxdasm.cpp | 50 ++++++++++++--------- src/devices/cpu/sharc/sharc.cpp | 36 +++++---------- src/emu/image.cpp | 24 +++++----- src/emu/network.cpp | 7 +-- src/mame/konami/zs01.cpp | 88 ++++++++++++++++++------------------- src/mame/midway/midzeus.h | 12 ++++- src/mame/sega/segaufo.cpp | 23 ++++++---- src/mame/slicer/slicer.cpp | 48 +++++++++----------- src/mame/taito/wgp_v.cpp | 15 ++----- src/mame/tomy/kisssite.cpp | 5 ++- src/tools/aueffectutil.mm | 6 +-- 12 files changed, 157 insertions(+), 159 deletions(-) diff --git a/src/devices/cpu/mipsx/mipsx.h b/src/devices/cpu/mipsx/mipsx.h index 208bc2249eb..34aa61d20fd 100644 --- a/src/devices/cpu/mipsx/mipsx.h +++ b/src/devices/cpu/mipsx/mipsx.h @@ -15,7 +15,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual uint32_t execute_min_cycles() const noexcept override { return 5; } + virtual uint32_t execute_min_cycles() const noexcept override { return 1; } virtual uint32_t execute_max_cycles() const noexcept override { return 5; } virtual uint32_t execute_input_lines() const noexcept override { return 0; } virtual void execute_run() override; diff --git a/src/devices/cpu/mipsx/mipsxdasm.cpp b/src/devices/cpu/mipsx/mipsxdasm.cpp index 74be5f1a009..26535a845e8 100644 --- a/src/devices/cpu/mipsx/mipsxdasm.cpp +++ b/src/devices/cpu/mipsx/mipsxdasm.cpp @@ -4,75 +4,85 @@ #include "emu.h" #include "mipsxdasm.h" -static const bool SHOW_R0_AS_0 = false; +namespace { -u32 mipsx_disassembler::opcode_alignment() const -{ - return 4; -} +constexpr bool SHOW_R0_AS_0 = false; -int mipsx_disassembler::get_ty(u32 opcode) +char const *const REGNAMES[32] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31" }; + + +constexpr int get_ty(u32 opcode) { return BIT(opcode, 30, 2); } -int mipsx_disassembler::get_op(u32 opcode) +constexpr int get_op(u32 opcode) { return BIT(opcode, 27, 3); } -int mipsx_disassembler::get_src1(u32 opcode) +constexpr int get_src1(u32 opcode) { return BIT(opcode, 22, 5); } -int mipsx_disassembler::get_src2_dest(u32 opcode) +constexpr int get_src2_dest(u32 opcode) { return BIT(opcode, 17, 5); } -int mipsx_disassembler::get_compute_dest(u32 opcode) +constexpr int get_compute_dest(u32 opcode) { return BIT(opcode, 12, 5); } -int mipsx_disassembler::get_compute_compfunc(u32 opcode) +constexpr int get_compute_compfunc(u32 opcode) { return BIT(opcode, 0, 12); } -int mipsx_disassembler::get_offset(u32 opcode) +constexpr int get_offset(u32 opcode) { return BIT(opcode, 0, 17); } -int mipsx_disassembler::get_sq(u32 opcode) +constexpr int get_sq(u32 opcode) { return BIT(opcode, 16, 1); } -int mipsx_disassembler::get_asr_amount(int shift) +constexpr int get_asr_amount(int shift) { // TODO return shift; } -int mipsx_disassembler::get_sh_amount(int shift) +constexpr int get_sh_amount(int shift) { // TODO return shift; } -static const char *regnames[32] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31" }; -const char *mipsx_disassembler::get_regname(u8 reg) +const char *get_regname(u8 reg) { // general purpose register 0 just acts as a constant 0, it can't be changed, if desired simply show it as a non-canonical 0 for readability if ((reg == 0) && (SHOW_R0_AS_0)) return "#0"; - return regnames[reg]; + return REGNAMES[reg]; +} + +} // anonymous namespace + + +u32 mipsx_disassembler::opcode_alignment() const +{ + return 4; } offs_t mipsx_disassembler::disassemble(std::ostream& stream, offs_t pc, const data_buffer& opcodes, const data_buffer& params) @@ -89,7 +99,7 @@ offs_t mipsx_disassembler::disassemble(std::ostream& stream, offs_t pc, const da const u32 basepc = pc + 8; const int src1 = get_src1(opcode); const int src2 = get_src2_dest(opcode); - const std::string squash = get_sq(opcode) ? "sq" : ""; + const std::string_view squash = get_sq(opcode) ? "sq" : ""; switch (op) { diff --git a/src/devices/cpu/sharc/sharc.cpp b/src/devices/cpu/sharc/sharc.cpp index e3b965eb25d..30ee295c82e 100644 --- a/src/devices/cpu/sharc/sharc.cpp +++ b/src/devices/cpu/sharc/sharc.cpp @@ -490,34 +490,22 @@ void adsp21062_device::device_start() m_drcuml->symbol_add(&m_core->pc, sizeof(m_core->pc), "pc"); m_drcuml->symbol_add(&m_core->icount, sizeof(m_core->icount), "icount"); - for (int i=0; i < 16; i++) + for (int i = 0; i < 16; i++) { char buf[10]; - sprintf(buf, "r%d", i); + + snprintf(buf, std::size(buf), "r%d", i); m_drcuml->symbol_add(&m_core->r[i], sizeof(m_core->r[i]), buf); - if (i < 8) - { - sprintf(buf, "dag_i%d", i); - m_drcuml->symbol_add(&m_core->dag1.i[i & 7], sizeof(m_core->dag1.i[i & 7]), buf); - sprintf(buf, "dag_m%d", i); - m_drcuml->symbol_add(&m_core->dag1.m[i & 7], sizeof(m_core->dag1.m[i & 7]), buf); - sprintf(buf, "dag_l%d", i); - m_drcuml->symbol_add(&m_core->dag1.l[i & 7], sizeof(m_core->dag1.l[i & 7]), buf); - sprintf(buf, "dag_b%d", i); - m_drcuml->symbol_add(&m_core->dag1.b[i & 7], sizeof(m_core->dag1.b[i & 7]), buf); - } - else - { - sprintf(buf, "dag_i%d", i); - m_drcuml->symbol_add(&m_core->dag2.i[i & 7], sizeof(m_core->dag2.i[i & 7]), buf); - sprintf(buf, "dag_m%d", i); - m_drcuml->symbol_add(&m_core->dag2.m[i & 7], sizeof(m_core->dag2.m[i & 7]), buf); - sprintf(buf, "dag_l%d", i); - m_drcuml->symbol_add(&m_core->dag2.l[i & 7], sizeof(m_core->dag2.l[i & 7]), buf); - sprintf(buf, "dag_b%d", i); - m_drcuml->symbol_add(&m_core->dag2.b[i & 7], sizeof(m_core->dag2.b[i & 7]), buf); - } + SHARC_DAG &dag((i < 8) ? m_core->dag1 : m_core->dag2); + snprintf(buf, std::size(buf), "dag_i%d", i); + m_drcuml->symbol_add(&dag.i[i & 7], sizeof(dag.i[i & 7]), buf); + snprintf(buf, std::size(buf), "dag_m%d", i); + m_drcuml->symbol_add(&dag.m[i & 7], sizeof(dag.m[i & 7]), buf); + snprintf(buf, std::size(buf), "dag_l%d", i); + m_drcuml->symbol_add(&dag.l[i & 7], sizeof(dag.l[i & 7]), buf); + snprintf(buf, std::size(buf), "dag_b%d", i); + m_drcuml->symbol_add(&dag.b[i & 7], sizeof(dag.b[i & 7]), buf); } m_drcuml->symbol_add(&m_core->astat, sizeof(m_core->astat), "astat"); diff --git a/src/emu/image.cpp b/src/emu/image.cpp index 3839a57549b..52e553953a7 100644 --- a/src/emu/image.cpp +++ b/src/emu/image.cpp @@ -181,24 +181,22 @@ void image_manager::config_save(config_type cfg_type, util::xml::data_node *pare int image_manager::write_config(emu_options &options, const char *filename, const game_driver *gamedrv) { - char buffer[128]; - int retval = 1; - - if (gamedrv != nullptr) + std::string buffer; + if (gamedrv) { - sprintf(buffer, "%s.ini", gamedrv->name); - filename = buffer; + buffer.reserve(strlen(gamedrv->name) + 4); + buffer = gamedrv->name; + buffer += ".ini"; + filename = buffer.c_str(); } emu_file file(options.ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); std::error_condition const filerr = file.open(filename); - if (!filerr) - { - std::string inistring = options.output_ini(); - file.puts(inistring); - retval = 0; - } - return retval; + if (filerr) + return 1; + + file.puts(options.output_ini()); + return 0; } /*------------------------------------------------- diff --git a/src/emu/network.cpp b/src/emu/network.cpp index f5e065ac9cb..5953031133e 100644 --- a/src/emu/network.cpp +++ b/src/emu/network.cpp @@ -88,9 +88,10 @@ void network_manager::config_save(config_type cfg_type, util::xml::data_node *pa node->set_attribute("tag", network.device().tag()); node->set_attribute_int("interface", network.get_interface()); const std::array &mac = network.get_mac(); - char mac_addr[6 * 3]; - sprintf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - node->set_attribute("mac", mac_addr); + const std::string mac_addr = util::string_format( + "%02x:%02x:%02x:%02x:%02x:%02x", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + node->set_attribute("mac", mac_addr.c_str()); } } } diff --git a/src/mame/konami/zs01.cpp b/src/mame/konami/zs01.cpp index a77d0e74f00..6887540bfde 100644 --- a/src/mame/konami/zs01.cpp +++ b/src/mame/konami/zs01.cpp @@ -17,21 +17,14 @@ #include #include +#define LOG_SIGNALS (1 << 1) +#define LOG_ALL (LOG_GENERAL | LOG_SIGNALS) -#define VERBOSE_LEVEL ( 0 ) +//#define VERBOSE LOG_ALL +#include "logmacro.h" + +#define LOGSIGNALS(...) LOGMASKED(LOG_SIGNALS, __VA_ARGS__) -inline void ATTR_PRINTF( 3, 4 ) zs01_device::verboselog( int n_level, const char *s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%s: zs01(%s) %s", machine().describe_context(), tag(), buf ); - } -} // device type definition DEFINE_DEVICE_TYPE(ZS01, zs01_device, "zs01", "Konami ZS01 PIC") @@ -105,12 +98,12 @@ void zs01_device::write_rst(int state) { if( m_rst != state ) { - verboselog( 2, "rst=%d\n", state ); + LOGSIGNALS( "%s: rst=%d\n", machine().describe_context(), state ); } if( m_rst == 0 && state != 0 && m_cs == 0 ) { - verboselog( 1, "goto response to reset\n" ); + LOG( "%s: goto response to reset\n", machine().describe_context() ); m_state = STATE_RESPONSE_TO_RESET; m_bit = 0; m_byte = 0; @@ -123,7 +116,7 @@ void zs01_device::write_cs(int state) { if( m_cs != state ) { - verboselog( 2, "cs=%d\n", state ); + LOGSIGNALS( "%s: cs=%d\n", machine().describe_context(), state ); } // if( m_cs != 0 && state == 0 ) @@ -343,7 +336,7 @@ void zs01_device::write_scl(int state) { if( m_scl != state ) { - verboselog( 2, "scl=%d\n", state ); + LOGSIGNALS( "%s: scl=%d\n", machine().describe_context(), state ); } if( m_cs == 0 ) @@ -359,7 +352,7 @@ void zs01_device::write_scl(int state) if( m_bit == 0 ) { m_shift = m_response_to_reset[ m_byte ]; - verboselog( 1, "<- response_to_reset[ %d ]: %02x\n", m_byte, m_shift ); + LOG( "%s: <- response_to_reset[ %d ]: %02x\n", machine().describe_context(), m_byte, m_shift ); } m_sdar = ( m_shift >> 7 ) & 1; @@ -374,7 +367,7 @@ void zs01_device::write_scl(int state) if( m_byte == sizeof( m_response_to_reset ) ) { m_sdar = 1; - verboselog( 1, "goto stop\n" ); + LOG( "%s: goto stop\n", machine().describe_context() ); m_state = STATE_STOP; } } @@ -388,7 +381,7 @@ void zs01_device::write_scl(int state) { if( m_bit < 8 ) { - verboselog( 2, "clock\n" ); + LOGSIGNALS( "%s: clock\n", machine().describe_context() ); m_shift <<= 1; if( m_sdaw != 0 ) @@ -406,7 +399,7 @@ void zs01_device::write_scl(int state) { case STATE_LOAD_COMMAND: m_write_buffer[ m_byte ] = m_shift; - verboselog( 2, "-> write_buffer[ %d ]: %02x\n", m_byte, m_write_buffer[ m_byte ] ); + LOGSIGNALS( "%s: -> write_buffer[ %d ]: %02x\n", machine().describe_context(), m_byte, m_write_buffer[ m_byte ] ); m_byte++; if( m_byte == sizeof( m_write_buffer ) ) @@ -424,12 +417,17 @@ void zs01_device::write_scl(int state) uint16_t crc = calc_crc( m_write_buffer, 10 ); uint16_t msg_crc = ( ( m_write_buffer[ 10 ] << 8 ) | m_write_buffer[ 11 ] ); - verboselog( 1, "-> command: %02x (%s)\n", m_write_buffer[ 0 ], ( m_write_buffer[ 0 ] & 1 ) ? "READ" : "WRITE" ); - verboselog( 1, "-> address: %04x (%02x)\n", data_offset(), m_write_buffer[ 1 ] ); - verboselog( 1, "-> data: %02x%02x%02x%02x%02x%02x%02x%02x\n", - m_write_buffer[ 2 ], m_write_buffer[ 3 ], m_write_buffer[ 4 ], m_write_buffer[ 5 ], - m_write_buffer[ 6 ], m_write_buffer[ 7 ], m_write_buffer[ 8 ], m_write_buffer[ 9 ] ); - verboselog( 1, "-> crc: %04x vs %04x %s\n", crc, msg_crc, crc == msg_crc ? "" : "(BAD)"); + LOG( + "%s: -> command: %02x (%s)\n" + "-> address: %04x (%02x)\n" + "-> data: %02x%02x%02x%02x%02x%02x%02x%02x\n" + "-> crc: %04x vs %04x %s\n", + machine().describe_context(), + m_write_buffer[ 0 ], ( m_write_buffer[ 0 ] & 1 ) ? "READ" : "WRITE", + data_offset(), m_write_buffer[ 1 ], + m_write_buffer[ 2 ], m_write_buffer[ 3 ], m_write_buffer[ 4 ], m_write_buffer[ 5 ], + m_write_buffer[ 6 ], m_write_buffer[ 7 ], m_write_buffer[ 8 ], m_write_buffer[ 9 ], + crc, msg_crc, crc == msg_crc ? "" : "(BAD)" ); if( crc == msg_crc ) { @@ -463,7 +461,7 @@ void zs01_device::write_scl(int state) } else { - verboselog( 1, "-> unknown write offset: %04x (%02x)\n", data_offset(), m_write_buffer[ 1 ] ); + LOG( "%s: -> unknown write offset: %04x (%02x)\n", machine().describe_context(), data_offset(), m_write_buffer[ 1 ] ); } break; @@ -500,7 +498,7 @@ void zs01_device::write_scl(int state) } else { - verboselog( 1, "-> unknown read offset: %04x (%02x)\n", data_offset(), m_write_buffer[ 1 ] ); + LOG( "%s: -> unknown read offset: %04x (%02x)\n", machine().describe_context(), data_offset(), m_write_buffer[ 1 ] ); } memcpy( m_response_key, &m_write_buffer[ 2 ], sizeof( m_response_key ) ); @@ -509,7 +507,7 @@ void zs01_device::write_scl(int state) } else { - verboselog( 0, "bad crc\n" ); + logerror( "%s: bad crc\n", machine().describe_context() ); m_read_buffer[ 0 ] = STATUS_ERROR; m_configuration_registers[ CONFIG_RC ]++; @@ -521,11 +519,13 @@ void zs01_device::write_scl(int state) } } - verboselog( 1, "<- status: %02x\n", m_read_buffer[ 0 ] ); - - verboselog( 1, "<- data: %02x%02x%02x%02x%02x%02x%02x%02x\n", - m_read_buffer[ 2 ], m_read_buffer[ 3 ], m_read_buffer[ 4 ], m_read_buffer[ 5 ], - m_read_buffer[ 6 ], m_read_buffer[ 7 ], m_read_buffer[ 8 ], m_read_buffer[ 9 ] ); + LOG( + "%s: <- status: %02x\n" + "<- data: %02x%02x%02x%02x%02x%02x%02x%02x\n", + machine().describe_context(), + m_read_buffer[ 0 ], + m_read_buffer[ 2 ], m_read_buffer[ 3 ], m_read_buffer[ 4 ], m_read_buffer[ 5 ], + m_read_buffer[ 6 ], m_read_buffer[ 7 ], m_read_buffer[ 8 ], m_read_buffer[ 9 ] ); m_previous_byte = m_read_buffer[ 1 ]; @@ -560,7 +560,7 @@ void zs01_device::write_scl(int state) { case STATE_READ_DATA: m_shift = m_read_buffer[ m_byte ]; - verboselog( 2, "<- read_buffer[ %d ]: %02x\n", m_byte, m_shift ); + LOGSIGNALS( "%s: <- read_buffer[ %d ]: %02x\n", machine().describe_context(), m_byte, m_shift ); break; } } @@ -576,7 +576,7 @@ void zs01_device::write_scl(int state) if( m_sdaw == 0 ) { - verboselog( 2, "ack <-\n" ); + LOGSIGNALS( "%s: ack <-\n", machine().describe_context() ); m_byte++; if( m_byte == sizeof( m_read_buffer ) ) @@ -588,7 +588,7 @@ void zs01_device::write_scl(int state) } else { - verboselog( 2, "nak <-\n" ); + LOGSIGNALS( "%s: nak <-\n", machine().describe_context() ); } } } @@ -603,14 +603,14 @@ void zs01_device::write_sda(int state) { if( m_sdaw != state ) { - verboselog( 2, "sdaw=%d\n", state ); + LOGSIGNALS( "%s: sdaw=%d\n", machine().describe_context(), state ); } if( m_cs == 0 && m_scl != 0 ) { // if( m_sdaw == 0 && state != 0 ) // { -// verboselog( 1, "goto stop\n" ); +// LOG( "%s: goto stop\n", machine().describe_context() ); // m_state = STATE_STOP; // m_sdar = 0; // } @@ -620,12 +620,12 @@ void zs01_device::write_sda(int state) switch( m_state ) { case STATE_STOP: - verboselog( 1, "goto start\n" ); + LOG( "%s: goto start\n", machine().describe_context() ); m_state = STATE_LOAD_COMMAND; break; // default: -// verboselog( 1, "skipped start (default)\n" ); +// LOG( "%s: skipped start (default)\n", machine().describe_context() ); // break; } @@ -643,11 +643,11 @@ int zs01_device::read_sda() { if( m_cs != 0 ) { - verboselog( 2, "not selected\n" ); + LOGSIGNALS( "%s: not selected\n", machine().describe_context() ); return 1; } - verboselog( 2, "sdar=%d\n", m_sdar ); + LOGSIGNALS( "%s: sdar=%d\n", machine().describe_context(), m_sdar ); return m_sdar; } diff --git a/src/mame/midway/midzeus.h b/src/mame/midway/midzeus.h index 0f4bb9abb5b..c523866294b 100644 --- a/src/mame/midway/midzeus.h +++ b/src/mame/midway/midzeus.h @@ -5,12 +5,18 @@ Driver for Midway Zeus games **************************************************************************/ +#ifndef MAME_MIDWAY_MIDZEUS_H +#define MAME_MIDWAY_MIDZEUS_H + +#pragma once + +#include "midwayic.h" #include "machine/timekpr.h" +#include "video/poly.h" + #include "emupal.h" #include "screen.h" -#include "midwayic.h" -#include "video/poly.h" /************************************* * @@ -193,3 +199,5 @@ private: required_ioport_array<2> m_io_gun_x; required_ioport_array<2> m_io_gun_y; }; + +#endif // MAME_MIDWAY_MIDZEUS_H diff --git a/src/mame/sega/segaufo.cpp b/src/mame/sega/segaufo.cpp index 83a88a74dd8..90e8f20aa90 100644 --- a/src/mame/sega/segaufo.cpp +++ b/src/mame/sega/segaufo.cpp @@ -43,15 +43,21 @@ ***************************************************************************/ #include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/pit8253.h" + #include "315_5296.h" #include "315_5338a.h" + +#include "cpu/z80/z80.h" +#include "machine/pit8253.h" #include "machine/timer.h" #include "sound/upd7759.h" #include "sound/ymopn.h" + #include "speaker.h" +#include +#include + // the layouts are very similar to eachother #include "newufo.lh" #include "ufomini.lh" @@ -184,18 +190,17 @@ TIMER_DEVICE_CALLBACK_MEMBER(ufo_state::update_info) // 2 Z: 000 = up, 100 = down // 3 C: 000 = closed, 100 = open for (int p = 0; p < 2; p++) + { for (int m = 0; m < 4; m++) m_counters[(p << 2) | m] = uint8_t(m_player[p].motor[m].position * 100); + } #if 0 - char msg1[0x100] = {0}; - char msg2[0x100] = {0}; + std::ostringstream msg; + msg << std::hex << std::setfill('0'); for (int i = 0; i < 8; i++) - { - sprintf(msg2, "%02X ", m_io2->debug_peek_output(i)); - strcat(msg1, msg2); - } - popmessage("%s", msg1); + msg << std::setw(2) << m_io2->debug_peek_output(i); + popmessage("%s", std::move(msg).str()); #endif } diff --git a/src/mame/slicer/slicer.cpp b/src/mame/slicer/slicer.cpp index 8815fe356b9..4b61111b232 100644 --- a/src/mame/slicer/slicer.cpp +++ b/src/mame/slicer/slicer.cpp @@ -6,14 +6,15 @@ // which will fixup the relocations #include "emu.h" + +#include "bus/isa/isa.h" +#include "bus/rs232/rs232.h" +#include "bus/scsi/scsi.h" #include "cpu/i86/i186.h" #include "imagedev/floppy.h" #include "machine/74259.h" -#include "machine/wd_fdc.h" #include "machine/mc68681.h" -#include "bus/rs232/rs232.h" -#include "bus/isa/isa.h" -#include "bus/scsi/scsi.h" +#include "machine/wd_fdc.h" namespace { @@ -24,6 +25,7 @@ public: slicer_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_fdc(*this, "fdc"), + m_floppies(*this, "fdc:%u", 0U), m_sasi(*this, "sasi") { } @@ -33,42 +35,34 @@ public: private: void sio_out_w(uint8_t data); void drive_size_w(int state); - template void drive_sel_w(int state); + template void drive_sel_w(int state); void slicer_io(address_map &map); void slicer_map(address_map &map); required_device m_fdc; + required_device_array m_floppies; required_device m_sasi; }; void slicer_state::sio_out_w(uint8_t data) { - floppy_image_device *floppy; - int state = (data & 0x80) ? 0 : 1; - char devname[8]; + const int state = (data & 0x80) ? 0 : 1; - for(int i = 0; i < 4; i++) + for (auto &floppy : m_floppies) { - sprintf(devname, "%d", i); - floppy = m_fdc->subdevice(devname)->get_device(); - if(floppy) - floppy->mon_w(state); + if (floppy->get_device()) + floppy->get_device()->mon_w(state); } } -template +template void slicer_state::drive_sel_w(int state) { - floppy_image_device *floppy; - char devname[8]; - if (!state) return; - sprintf(devname, "%d", drive); - floppy = m_fdc->subdevice(devname)->get_device(); - m_fdc->set_floppy(floppy); + m_fdc->set_floppy(m_floppies[Drive]->get_device()); } void slicer_state::drive_size_w(int state) @@ -121,20 +115,20 @@ void slicer_state::slicer(machine_config &config) FD1797(config, m_fdc, 16_MHz_XTAL / 2 / 8); m_fdc->intrq_wr_callback().set("maincpu", FUNC(i80186_cpu_device::int1_w)); m_fdc->drq_wr_callback().set("maincpu", FUNC(i80186_cpu_device::drq0_w)); - FLOPPY_CONNECTOR(config, "fdc:0", slicer_floppies, "525dd", floppy_image_device::default_mfm_floppy_formats); - FLOPPY_CONNECTOR(config, "fdc:1", slicer_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); - FLOPPY_CONNECTOR(config, "fdc:2", slicer_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); - FLOPPY_CONNECTOR(config, "fdc:3", slicer_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); + FLOPPY_CONNECTOR(config, m_floppies[0], slicer_floppies, "525dd", floppy_image_device::default_mfm_floppy_formats); + FLOPPY_CONNECTOR(config, m_floppies[1], slicer_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); + FLOPPY_CONNECTOR(config, m_floppies[2], slicer_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); + FLOPPY_CONNECTOR(config, m_floppies[3], slicer_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); ls259_device &drivelatch(LS259(config, "drivelatch")); // U29 - drivelatch.q_out_cb<0>().set("sasi", FUNC(scsi_port_device::write_sel)); - drivelatch.q_out_cb<1>().set("sasi", FUNC(scsi_port_device::write_rst)); + drivelatch.q_out_cb<0>().set(m_sasi, FUNC(scsi_port_device::write_sel)); + drivelatch.q_out_cb<1>().set(m_sasi, FUNC(scsi_port_device::write_rst)); drivelatch.q_out_cb<2>().set(FUNC(slicer_state::drive_sel_w<3>)); drivelatch.q_out_cb<3>().set(FUNC(slicer_state::drive_sel_w<2>)); drivelatch.q_out_cb<4>().set(FUNC(slicer_state::drive_sel_w<1>)); drivelatch.q_out_cb<5>().set(FUNC(slicer_state::drive_sel_w<0>)); drivelatch.q_out_cb<6>().set(FUNC(slicer_state::drive_size_w)); - drivelatch.q_out_cb<7>().set("fdc", FUNC(fd1797_device::dden_w)); + drivelatch.q_out_cb<7>().set(m_fdc, FUNC(fd1797_device::dden_w)); SCSI_PORT(config, m_sasi, 0); m_sasi->set_data_input_buffer("sasi_data_in"); diff --git a/src/mame/taito/wgp_v.cpp b/src/mame/taito/wgp_v.cpp index 9c5c44e33fe..f78a8115dcf 100644 --- a/src/mame/taito/wgp_v.cpp +++ b/src/mame/taito/wgp_v.cpp @@ -437,11 +437,7 @@ void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const } #if 0 if (rotate) - { - char buf[80]; - sprintf(buf, "sprite rotate offs %04x ?", rotate); - popmessage(buf); - } + popmessage("sprite rotate offs %04x ?", rotate); #endif } @@ -678,12 +674,9 @@ u32 wgp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const m_tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 0); #if 0 - { - char buf[80]; - sprintf(buf,"piv_ctrl_reg: %04x y zoom: %04x %04x %04x",m_piv_ctrl_reg, - m_piv_zoom[0],m_piv_zoom[1],m_piv_zoom[2]); - popmessage(buf); - } + popmessage("piv_ctrl_reg: %04x y zoom: %04x %04x %04x", + m_piv_ctrl_reg, + m_piv_zoom[0], m_piv_zoom[1], m_piv_zoom[2]); #endif /* Enable this to watch the rotation control words */ diff --git a/src/mame/tomy/kisssite.cpp b/src/mame/tomy/kisssite.cpp index b053565741a..446315af94d 100644 --- a/src/mame/tomy/kisssite.cpp +++ b/src/mame/tomy/kisssite.cpp @@ -45,11 +45,12 @@ fnn0040L #include "emu.h" -#include "softlist_dev.h" - #include "bus/ata/atapicdr.h" #include "cpu/mipsx/mipsx.h" +#include "softlist_dev.h" + + namespace { class kisssite_state : public driver_device diff --git a/src/tools/aueffectutil.mm b/src/tools/aueffectutil.mm index 7b2105f8696..b8a83de4c64 100644 --- a/src/tools/aueffectutil.mm +++ b/src/tools/aueffectutil.mm @@ -677,7 +677,7 @@ static void UpdateChangeCountCallback( [alert setInformativeText:[NSString stringWithFormat:@"Tried to select preset %ld of %ld", (long)idx + 1, (long)total]]; - [alert beginSheetModalForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; + [alert beginSheetModalForWindow:window completionHandler:nil]; return; } @@ -695,7 +695,7 @@ static void UpdateChangeCountCallback( [alert setMessageText:[NSString stringWithFormat:@"Error loading preset %@", preset->presetName]]; [alert setInformativeText:[NSString stringWithFormat:@"Error %ld encountered while setting AudioUnit property", (long)status]]; - [alert beginSheetModalForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; + [alert beginSheetModalForWindow:window completionHandler:nil]; return; } @@ -708,7 +708,7 @@ static void UpdateChangeCountCallback( preset->presetName]]; [alert setInformativeText:[NSString stringWithFormat:@"Error %ld encountered while sending notification", (long)status]]; - [alert beginSheetModalForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; + [alert beginSheetModalForWindow:window completionHandler:nil]; return; } } -- cgit v1.2.3