Make osd_printf_* use util/strformat semantics.

(nw) This has been a long time coming but it's here at last.  It should
be easier now that logerror, popmessage and osd_printf_* behave like
string_format and stream_format.  Remember the differences from printf:
* Any object with a stream out operator works with %s
* %d, %i, %o, %x, %X, etc. work out the size by magic
* No sign extending promotion to int for short/char
* No widening/narrowing conversions for characters/strings
* Same rules on all platforms, insulated from C runtime library
* No format warnings from compiler
* Assert in debug builds if number of arguments doesn't match format

(nw) Also removed a pile of redundant c_str and string_format, and some
workarounds for not being able to portably format 64-bit integers or
long long.
This commit is contained in:
Vas Crabb 2019-09-26 20:53:06 +10:00
parent 9d4b7b02ac
commit 9a12ab37af
82 changed files with 375 additions and 397 deletions

View File

@ -813,6 +813,7 @@ if (_OPTIONS["osd"] == "sdl") then
end
links {
"utils",
"ocore_" .. _OPTIONS["osd"],
ext_lib("utf8proc"),
}
@ -876,6 +877,7 @@ if (_OPTIONS["osd"] == "sdl") then
includedirs {
MAME_DIR .. "src/osd",
MAME_DIR .. "src/lib/util",
}
files {

View File

@ -761,7 +761,7 @@ int gba_cart_slot_device::get_cart_type(const uint8_t *ROM, uint32_t len)
else if ((i<len-8) && !memcmp(&ROM[i], "SIIRTC_V", 8))
chip |= GBA_CHIP_RTC;
}
osd_printf_info("GBA: Detected (ROM) %s\n", gba_chip_string(chip).c_str());
osd_printf_info("GBA: Detected (ROM) %s\n", gba_chip_string(chip));
// fix for games which return more than one kind of chip: either it is one of the known titles, or we default to no battery
if (gba_chip_has_conflict(chip))
@ -829,7 +829,7 @@ int gba_cart_slot_device::get_cart_type(const uint8_t *ROM, uint32_t len)
has_rtc = true;
}
osd_printf_info("GBA: Emulate %s\n", gba_chip_string(chip).c_str());
osd_printf_info("GBA: Emulate %s\n", gba_chip_string(chip));
switch (chip)
{

View File

@ -1060,7 +1060,7 @@ void gba_eeprom_device::write(uint32_t data)
if (m_bits == 0)
{
osd_printf_verbose("%s: EEPROM: %02x to %x\n", machine().describe_context().c_str(), m_eep_data, m_addr);
osd_printf_verbose("%s: EEPROM: %02x to %x\n", machine().describe_context(), m_eep_data, m_addr);
if (m_addr >= m_data_size)
fatalerror("eeprom: invalid address (%x)\n", m_addr);

View File

@ -285,7 +285,7 @@ WRITE32_MEMBER( nubus_image_device::file_cmd_w )
fullpath.append(PATH_SEPARATOR);
fullpath.append((const char*)filectx.filename);
if(osd_file::open(fullpath, OPEN_FLAG_READ, filectx.fd, filectx.filelen) != osd_file::error::NONE)
osd_printf_error("Error opening %s\n", fullpath.c_str());
osd_printf_error("Error opening %s\n", fullpath);
filectx.bytecount = 0;
}
break;
@ -298,7 +298,7 @@ WRITE32_MEMBER( nubus_image_device::file_cmd_w )
fullpath.append((const char*)filectx.filename);
uint64_t filesize; // unused, but it's an output from the open call
if(osd_file::open(fullpath, OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, filectx.fd, filesize) != osd_file::error::NONE)
osd_printf_error("Error opening %s\n", fullpath.c_str());
osd_printf_error("Error opening %s\n", fullpath);
filectx.bytecount = 0;
}
break;

View File

@ -449,9 +449,9 @@ inline void ppc_device::set_decrementer(uint32_t newdec)
if (PRINTF_DECREMENTER)
{
uint64_t total = total_cycles();
osd_printf_debug("set_decrementer: olddec=%08X newdec=%08X divisor=%d totalcyc=%08X%08X timer=%08X%08X\n",
osd_printf_debug("set_decrementer: olddec=%08X newdec=%08X divisor=%d totalcyc=%016X timer=%016X\n",
curdec, newdec, m_tb_divisor,
(uint32_t)(total >> 32), (uint32_t)total, (uint32_t)(cycles_until_done >> 32), (uint32_t)cycles_until_done);
total, cycles_until_done);
}
m_dec_zero_cycles = total_cycles() + cycles_until_done;

View File

@ -326,7 +326,7 @@ void rsp_device::unimplemented_opcode(uint32_t op)
std::ostringstream string;
rsp_disassembler rspd;
rspd.dasm_one(string, m_ppc, op);
osd_printf_debug("%08X: %s\n", m_ppc, string.str().c_str());
osd_printf_debug("%08X: %s\n", m_ppc, string.str());
}
#if SAVE_DISASM

View File

@ -134,7 +134,7 @@ void rsp_device::cop2_drc::cfunc_unimplemented_opcode()
std::ostringstream stream;
rspd.dasm_one(stream, ppc, m_rspcop2_state->op);
const std::string stream_string = stream.str();
osd_printf_debug("%08X: %s\n", ppc, stream_string.c_str());
osd_printf_debug("%08X: %s\n", ppc, stream_string);
}
fatalerror("RSP: unknown opcode %02X (%08X) at %08X\n", m_rspcop2_state->op >> 26, m_rspcop2_state->op, ppc);
}

View File

@ -728,7 +728,7 @@ void uml::instruction::simplify()
{
std::string disasm1 = orig.disasm(block->drcuml);
std::string disasm2 = inst->disasm(block->drcuml);
osd_printf_debug("Simplified: %-50.50s -> %s\n", disasm1.c_str(), disasm2.c_str());
osd_printf_debug("Simplified: %-50.50s -> %s\n", disasm1, disasm2);
}
*/

View File

@ -109,13 +109,13 @@ protected:
case plib::plog_level::VERBOSE:
break;
case plib::plog_level::INFO:
osd_printf_verbose("netlist INFO: %s\n", ls.c_str());
osd_printf_verbose("netlist INFO: %s\n", ls);
break;
case plib::plog_level::WARNING:
osd_printf_warning("netlist WARNING: %s\n", ls.c_str());
osd_printf_warning("netlist WARNING: %s\n", ls);
break;
case plib::plog_level::ERROR:
osd_printf_error("netlist ERROR: %s\n", ls.c_str());
osd_printf_error("netlist ERROR: %s\n", ls);
break;
case plib::plog_level::FATAL:
throw emu_fatalerror(1, "netlist FATAL: %s\n", ls.c_str());

View File

@ -148,7 +148,7 @@ void ram_device::device_start()
else
util::stream_format(output, "%s,%s).\n", m_default_size, m_extra_options_string);
osd_printf_error("%s", output.str().c_str());
osd_printf_error("%s", output.str());
osd_printf_warning("Setting value to default %s\n", m_default_size);
@ -190,7 +190,7 @@ void ram_device::device_validity_check(validity_checker &valid) const
// report any errors
if (!bad_option.empty())
osd_printf_error("Invalid RAM option: %s\n", bad_option.c_str());
osd_printf_error("Invalid RAM option: %s\n", bad_option);
// report duplicates
using extra_option_ref_set = std::set<std::reference_wrapper<extra_option const>, bool (*)(extra_option const &, extra_option const &)>;
@ -199,7 +199,7 @@ void ram_device::device_validity_check(validity_checker &valid) const
{
auto const ins(sorted.emplace(opt));
if (!ins.second)
osd_printf_error("Duplicate RAM options: %s == %s (%u)\n", ins.first->get().first.c_str(), opt.first.c_str(), opt.second);
osd_printf_error("Duplicate RAM options: %s == %s (%u)\n", ins.first->get().first, opt.first, opt.second);
}
}
}

View File

@ -166,7 +166,7 @@ void z80_daisy_chain_interface::daisy_init(const z80_daisy_config *daisy)
tailptr = &(*tailptr)->m_daisy_next;
}
osd_printf_verbose("Daisy chain = %s\n", daisy_show_chain().c_str());
osd_printf_verbose("Daisy chain = %s\n", daisy_show_chain());
}

View File

@ -322,7 +322,7 @@ READ16_MEMBER( rf5c400_device::rf5c400_r )
{
if (offset < 0x400)
{
//osd_printf_debug("%s:rf5c400_r: %08X, %08X\n", machine().describe_context().c_str(), offset, mem_mask);
//osd_printf_debug("%s:rf5c400_r: %08X, %08X\n", machine().describe_context(), offset, mem_mask);
switch(offset)
{
@ -343,7 +343,7 @@ READ16_MEMBER( rf5c400_device::rf5c400_r )
default:
{
//osd_printf_debug("%s:rf5c400_r: %08X, %08X\n", machine().describe_context().c_str(), offset, mem_mask);
//osd_printf_debug("%s:rf5c400_r: %08X, %08X\n", machine().describe_context(), offset, mem_mask);
return 0;
}
}
@ -458,11 +458,11 @@ WRITE16_MEMBER( rf5c400_device::rf5c400_w )
default:
{
//osd_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", machine().describe_context().c_str(), data, offset, mem_mask);
//osd_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", machine().describe_context(), data, offset, mem_mask);
break;
}
}
//osd_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", machine().describe_context().c_str(), data, offset, mem_mask);
//osd_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", machine().describe_context(), data, offset, mem_mask);
}
else
{

View File

@ -601,7 +601,7 @@ void sega315_5313_device::vdp_set_register(int regnum, u8 value)
// if (regnum == 0x0a)
// osd_printf_debug("Set HINT Reload Register to %d on scanline %d\n", value, get_scanline_counter());
// osd_printf_debug("%s: Setting VDP Register #%02x to %02x\n", machine().describe_context().c_str(), regnum, value);
// osd_printf_debug("%s: Setting VDP Register #%02x to %02x\n", machine().describe_context(), regnum, value);
}
void sega315_5313_device::update_code_and_address(void)
@ -764,7 +764,7 @@ void sega315_5313_device::handle_dma_bits()
#if 0
const u32 source = (MEGADRIVE_REG15_DMASOURCE1 | (MEGADRIVE_REG16_DMASOURCE2 << 8) | ((MEGADRIVE_REG17_DMASOURCE3 & 0xff) << 16)) << 1;
const u16 length = (MEGADRIVE_REG13_DMALENGTH1 | (MEGADRIVE_REG14_DMALENGTH2 << 8)) << 1;
osd_printf_debug("%s 68k DMAtran set source %06x length %04x dest %04x enabled %01x code %02x %02x\n", machine().describe_context().c_str(), source, length, m_vdp_address, MEGADRIVE_REG01_DMA_ENABLE, m_vdp_code, MEGADRIVE_REG0F_AUTO_INC);
osd_printf_debug("%s 68k DMAtran set source %06x length %04x dest %04x enabled %01x code %02x %02x\n", machine().describe_context(), source, length, m_vdp_address, MEGADRIVE_REG01_DMA_ENABLE, m_vdp_code, MEGADRIVE_REG0F_AUTO_INC);
#endif
if (MEGADRIVE_REG17_DMATYPE == 0x0 || MEGADRIVE_REG17_DMATYPE == 0x1)
{
@ -1315,7 +1315,7 @@ u16 sega315_5313_device::vdp_r(offs_t offset, u16 mem_mask)
// if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) osd_printf_debug("8-bit VDP read HV counter port access, offset %04x mem_mask %04x\n", offset, mem_mask);
retvalue = megadriv_read_hv_counters();
// retvalue = machine().rand();
// osd_printf_debug("%s: Read HV counters at scanline %d hpos %d (return %04x)\n", machine().describe_context().c_str(), get_scanline_counter(), get_hposition(), retvalue);
// osd_printf_debug("%s: Read HV counters at scanline %d hpos %d (return %04x)\n", machine().describe_context(), get_scanline_counter(), get_hposition(), retvalue);
break;
case 0x10:

View File

@ -2071,7 +2071,7 @@ void zeus2_device::check_tex(uint32_t &texmode, float &zObj, float &zMat, float
infoStr += tex_info();
tex_map.insert(std::pair<uint32_t, std::string>(zeus_texbase, infoStr));
osd_printf_info("%s\n", infoStr.c_str());
osd_printf_info("%s\n", infoStr);
}
}

View File

@ -686,7 +686,7 @@ bool address_map_entry::unitmask_is_appropriate(u8 width, u64 unitmask, const ch
// if map is narrower than 64 bits, check the mask width as well
if (m_map.m_databits < 64 && (unitmask >> m_map.m_databits) != 0)
{
osd_printf_error("Handler %s specified a mask of %08X%08X, too wide to be used in a %d-bit address map\n", string, (u32)(unitmask >> 32), (u32)unitmask, m_map.m_databits);
osd_printf_error("Handler %s specified a mask of %016X, too wide to be used in a %d-bit address map\n", string, unitmask, m_map.m_databits);
return false;
}
@ -700,7 +700,7 @@ bool address_map_entry::unitmask_is_appropriate(u8 width, u64 unitmask, const ch
count++;
else if ((unitmask & singlemask) != 0)
{
osd_printf_error("Handler %s specified a mask of %08X%08X; needs to be in even chunks of %X\n", string, (u32)(unitmask >> 32), (u32)unitmask, basemask);
osd_printf_error("Handler %s specified a mask of %016X; needs to be in even chunks of %X\n", string, unitmask, basemask);
return false;
}
singlemask <<= width;
@ -718,7 +718,7 @@ bool address_map_entry::unitmask_is_appropriate(u8 width, u64 unitmask, const ch
|| (unitmask_wh != 0 && unitmask_wl != 0 && unitmask_wh != unitmask_wl)
|| (unitmask_dh != 0 && unitmask_dl != 0 && unitmask_dh != unitmask_dl))
{
osd_printf_error("Handler %s specified an asymmetrical mask of %08X%08X\n", string, (u32)(unitmask >> 32), (u32)unitmask);
osd_printf_error("Handler %s specified an asymmetrical mask of %016X\n", string, unitmask);
return false;
}
#endif

View File

@ -329,9 +329,9 @@ bool finder_base::report_missing(bool found, const char *objname, bool required)
// otherwise, report
std::string const region_fulltag(m_base.get().subtag(m_tag));
if (required)
osd_printf_error("Required %s '%s' not found\n", objname, region_fulltag.c_str());
osd_printf_error("Required %s '%s' not found\n", objname, region_fulltag);
else if (DUMMY_TAG != m_tag)
osd_printf_verbose("Optional %s '%s' not found\n", objname, region_fulltag.c_str());
osd_printf_verbose("Optional %s '%s' not found\n", objname, region_fulltag);
return !required;
}
}

View File

@ -316,7 +316,7 @@ void device_gfx_interface::interface_validity_check(validity_checker &valid) con
u32 region_length = valid.region_length(gfxregion.c_str());
if (region_length == 0)
osd_printf_error("gfx[%d] references nonexistent region '%s'\n", gfxnum, gfxregion.c_str());
osd_printf_error("gfx[%d] references nonexistent region '%s'\n", gfxnum, gfxregion);
// if we have a valid region, and we're not using auto-sizing, check the decode against the region length
else if (!IS_FRAC(layout.total))

View File

@ -842,8 +842,8 @@ std::vector<u32> device_image_interface::determine_open_plan(bool is_create)
static void dump_wrong_and_correct_checksums(const util::hash_collection &hashes, const util::hash_collection &acthashes)
{
osd_printf_error(" EXPECTED: %s\n", hashes.macro_string().c_str());
osd_printf_error(" FOUND: %s\n", acthashes.macro_string().c_str());
osd_printf_error(" EXPECTED: %s\n", hashes.macro_string());
osd_printf_error(" FOUND: %s\n", acthashes.macro_string());
}
@ -918,9 +918,9 @@ bool device_image_interface::load_software(software_list_device &swlist, const c
u32 supported = swinfo->supported();
if (supported == SOFTWARE_SUPPORTED_PARTIAL)
osd_printf_error("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist.list_name().c_str());
osd_printf_error("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist.list_name());
if (supported == SOFTWARE_SUPPORTED_NO)
osd_printf_error("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist.list_name().c_str());
osd_printf_error("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist.list_name());
// attempt reading up the chain through the parents and create a locationtag std::string in the format
// " swlist % clonename % parentname "
@ -1051,7 +1051,7 @@ done:
if (device().machine().phase() == machine_phase::RUNNING)
device().popmessage("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, error());
else
osd_printf_error("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path.c_str(), error());
osd_printf_error("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path, error());
}
clear();
}

View File

@ -260,7 +260,7 @@ void device_sound_interface::interface_validity_check(validity_checker &valid) c
// find a device with the requested tag
device_t const *const target = route.m_base.get().subdevice(route.m_target.c_str());
if (!target)
osd_printf_error("Attempting to route sound to non-existent device '%s'\n", route.m_base.get().subtag(route.m_target.c_str()).c_str());
osd_printf_error("Attempting to route sound to non-existent device '%s'\n", route.m_base.get().subtag(route.m_target.c_str()));
// if it's not a speaker or a sound device, error
device_sound_interface const *sound;

View File

@ -423,7 +423,7 @@ input_device_joystick::input_device_joystick(input_manager &manager, const char
m_joymap.parse(input_class_joystick::map_8way);
}
else if (mapstring != input_class_joystick::map_8way)
osd_printf_verbose("Input: Default joystick map = %s\n", m_joymap.to_string().c_str());
osd_printf_verbose("Input: Default joystick map = %s\n", m_joymap.to_string());
}
@ -648,7 +648,7 @@ bool input_class_joystick::set_global_joystick_map(const char *mapstring)
if (!map.parse(mapstring))
return false;
osd_printf_verbose("Input: Changing default joystick map = %s\n", map.to_string().c_str());
osd_printf_verbose("Input: Changing default joystick map = %s\n", map.to_string());
// iterate over joysticks and set the map
for (int joynum = 0; joynum <= maxindex(); joynum++)

View File

@ -1706,7 +1706,7 @@ time_t ioport_manager::initialize()
std::string errors;
m_portlist.append(device, errors);
if (!errors.empty())
osd_printf_error("Input port errors:\n%s", errors.c_str());
osd_printf_error("Input port errors:\n%s", errors);
}
// renumber player numbers for controller ports
@ -2558,12 +2558,12 @@ time_t ioport_manager::playback_init()
osd_printf_info("INP version %u.%u\n", header.get_majversion(), header.get_minversion());
time_t basetime = header.get_basetime();
osd_printf_info("Created %s\n", ctime(&basetime));
osd_printf_info("Recorded using %s\n", header.get_appdesc().c_str());
osd_printf_info("Recorded using %s\n", header.get_appdesc());
// verify the header against the current game
std::string const sysname = header.get_sysname();
if (sysname != machine().system().name)
osd_printf_info("Input file is for machine '%s', not for current machine '%s'\n", sysname.c_str(), machine().system().name);
osd_printf_info("Input file is for machine '%s', not for current machine '%s'\n", sysname, machine().system().name);
// enable compression
m_playback_file.compress(FCOMPRESS_MEDIUM);
@ -2907,15 +2907,15 @@ void ioport_manager::record_frame(const attotime &curtime)
timecode_key = string_format("EXTRA_STOP_%03d", (m_timecode_count-4)/2);
}
osd_printf_info("%s \n", message.c_str());
machine().popmessage("%s \n", message.c_str());
osd_printf_info("%s \n", message);
machine().popmessage("%s \n", message);
m_timecode_file.printf(
"%-19s %s %s %s %s %s %s\n",
timecode_key.c_str(),
current_time_str.c_str(), elapsed_time_str.c_str(),
mseconds_start_str.c_str(), mseconds_elapsed_str.c_str(),
frame_start_str.c_str(), frame_elapsed_str.c_str());
timecode_key,
current_time_str, elapsed_time_str,
mseconds_start_str, mseconds_elapsed_str,
frame_start_str, frame_elapsed_str);
machine().video().set_timecode_write(false);
machine().video().set_timecode_text(timecode_text);

View File

@ -1298,9 +1298,9 @@ private:
// log an error
if (m_alphafile.empty())
osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile.c_str());
osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile);
else
osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile.c_str(), m_alphafile.c_str());
osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile, m_alphafile);
}
}

View File

@ -605,7 +605,7 @@ void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname
bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]);
else
{
osd_printf_error("Cannot read JPEG data from %s file.\n", fname.c_str());
osd_printf_error("Cannot read JPEG data from %s file.\n", fname);
bitmap.reset();
break;
}

View File

@ -470,7 +470,7 @@ void rom_load_manager::display_rom_load_results(bool from_list)
if (m_errors != 0)
{
/* create the error message and exit fatally */
osd_printf_error("%s", m_errorstring.c_str());
osd_printf_error("%s", m_errorstring);
fatalerror_exitcode(machine(), EMU_ERR_MISSING_FILES, "Required files are missing, the machine cannot be run.");
}
@ -478,7 +478,7 @@ void rom_load_manager::display_rom_load_results(bool from_list)
if ((m_warnings) || (m_knownbad))
{
m_errorstring.append("WARNING: the machine might not run correctly.");
osd_printf_warning("%s\n", m_errorstring.c_str());
osd_printf_warning("%s\n", m_errorstring);
}
}

View File

@ -89,7 +89,7 @@ void save_manager::allow_registration(bool allowed)
{
if (m_entry_list[i]->m_name == m_entry_list[i + 1]->m_name)
{
osd_printf_error("Duplicate save state registration entry (%s)\n", m_entry_list[i]->m_name.c_str());
osd_printf_error("Duplicate save state registration entry (%s)\n", m_entry_list[i]->m_name);
dupes_found++;
}
}

View File

@ -1707,5 +1707,5 @@ void screen_device::load_effect_overlay(const char *filename)
if (m_screen_overlay_bitmap.valid())
m_container->set_overlay(&m_screen_overlay_bitmap);
else
osd_printf_warning("Unable to load effect PNG file '%s'\n", fullname.c_str());
osd_printf_warning("Unable to load effect PNG file '%s'\n", fullname);
}

View File

@ -221,15 +221,15 @@ void software_list_device::display_matches(const machine_config &config, const c
{
// different output depending on original system or compatible
if (swlistdev.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
osd_printf_error("* Software list \"%s\" (%s) matches: \n", swlistdev.list_name().c_str(), swlistdev.description().c_str());
osd_printf_error("* Software list \"%s\" (%s) matches: \n", swlistdev.list_name(), swlistdev.description());
else
osd_printf_error("* Compatible software list \"%s\" (%s) matches: \n", swlistdev.list_name().c_str(), swlistdev.description().c_str());
osd_printf_error("* Compatible software list \"%s\" (%s) matches: \n", swlistdev.list_name(), swlistdev.description());
// print them out
for (auto &match : matches)
{
if (match != nullptr)
osd_printf_error("%-18s%s\n", match->shortname().c_str(), match->longname().c_str());
osd_printf_error("%-18s%s\n", match->shortname(), match->longname());
}
osd_printf_error("\n");
@ -440,28 +440,28 @@ void software_list_device::internal_validity_check(validity_checker &valid)
// Did we lost any description?
if (swinfo.longname().empty())
{
osd_printf_error("%s: %s has no description\n", filename(), shortname.c_str());
osd_printf_error("%s: %s has no description\n", filename(), shortname);
break;
}
// Did we lost any year?
if (swinfo.year().empty())
{
osd_printf_error("%s: %s has no year\n", filename(), shortname.c_str());
osd_printf_error("%s: %s has no year\n", filename(), shortname);
break;
}
// Did we lost any publisher?
if (swinfo.publisher().empty())
{
osd_printf_error("%s: %s has no publisher\n", filename(), shortname.c_str());
osd_printf_error("%s: %s has no publisher\n", filename(), shortname);
break;
}
// Did we lost the software parts?
if (swinfo.parts().empty())
{
osd_printf_error("%s: %s has no part\n", filename(), shortname.c_str());
osd_printf_error("%s: %s has no part\n", filename(), shortname);
break;
}
@ -471,20 +471,20 @@ void software_list_device::internal_validity_check(validity_checker &valid)
if (!names.insert(std::make_pair(shortname, &swinfo)).second)
{
const software_info *match = names.find(shortname)->second;
osd_printf_error("%s: %s is a duplicate name (%s)\n", filename(), shortname.c_str(), match->shortname().c_str());
osd_printf_error("%s: %s is a duplicate name (%s)\n", filename(), shortname, match->shortname());
}
// check for duplicate descriptions
std::string longname(swinfo.longname());
if (!descriptions.insert(std::make_pair(strmakelower(longname), &swinfo)).second)
osd_printf_error("%s: %s is a duplicate description (%s)\n", filename(), swinfo.longname().c_str(), shortname.c_str());
osd_printf_error("%s: %s is a duplicate description (%s)\n", filename(), swinfo.longname(), shortname);
bool const is_clone(!swinfo.parentname().empty());
if (is_clone)
{
if (swinfo.parentname() == shortname)
{
osd_printf_error("%s: %s is set as a clone of itself\n", filename(), shortname.c_str());
osd_printf_error("%s: %s is set as a clone of itself\n", filename(), shortname);
break;
}
@ -492,21 +492,21 @@ void software_list_device::internal_validity_check(validity_checker &valid)
const software_info *swinfo2 = find(swinfo.parentname().c_str());
if (swinfo2 == nullptr)
osd_printf_error("%s: parent '%s' software for '%s' not found\n", filename(), swinfo.parentname().c_str(), shortname.c_str());
osd_printf_error("%s: parent '%s' software for '%s' not found\n", filename(), swinfo.parentname(), shortname);
else if (!swinfo2->parentname().empty())
osd_printf_error("%s: %s is a clone of a clone\n", filename(), shortname.c_str());
osd_printf_error("%s: %s is a clone of a clone\n", filename(), shortname);
}
// make sure the driver name isn't too long
if (shortname.length() > (is_clone ? NAME_LEN_CLONE : NAME_LEN_PARENT))
osd_printf_error("%s: %s %s software name must be %d characters or less\n", filename(), shortname.c_str(),
osd_printf_error("%s: %s %s software name must be %d characters or less\n", filename(), shortname,
is_clone ? "clone" : "parent", is_clone ? NAME_LEN_CLONE : NAME_LEN_PARENT);
// make sure the driver name doesn't contain invalid characters
for (char ch : shortname)
if (((ch < '0') || (ch > '9')) && ((ch < 'a') || (ch > 'z')) && (ch != '_'))
{
osd_printf_error("%s: %s contains invalid characters\n", filename(), shortname.c_str());
osd_printf_error("%s: %s contains invalid characters\n", filename(), shortname);
break;
}
@ -514,7 +514,7 @@ void software_list_device::internal_validity_check(validity_checker &valid)
for (char ch : swinfo.year())
if (!isdigit(u8(ch)) && (ch != '?') && (ch != '+'))
{
osd_printf_error("%s: %s has an invalid year '%s'\n", filename(), shortname.c_str(), swinfo.year().c_str());
osd_printf_error("%s: %s has an invalid year '%s'\n", filename(), shortname, swinfo.year());
break;
}
@ -522,13 +522,13 @@ void software_list_device::internal_validity_check(validity_checker &valid)
for (const software_part &part : swinfo.parts())
{
if (part.interface().empty())
osd_printf_error("%s: %s has a part (%s) without interface\n", filename(), shortname.c_str(), part.name().c_str());
osd_printf_error("%s: %s has a part (%s) without interface\n", filename(), shortname, part.name());
if (part.romdata().empty())
osd_printf_error("%s: %s has a part (%s) with no data\n", filename(), shortname.c_str(), part.name().c_str());
osd_printf_error("%s: %s has a part (%s) with no data\n", filename(), shortname, part.name());
if (!part_names.insert(std::make_pair(part.name(), &swinfo)).second)
osd_printf_error("%s: %s has a part (%s) whose name is duplicate\n", filename(), shortname.c_str(), part.name().c_str());
osd_printf_error("%s: %s has a part (%s) whose name is duplicate\n", filename(), shortname, part.name());
}
}

View File

@ -430,32 +430,32 @@ void validity_checker::validate_inlines()
resulti64 = mul_32x32(testi32a, testi32b);
expectedi64 = s64(testi32a) * s64(testi32b);
if (resulti64 != expectedi64)
osd_printf_error("Error testing mul_32x32 (%08X x %08X) = %08X%08X (expected %08X%08X)\n", testi32a, testi32b, u32(resulti64 >> 32), u32(resulti64), u32(expectedi64 >> 32), u32(expectedi64));
osd_printf_error("Error testing mul_32x32 (%08X x %08X) = %16X (expected %16X)\n", s32(testi32a), s32(testi32b), resulti64, expectedi64);
resultu64 = mulu_32x32(testu32a, testu32b);
expectedu64 = u64(testu32a) * u64(testu32b);
if (resultu64 != expectedu64)
osd_printf_error("Error testing mulu_32x32 (%08X x %08X) = %08X%08X (expected %08X%08X)\n", testu32a, testu32b, u32(resultu64 >> 32), u32(resultu64), u32(expectedu64 >> 32), u32(expectedu64));
osd_printf_error("Error testing mulu_32x32 (%08X x %08X) = %16X (expected %16X)\n", u32(testu32a), u32(testu32b), resultu64, expectedu64);
resulti32 = mul_32x32_hi(testi32a, testi32b);
expectedi32 = (s64(testi32a) * s64(testi32b)) >> 32;
if (resulti32 != expectedi32)
osd_printf_error("Error testing mul_32x32_hi (%08X x %08X) = %08X (expected %08X)\n", testi32a, testi32b, resulti32, expectedi32);
osd_printf_error("Error testing mul_32x32_hi (%08X x %08X) = %08X (expected %08X)\n", s32(testi32a), s32(testi32b), resulti32, expectedi32);
resultu32 = mulu_32x32_hi(testu32a, testu32b);
expectedu32 = (s64(testu32a) * s64(testu32b)) >> 32;
if (resultu32 != expectedu32)
osd_printf_error("Error testing mulu_32x32_hi (%08X x %08X) = %08X (expected %08X)\n", testu32a, testu32b, resultu32, expectedu32);
osd_printf_error("Error testing mulu_32x32_hi (%08X x %08X) = %08X (expected %08X)\n", u32(testu32a), u32(testu32b), resultu32, expectedu32);
resulti32 = mul_32x32_shift(testi32a, testi32b, 7);
expectedi32 = (s64(testi32a) * s64(testi32b)) >> 7;
if (resulti32 != expectedi32)
osd_printf_error("Error testing mul_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", testi32a, testi32b, resulti32, expectedi32);
osd_printf_error("Error testing mul_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", s32(testi32a), s32(testi32b), resulti32, expectedi32);
resultu32 = mulu_32x32_shift(testu32a, testu32b, 7);
expectedu32 = (s64(testu32a) * s64(testu32b)) >> 7;
if (resultu32 != expectedu32)
osd_printf_error("Error testing mulu_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", testu32a, testu32b, resultu32, expectedu32);
osd_printf_error("Error testing mulu_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", u32(testu32a), u32(testu32b), resultu32, expectedu32);
while (s64(testi32a) * s64(0x7fffffff) < testi64a)
testi64a /= 2;
@ -465,34 +465,34 @@ void validity_checker::validate_inlines()
resulti32 = div_64x32(testi64a, testi32a);
expectedi32 = testi64a / s64(testi32a);
if (resulti32 != expectedi32)
osd_printf_error("Error testing div_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", u32(testi64a >> 32), u32(testi64a), testi32a, resulti32, expectedi32);
osd_printf_error("Error testing div_64x32 (%16X / %08X) = %08X (expected %08X)\n", s64(testi64a), s32(testi32a), resulti32, expectedi32);
resultu32 = divu_64x32(testu64a, testu32a);
expectedu32 = testu64a / u64(testu32a);
if (resultu32 != expectedu32)
osd_printf_error("Error testing divu_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", u32(testu64a >> 32), u32(testu64a), testu32a, resultu32, expectedu32);
osd_printf_error("Error testing divu_64x32 (%16X / %08X) = %08X (expected %08X)\n", u64(testu64a), u32(testu32a), resultu32, expectedu32);
resulti32 = div_64x32_rem(testi64a, testi32a, &remainder);
expectedi32 = testi64a / s64(testi32a);
expremainder = testi64a % s64(testi32a);
if (resulti32 != expectedi32 || remainder != expremainder)
osd_printf_error("Error testing div_64x32_rem (%08X%08X / %08X) = %08X,%08X (expected %08X,%08X)\n", u32(testi64a >> 32), u32(testi64a), testi32a, resulti32, remainder, expectedi32, expremainder);
osd_printf_error("Error testing div_64x32_rem (%16X / %08X) = %08X,%08X (expected %08X,%08X)\n", s64(testi64a), s32(testi32a), resulti32, remainder, expectedi32, expremainder);
resultu32 = divu_64x32_rem(testu64a, testu32a, &uremainder);
expectedu32 = testu64a / u64(testu32a);
expuremainder = testu64a % u64(testu32a);
if (resultu32 != expectedu32 || uremainder != expuremainder)
osd_printf_error("Error testing divu_64x32_rem (%08X%08X / %08X) = %08X,%08X (expected %08X,%08X)\n", u32(testu64a >> 32), u32(testu64a), testu32a, resultu32, uremainder, expectedu32, expuremainder);
osd_printf_error("Error testing divu_64x32_rem (%16X / %08X) = %08X,%08X (expected %08X,%08X)\n", u64(testu64a), u32(testu32a), resultu32, uremainder, expectedu32, expuremainder);
resulti32 = mod_64x32(testi64a, testi32a);
expectedi32 = testi64a % s64(testi32a);
if (resulti32 != expectedi32)
osd_printf_error("Error testing mod_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", u32(testi64a >> 32), u32(testi64a), testi32a, resulti32, expectedi32);
osd_printf_error("Error testing mod_64x32 (%16X / %08X) = %08X (expected %08X)\n", s64(testi64a), s32(testi32a), resulti32, expectedi32);
resultu32 = modu_64x32(testu64a, testu32a);
expectedu32 = testu64a % u64(testu32a);
if (resultu32 != expectedu32)
osd_printf_error("Error testing modu_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", u32(testu64a >> 32), u32(testu64a), testu32a, resultu32, expectedu32);
osd_printf_error("Error testing modu_64x32 (%16X / %08X) = %08X (expected %08X)\n", u64(testu64a), u32(testu32a), resultu32, expectedu32);
while (s64(testi32a) * s64(0x7fffffff) < (s32(testi64a) << 3))
testi64a /= 2;
@ -502,12 +502,12 @@ void validity_checker::validate_inlines()
resulti32 = div_32x32_shift(s32(testi64a), testi32a, 3);
expectedi32 = (s64(s32(testi64a)) << 3) / s64(testi32a);
if (resulti32 != expectedi32)
osd_printf_error("Error testing div_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", s32(testi64a), testi32a, resulti32, expectedi32);
osd_printf_error("Error testing div_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", s32(testi64a), s32(testi32a), resulti32, expectedi32);
resultu32 = divu_32x32_shift(u32(testu64a), testu32a, 3);
expectedu32 = (u64(u32(testu64a)) << 3) / u64(testu32a);
if (resultu32 != expectedu32)
osd_printf_error("Error testing divu_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", u32(testu64a), testu32a, resultu32, expectedu32);
osd_printf_error("Error testing divu_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", u32(testu64a), u32(testu32a), resultu32, expectedu32);
if (fabsf(recip_approx(100.0f) - 0.01f) > 0.0001f)
osd_printf_error("Error testing recip_approx\n");
@ -582,10 +582,10 @@ void validity_checker::validate_rgb()
const volatile s32 r = rgb.get_r32();
const volatile s32 g = rgb.get_g32();
const volatile s32 b = rgb.get_b32();
if (a != expected_a) osd_printf_error("Error testing %s get_a32() = %d (expected %d)\n", desc, a, expected_a);
if (r != expected_r) osd_printf_error("Error testing %s get_r32() = %d (expected %d)\n", desc, r, expected_r);
if (g != expected_g) osd_printf_error("Error testing %s get_g32() = %d (expected %d)\n", desc, g, expected_g);
if (b != expected_b) osd_printf_error("Error testing %s get_b32() = %d (expected %d)\n", desc, b, expected_b);
if (a != expected_a) osd_printf_error("Error testing %s get_a32() = %d (expected %d)\n", desc, s32(a), s32(expected_a));
if (r != expected_r) osd_printf_error("Error testing %s get_r32() = %d (expected %d)\n", desc, s32(r), s32(expected_r));
if (g != expected_g) osd_printf_error("Error testing %s get_g32() = %d (expected %d)\n", desc, s32(g), s32(expected_g));
if (b != expected_b) osd_printf_error("Error testing %s get_b32() = %d (expected %d)\n", desc, s32(b), s32(expected_b));
};
// check set/get
@ -901,10 +901,10 @@ void validity_checker::validate_rgb()
actual_r = s32(u32(rgb.get_r()));
actual_g = s32(u32(rgb.get_g()));
actual_b = s32(u32(rgb.get_b()));
if (actual_a != expected_a) osd_printf_error("Error testing rgbaint_t::get_a() = %d (expected %d)\n", actual_a, expected_a);
if (actual_r != expected_r) osd_printf_error("Error testing rgbaint_t::get_r() = %d (expected %d)\n", actual_r, expected_r);
if (actual_g != expected_g) osd_printf_error("Error testing rgbaint_t::get_g() = %d (expected %d)\n", actual_g, expected_g);
if (actual_b != expected_b) osd_printf_error("Error testing rgbaint_t::get_b() = %d (expected %d)\n", actual_b, expected_b);
if (actual_a != expected_a) osd_printf_error("Error testing rgbaint_t::get_a() = %d (expected %d)\n", s32(actual_a), s32(expected_a));
if (actual_r != expected_r) osd_printf_error("Error testing rgbaint_t::get_r() = %d (expected %d)\n", s32(actual_r), s32(expected_r));
if (actual_g != expected_g) osd_printf_error("Error testing rgbaint_t::get_g() = %d (expected %d)\n", s32(actual_g), s32(expected_g));
if (actual_b != expected_b) osd_printf_error("Error testing rgbaint_t::get_b() = %d (expected %d)\n", s32(actual_b), s32(expected_b));
// test set from packed RGBA
imm = random_i32();
@ -1406,14 +1406,14 @@ void validity_checker::validate_driver()
if (!m_names_map.insert(std::make_pair(m_current_driver->name, m_current_driver)).second)
{
const game_driver *match = m_names_map.find(m_current_driver->name)->second;
osd_printf_error("Driver name is a duplicate of %s(%s)\n", core_filename_extract_base(match->type.source()).c_str(), match->name);
osd_printf_error("Driver name is a duplicate of %s(%s)\n", core_filename_extract_base(match->type.source()), match->name);
}
// check for duplicate descriptions
if (!m_descriptions_map.insert(std::make_pair(m_current_driver->type.fullname(), m_current_driver)).second)
{
const game_driver *match = m_descriptions_map.find(m_current_driver->type.fullname())->second;
osd_printf_error("Driver description is a duplicate of %s(%s)\n", core_filename_extract_base(match->type.source()).c_str(), match->name);
osd_printf_error("Driver description is a duplicate of %s(%s)\n", core_filename_extract_base(match->type.source()), match->name);
}
// determine if we are a clone
@ -1551,7 +1551,7 @@ void validity_checker::validate_roms(device_t &root)
// attempt to add it to the map, reporting duplicates as errors
current_length = ROMREGION_GETLENGTH(romp);
if (!m_region_map.insert(std::make_pair(fulltag, current_length)).second)
osd_printf_error("Multiple ROM_REGIONs with the same tag '%s' defined\n", fulltag.c_str());
osd_printf_error("Multiple ROM_REGIONs with the same tag '%s' defined\n", fulltag);
}
else if (ROMENTRY_ISSYSTEM_BIOS(romp)) // If this is a system bios, make sure it is using the next available bios number
{
@ -1579,7 +1579,7 @@ void validity_checker::validate_roms(device_t &root)
osd_printf_error("Duplicate BIOS name %s specified (%d and %d)\n", biosname, nameins.first->second, bios_flags - 1);
auto const descins = bios_descs.emplace(romp->hashdata, biosname);
if (!descins.second)
osd_printf_error("BIOS %s has duplicate description '%s' (was %s)\n", biosname, romp->hashdata, descins.first->second.c_str());
osd_printf_error("BIOS %s has duplicate description '%s' (was %s)\n", biosname, romp->hashdata, descins.first->second);
}
else if (ROMENTRY_ISDEFAULT_BIOS(romp)) // if this is a default BIOS setting, remember it so it to check at the end
{
@ -1623,7 +1623,7 @@ void validity_checker::validate_roms(device_t &root)
if (defbios && (bios_names.find(defbios) == bios_names.end()))
osd_printf_error("Default BIOS '%s' not found\n", defbios);
if (!device.get_default_bios_tag().empty() && (bios_names.find(device.get_default_bios_tag()) == bios_names.end()))
osd_printf_error("Configured BIOS '%s' not found\n", device.get_default_bios_tag().c_str());
osd_printf_error("Configured BIOS '%s' not found\n", device.get_default_bios_tag());
// check that there aren't ROMs for a non-existent BIOS option
if (max_bios > last_bios)
@ -1828,7 +1828,7 @@ void validity_checker::validate_inputs()
// report any errors during construction
if (!errorbuf.empty())
osd_printf_error("I/O port error during construction:\n%s\n", errorbuf.c_str());
osd_printf_error("I/O port error during construction:\n%s\n", errorbuf);
// do a first pass over ports to add their names and find duplicates
for (auto &port : portlist)
@ -2053,7 +2053,7 @@ void validity_checker::validate_device_types()
// ensure shortname exists
if (!dev->shortname() || !*dev->shortname())
{
osd_printf_error("Device %s does not have short name defined\n", description.c_str());
osd_printf_error("Device %s does not have short name defined\n", description);
}
else
{
@ -2066,7 +2066,7 @@ void validity_checker::validate_device_types()
{
if (((*s < '0') || (*s > '9')) && ((*s < 'a') || (*s > 'z')) && (*s != '_'))
{
osd_printf_error("Device %s short name contains invalid characters\n", description.c_str());
osd_printf_error("Device %s short name contains invalid characters\n", description);
break;
}
}
@ -2078,12 +2078,12 @@ void validity_checker::validate_device_types()
if (m_names_map.end() != drvname)
{
game_driver const &dup(*drvname->second);
osd_printf_error("Device %s short name is a duplicate of %s(%s)\n", description.c_str(), core_filename_extract_base(dup.type.source()).c_str(), dup.name);
osd_printf_error("Device %s short name is a duplicate of %s(%s)\n", description, core_filename_extract_base(dup.type.source()), dup.name);
}
else if (!devname.second)
{
device_t *const dup = config.device_add("_dup", *devname.first->second, 0);
osd_printf_error("Device %s short name is a duplicate of %s(%s)\n", description.c_str(), core_filename_extract_base(dup->source()).c_str(), dup->shortname());
osd_printf_error("Device %s short name is a duplicate of %s(%s)\n", description, core_filename_extract_base(dup->source()), dup->shortname());
config.device_remove("_dup");
}
}
@ -2091,7 +2091,7 @@ void validity_checker::validate_device_types()
// ensure name exists
if (!dev->name() || !*dev->name())
{
osd_printf_error("Device %s does not have name defined\n", description.c_str());
osd_printf_error("Device %s does not have name defined\n", description);
}
else
{
@ -2102,23 +2102,23 @@ void validity_checker::validate_device_types()
if (m_descriptions_map.end() != drvdesc)
{
game_driver const &dup(*drvdesc->second);
osd_printf_error("Device %s name '%s' is a duplicate of %s(%s)\n", description.c_str(), dev->name(), core_filename_extract_base(dup.type.source()).c_str(), dup.name);
osd_printf_error("Device %s name '%s' is a duplicate of %s(%s)\n", description, dev->name(), core_filename_extract_base(dup.type.source()), dup.name);
}
else if (!devdesc.second)
{
device_t *const dup = config.device_add("_dup", *devdesc.first->second, 0);
osd_printf_error("Device %s name '%s' is a duplicate of %s(%s)\n", description.c_str(), dev->name(), core_filename_extract_base(dup->source()).c_str(), dup->shortname());
osd_printf_error("Device %s name '%s' is a duplicate of %s(%s)\n", description, dev->name(), core_filename_extract_base(dup->source()), dup->shortname());
config.device_remove("_dup");
}
}
// ensure source exists
if (!dev->source() || !*dev->source())
osd_printf_error("Device %s does not have source defined\n", description.c_str());
osd_printf_error("Device %s does not have source defined\n", description);
// check that reported type matches supplied type
if (dev->type().type() != type.type())
osd_printf_error("Device %s reports type '%s' (created with '%s')\n", description.c_str(), dev->type().type().name(), type.type().name());
osd_printf_error("Device %s reports type '%s' (created with '%s')\n", description, dev->type().type().name(), type.type().name());
// catch invalid flag combinations
device_t::feature_type const unemulated(dev->type().unemulated_features());
@ -2154,18 +2154,15 @@ void validity_checker::validate_device_types()
// and device
//-------------------------------------------------
void validity_checker::build_output_prefix(std::string &str)
void validity_checker::build_output_prefix(std::ostream &str) const
{
// start empty
str.clear();
// if we have a current (non-root) device, indicate that
if (m_current_device != nullptr && m_current_device->owner() != nullptr)
str.append(m_current_device->name()).append(" device '").append(m_current_device->tag() + 1).append("': ");
if (m_current_device && m_current_device->owner())
util::stream_format(str, "%s device '%s': ", m_current_device->name(), m_current_device->tag() + 1);
// if we have a current port, indicate that as well
if (m_current_ioport != nullptr)
str.append("ioport '").append(m_current_ioport).append("': ");
if (m_current_ioport)
util::stream_format(str, "ioport '%s': ", m_current_ioport);
}
@ -2173,9 +2170,9 @@ void validity_checker::build_output_prefix(std::string &str)
// error_output - error message output override
//-------------------------------------------------
void validity_checker::output_callback(osd_output_channel channel, const char *msg, va_list args)
void validity_checker::output_callback(osd_output_channel channel, const util::format_argument_pack<std::ostream> &args)
{
std::string output;
std::ostringstream output;
switch (channel)
{
case OSD_OUTPUT_CHANNEL_ERROR:
@ -2186,8 +2183,8 @@ void validity_checker::output_callback(osd_output_channel channel, const char *m
build_output_prefix(output);
// generate the string
strcatvprintf(output, msg, args);
m_error_text.append(output);
util::stream_format(output, args);
m_error_text.append(output.str());
break;
case OSD_OUTPUT_CHANNEL_WARNING:
@ -2198,8 +2195,8 @@ void validity_checker::output_callback(osd_output_channel channel, const char *m
build_output_prefix(output);
// generate the string and output to the original target
strcatvprintf(output, msg, args);
m_warning_text.append(output);
util::stream_format(output, args);
m_warning_text.append(output.str());
break;
case OSD_OUTPUT_CHANNEL_VERBOSE:
@ -2210,12 +2207,12 @@ void validity_checker::output_callback(osd_output_channel channel, const char *m
build_output_prefix(output);
// generate the string and output to the original target
strcatvprintf(output, msg, args);
m_verbose_text.append(output);
util::stream_format(output, args);
m_verbose_text.append(output.str());
break;
default:
chain_output(channel, msg, args);
chain_output(channel, args);
break;
}
}
@ -2226,14 +2223,11 @@ void validity_checker::output_callback(osd_output_channel channel, const char *m
// can be forwarded onto the given delegate
//-------------------------------------------------
void validity_checker::output_via_delegate(osd_output_channel channel, const char *format, ...)
template <typename Format, typename... Params>
void validity_checker::output_via_delegate(osd_output_channel channel, Format &&fmt, Params &&...args)
{
va_list argptr;
// call through to the delegate with the proper parameters
va_start(argptr, format);
chain_output(channel, format, argptr);
va_end(argptr);
chain_output(channel, util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
}
//-------------------------------------------------

View File

@ -52,7 +52,7 @@ public:
// osd_output interface
protected:
virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override;
virtual void output_callback(osd_output_channel channel, const util::format_argument_pack<std::ostream> &args) override;
private:
// internal map types
@ -82,8 +82,8 @@ private:
void validate_device_types();
// output helpers
void build_output_prefix(std::string &str);
void output_via_delegate(osd_output_channel channel, const char *format, ...) ATTR_PRINTF(3,4);
void build_output_prefix(std::ostream &str) const;
template <typename Format, typename... Params> void output_via_delegate(osd_output_channel channel, Format &&fmt, Params &&...args);
void output_indented_errors(std::string &text, const char *header);
// random number generation

View File

@ -810,14 +810,14 @@ bool cheat_entry::activate()
// if we're a oneshot cheat, execute the "on" script and indicate change
execute_on_script();
changed = true;
m_manager.machine().popmessage("Activated %s", m_description.c_str());
m_manager.machine().popmessage("Activated %s", m_description);
}
else if (is_oneshot_parameter() && (m_state != SCRIPT_STATE_OFF))
{
// if we're a oneshot parameter cheat and we're active, execute the "state change" script and indicate change
execute_change_script();
changed = true;
m_manager.machine().popmessage("Activated\n %s = %s", m_description.c_str(), m_parameter->text());
m_manager.machine().popmessage("Activated\n %s = %s", m_description, m_parameter->text());
}
return changed;

View File

@ -252,7 +252,7 @@ void cli_frontend::start_execution(mame_machine_manager *manager, const std::vec
if (option_errors.tellp() > 0)
{
std::string option_errors_string = option_errors.str();
osd_printf_error("Error in command line:\n%s\n", strtrimspace(option_errors_string).c_str());
osd_printf_error("Error in command line:\n%s\n", strtrimspace(option_errors_string));
}
// if we can't find it, give an appropriate error
@ -284,7 +284,7 @@ int cli_frontend::execute(std::vector<std::string> &args)
{
std::string str(fatal.string());
strtrimspace(str);
osd_printf_error("%s\n", str.c_str());
osd_printf_error("%s\n", str);
m_result = (fatal.exitcode() != 0) ? fatal.exitcode() : EMU_ERR_FATALERROR;
// if a game was specified, wasn't a wildcard, and our error indicates this was the
@ -313,7 +313,7 @@ int cli_frontend::execute(std::vector<std::string> &args)
if (0 <= match)
{
game_driver const &drv(drivlist.driver(match));
osd_printf_error("%s", util::string_format("%-18s%-*s(%s, %s)\n", drv.name, titlelen + 2, drv.type.fullname(), drv.manufacturer, drv.year).c_str());
osd_printf_error("%-18s%-*s(%s, %s)\n", drv.name, titlelen + 2, drv.type.fullname(), drv.manufacturer, drv.year);
}
}
}
@ -392,7 +392,7 @@ void cli_frontend::listsource(const std::vector<std::string> &args)
{
auto const list_system_source = [] (device_type type)
{
osd_printf_info("%-16s %s\n", type.shortname(), core_filename_extract_base(type.source()).c_str());
osd_printf_info("%-16s %s\n", type.shortname(), core_filename_extract_base(type.source()));
};
apply_action(
args,
@ -493,9 +493,9 @@ void cli_frontend::listbrothers(const std::vector<std::string> &args)
{
int clone_of = drivlist.clone();
if (clone_of != -1)
osd_printf_info("%-20s %-16s %s\n", core_filename_extract_base(drivlist.driver().type.source()).c_str(), drivlist.driver().name, (clone_of == -1 ? "" : drivlist.driver(clone_of).name));
osd_printf_info("%-20s %-16s %s\n", core_filename_extract_base(drivlist.driver().type.source()), drivlist.driver().name, (clone_of == -1 ? "" : drivlist.driver(clone_of).name));
else
osd_printf_info("%-20s %s\n", core_filename_extract_base(drivlist.driver().type.source()).c_str(), drivlist.driver().name);
osd_printf_info("%-20s %s\n", core_filename_extract_base(drivlist.driver().type.source()), drivlist.driver().name);
}
}
@ -580,7 +580,7 @@ void cli_frontend::listroms(const std::vector<std::string> &args)
{
if (hashes.flag(util::hash_collection::FLAG_BAD_DUMP))
osd_printf_info(" BAD");
osd_printf_info(" %s", hashes.macro_string().c_str());
osd_printf_info(" %s", hashes.macro_string());
}
else
osd_printf_info(" NO GOOD DUMP KNOWN");
@ -1615,7 +1615,7 @@ void cli_frontend::execute_commands(const char *exename)
if (m_options.command() == CLICOMMAND_SHOWUSAGE)
{
osd_printf_info("Usage: %s [machine] [media] [software] [options]",exename);
osd_printf_info("\n\nOptions:\n%s", m_options.output_help().c_str());
osd_printf_info("\n\nOptions:\n%s", m_options.output_help());
return;
}
@ -1640,7 +1640,7 @@ void cli_frontend::execute_commands(const char *exename)
std::ostringstream option_errors;
mame_options::parse_standard_inis(m_options,option_errors);
if (option_errors.tellp() > 0)
osd_printf_error("%s\n", option_errors.str().c_str());
osd_printf_error("%s\n", option_errors.str());
// createconfig?
if (m_options.command() == CLICOMMAND_CREATECONFIG)

View File

@ -161,18 +161,18 @@ void media_identifier::collect_files(std::vector<file_info> &info, char const *p
if (util::archive_file::error::NONE == err)
digest_data(info, curfile.c_str(), &data[0], length);
else
osd_printf_error("%s: error decompressing file\n", curfile.c_str());
osd_printf_error("%s: error decompressing file\n", curfile);
}
catch (...)
{
// resizing the buffer could cause a bad_alloc if archive contains large files
osd_printf_error("%s: error decompressing file\n", curfile.c_str());
osd_printf_error("%s: error decompressing file\n", curfile);
}
data.clear();
}
else
{
osd_printf_error("%s: file too large to decompress into memory\n", curfile.c_str());
osd_printf_error("%s: file too large to decompress into memory\n", curfile);
}
}
}
@ -209,12 +209,12 @@ void media_identifier::digest_file(std::vector<file_info> &info, char const *pat
m_total++;
if (err != CHDERR_NONE)
{
osd_printf_info("%-20sNOT A CHD\n", core_filename_extract_base(path).c_str());
osd_printf_info("%-20sNOT A CHD\n", core_filename_extract_base(path));
m_nonroms++;
}
else if (!chd.compressed())
{
osd_printf_info("%-20sis a writeable CHD\n", core_filename_extract_base(path).c_str());
osd_printf_info("%-20sis a writeable CHD\n", core_filename_extract_base(path));
}
else
{
@ -413,7 +413,7 @@ void media_identifier::print_results(std::vector<file_info> const &info)
{
for (file_info const &file : info)
{
osd_printf_info("%-20s", core_filename_extract_base(file.name()).c_str());
osd_printf_info("%-20s", core_filename_extract_base(file.name()));
if (file.matches().empty())
{
osd_printf_info("NO MATCH\n");

View File

@ -73,15 +73,14 @@ bool plugin_options::load_plugin(const std::string &path)
if (document.HasParseError())
{
std::string error(GetParseError_En(document.GetParseError()));
osd_printf_error("Unable to parse plugin definition file %s. Errors returned:\n", path.c_str());
osd_printf_error("%s\n", error.c_str());
const std::string error(GetParseError_En(document.GetParseError()));
osd_printf_error("Unable to parse plugin definition file %s. Errors returned:\n%s", path, error);
return false;
}
if (!document["plugin"].IsObject())
{
osd_printf_error("Bad plugin definition file %s:\n", path.c_str());
osd_printf_error("Bad plugin definition file %s:\n", path);
return false;
}

View File

@ -421,7 +421,7 @@ void menu_file_selector::populate(float &customtop, float &custombottom)
// build the menu for each item
if (osd_file::error::NONE != err)
{
osd_printf_verbose("menu_file_selector::populate: error opening directory '%s' (%d)\n", m_current_directory.c_str(), int(err));
osd_printf_verbose("menu_file_selector::populate: error opening directory '%s' (%d)\n", m_current_directory, int(err));
}
else
{

View File

@ -64,7 +64,7 @@ void inifile_manager::load_ini_category(size_t file, size_t category, std::unord
emu_file fp(m_options.categoryini_path(), OPEN_FLAG_READ);
if (fp.open(filename) != osd_file::error::NONE)
{
osd_printf_error("Failed to open category file %s for reading\n", filename.c_str());
osd_printf_error("Failed to open category file %s for reading\n", filename);
return;
}
@ -72,7 +72,7 @@ void inifile_manager::load_ini_category(size_t file, size_t category, std::unord
if (fp.seek(offset, SEEK_SET) || (fp.tell() != offset))
{
fp.close();
osd_printf_error("Failed to seek to category offset in file %s\n", filename.c_str());
osd_printf_error("Failed to seek to category offset in file %s\n", filename);
return;
}

View File

@ -608,7 +608,7 @@ void menu_export::handle()
// and do the dirty work
info_xml_creator creator(machine().options());
creator.output(pfile, filter, include_devices);
machine().popmessage(_("%s.xml saved under ui folder."), filename.c_str());
machine().popmessage(_("%s.xml saved under ui folder."), filename);
}
}
break;
@ -645,7 +645,7 @@ void menu_export::handle()
util::stream_format(buffer, "%-18s\"%s\"\n", drvlist.driver().name, drvlist.driver().type.fullname());
file.puts(buffer.str().c_str());
file.close();
machine().popmessage(_("%s.txt saved under ui folder."), filename.c_str());
machine().popmessage(_("%s.txt saved under ui folder."), filename);
}
}
break;

View File

@ -1013,7 +1013,7 @@ void menu_select_launch::check_for_icons(char const *listname)
current.append(PATH_SEPARATOR);
current.append(listname);
}
osd_printf_verbose("Checking for icons in directory %s\n", current.c_str());
osd_printf_verbose("Checking for icons in directory %s\n", current);
// open and walk the directory
osd::directory::ptr const dir(osd::directory::open(current));

View File

@ -225,12 +225,12 @@ void menu_select_software::handle()
if (!mfav.is_favorite_system_software(*swinfo))
{
mfav.add_favorite_software(*swinfo);
machine().popmessage(_("%s\n added to favorites list."), swinfo->longname.c_str());
machine().popmessage(_("%s\n added to favorites list."), swinfo->longname);
}
else
{
machine().popmessage(_("%s\n removed from favorites list."), swinfo->longname.c_str());
machine().popmessage(_("%s\n removed from favorites list."), swinfo->longname);
mfav.remove_favorite_software(*swinfo);
}
}

View File

@ -128,7 +128,7 @@ static int camplynx_handle_cassette(int16_t *buffer, const uint8_t *bytes)
/* tell user how to load the tape */
if (buffer)
osd_printf_info("%s\n", pgmname.c_str());
osd_printf_info("%s\n", pgmname);
/* second SYNC + A5 */
for (i = 0; i < 555; i++)

View File

@ -128,16 +128,6 @@ bool core_iswildstr(const char *sp)
#include <algorithm>
int strcatvprintf(std::string &str, const char *format, va_list args)
{
char tempbuf[4096];
int result = vsprintf(tempbuf, format, args);
// set the result
str.append(tempbuf);
return result;
}
void strdelchr(std::string& str, char chr)
{
for (size_t i = 0; i < str.length(); i++)

View File

@ -54,8 +54,6 @@ int core_strwildcmp(const char *sp1, const char *sp2);
bool core_iswildstr(const char *sp);
int strcatvprintf(std::string &str, const char *format, va_list args);
void strdelchr(std::string& str, char chr);
void strreplacechr(std::string& str, char ch, char newch);
std::string &strtrimspace(std::string& str);

View File

@ -115,7 +115,7 @@ public:
{
ptr result;
std::swap(s_cache[cachenum], result);
osd_printf_verbose("un7z: found %s in cache\n", filename.c_str());
osd_printf_verbose("un7z: found %s in cache\n", filename);
return result;
}
}
@ -314,7 +314,7 @@ archive_file::error m7z_file_impl::initialize()
if (err != osd_file::error::NONE)
return archive_file::error::FILE_ERROR;
osd_printf_verbose("un7z: opened archive file %s\n", m_filename.c_str());
osd_printf_verbose("un7z: opened archive file %s\n", m_filename);
CrcGenerateTable(); // FIXME: doesn't belong here - it should be called once statically
@ -323,7 +323,7 @@ archive_file::error m7z_file_impl::initialize()
SRes const res = SzArEx_Open(&m_db, &m_look_stream.s, &m_alloc_imp, &m_alloc_temp_imp);
if (res != SZ_OK)
{
osd_printf_error("un7z: error opening %s as 7z archive (%d)\n", m_filename.c_str(), int(res));
osd_printf_error("un7z: error opening %s as 7z archive (%d)\n", m_filename, int(res));
switch (res)
{
case SZ_ERROR_UNSUPPORTED: return archive_file::error::UNSUPPORTED;
@ -347,7 +347,7 @@ void m7z_file_impl::close(ptr &&archive)
if (!archive) return;
// close the open files
osd_printf_verbose("un7z: closing archive file %s and sending to cache\n", archive->m_filename.c_str());
osd_printf_verbose("un7z: closing archive file %s and sending to cache\n", archive->m_filename);
archive->m_archive_stream.osdfile.reset();
// find the first nullptr entry in the cache
@ -361,7 +361,7 @@ void m7z_file_impl::close(ptr &&archive)
if (cachenum == s_cache.size())
{
cachenum--;
osd_printf_verbose("un7z: removing %s from cache to make space\n", s_cache[cachenum]->m_filename.c_str());
osd_printf_verbose("un7z: removing %s from cache to make space\n", s_cache[cachenum]->m_filename);
s_cache[cachenum].reset();
}
@ -387,7 +387,7 @@ archive_file::error m7z_file_impl::decompress(void *buffer, std::uint32_t length
// if we don't have enough buffer, error
if (length < m_curr_length)
{
osd_printf_error("un7z: buffer too small to decompress %s from %s\n", m_curr_name.c_str(), m_filename.c_str());
osd_printf_error("un7z: buffer too small to decompress %s from %s\n", m_curr_name, m_filename);
return archive_file::error::BUFFER_TOO_SMALL;
}
@ -398,10 +398,10 @@ archive_file::error m7z_file_impl::decompress(void *buffer, std::uint32_t length
osd_file::error const err = osd_file::open(m_filename, OPEN_FLAG_READ, m_archive_stream.osdfile, m_archive_stream.length);
if (err != osd_file::error::NONE)
{
osd_printf_error("un7z: error reopening archive file %s (%d)\n", m_filename.c_str(), int(err));
osd_printf_error("un7z: error reopening archive file %s (%d)\n", m_filename, int(err));
return archive_file::error::FILE_ERROR;
}
osd_printf_verbose("un7z: reopened archive file %s\n", m_filename.c_str());
osd_printf_verbose("un7z: reopened archive file %s\n", m_filename);
}
std::size_t offset(0);
@ -413,7 +413,7 @@ archive_file::error m7z_file_impl::decompress(void *buffer, std::uint32_t length
&m_alloc_imp, &m_alloc_temp_imp); // allocator helpers
if (res != SZ_OK)
{
osd_printf_error("un7z: error decompressing %s from %s (%d)\n", m_curr_name.c_str(), m_filename.c_str(), int(res));
osd_printf_error("un7z: error decompressing %s from %s (%d)\n", m_curr_name, m_filename, int(res));
switch (res)
{
case SZ_ERROR_UNSUPPORTED: return archive_file::error::UNSUPPORTED;

View File

@ -67,7 +67,7 @@ public:
{
ptr result;
std::swap(s_cache[cachenum], result);
osd_printf_verbose("unzip: found %s in cache\n", filename.c_str());
osd_printf_verbose("unzip: found %s in cache\n", filename);
return result;
}
}
@ -91,17 +91,17 @@ public:
// verify that we can work with this zipfile (no disk spanning allowed)
if (m_ecd.disk_number != m_ecd.cd_start_disk_number)
{
osd_printf_error("unzip: %s central directory starts in another segment\n", m_filename.c_str());
osd_printf_error("unzip: %s central directory starts in another segment\n", m_filename);
return archive_file::error::UNSUPPORTED;
}
if (m_ecd.cd_disk_entries != m_ecd.cd_total_entries)
{
osd_printf_error("unzip: %s not all central directory entries reside in this segment\n", m_filename.c_str());
osd_printf_error("unzip: %s not all central directory entries reside in this segment\n", m_filename);
return archive_file::error::UNSUPPORTED;
}
if (std::size_t(m_ecd.cd_size) != m_ecd.cd_size)
{
osd_printf_error("unzip: %s central directory too large to load\n", m_filename.c_str());
osd_printf_error("unzip: %s central directory too large to load\n", m_filename);
return archive_file::error::UNSUPPORTED;
}
@ -109,7 +109,7 @@ public:
try { m_cd.resize(std::size_t(m_ecd.cd_size)); }
catch (...)
{
osd_printf_error("unzip: %s failed to allocate memory for central directory\n", m_filename.c_str());
osd_printf_error("unzip: %s failed to allocate memory for central directory\n", m_filename);
return archive_file::error::OUT_OF_MEMORY;
}
@ -123,18 +123,18 @@ public:
auto const filerr = m_file->read(&m_cd[cd_offs], m_ecd.cd_start_disk_offset + cd_offs, chunk, read_length);
if (filerr != osd_file::error::NONE)
{
osd_printf_error("unzip: %s error reading central directory (%d)\n", m_filename.c_str(), int(filerr));
osd_printf_error("unzip: %s error reading central directory (%d)\n", m_filename, int(filerr));
return archive_file::error::FILE_ERROR;
}
if (!read_length)
{
osd_printf_error("unzip: %s unexpectedly reached end-of-file while reading central directory\n", m_filename.c_str());
osd_printf_error("unzip: %s unexpectedly reached end-of-file while reading central directory\n", m_filename);
return archive_file::error::FILE_TRUNCATED;
}
cd_remaining -= read_length;
cd_offs += read_length;
}
osd_printf_verbose("unzip: read %s central directory\n", m_filename.c_str());
osd_printf_verbose("unzip: read %s central directory\n", m_filename);
return archive_file::error::NONE;
}
@ -197,12 +197,12 @@ private:
if (filerr != osd_file::error::NONE)
{
// this would spam every time it looks for a non-existent archive, which is a lot
//osd_printf_error("unzip: error reopening archive file %s (%d)\n", m_filename.c_str(), int(filerr));
//osd_printf_error("unzip: error reopening archive file %s (%d)\n", m_filename, int(filerr));
return archive_file::error::FILE_ERROR;
}
else
{
osd_printf_verbose("unzip: opened archive file %s\n", m_filename.c_str());
osd_printf_verbose("unzip: opened archive file %s\n", m_filename);
}
}
return archive_file::error::NONE;
@ -667,7 +667,7 @@ void zip_file_impl::close(ptr &&zip)
if (!zip) return;
// close the open files
osd_printf_verbose("unzip: closing archive file %s and sending to cache\n", zip->m_filename.c_str());
osd_printf_verbose("unzip: closing archive file %s and sending to cache\n", zip->m_filename);
zip->m_file.reset();
// find the first nullptr entry in the cache
@ -681,7 +681,7 @@ void zip_file_impl::close(ptr &&zip)
if (cachenum == s_cache.size())
{
cachenum--;
osd_printf_verbose("unzip: removing %s from cache to make space\n", s_cache[cachenum]->m_filename.c_str());
osd_printf_verbose("unzip: removing %s from cache to make space\n", s_cache[cachenum]->m_filename);
s_cache[cachenum].reset();
}
@ -822,14 +822,14 @@ archive_file::error zip_file_impl::decompress(void *buffer, std::uint32_t length
// if we don't have enough buffer, error
if (length < m_header.uncompressed_length)
{
osd_printf_error("unzip: buffer too small to decompress %s from %s\n", m_header.file_name.c_str(), m_filename.c_str());
osd_printf_error("unzip: buffer too small to decompress %s from %s\n", m_header.file_name, m_filename);
return archive_file::error::BUFFER_TOO_SMALL;
}
// make sure the info in the header aligns with what we know
if (m_header.start_disk_number != m_ecd.disk_number)
{
osd_printf_error("unzip: %s does not reside in segment %s\n", m_header.file_name.c_str(), m_filename.c_str());
osd_printf_error("unzip: %s does not reside in segment %s\n", m_header.file_name, m_filename);
return archive_file::error::UNSUPPORTED;
}
@ -895,7 +895,7 @@ archive_file::error zip_file_impl::read_ecd()
try { buffer.reset(new std::uint8_t[buflen + 1]); }
catch (...)
{
osd_printf_error("unzip: %s failed to allocate memory for ECD search\n", m_filename.c_str());
osd_printf_error("unzip: %s failed to allocate memory for ECD search\n", m_filename);
return archive_file::error::OUT_OF_MEMORY;
}
@ -903,7 +903,7 @@ archive_file::error zip_file_impl::read_ecd()
error = m_file->read(&buffer[0], m_length - buflen, buflen, read_length);
if ((error != osd_file::error::NONE) || (read_length != buflen))
{
osd_printf_error("unzip: %s error reading file to search for ECD (%d)\n", m_filename.c_str(), int(error));
osd_printf_error("unzip: %s error reading file to search for ECD (%d)\n", m_filename, int(error));
return archive_file::error::FILE_ERROR;
}
@ -919,7 +919,7 @@ archive_file::error zip_file_impl::read_ecd()
// if we found it, fill out the data
if (offset >= 0)
{
osd_printf_verbose("unzip: found %s ECD\n", m_filename.c_str());
osd_printf_verbose("unzip: found %s ECD\n", m_filename);
// extract ECD info
ecd_reader const ecd_rd(buffer.get() + offset);
@ -933,7 +933,7 @@ archive_file::error zip_file_impl::read_ecd()
// is the file too small to contain a ZIP64 ECD locator?
if ((m_length - buflen + offset) < ecd64_locator_reader::minimum_length())
{
osd_printf_verbose("unzip: %s too small to contain ZIP64 ECD locator\n", m_filename.c_str());
osd_printf_verbose("unzip: %s too small to contain ZIP64 ECD locator\n", m_filename);
return archive_file::error::NONE;
}
@ -945,7 +945,7 @@ archive_file::error zip_file_impl::read_ecd()
read_length);
if ((error != osd_file::error::NONE) || (read_length != ecd64_locator_reader::minimum_length()))
{
osd_printf_error("unzip: error reading %s to search for ZIP64 ECD locator (%d)\n", m_filename.c_str(), int(error));
osd_printf_error("unzip: error reading %s to search for ZIP64 ECD locator (%d)\n", m_filename, int(error));
return archive_file::error::FILE_ERROR;
}
@ -953,14 +953,14 @@ archive_file::error zip_file_impl::read_ecd()
ecd64_locator_reader const ecd64_loc_rd(buffer.get());
if (!ecd64_loc_rd.signature_correct())
{
osd_printf_verbose("unzip: %s has no ZIP64 ECD locator\n", m_filename.c_str());
osd_printf_verbose("unzip: %s has no ZIP64 ECD locator\n", m_filename);
return archive_file::error::NONE;
}
// check that the ZIP64 ECD is in this segment (assuming this segment is the last segment)
if ((ecd64_loc_rd.ecd64_disk() + 1) != ecd64_loc_rd.total_disks())
{
osd_printf_error("unzip: %s ZIP64 ECD resides in a different segment\n", m_filename.c_str());
osd_printf_error("unzip: %s ZIP64 ECD resides in a different segment\n", m_filename);
return archive_file::error::UNSUPPORTED;
}
@ -968,12 +968,12 @@ archive_file::error zip_file_impl::read_ecd()
error = m_file->read(&buffer[0], ecd64_loc_rd.ecd64_offset(), ecd64_reader::minimum_length(), read_length);
if (error != osd_file::error::NONE)
{
osd_printf_error("unzip: error reading %s ZIP64 ECD (%d)\n", m_filename.c_str(), int(error));
osd_printf_error("unzip: error reading %s ZIP64 ECD (%d)\n", m_filename, int(error));
return archive_file::error::FILE_ERROR;
}
if (read_length != ecd64_reader::minimum_length())
{
osd_printf_error("unzip: unexpectedly reached end-of-file while reading %s ZIP64 ECD\n", m_filename.c_str());
osd_printf_error("unzip: unexpectedly reached end-of-file while reading %s ZIP64 ECD\n", m_filename);
return archive_file::error::FILE_TRUNCATED;
}
@ -988,7 +988,7 @@ archive_file::error zip_file_impl::read_ecd()
}
if (ecd64_rd.total_length() < ecd64_reader::minimum_length())
{
osd_printf_error("unzip: %s ZIP64 ECD appears to be too small\n", m_filename.c_str());
osd_printf_error("unzip: %s ZIP64 ECD appears to be too small\n", m_filename);
return archive_file::error::UNSUPPORTED;
}
if (ecd64_rd.version_needed() > 63)
@ -998,7 +998,7 @@ archive_file::error zip_file_impl::read_ecd()
m_filename.c_str(), unsigned(ecd64_rd.version_needed() / 10), unsigned(ecd64_rd.version_needed() % 10));
return archive_file::error::UNSUPPORTED;
}
osd_printf_verbose("unzip: found %s ZIP64 ECD\n", m_filename.c_str());
osd_printf_verbose("unzip: found %s ZIP64 ECD\n", m_filename);
// extract ZIP64 ECD info
m_ecd.disk_number = ecd64_rd.this_disk_no();
@ -1018,11 +1018,11 @@ archive_file::error zip_file_impl::read_ecd()
}
else
{
osd_printf_error("unzip: %s couldn't find ECD\n", m_filename.c_str());
osd_printf_error("unzip: %s couldn't find ECD\n", m_filename);
return archive_file::error::BAD_SIGNATURE;
}
}
osd_printf_error("unzip: %s couldn't find ECD in last 64KiB\n", m_filename.c_str());
osd_printf_error("unzip: %s couldn't find ECD in last 64KiB\n", m_filename);
return archive_file::error::OUT_OF_MEMORY;
}
@ -1038,7 +1038,7 @@ archive_file::error zip_file_impl::get_compressed_data_offset(std::uint64_t &off
general_flag_reader const flags(m_header.bit_flag);
if (m_header.start_disk_number != m_ecd.disk_number)
{
osd_printf_error("unzip: %s does not reside in segment %s\n", m_header.file_name.c_str(), m_filename.c_str());
osd_printf_error("unzip: %s does not reside in segment %s\n", m_header.file_name, m_filename);
return archive_file::error::UNSUPPORTED;
}
if (m_header.version_needed > 63)
@ -1050,12 +1050,12 @@ archive_file::error zip_file_impl::get_compressed_data_offset(std::uint64_t &off
}
if (flags.encrypted() || flags.strong_encryption())
{
osd_printf_error("unzip: %s in %s is encrypted\n", m_header.file_name.c_str(), m_filename.c_str());
osd_printf_error("unzip: %s in %s is encrypted\n", m_header.file_name, m_filename);
return archive_file::error::UNSUPPORTED;
}
if (flags.patch_data())
{
osd_printf_error("unzip: %s in %s is compressed patch data\n", m_header.file_name.c_str(), m_filename.c_str());
osd_printf_error("unzip: %s in %s is compressed patch data\n", m_header.file_name, m_filename);
return archive_file::error::UNSUPPORTED;
}
@ -1114,12 +1114,12 @@ archive_file::error zip_file_impl::decompress_data_type_0(std::uint64_t offset,
auto const filerr = m_file->read(buffer, offset, m_header.compressed_length, read_length);
if (filerr != osd_file::error::NONE)
{
osd_printf_error("unzip: error reading %s from %s (%d)\n", m_header.file_name.c_str(), m_filename.c_str(), int(filerr));
osd_printf_error("unzip: error reading %s from %s (%d)\n", m_header.file_name, m_filename, int(filerr));
return archive_file::error::FILE_ERROR;
}
else if (read_length != m_header.compressed_length)
{
osd_printf_error("unzip: unexpectedly reached end-of-file while reading %s from %s\n", m_header.file_name.c_str(), m_filename.c_str());
osd_printf_error("unzip: unexpectedly reached end-of-file while reading %s from %s\n", m_header.file_name, m_filename);
return archive_file::error::FILE_TRUNCATED;
}
else
@ -1205,7 +1205,7 @@ archive_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset,
}
else if (zerr != Z_OK)
{
osd_printf_error("unzip: error inflating %s from %s (%d)\n", m_header.file_name.c_str(), m_filename.c_str(), zerr);
osd_printf_error("unzip: error inflating %s from %s (%d)\n", m_header.file_name, m_filename, zerr);
inflateEnd(&stream);
return archive_file::error::DECOMPRESS_ERROR;
}
@ -1215,7 +1215,7 @@ archive_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset,
zerr = inflateEnd(&stream);
if (zerr != Z_OK)
{
osd_printf_error("unzip: error finishing inflation of %s from %s (%d)\n", m_header.file_name.c_str(), m_filename.c_str(), zerr);
osd_printf_error("unzip: error finishing inflation of %s from %s (%d)\n", m_header.file_name, m_filename, zerr);
return archive_file::error::DECOMPRESS_ERROR;
}
@ -1384,7 +1384,7 @@ archive_file::error zip_file_impl::decompress_data_type_14(std::uint64_t offset,
&lzstatus);
if (SZ_OK != lzerr)
{
osd_printf_error("unzip: error decoding LZMA data for %s in %s (%d)\n", m_header.file_name.c_str(), m_filename.c_str(), int(lzerr));
osd_printf_error("unzip: error decoding LZMA data for %s in %s (%d)\n", m_header.file_name, m_filename, int(lzerr));
LzmaDec_Free(&stream, &alloc_imp);
return archive_file::error::DECOMPRESS_ERROR;
}

View File

@ -1074,7 +1074,7 @@ u8 snes_sound_device::spc_io_r(offs_t offset)
case 0x5: /* Port 1 */
case 0x6: /* Port 2 */
case 0x7: /* Port 3 */
// osd_printf_debug("%s SPC: rd %02x @ %d\n", machine().describe_context().c_str(), m_port_in[offset - 4], offset - 4);
// osd_printf_debug("%s SPC: rd %02x @ %d\n", machine().describe_context(), m_port_in[offset - 4], offset - 4);
return m_port_in[offset - 4];
case 0x8: //normal RAM, can be read even if the ram disabled flag ($f0 bit 1) is active
case 0x9:
@ -1141,7 +1141,7 @@ void snes_sound_device::spc_io_w(offs_t offset, u8 data)
case 0x5: /* Port 1 */
case 0x6: /* Port 2 */
case 0x7: /* Port 3 */
// osd_printf_debug("%s SPC: %02x to APU @ %d\n", machine().describe_context().c_str(), data, offset & 3);
// osd_printf_debug("%s SPC: %02x to APU @ %d\n", machine().describe_context(), data, offset & 3);
m_port_out[offset - 4] = data;
// Unneeded, we already run at perfect_interleave
// machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));

View File

@ -496,7 +496,7 @@ void bfcobra_state::RunBlit(address_space &space)
/* This debug is now wrong ! */
if (DEBUG_BLITTER)
{
osd_printf_debug("\n%s:Blitter: Running command from 0x%.5x\n\n", device->machine().describe_context().c_str(), blitter.program.addr - 12);
osd_printf_debug("\n%s:Blitter: Running command from 0x%.5x\n\n", device->machine().describe_context(), blitter.program.addr - 12);
osd_printf_debug("Command Reg %.2x", blitter.command);
osd_printf_debug(" %s %s %s %s %s %s %s\n",
blitter.command & CMD_RUN ? "RUN" : " ",

View File

@ -200,7 +200,7 @@ uint8_t calchase_state::mtxc_config_r(int function, int reg)
void calchase_state::mtxc_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:MTXC: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:MTXC: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
/*
memory banking with North Bridge:
@ -294,7 +294,7 @@ uint8_t calchase_state::piix4_config_r(int function, int reg)
void calchase_state::piix4_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
m_piix4_config_reg[function][reg] = data;
}

View File

@ -332,7 +332,7 @@ void ldplayer_state::machine_reset()
timer_set(attotime::zero, TIMER_ID_AUTOPLAY);
// indicate the name of the file we opened
popmessage("Opened %s\n", m_filename.c_str());
popmessage("Opened %s\n", m_filename);
}

View File

@ -1158,7 +1158,7 @@ READ64_MEMBER(model3_state::real3d_dma_r)
}
break;
}
osd_printf_debug("real3d_dma_r: %08X, %08X%08X\n", offset, (uint32_t)(mem_mask >> 32), (uint32_t)(mem_mask));
osd_printf_debug("real3d_dma_r: %08X, %016X\n", offset, mem_mask);
return 0;
}

View File

@ -1878,7 +1878,7 @@ inline int atomiswave_state::decode_reg32_64(uint32_t offset, uint64_t mem_mask,
// non 32-bit accesses have not yet been seen here, we need to know when they are
if ((mem_mask != 0xffffffff00000000U) && (mem_mask != 0x00000000ffffffffU))
{
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context().c_str());
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context());
//machine().debug_break();
}
@ -1946,7 +1946,7 @@ WRITE64_MEMBER(atomiswave_state::aw_modem_w )
0x0060028C rw POUT CN304 (EX. IO board)
*/
osd_printf_verbose("%s",string_format("MODEM: [%08x=%x] write %x to %x, mask %x\n", 0x600000+reg*4, dat, data, offset, mem_mask).c_str());
osd_printf_verbose("MODEM: [%08x=%x] write %x to %x, mask %x\n", 0x600000+reg*4, dat, data, offset, mem_mask);
}
void atomiswave_state::aw_map(address_map &map)

View File

@ -176,7 +176,7 @@ uint8_t queen_state::piix4_config_r(int function, int reg)
void queen_state::piix4_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
m_piix4_config_reg[function][reg] = data;
}

View File

@ -156,7 +156,7 @@ uint8_t savquest_state::mtxc_config_r(int function, int reg)
void savquest_state::mtxc_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:MXTC: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:MXTC: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
#if 1
switch(reg)
@ -299,7 +299,7 @@ uint8_t savquest_state::piix4_config_r(int function, int reg)
void savquest_state::piix4_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
m_piix4_config_reg[function][reg] = data;
}

View File

@ -130,7 +130,7 @@ uint8_t taitowlf_state::mtxc_config_r(int function, int reg)
void taitowlf_state::mtxc_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:MTXC: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:MTXC: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
switch(reg)
{
@ -204,7 +204,7 @@ uint8_t taitowlf_state::piix4_config_r(int function, int reg)
void taitowlf_state::piix4_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
m_piix4_config_reg[function][reg] = data;
}

View File

@ -85,7 +85,7 @@ uint8_t voyager_state::mtxc_config_r(int function, int reg)
void voyager_state::mtxc_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:MTXC: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:MTXC: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
switch(reg)
{
@ -184,7 +184,7 @@ uint8_t voyager_state::piix4_config_r(int function, int reg)
void voyager_state::piix4_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
m_piix4_config_reg[function][reg] = data;
}

View File

@ -251,7 +251,7 @@ uint8_t xtom3d_state::piix4_config_r(int function, int reg)
void xtom3d_state::piix4_config_w(int function, int reg, uint8_t data)
{
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context().c_str(), function, reg, data);
// osd_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", machine().describe_context(), function, reg, data);
m_piix4_config_reg[function][reg] = data;
}

View File

@ -1316,7 +1316,7 @@ void bbc_state::insert_device_rom(memory_region *rom)
/* compare first 1K of bank with what we want to insert */
if (!memcmp(rom->base(), m_region_swr->base() + (bank * 0x4000), 0x400))
{
osd_printf_verbose("Found '%s' in romslot%d\n", get_rom_name(rom->base()).c_str(), bank);
osd_printf_verbose("Found '%s' in romslot%d\n", get_rom_name(rom->base()), bank);
return;
}
}
@ -1335,8 +1335,8 @@ void bbc_state::insert_device_rom(memory_region *rom)
if (swr[0x0006] == 0xff && swr[0x4006] == 0xff)
{
memcpy(m_region_swr->base() + (bank * 0x4000), rom->base(), rom->bytes());
osd_printf_verbose("Inserting '%s' into romslot%d\n", get_rom_name(rom->base() + 0x4000).c_str(), bank + 1);
osd_printf_verbose("Inserting '%s' into romslot%d\n", get_rom_name(rom->base()).c_str(), bank);
osd_printf_verbose("Inserting '%s' into romslot%d\n", get_rom_name(rom->base() + 0x4000), bank + 1);
osd_printf_verbose("Inserting '%s' into romslot%d\n", get_rom_name(rom->base()), bank);
return;
}
break;
@ -1346,7 +1346,7 @@ void bbc_state::insert_device_rom(memory_region *rom)
if (swr[0x0006] == 0xff)
{
memcpy(m_region_swr->base() + (bank * 0x4000), rom->base(), rom->bytes());
osd_printf_verbose("Inserting '%s' into romslot%d\n", get_rom_name(rom->base()).c_str(), bank);
osd_printf_verbose("Inserting '%s' into romslot%d\n", get_rom_name(rom->base()), bank);
return;
}
break;
@ -1478,7 +1478,7 @@ void bbc_state::setup_device_roms()
/* list all inserted ROMs */
for (int i = 15; i >= 0; i--)
{
osd_printf_info("ROM %X : %s\n", i, get_rom_name(m_region_swr->base() + (i * 0x4000)).c_str());
osd_printf_info("ROM %X : %s\n", i, get_rom_name(m_region_swr->base() + (i * 0x4000)));
}
}

View File

@ -246,7 +246,7 @@ int dc_state::decode_reg32_64(uint32_t offset, uint64_t mem_mask, uint64_t *shif
// non 32-bit accesses have not yet been seen here, we need to know when they are
if ((mem_mask != 0xffffffff00000000U) && (mem_mask != 0x00000000ffffffffU))
{
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context().c_str());
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context());
//machine().debug_break();
}
@ -270,7 +270,7 @@ int dc_state::decode_reg3216_64(uint32_t offset, uint64_t mem_mask, uint64_t *sh
if ((mem_mask != 0x0000ffff00000000U) && (mem_mask != 0x000000000000ffffU) &&
(mem_mask != 0xffffffff00000000U) && (mem_mask != 0x00000000ffffffffU))
{
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context().c_str());
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context());
//machine().debug_break();
}
@ -377,7 +377,7 @@ READ64_MEMBER(dc_state::dc_sysctrl_r )
#if DEBUG_SYSCTRL
if ((reg != 0x40) && (reg != 0x41) && (reg != 0x42) && (reg != 0x23) && (reg > 2)) // filter out IRQ status reads
{
osd_printf_verbose("%s",string_format("SYSCTRL: [%08x] read %x @ %x (reg %x: %s), mask %x (PC=%x)\n", 0x5f6800+reg*4, dc_sysctrl_regs[reg], offset, reg, sysctrl_names[reg], mem_mask, m_maincpu->pc()).c_str());
osd_printf_verbose("SYSCTRL: [%08x] read %x @ %x (reg %x: %s), mask %x (PC=%x)\n", 0x5f6800+reg*4, dc_sysctrl_regs[reg], offset, reg, sysctrl_names[reg], mem_mask, m_maincpu->pc());
}
#endif
@ -475,7 +475,7 @@ WRITE64_MEMBER(dc_state::dc_sysctrl_w )
#if DEBUG_SYSCTRL
if ((reg != 0x40) && (reg != 0x42) && (reg > 2)) // filter out IRQ acks and ch2 dma
{
osd_printf_verbose("%s",string_format("SYSCTRL: write %x to %x (reg %x), mask %x\n", data>>shift, offset, reg, /*sysctrl_names[reg],*/ mem_mask).c_str());
osd_printf_verbose("SYSCTRL: write %x to %x (reg %x), mask %x\n", data>>shift, offset, reg, /*sysctrl_names[reg],*/ mem_mask);
}
#endif
}
@ -516,7 +516,7 @@ WRITE64_MEMBER(dc_state::dc_gdrom_w )
off=offset << 1;
}
osd_printf_verbose("%s",string_format("GDROM: [%08x=%x]write %x to %x, mask %x\n", 0x5f7000+off*4, dat, data, offset, mem_mask).c_str());
osd_printf_verbose("GDROM: [%08x=%x]write %x to %x, mask %x\n", 0x5f7000+off*4, dat, data, offset, mem_mask);
}
READ64_MEMBER(dc_state::dc_g2_ctrl_r )
@ -635,7 +635,7 @@ WRITE64_MEMBER(dc_state::dc_modem_w )
reg = decode_reg32_64(offset, mem_mask, &shift);
dat = (uint32_t)(data >> shift);
osd_printf_verbose("%s",string_format("MODEM: [%08x=%x] write %x to %x, mask %x\n", 0x600000+reg*4, dat, data, offset, mem_mask).c_str());
osd_printf_verbose("MODEM: [%08x=%x] write %x to %x, mask %x\n", 0x600000+reg*4, dat, data, offset, mem_mask);
}
#define SAVE_G2DMA(x) \
@ -679,7 +679,7 @@ void dc_state::machine_reset()
READ32_MEMBER(dc_state::dc_aica_reg_r)
{
// osd_printf_verbose("%s",string_format("AICA REG: [%08x] read %x, mask %x\n", 0x700000+reg*4, (uint64_t)offset, mem_mask).c_str());
// osd_printf_verbose("AICA REG: [%08x] read %x, mask %x\n", 0x700000+reg*4, (uint64_t)offset, mem_mask);
if(offset == 0x2c00/4)
return m_armrst;
@ -710,7 +710,7 @@ WRITE32_MEMBER(dc_state::dc_aica_reg_w)
m_aica->write(offset*2, data, 0xffff);
// osd_printf_verbose("%s",string_format("AICA REG: [%08x=%x] write %x to %x, mask %x\n", 0x700000+reg*4, data, offset, mem_mask).c_str());
// osd_printf_verbose("AICA REG: [%08x=%x] write %x to %x, mask %x\n", 0x700000+reg*4, data, offset, mem_mask);
}
READ32_MEMBER(dc_state::dc_arm_aica_r)

View File

@ -145,7 +145,7 @@ READ32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_r )
WRITE32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_w )
{
g1bus_regs[offset] = data; // 5f7400+reg*4=dat
// osd_printf_verbose("%s",string_format("G1CTRL: [%08x=%x] write %x to %x, mask %x\n", 0x5f7400+reg*4, dat, data, offset, mem_mask).c_str());
// osd_printf_verbose("G1CTRL: [%08x=%x] write %x to %x, mask %x\n", 0x5f7400+reg*4, dat, data, offset, mem_mask);
switch (offset)
{
case SB_GDST:

View File

@ -344,7 +344,7 @@ READ32_MEMBER( iteagle_fpga_device::fpga_r )
default:
if (LOG_FPGA)
logerror("%s:fpga_r offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask);
osd_printf_debug("%s:fpga_r offset %04X = %08X & %08X\n", machine().describe_context().c_str(), offset*4, result, mem_mask);
osd_printf_debug("%s:fpga_r offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask);
break;
}
if (offset!=0x4/4)
@ -413,7 +413,7 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w )
m_serial0_1.write_data((data >> 16) & 0xff, 1);
if (m_serial0_1.get_tx_str(1).back() == 0xd) {
logerror("com0: %s", m_serial0_1.get_tx_str(1).c_str());
osd_printf_info("com0: %s\n", m_serial0_1.get_tx_str(1).c_str());
osd_printf_info("com0: %s\n", m_serial0_1.get_tx_str(1));
m_serial0_1.clear_tx_str(1);
}
}
@ -464,7 +464,7 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w )
m_serial2_3.write_data((data >> 24) & 0xff, chan);
if (m_serial2_3.get_tx_str(chan).back() == 0xd) {
if (LOG_SERIAL) logerror("com3: %s\n", m_serial2_3.get_tx_str(chan).c_str());
osd_printf_debug("com3: %s\n", m_serial2_3.get_tx_str(chan).c_str());
osd_printf_debug("com3: %s\n", m_serial2_3.get_tx_str(chan));
if (m_serial2_3.get_tx_str(chan).find("ATI5") != -1)
m_serial2_3.write_rx_str(chan, "OK\r181\r");
else if (m_serial2_3.get_tx_str(chan).find("ATS0?") != -1)
@ -488,7 +488,7 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w )
default:
if (LOG_FPGA)
logerror("%s:fpga_w offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, data, mem_mask);
osd_printf_debug("%s:fpga_w offset %04X = %08X & %08X\n", machine().describe_context().c_str(), offset*4, data, mem_mask);
osd_printf_debug("%s:fpga_w offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, data, mem_mask);
break;
}
}
@ -542,7 +542,7 @@ void iteagle_am85c30::write_data(uint8_t data, int channel)
// Limit length
if (m_serial_tx[channel].size() >= 4000) {
if (LOG_SERIAL) printf("%s\n", m_serial_tx[channel].c_str());
osd_printf_debug("%s\n", m_serial_tx[channel].c_str());
osd_printf_debug("%s\n", m_serial_tx[channel]);
m_serial_tx[channel].clear();
}
}
@ -854,7 +854,7 @@ READ32_MEMBER( iteagle_periph_device::ctrl_r )
case 0x0/4:
if (LOG_PERIPH)
logerror("%s:fpga ctrl_r from offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask);
osd_printf_debug("%s:fpga ctrl_r from offset %04X = %08X & %08X\n", machine().describe_context().c_str(), offset*4, result, mem_mask);
osd_printf_debug("%s:fpga ctrl_r from offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask);
break;
case 0x70/4:
if (ACCESSING_BITS_8_15) {
@ -890,7 +890,7 @@ READ32_MEMBER( iteagle_periph_device::ctrl_r )
default:
if (LOG_PERIPH)
logerror("%s:fpga ctrl_r from offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask);
osd_printf_debug("%s:fpga ctrl_r from offset %04X = %08X & %08X\n", machine().describe_context().c_str(), offset*4, result, mem_mask);
osd_printf_debug("%s:fpga ctrl_r from offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask);
break;
}
return result;

View File

@ -114,7 +114,7 @@ READ32_MEMBER( konppc_device::cgboard_dsp_comm_r_ppc )
{
if (cgboard_id < MAX_CG_BOARDS)
{
// osd_printf_debug("%s dsp_cmd_r: (board %d) %08X, %08X\n", machine().describe_context().c_str(), cgboard_id, offset, mem_mask);
// osd_printf_debug("%s dsp_cmd_r: (board %d) %08X, %08X\n", machine().describe_context(), cgboard_id, offset, mem_mask);
return dsp_comm_sharc[cgboard_id][offset] | (dsp_state[cgboard_id] << 16);
}
else
@ -125,7 +125,7 @@ READ32_MEMBER( konppc_device::cgboard_dsp_comm_r_ppc )
WRITE32_MEMBER( konppc_device::cgboard_dsp_comm_w_ppc )
{
// osd_printf_debug("%s dsp_cmd_w: (board %d) %08X, %08X, %08X\n", machine().describe_context().c_str(), cgboard_id, data, offset, mem_mask);
// osd_printf_debug("%s dsp_cmd_w: (board %d) %08X, %08X, %08X\n", machine().describe_context(), cgboard_id, data, offset, mem_mask);
if (cgboard_id < MAX_CG_BOARDS)
{

View File

@ -511,9 +511,9 @@ if (++reps % 100 == 99)
{
osd_printf_debug("---\nBlitter stats:\n");
for (i = 0; i < blitter_count; i++)
osd_printf_debug(" CMD=%08X A1=%08X A2=%08X %6d times, %08X%08X pixels\n",
osd_printf_debug(" CMD=%08X A1=%08X A2=%08X %6d times, %016X pixels\n",
blitter_stats[i][0], blitter_stats[i][1], blitter_stats[i][2],
blitter_stats[i][3], (uint32_t)(blitter_pixels[i] >> 32), (uint32_t)(blitter_pixels[i]));
blitter_stats[i][3], blitter_pixels[i]);
osd_printf_debug("---\n");
}
}

View File

@ -1308,7 +1308,7 @@ READ32_MEMBER( k001005_device::read )
}
default:
//osd_printf_debug("%s m_r: %08X, %08X\n", machine().describe_context().c_str(), offset, mem_mask);
//osd_printf_debug("%s m_r: %08X, %08X\n", machine().describe_context(), offset, mem_mask);
break;
}
return 0;
@ -1322,7 +1322,7 @@ WRITE32_MEMBER( k001005_device::write )
{
case 0x000: // FIFO write
{
//osd_printf_debug("%s K001005 FIFO write: %08X\n", machine().describe_context().c_str(), data);
//osd_printf_debug("%s K001005 FIFO write: %08X\n", machine().describe_context(), data);
if (m_status != 1 && m_status != 2)
{
if (m_fifo_write_ptr < 0x400)
@ -1339,7 +1339,7 @@ WRITE32_MEMBER( k001005_device::write )
dsp->set_flag_input(1, ASSERT_LINE);
}
// osd_printf_debug("%s K001005 FIFO write: %08X\n", machine().describe_context().c_str(), data);
// osd_printf_debug("%s K001005 FIFO write: %08X\n", machine().describe_context(), data);
m_fifo[m_fifo_write_ptr] = data;
m_fifo_write_ptr++;
m_fifo_write_ptr &= 0x7ff;
@ -1446,7 +1446,7 @@ WRITE32_MEMBER( k001005_device::write )
break;
default:
//osd_printf_debug("%s m_w: %08X, %08X, %08X\n", machine().describe_context().c_str(), data, offset, mem_mask);
//osd_printf_debug("%s m_w: %08X, %08X, %08X\n", machine().describe_context(), data, offset, mem_mask);
break;
}

View File

@ -2159,13 +2159,13 @@ WRITE64_MEMBER( powervr2_device::ta_fifo_poly_w )
tafifo_buff[tafifo_pos]=(uint32_t)data;
tafifo_buff[tafifo_pos+1]=(uint32_t)(data >> 32);
#if DEBUG_FIFO_POLY
osd_printf_debug("%s",string_format("ta_fifo_poly_w: Unmapped write64 %08x = %x -> %08x %08x\n", 0x10000000+offset*8, data, tafifo_buff[tafifo_pos], tafifo_buff[tafifo_pos+1]).c_str());
osd_printf_debug("ta_fifo_poly_w: Unmapped write64 %08x = %x -> %08x %08x\n", 0x10000000+offset*8, data, tafifo_buff[tafifo_pos], tafifo_buff[tafifo_pos+1]);
#endif
tafifo_pos += 2;
}
else
{
osd_printf_debug("%s",string_format("ta_fifo_poly_w: Unmapped write64 %08x = %x mask %x\n", 0x10000000+offset*8, data, mem_mask).c_str());
osd_printf_debug("ta_fifo_poly_w: Unmapped write64 %08x = %x mask %x\n", 0x10000000+offset*8, data, mem_mask);
}
tafifo_pos &= tafifo_mask;

View File

@ -544,7 +544,7 @@ void debug_gdbstub::wait_for_debugger(device_t &device, bool firststop)
uint64_t datamask = entry->datamask();
int index = entry->index();
const std::string &format_string = entry->format_string();
osd_printf_info("[%3d] datasize %d mask %016" PRIx64 " [%s] [%s]\n", index, datasize, datamask, symbol, format_string.c_str());
osd_printf_info("[%3d] datasize %d mask %016" PRIx64 " [%s] [%s]\n", index, datasize, datamask, symbol, format_string);
}
#endif
@ -583,7 +583,7 @@ void debug_gdbstub::wait_for_debugger(device_t &device, bool firststop)
#if 0
for ( const auto &reg: m_gdb_registers )
osd_printf_info(" %3d (%d) %d %d [%s]\n", reg.gdb_regnum, reg.state_index, reg.gdb_bitsize, reg.gdb_type, reg.gdb_name.c_str());
osd_printf_info(" %3d (%d) %d %d [%s]\n", reg.gdb_regnum, reg.state_index, reg.gdb_bitsize, reg.gdb_type, reg.gdb_name);
#endif
std::string socket_name = string_format("socket.localhost:%d", m_debugger_port);

View File

@ -624,7 +624,7 @@ private:
HR_RETHR(fonts->FindFamilyName(familyName.c_str(), &family_index, &exists));
if (!exists)
{
osd_printf_error("Font with family name %S does not exist.\n", familyName.c_str());
osd_printf_error("Font with family name %s does not exist.\n", osd::text::from_wstring(familyName));
return E_FAIL;
}

View File

@ -54,7 +54,7 @@ private:
bool osd_font_osx::open(std::string const &font_path, std::string const &name, int &height)
{
osd_printf_verbose("osd_font_osx::open: name=\"%s\"\n", name.c_str());
osd_printf_verbose("osd_font_osx::open: name=\"%s\"\n", name);
CFStringRef const font_name(CFStringCreateWithCString(nullptr, name.c_str(), kCFStringEncodingUTF8));
if (!font_name)
{
@ -73,7 +73,7 @@ bool osd_font_osx::open(std::string const &font_path, std::string const &name, i
CFRelease(font_name);
if (!font_descriptor)
{
osd_printf_verbose("osd_font_osx::open: failed to create CoreText font descriptor for \"%s\"\n", name.c_str());
osd_printf_verbose("osd_font_osx::open: failed to create CoreText font descriptor for \"%s\"\n", name);
return false;
}
@ -81,7 +81,7 @@ bool osd_font_osx::open(std::string const &font_path, std::string const &name, i
CFRelease(font_descriptor);
if (!ct_font)
{
osd_printf_verbose("osd_font_osx::open: failed to create CoreText font for \"%s\"\n", name.c_str());
osd_printf_verbose("osd_font_osx::open: failed to create CoreText font for \"%s\"\n", name);
return false;
}

View File

@ -88,7 +88,7 @@ bool osd_font_sdl::open(std::string const &font_path, std::string const &_name,
// if no success, try the font path
if (!font)
{
osd_printf_verbose("Searching font %s in -%s path/s\n", family.c_str(), font_path.c_str());
osd_printf_verbose("Searching font %s in -%s path/s\n", family, font_path);
//emu_file file(options().font_path(), OPEN_FLAG_READ);
emu_file file(font_path.c_str(), OPEN_FLAG_READ);
if (file.open(family.c_str()) == osd_file::error::NONE)
@ -96,7 +96,7 @@ bool osd_font_sdl::open(std::string const &font_path, std::string const &_name,
std::string full_name = file.fullpath();
font = TTF_OpenFont_Magic(full_name, POINT_SIZE, 0);
if (font)
osd_printf_verbose("Found font %s\n", full_name.c_str());
osd_printf_verbose("Found font %s\n", full_name);
}
}
@ -112,7 +112,7 @@ bool osd_font_sdl::open(std::string const &font_path, std::string const &_name,
{
if (!BDF_Check_Magic(name))
{
osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.c_str());
osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name);
}
return false;
}

View File

@ -195,7 +195,7 @@ static inline void devmap_init(running_machine &machine, device_map_t *devmap, c
{
// remove the spaces from the name store it in the index
devmap->map[dev].name = remove_spaces(dev_name);
osd_printf_verbose("%s: Logical id %d: %s\n", label, dev + 1, devmap->map[dev].name.c_str());
osd_printf_verbose("%s: Logical id %d: %s\n", label, dev + 1, devmap->map[dev].name);
devmap->initialized = 1;
}
}

View File

@ -469,7 +469,7 @@ public:
// Register and add the device
devinfo = create_lightgun_device(machine, index);
osd_printf_verbose("%i: %s\n", index, name.c_str());
osd_printf_verbose("%i: %s\n", index, name);
// Find the device info associated with the name
info = find_device_info(m_display, name.c_str(), 0);
@ -477,7 +477,7 @@ public:
// If we couldn't find the device, skip
if (info == nullptr)
{
osd_printf_verbose("Can't find device %s!\n", name.c_str());
osd_printf_verbose("Can't find device %s!\n", name);
continue;
}

View File

@ -13,6 +13,9 @@
#include "osdepend.h"
#include "modules/lib/osdobj_common.h"
#include <iostream>
const options_entry osd_options::s_option_entries[] =
{
{ nullptr, nullptr, OPTION_HEADER, "OSD KEYBOARD MAPPING OPTIONS" },
@ -381,28 +384,28 @@ void osd_common_t::update_option(const std::string &key, std::vector<const char
//-------------------------------------------------
// output_callback - callback for osd_printf_...
//-------------------------------------------------
void osd_common_t::output_callback(osd_output_channel channel, const char *msg, va_list args)
void osd_common_t::output_callback(osd_output_channel channel, const util::format_argument_pack<std::ostream> &args)
{
switch (channel)
{
case OSD_OUTPUT_CHANNEL_ERROR:
case OSD_OUTPUT_CHANNEL_WARNING:
vfprintf(stderr, msg, args);
break;
case OSD_OUTPUT_CHANNEL_INFO:
case OSD_OUTPUT_CHANNEL_LOG:
vfprintf(stdout, msg, args);
break;
case OSD_OUTPUT_CHANNEL_VERBOSE:
if (verbose()) vfprintf(stdout, msg, args);
break;
case OSD_OUTPUT_CHANNEL_DEBUG:
case OSD_OUTPUT_CHANNEL_ERROR:
case OSD_OUTPUT_CHANNEL_WARNING:
util::stream_format(std::cerr, args);
break;
case OSD_OUTPUT_CHANNEL_INFO:
case OSD_OUTPUT_CHANNEL_LOG:
util::stream_format(std::cout, args);
break;
case OSD_OUTPUT_CHANNEL_VERBOSE:
if (verbose()) util::stream_format(std::cout, args);
break;
case OSD_OUTPUT_CHANNEL_DEBUG:
#ifdef MAME_DEBUG
vfprintf(stdout, msg, args);
util::stream_format(std::cout, args);
#endif
break;
default:
break;
break;
default:
break;
}
}

View File

@ -245,7 +245,7 @@ public:
virtual osd_options &options() { return m_options; }
// osd_output interface ...
virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override;
virtual void output_callback(osd_output_channel channel, const util::format_argument_pack<std::ostream> &args) override;
bool verbose() const { return m_print_verbose; }
virtual void set_verbose(bool print_verbose) override { m_print_verbose = print_verbose; }
@ -279,7 +279,7 @@ private:
opt_val = "";
else if (!m_mod_man.type_has_name(opt_name.c_str(), opt_val.c_str()))
{
osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val.c_str(), opt_name.c_str());
osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val, opt_name);
opt_val = "";
}
return m_mod_man.select_module(opt_name.c_str(), opt_val.c_str());

View File

@ -166,7 +166,7 @@ protected:
{
for (auto monitor : list())
{
osd_printf_verbose("Video: Monitor %I64u = \"%s\" %s\n", monitor->oshandle(), monitor->devicename().c_str(), monitor->is_primary() ? "(primary)" : "");
osd_printf_verbose("Video: Monitor %I64u = \"%s\" %s\n", monitor->oshandle(), monitor->devicename(), monitor->is_primary() ? "(primary)" : "");
}
}

View File

@ -115,7 +115,7 @@ protected:
// allocate a new monitor info
std::shared_ptr<osd_monitor_info> monitor = std::make_shared<mac_monitor_info>(*this, displayList[disp], temp, 1.0f);
osd_printf_verbose("Adding monitor %s (%d x %d)\n", monitor->devicename().c_str(),
osd_printf_verbose("Adding monitor %s (%d x %d)\n", monitor->devicename(),
monitor->position_size().width(), monitor->position_size().height());
// guess the aspect ratio assuming square pixels

View File

@ -118,8 +118,9 @@ protected:
// allocate a new monitor info
std::shared_ptr<osd_monitor_info> monitor = std::make_shared<sdl_monitor_info>(*this, i, temp, 1.0f);
osd_printf_verbose("Adding monitor %s (%d x %d)\n", monitor->devicename().c_str(),
monitor->position_size().width(), monitor->position_size().height());
osd_printf_verbose("Adding monitor %s (%d x %d)\n",
monitor->devicename(),
monitor->position_size().width(), monitor->position_size().height());
// guess the aspect ratio assuming square pixels
monitor->set_aspect(static_cast<float>(monitor->position_size().width()) / static_cast<float>(monitor->position_size().height()));

View File

@ -96,7 +96,7 @@ protected:
{
for (auto monitor : list())
{
osd_printf_verbose("Video: Monitor %I64u = \"%s\" %s\n", monitor->oshandle(), monitor->devicename().c_str(), monitor->is_primary() ? "(primary)" : "");
osd_printf_verbose("Video: Monitor %I64u = \"%s\" %s\n", monitor->oshandle(), monitor->devicename(), monitor->is_primary() ? "(primary)" : "");
}
}

View File

@ -21,7 +21,7 @@ bgfx_effect::bgfx_effect(uint64_t state, bgfx::ShaderHandle vertex_shader, bgfx:
{
if (m_uniforms[uniforms[i]->name()] != nullptr)
{
osd_printf_verbose("Uniform %s appears to be duplicated in one or more effects, please double-check the effect JSON files.\n", uniforms[i]->name().c_str());
osd_printf_verbose("Uniform %s appears to be duplicated in one or more effects, please double-check the effect JSON files.\n", uniforms[i]->name());
delete uniforms[i];
continue;
}

View File

@ -81,7 +81,7 @@ bgfx_target* target_manager::target(uint32_t screen, std::string name)
bgfx_target* target = m_targets[full_name];
if (target == nullptr)
{
osd_printf_verbose("Warning: Attempting to retrieve a nonexistent target '%s' for screen %d\n", name.c_str(), screen);
osd_printf_verbose("Warning: Attempting to retrieve a nonexistent target '%s' for screen %d\n", name, screen);
}
return target;
}

View File

@ -1227,7 +1227,7 @@ int renderer_d3d9::config_adapter_mode()
// make sure it's a pixel format we can get behind
if (m_pixformat != D3DFMT_X1R5G5B5 && m_pixformat != D3DFMT_R5G6B5 && m_pixformat != D3DFMT_X8R8G8B8)
{
osd_printf_error("Device %s currently in an unsupported mode\n", win->monitor()->devicename().c_str());
osd_printf_error("Device %s currently in an unsupported mode\n", win->monitor()->devicename());
return 1;
}
}
@ -1250,7 +1250,7 @@ int renderer_d3d9::config_adapter_mode()
result = d3dintf->d3dobj->CheckDeviceType(m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !win->fullscreen());
if (FAILED(result))
{
osd_printf_error("Proposed video mode not supported on device %s\n", win->monitor()->devicename().c_str());
osd_printf_error("Proposed video mode not supported on device %s\n", win->monitor()->devicename());
return 1;
}

View File

@ -59,122 +59,80 @@ void osd_output::pop(osd_output *delegate)
***************************************************************************/
/*-------------------------------------------------
osd_printf_error - output an error to the
osd_vprintf_error - output an error to the
appropriate callback
-------------------------------------------------*/
void CLIB_DECL osd_printf_error(const char *format, ...)
void osd_vprintf_error(util::format_argument_pack<std::ostream> const &args)
{
va_list argptr;
/* do the output */
va_start(argptr, format);
#if defined(SDLMAME_ANDROID)
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, format, argptr);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "%s", util::string_format(args).c_str());
#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_ERROR, format, argptr);
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_ERROR, args);
#endif
va_end(argptr);
}
/*-------------------------------------------------
osd_printf_warning - output a warning to the
osd_vprintf_warning - output a warning to the
appropriate callback
-------------------------------------------------*/
void CLIB_DECL osd_printf_warning(const char *format, ...)
void osd_vprintf_warning(util::format_argument_pack<std::ostream> const &args)
{
va_list argptr;
/* do the output */
va_start(argptr, format);
#if defined(SDLMAME_ANDROID)
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, format, argptr);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "%s", util::string_format(args).c_str());
#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_WARNING, format, argptr);
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_WARNING, args);
#endif
va_end(argptr);
}
/*-------------------------------------------------
osd_printf_info - output info text to the
osd_vprintf_info - output info text to the
appropriate callback
-------------------------------------------------*/
void CLIB_DECL osd_printf_info(const char *format, ...)
void osd_vprintf_info(util::format_argument_pack<std::ostream> const &args)
{
va_list argptr;
/* do the output */
va_start(argptr, format);
#if defined(SDLMAME_ANDROID)
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, format, argptr);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "%s", util::string_format(args).c_str());
#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_INFO, format, argptr);
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_INFO, args);
#endif
va_end(argptr);
}
/*-------------------------------------------------
osd_printf_verbose - output verbose text to
osd_vprintf_verbose - output verbose text to
the appropriate callback
-------------------------------------------------*/
void CLIB_DECL osd_printf_verbose(const char *format, ...)
void osd_vprintf_verbose(util::format_argument_pack<std::ostream> const &args)
{
va_list argptr;
/* do the output */
va_start(argptr, format);
#if defined(SDLMAME_ANDROID)
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, format, argptr);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, "%s", util::string_format(args).c_str());
#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_VERBOSE, format, argptr);
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_VERBOSE, args);
#endif
va_end(argptr);
}
/*-------------------------------------------------
osd_printf_debug - output debug text to the
osd_vprintf_debug - output debug text to the
appropriate callback
-------------------------------------------------*/
void CLIB_DECL osd_printf_debug(const char *format, ...)
void osd_vprintf_debug(util::format_argument_pack<std::ostream> const &args)
{
va_list argptr;
/* do the output */
va_start(argptr, format);
#if defined(SDLMAME_ANDROID)
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, format, argptr);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "%s", util::string_format(args).c_str());
#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_DEBUG, format, argptr);
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_DEBUG, args);
#endif
va_end(argptr);
}
/*-------------------------------------------------
osd_printf_log - output log text to the
appropriate callback
-------------------------------------------------*/
#ifdef UNUSED_FUNCTION
void CLIB_DECL osd_printf_log(const char *format, ...)
{
va_list argptr;
/* do the output */
va_start(argptr, format);
output_cb[OSD_OUTPUT_CHANNEL_LOG])(format, argptr);
va_end(argptr);
}
#endif
//============================================================
// osd_ticks
//============================================================

View File

@ -13,19 +13,23 @@
broken out into several categories.
***************************************************************************/
#pragma once
#ifndef MAME_OSD_OSDCORE_H
#define MAME_OSD_OSDCORE_H
#pragma once
#include "osdcomm.h"
#include "strformat.h"
#include <chrono>
#include <cstdarg>
#include <cstdint>
#include <iosfwd>
#include <memory>
#include <string>
#include <utility>
#include <vector>
@ -1013,30 +1017,55 @@ public:
class osd_output
{
public:
osd_output() : m_chain(nullptr) { }
osd_output() { }
virtual ~osd_output() { }
virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) = 0;
virtual void output_callback(osd_output_channel channel, util::format_argument_pack<std::ostream> const &args) = 0;
static void push(osd_output *delegate);
static void pop(osd_output *delegate);
protected:
void chain_output(osd_output_channel channel, const char *msg, va_list args) const
void chain_output(osd_output_channel channel, util::format_argument_pack<std::ostream> const &args) const
{
if (m_chain != nullptr)
m_chain->output_callback(channel, msg, args);
if (m_chain)
m_chain->output_callback(channel, args);
}
private:
osd_output *m_chain;
osd_output *m_chain = nullptr;
};
/* calls to be used by the code */
void CLIB_DECL osd_printf_error(const char *format, ...) ATTR_PRINTF(1,2);
void CLIB_DECL osd_printf_warning(const char *format, ...) ATTR_PRINTF(1,2);
void CLIB_DECL osd_printf_info(const char *format, ...) ATTR_PRINTF(1,2);
void CLIB_DECL osd_printf_verbose(const char *format, ...) ATTR_PRINTF(1,2);
void CLIB_DECL osd_printf_debug(const char *format, ...) ATTR_PRINTF(1,2);
// diagnostic output
void osd_vprintf_error(util::format_argument_pack<std::ostream> const &args);
void osd_vprintf_warning(util::format_argument_pack<std::ostream> const &args);
void osd_vprintf_info(util::format_argument_pack<std::ostream> const &args);
void osd_vprintf_verbose(util::format_argument_pack<std::ostream> const &args);
void osd_vprintf_debug(util::format_argument_pack<std::ostream> const &args);
template <typename Format, typename... Params> void osd_printf_error(Format &&fmt, Params &&...args)
{
return osd_vprintf_error(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
}
template <typename Format, typename... Params> void osd_printf_warning(Format &&fmt, Params &&...args)
{
return osd_vprintf_warning(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
}
template <typename Format, typename... Params> void osd_printf_info(Format &&fmt, Params &&...args)
{
return osd_vprintf_info(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
}
template <typename Format, typename... Params> void osd_printf_verbose(Format &&fmt, Params &&...args)
{
return osd_vprintf_verbose(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
}
template <typename Format, typename... Params> void osd_printf_debug(Format &&fmt, Params &&...args)
{
return osd_vprintf_debug(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
}
// returns command line arguments as an std::vector<std::string> in UTF-8
std::vector<std::string> osd_get_command_line(int argc, char *argv[]);

View File

@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert, R. Belmont
#ifndef _osdsdl_h_
#define _osdsdl_h_
#ifndef MAME_OSD_SDL_OSDSDL_H
#define MAME_OSD_SDL_OSDSDL_H
#pragma once
#include "modules/lib/osdobj_common.h"
#include "modules/osdmodule.h"
@ -161,4 +163,4 @@ private:
extern int osd_num_processors;
#endif
#endif // MAME_OSD_SDL_OSDSDL_H

View File

@ -140,7 +140,10 @@ bool sdl_osd_interface::window_init()
osd_printf_verbose("\nHints:\n");
for (int i = 0; hints[i] != nullptr; i++)
osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i]));
{
char const *const hint(SDL_GetHint(hints[i]));
osd_printf_verbose("\t%-40s %s\n", hints[i], hint ? hint : "(NULL)");
}
// set up the window list
osd_printf_verbose("Leave sdlwindow_init\n");

View File

@ -66,21 +66,20 @@ using namespace Windows::UI::Popups;
class winui_output_error : public osd_output
{
public:
virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override
virtual void output_callback(osd_output_channel channel, const util::format_argument_pack<std::ostream> &args) override
{
if (channel == OSD_OUTPUT_CHANNEL_ERROR)
{
char buffer[1024];
// if we are in fullscreen mode, go to windowed mode
if ((video_config.windowed == 0) && !osd_common_t::s_window_list.empty())
winwindow_toggle_full_screen();
vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args);
win_message_box_utf8(!osd_common_t::s_window_list.empty() ? std::static_pointer_cast<win_window_info>(osd_common_t::s_window_list.front())->platform_window() : nullptr, buffer, emulator_info::get_appname(), MB_OK);
std::ostringstream buffer;
util::stream_format(buffer, args);
win_message_box_utf8(!osd_common_t::s_window_list.empty() ? std::static_pointer_cast<win_window_info>(osd_common_t::s_window_list.front())->platform_window() : nullptr, buffer.str().c_str(), emulator_info::get_appname(), MB_OK);
}
else
chain_output(channel, msg, args);
chain_output(channel, args);
}
};