diff options
Diffstat (limited to 'src/emu/emucore.cpp')
-rw-r--r-- | src/emu/emucore.cpp | 79 |
1 files changed, 8 insertions, 71 deletions
diff --git a/src/emu/emucore.cpp b/src/emu/emucore.cpp index 35256b4f364..d9a314cfaa2 100644 --- a/src/emu/emucore.cpp +++ b/src/emu/emucore.cpp @@ -2,72 +2,27 @@ // copyright-holders:Nicola Salmoria, Aaron Giles /*************************************************************************** - emucore.c + emucore.cpp Simple core functions that are defined in emucore.h and which may need to be accessed by other MAME-related tools. + ****************************************************************************/ #include "emu.h" #include "emucore.h" #include "osdcore.h" -const char *const endianness_names[2] = { "little", "big" }; - -emu_fatalerror::emu_fatalerror(const char *format, ...) : code(0) -{ - if (format == nullptr) - { - text[0] = '\0'; - } - else - { - va_list ap; - va_start(ap, format); - vsnprintf(text, sizeof(text), format, ap); - va_end(ap); - } - osd_break_into_debugger(text); -} - -emu_fatalerror::emu_fatalerror(const char *format, va_list ap) : code(0) -{ - if (format == nullptr) - { - text[0] = '\0'; - } - else - { - vsnprintf(text, sizeof(text), format, ap); - } - osd_break_into_debugger(text); -} - -emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, ...) : code(_exitcode) +emu_fatalerror::emu_fatalerror(util::format_argument_pack<char> const &args) + : emu_fatalerror(0, args) { - if (format == nullptr) - { - text[0] = '\0'; - } - else - { - va_list ap; - va_start(ap, format); - vsnprintf(text, sizeof(text), format, ap); - va_end(ap); - } + osd_break_into_debugger(m_text.c_str()); } -emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, va_list ap) : code(_exitcode) +emu_fatalerror::emu_fatalerror(int _exitcode, util::format_argument_pack<char> const &args) + : m_text(util::string_format(args)) + , m_code(_exitcode) { - if (format == nullptr) - { - text[0] = '\0'; - } - else - { - vsnprintf(text, sizeof(text), format, ap); - } } @@ -82,21 +37,3 @@ void report_bad_device_cast(const device_t *dev, const std::type_info &src_type, throw emu_fatalerror("Error: bad downcast<> or device<>. Tried to convert the device %s (%s) of type %s to a %s, which are incompatible.\n", dev->tag(), dev->name(), src_type.name(), dst_type.name()); } - -void fatalerror(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - emu_fatalerror error(format, ap); - va_end(ap); - throw error; -} - -void fatalerror_exitcode(running_machine &machine, int exitcode, const char *format, ...) -{ - va_list ap; - va_start(ap, format); - emu_fatalerror error(exitcode, format, ap); - va_end(ap); - throw error; -} |