From a77ed6f4a7eb3a4f8abe5b33f6a31384f30b3092 Mon Sep 17 00:00:00 2001 From: ztjohnst Date: Fri, 31 Jul 2020 22:42:05 -0400 Subject: [PATCH] [Base] Add ShowInfoMB / ShowErrorMB functions. [Base] Add ShowInfoMessageBox / ShowErrorMessageBox functions. --- src/xenia/base/logging.cc | 14 ++++++++++++++ src/xenia/base/logging.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/src/xenia/base/logging.cc b/src/xenia/base/logging.cc index 6464a2b8c..d928ec56a 100644 --- a/src/xenia/base/logging.cc +++ b/src/xenia/base/logging.cc @@ -363,4 +363,18 @@ void FatalError(const std::string_view str) { std::exit(1); } +void ShowInfoMessageBox(std::string m) { +#if XE_PLATFORM_WIN32 + MessageBoxW(NULL, (LPCWSTR)xe::to_utf16(m).c_str(), L"Xenia Help", + MB_OK | MB_ICONINFORMATION | MB_APPLMODAL | MB_SETFOREGROUND); +#endif // WIN32 +} + +void ShowErrorMessageBox(std::string m) { +#if XE_PLATFORM_WIN32 + MessageBoxW(NULL, (LPCWSTR)xe::path_to_utf16(m).c_str(), L"Xenia Error", + MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); +#endif // WIN32 +} + } // namespace xe diff --git a/src/xenia/base/logging.h b/src/xenia/base/logging.h index d2df15cce..e3144a056 100644 --- a/src/xenia/base/logging.h +++ b/src/xenia/base/logging.h @@ -95,6 +95,11 @@ void AppendLogLine(LogLevel log_level, const char prefix_char, // Logs a fatal error and aborts the program. void FatalError(const std::string_view str); +// Shows error box +void ShowErrorMessageBox(std::string m); + +// Show info box +void ShowInfoMessageBox(std::string m); } // namespace xe #if XE_OPTION_ENABLE_LOGGING