diff options
Diffstat (limited to 'src/emu/emucore.c')
-rw-r--r-- | src/emu/emucore.c | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/src/emu/emucore.c b/src/emu/emucore.c index 514401687c6..923ba0e1187 100644 --- a/src/emu/emucore.c +++ b/src/emu/emucore.c @@ -1,6 +1,6 @@ /*************************************************************************** - mamecore.c + emucore.c Simple core functions that are defined in emucore.h and which may need to be accessed by other MAME-related tools. @@ -11,6 +11,69 @@ ****************************************************************************/ #include "emu.h" +#include "emucore.h" +#include "osdcore.h" + +emu_fatalerror::emu_fatalerror(const char *format, ...) +: code(0) +{ + if (format == NULL) + { + text[0] = '\0'; + } + else + { + va_list ap; + va_start(ap, format); + vsprintf(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 == NULL) + { + text[0] = '\0'; + } + else + { + vsprintf(text, format, ap); + } + osd_break_into_debugger(text); +} + +emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, ...) +: code(_exitcode) +{ + if (format == NULL) + { + text[0] = '\0'; + } + else + { + va_list ap; + va_start(ap, format); + vsprintf(text, format, ap); + va_end(ap); + } +} + +emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, va_list ap) +: code(_exitcode) +{ + if (format == NULL) + { + text[0] = '\0'; + } + else + { + vsprintf(text, format, ap); + } +} + void report_bad_cast(const std::type_info &src_type, const std::type_info &dst_type) { @@ -23,3 +86,21 @@ 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; +} |