HostInterface: Add debugger message callbacks

This commit is contained in:
Connor McLaughlin 2020-12-17 01:17:26 +10:00
parent fa0f177e51
commit a8af0f7ecb
4 changed files with 27 additions and 1 deletions

View file

@ -166,7 +166,12 @@ void HostInterface::ReportError(const char* message)
void HostInterface::ReportMessage(const char* message)
{
Log_InfoPrintf(message);
Log_InfoPrint(message);
}
void HostInterface::ReportDebuggerMessage(const char* message)
{
Log_InfoPrintf("(Debugger) %s", message);
}
bool HostInterface::ConfirmMessage(const char* message)
@ -195,6 +200,16 @@ void HostInterface::ReportFormattedMessage(const char* format, ...)
ReportMessage(message.c_str());
}
void HostInterface::ReportFormattedDebuggerMessage(const char* format, ...)
{
std::va_list ap;
va_start(ap, format);
std::string message = StringUtil::StdStringFromFormatV(format, ap);
va_end(ap);
ReportDebuggerMessage(message.c_str());
}
bool HostInterface::ConfirmFormattedMessage(const char* format, ...)
{
std::va_list ap;

View file

@ -62,10 +62,12 @@ public:
virtual void ReportError(const char* message);
virtual void ReportMessage(const char* message);
virtual void ReportDebuggerMessage(const char* message);
virtual bool ConfirmMessage(const char* message);
void ReportFormattedError(const char* format, ...);
void ReportFormattedMessage(const char* format, ...);
void ReportFormattedDebuggerMessage(const char* format, ...);
bool ConfirmFormattedMessage(const char* format, ...);
/// Adds OSD messages, duration is in seconds.

View file

@ -161,6 +161,13 @@ void QtHostInterface::ReportMessage(const char* message)
emit messageReported(QString::fromUtf8(message));
}
void QtHostInterface::ReportDebuggerMessage(const char* message)
{
HostInterface::ReportDebuggerMessage(message);
emit debuggerMessageReported(QString::fromUtf8(message));
}
bool QtHostInterface::ConfirmMessage(const char* message)
{
const bool was_fullscreen = m_is_fullscreen;

View file

@ -51,6 +51,7 @@ public:
public Q_SLOTS:
void ReportError(const char* message) override;
void ReportMessage(const char* message) override;
void ReportDebuggerMessage(const char* message) override;
bool ConfirmMessage(const char* message) override;
public:
@ -120,6 +121,7 @@ public:
Q_SIGNALS:
void errorReported(const QString& message);
void messageReported(const QString& message);
void debuggerMessageReported(const QString& message);
bool messageConfirmed(const QString& message);
void emulationStarting();
void emulationStarted();