diff options
-rw-r--r-- | scripts/src/emu.lua | 1 | ||||
-rw-r--r-- | src/emu/emu.h | 4 | ||||
-rw-r--r-- | src/emu/machine.cpp | 18 | ||||
-rw-r--r-- | src/emu/machine.h | 53 | ||||
-rw-r--r-- | src/emu/machine.ipp | 77 |
5 files changed, 71 insertions, 82 deletions
diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 6ca1594f4dc..71cd9c8064e 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -158,7 +158,6 @@ files { MAME_DIR .. "src/emu/mame.h", MAME_DIR .. "src/emu/machine.cpp", MAME_DIR .. "src/emu/machine.h", - MAME_DIR .. "src/emu/machine.ipp", MAME_DIR .. "src/emu/mconfig.cpp", MAME_DIR .. "src/emu/mconfig.h", MAME_DIR .. "src/emu/memarray.cpp", diff --git a/src/emu/emu.h b/src/emu/emu.h index 07474f871b3..1411ecda1db 100644 --- a/src/emu/emu.h +++ b/src/emu/emu.h @@ -106,9 +106,6 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_ #include "sound.h" #include "speaker.h" -// user interface -#include "ui/ui.h" - // generic helpers #include "devcb.h" #include "dispatch.h" @@ -118,6 +115,5 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_ // member templates that don't like incomplete types #include "device.ipp" -#include "machine.ipp" #endif /* __EMU_H__ */ diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 726979cadbc..2ffd4fc66c2 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -1202,6 +1202,24 @@ void running_machine::nvram_save() } } } + + +//************************************************************************** +// OUTPUT +//************************************************************************** + +void running_machine::popup_clear() const +{ + ui().popup_time(0, " "); +} + +void running_machine::popup_message(util::format_argument_pack<std::ostream> const &args) const +{ + std::string const temp(string_format(args)); + ui().popup_time(temp.length() / 40 + 2, temp); +} + + //************************************************************************** // CALLBACK ITEMS //************************************************************************** diff --git a/src/emu/machine.h b/src/emu/machine.h index f892e79c3c9..6f18ef60001 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -17,6 +17,7 @@ #ifndef __MACHINE_H__ #define __MACHINE_H__ +#include "strformat.h" #include "vecstream.h" #include <time.h> @@ -274,6 +275,8 @@ private: std::string nvram_filename(device_t &device) const; void nvram_load(); void nvram_save(); + void popup_clear() const; + void popup_message(util::format_argument_pack<std::ostream> const &args) const; // internal callbacks static void logfile_callback(const running_machine &machine, const char *buffer); @@ -382,4 +385,54 @@ private: mutable util::ovectorstream m_string_buffer; }; + + +//************************************************************************** +// MEMBER TEMPLATES +//************************************************************************** + +/*------------------------------------------------- + popmessage - pop up a user-visible message +-------------------------------------------------*/ + +template <typename Format, typename... Params> +inline void running_machine::popmessage(Format &&fmt, Params &&... args) const +{ + // if the format is NULL, it is a signal to clear the popmessage + // otherwise, generate the buffer and call the UI to display the message + if (is_null<Format>::value(fmt)) + popup_clear(); + else + popup_message(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...)); +} + + +/*------------------------------------------------- + logerror - log to the debugger and any other + OSD-defined output streams +-------------------------------------------------*/ + +template <typename Format, typename... Params> +inline void running_machine::logerror(Format &&fmt, Params &&... args) const +{ + // process only if there is a target + if (!m_logerror_list.empty()) + { + g_profiler.start(PROFILER_LOGERROR); + + // dump to the buffer + m_string_buffer.clear(); + m_string_buffer.seekp(0); + util::stream_format(m_string_buffer, std::forward<Format>(fmt), std::forward<Params>(args)...); + m_string_buffer.put('\0'); + + // log to all callbacks + char const *const str(&m_string_buffer.vec()[0]); + for (auto &cb : m_logerror_list) + (cb->m_func)(*this, str); + + g_profiler.stop(); + } +} + #endif /* __MACHINE_H__ */ diff --git a/src/emu/machine.ipp b/src/emu/machine.ipp deleted file mode 100644 index 44d029fd309..00000000000 --- a/src/emu/machine.ipp +++ /dev/null @@ -1,77 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - machine.ipp - - Controls execution of the core MAME system. - -***************************************************************************/ - -#pragma once - -#ifndef __EMU_H__ -#error Dont include this file directly; include emu.h instead. -#endif - -#ifndef __MACHINE_IPP__ -#define __MACHINE_IPP__ - -#include "strformat.h" - -//************************************************************************** -// MEMBER TEMPLATES -//************************************************************************** - -/*------------------------------------------------- - popmessage - pop up a user-visible message --------------------------------------------------*/ - -template <typename Format, typename... Params> -inline void running_machine::popmessage(Format &&fmt, Params &&... args) const -{ - if (is_null<Format>::value(fmt)) - { - // if the format is NULL, it is a signal to clear the popmessage - ui().popup_time(0, " "); - } - else - { - // otherwise, generate the buffer and call the UI to display the message - std::string const temp(string_format(std::forward<Format>(fmt), std::forward<Params>(args)...)); - - // pop it in the UI - ui().popup_time(temp.length() / 40 + 2, "%s", temp.c_str()); - } -} - - -/*------------------------------------------------- - logerror - log to the debugger and any other - OSD-defined output streams --------------------------------------------------*/ - -template <typename Format, typename... Params> -inline void running_machine::logerror(Format &&fmt, Params &&... args) const -{ - // process only if there is a target - if (!m_logerror_list.empty()) - { - g_profiler.start(PROFILER_LOGERROR); - - // dump to the buffer - m_string_buffer.clear(); - m_string_buffer.seekp(0); - util::stream_format(m_string_buffer, std::forward<Format>(fmt), std::forward<Params>(args)...); - m_string_buffer.put('\0'); - - // log to all callbacks - char const *const str(&m_string_buffer.vec()[0]); - for (auto &cb : m_logerror_list) - (cb->m_func)(*this, str); - - g_profiler.stop(); - } -} - -#endif // __MACHINE_IPP__ |