From 1d7f345960bc959411a2d530d7cd49f60448382d Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 29 Aug 2015 22:21:58 -0700 Subject: [PATCH] Fix logging with null varargs. --- src/xenia/base/logging.cc | 9 +++++++-- src/xenia/kernel/xam_user.cc | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/xenia/base/logging.cc b/src/xenia/base/logging.cc index d6cc807ba..d37ac4299 100644 --- a/src/xenia/base/logging.cc +++ b/src/xenia/base/logging.cc @@ -161,8 +161,13 @@ void LogLineFormat(const char level_char, const char* fmt, ...) { size_t chars_written = vsnprintf(log_format_buffer_.data(), log_format_buffer_.capacity(), fmt, args); va_end(args); - logger_->AppendLine(xe::threading::current_thread_id(), level_char, - log_format_buffer_.data(), chars_written); + if (chars_written != std::string::npos) { + logger_->AppendLine(xe::threading::current_thread_id(), level_char, + log_format_buffer_.data(), chars_written); + } else { + logger_->AppendLine(xe::threading::current_thread_id(), level_char, fmt, + std::strlen(fmt)); + } } void LogLineVarargs(const char level_char, const char* fmt, va_list args) { diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam_user.cc index e3d8fd537..96cb0f5a4 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam_user.cc @@ -45,6 +45,9 @@ SHIM_CALL XamUserGetSigninState_shim(PPCContext* ppc_context, XELOGD("XamUserGetSigninState(%d)", user_index); + // Yield, as some games spam this. + xe::threading::MaybeYield(); + // Lie and say we are signed in, but local-only. // This should keep games from asking us to sign in and also keep them // from initializing the network.