summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2021-11-12 18:38:18 +1100
committer Vas Crabb <vas@vastheman.com>2021-11-12 18:38:18 +1100
commit5c8e06be77c7d7ee72b8eaa3d2dc2bfee427ea1c (patch)
tree3dd17d2a193bdddc5c682a9e75d4c1b0153f0b4b
parentdc6ddf122cfbf98c1bf9d2ba705c6adfec98d847 (diff)
-osd/windows: Show error message box on a separate thread (see MT08118).
-emu/emuopts.cpp: Default to built-in UI language rather than English. * The external English message catalog is a placeholder anyway. -cpu/mcs48: Corrected comments - D87xxH have UVEPROM, not EEPROM.
-rw-r--r--src/devices/cpu/mcs48/mcs48.h54
-rw-r--r--src/emu/emuopts.cpp2
-rw-r--r--src/osd/windows/winmain.cpp67
3 files changed, 92 insertions, 31 deletions
diff --git a/src/devices/cpu/mcs48/mcs48.h b/src/devices/cpu/mcs48/mcs48.h
index df143df239c..bb5d3da44f9 100644
--- a/src/devices/cpu/mcs48/mcs48.h
+++ b/src/devices/cpu/mcs48/mcs48.h
@@ -70,33 +70,33 @@ enum
TYPES
***************************************************************************/
-/* Official Intel MCS-48 parts */
-DECLARE_DEVICE_TYPE(I8021, i8021_device) // 1k internal ROM, 64 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8022, i8022_device) // 2k internal ROM, 128 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8035, i8035_device) // external ROM, 64 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8048, i8048_device) // 1k internal ROM, 64 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8648, i8648_device) // 1k internal OTP ROM, 64 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8748, i8748_device) // 1k internal EEPROM, 64 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8039, i8039_device) // external ROM, 128 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8049, i8049_device) // 2k internal ROM, 128 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8749, i8749_device) // 2k internal EEPROM, 128 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8040, i8040_device) // external ROM, 256 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8050, i8050_device) // 4k internal ROM, 256 bytes internal RAM
-
-/* Official Intel UPI-41 parts */
-DECLARE_DEVICE_TYPE(I8041A, i8041a_device) // 1k internal ROM, 64 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8741A, i8741a_device) // 1k internal EEPROM, 64 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8041AH, i8041ah_device) // 1k internal ROM, 128 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8741AH, i8741ah_device) // 1k internal EEPROM, 128 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8042, i8042_device) // 2k internal ROM, 128 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8742, i8742_device) // 2k internal EEPROM, 128 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8042AH, i8042ah_device) // 2k internal ROM, 256 bytes internal RAM
-DECLARE_DEVICE_TYPE(I8742AH, i8742ah_device) // 2k internal EEPROM, 256 bytes internal RAM
-
-/* Clones */
-DECLARE_DEVICE_TYPE(MB8884, mb8884_device) // 8035 clone
-DECLARE_DEVICE_TYPE(N7751, n7751_device) // 8048 clone
-DECLARE_DEVICE_TYPE(M58715, m58715_device) // 8049 clone
+// Official Intel MCS-48 parts
+DECLARE_DEVICE_TYPE(I8021, i8021_device) // 1k internal ROM, 64 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8022, i8022_device) // 2k internal ROM, 128 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8035, i8035_device) // external ROM, 64 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8048, i8048_device) // 1k internal ROM, 64 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8648, i8648_device) // 1k internal OTP ROM, 64 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8748, i8748_device) // 1k internal UV EPROM, 64 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8039, i8039_device) // external ROM, 128 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8049, i8049_device) // 2k internal ROM, 128 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8749, i8749_device) // 2k internal UV EPROM, 128 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8040, i8040_device) // external ROM, 256 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8050, i8050_device) // 4k internal ROM, 256 bytes internal RAM
+
+// Official Intel UPI-41 parts
+DECLARE_DEVICE_TYPE(I8041A, i8041a_device) // 1k internal ROM, 64 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8741A, i8741a_device) // 1k internal UV EPROM, 64 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8041AH, i8041ah_device) // 1k internal ROM, 128 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8741AH, i8741ah_device) // 1k internal UV EPROM, 128 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8042, i8042_device) // 2k internal ROM, 128 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8742, i8742_device) // 2k internal UV EPROM, 128 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8042AH, i8042ah_device) // 2k internal ROM, 256 bytes internal RAM
+DECLARE_DEVICE_TYPE(I8742AH, i8742ah_device) // 2k internal UV EPROM, 256 bytes internal RAM
+
+// Clones
+DECLARE_DEVICE_TYPE(MB8884, mb8884_device) // 8035 clone
+DECLARE_DEVICE_TYPE(N7751, n7751_device) // 8048 clone
+DECLARE_DEVICE_TYPE(M58715, m58715_device) // 8049 clone
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
index bfe83daec16..8959c00da03 100644
--- a/src/emu/emuopts.cpp
+++ b/src/emu/emuopts.cpp
@@ -205,7 +205,7 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_RAMSIZE ";ram", nullptr, OPTION_STRING, "size of RAM (if supported by driver)" },
{ OPTION_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "ask for confirmation before exiting" },
{ OPTION_UI_MOUSE, "1", OPTION_BOOLEAN, "display UI mouse cursor" },
- { OPTION_LANGUAGE ";lang", "English", OPTION_STRING, "set UI display language" },
+ { OPTION_LANGUAGE ";lang", "", OPTION_STRING, "set UI display language" },
{ OPTION_NVRAM_SAVE ";nvwrite", "1", OPTION_BOOLEAN, "save NVRAM data on exit" },
{ nullptr, nullptr, OPTION_HEADER, "SCRIPTING OPTIONS" },
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp
index 09315e5ca84..b24d2980c19 100644
--- a/src/osd/windows/winmain.cpp
+++ b/src/osd/windows/winmain.cpp
@@ -25,6 +25,10 @@
#include <clocale>
#include <cstdarg>
#include <cstdio>
+#include <mutex>
+#include <optional>
+#include <sstream>
+#include <thread>
// standard windows headers
#include <windows.h>
@@ -55,6 +59,28 @@
class winui_output_error : public osd_output
{
+private:
+ struct ui_state
+ {
+ ~ui_state()
+ {
+ std::lock_guard guard(mutex);
+ if (thread)
+ thread->join();
+ }
+
+ std::ostringstream buffer;
+ std::optional<std::thread> thread;
+ std::mutex mutex;
+ bool active;
+ };
+
+ static ui_state &get_state()
+ {
+ static ui_state state;
+ return state;
+ }
+
public:
virtual void output_callback(osd_output_channel channel, const util::format_argument_pack<std::ostream> &args) override
{
@@ -64,12 +90,47 @@ public:
if ((video_config.windowed == 0) && !osd_common_t::s_window_list.empty())
winwindow_toggle_full_screen();
- 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);
+ auto &state(get_state());
+ std::lock_guard<std::mutex> guard(state.mutex);
+ util::stream_format(state.buffer, args);
+ if (!state.active)
+ {
+ if (state.thread)
+ {
+ state.thread->join();
+ state.thread = std::nullopt;
+ }
+ auto const parent = !osd_common_t::s_window_list.empty()
+ ? std::static_pointer_cast<win_window_info>(osd_common_t::s_window_list.front())->platform_window()
+ : nullptr;
+ state.thread.emplace(
+ [parent] ()
+ {
+ auto &state(get_state());
+ std::string message;
+ while (true)
+ {
+ {
+ std::lock_guard<std::mutex> guard(state.mutex);
+ message = std::move(state.buffer).str();
+ if (message.empty())
+ {
+ state.active = false;
+ return;
+ }
+ state.buffer.str(std::string());
+ }
+ // don't hold any locks lock while calling MessageBox
+ win_message_box_utf8(parent, message.c_str(), emulator_info::get_appname(), MB_OK);
+ }
+ });
+ state.active = true;
+ }
}
else
+ {
chain_output(channel, args);
+ }
}
};