mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-09 18:45:40 +00:00
Merge pull request #8257 from CookiePLMonster/assert-fixes
Fixes to assertions
This commit is contained in:
commit
73a9b4148b
@ -15,7 +15,7 @@
|
|||||||
{ \
|
{ \
|
||||||
if (!(_a_)) \
|
if (!(_a_)) \
|
||||||
{ \
|
{ \
|
||||||
if (!PanicYesNo(_fmt_ "\n\nIgnore and continue?", __VA_ARGS__)) \
|
if (!PanicYesNo(_fmt_, __VA_ARGS__)) \
|
||||||
Crash(); \
|
Crash(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -83,35 +83,27 @@ std::string GetStringT(const char* string)
|
|||||||
bool MsgAlert(bool yes_no, MsgType style, const char* format, ...)
|
bool MsgAlert(bool yes_no, MsgType style, const char* format, ...)
|
||||||
{
|
{
|
||||||
// Read message and write it to the log
|
// Read message and write it to the log
|
||||||
std::string caption;
|
const char* caption = "";
|
||||||
char buffer[2048];
|
char buffer[2048];
|
||||||
|
|
||||||
static std::string info_caption;
|
static const std::string info_caption = s_str_translator(_trans("Information"));
|
||||||
static std::string warn_caption;
|
static const std::string warn_caption = s_str_translator(_trans("Question"));
|
||||||
static std::string ques_caption;
|
static const std::string ques_caption = s_str_translator(_trans("Warning"));
|
||||||
static std::string crit_caption;
|
static const std::string crit_caption = s_str_translator(_trans("Critical"));
|
||||||
|
|
||||||
if (info_caption.empty())
|
|
||||||
{
|
|
||||||
info_caption = s_str_translator(_trans("Information"));
|
|
||||||
ques_caption = s_str_translator(_trans("Question"));
|
|
||||||
warn_caption = s_str_translator(_trans("Warning"));
|
|
||||||
crit_caption = s_str_translator(_trans("Critical"));
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (style)
|
switch (style)
|
||||||
{
|
{
|
||||||
case MsgType::Information:
|
case MsgType::Information:
|
||||||
caption = info_caption;
|
caption = info_caption.c_str();
|
||||||
break;
|
break;
|
||||||
case MsgType::Question:
|
case MsgType::Question:
|
||||||
caption = ques_caption;
|
caption = ques_caption.c_str();
|
||||||
break;
|
break;
|
||||||
case MsgType::Warning:
|
case MsgType::Warning:
|
||||||
caption = warn_caption;
|
caption = warn_caption.c_str();
|
||||||
break;
|
break;
|
||||||
case MsgType::Critical:
|
case MsgType::Critical:
|
||||||
caption = crit_caption;
|
caption = crit_caption.c_str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,13 +112,13 @@ bool MsgAlert(bool yes_no, MsgType style, const char* format, ...)
|
|||||||
CharArrayFromFormatV(buffer, sizeof(buffer) - 1, s_str_translator(format).c_str(), args);
|
CharArrayFromFormatV(buffer, sizeof(buffer) - 1, s_str_translator(format).c_str(), args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer);
|
ERROR_LOG(MASTER_LOG, "%s: %s", caption, buffer);
|
||||||
|
|
||||||
// Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored
|
// Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored
|
||||||
if (s_msg_handler != nullptr &&
|
if (s_msg_handler != nullptr &&
|
||||||
(s_alert_enabled || style == MsgType::Question || style == MsgType::Critical))
|
(s_alert_enabled || style == MsgType::Question || style == MsgType::Critical))
|
||||||
{
|
{
|
||||||
return s_msg_handler(caption.c_str(), buffer, yes_no, style);
|
return s_msg_handler(caption, buffer, yes_no, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -68,7 +68,10 @@ static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (button == QMessageBox::Ignore)
|
if (button == QMessageBox::Ignore)
|
||||||
|
{
|
||||||
Common::SetEnableAlert(false);
|
Common::SetEnableAlert(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user