aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-12 04:51:41 -0400
committerLioncash <mathew1800@gmail.com>2018-09-12 04:51:44 -0400
commit4b9e65a70cde9b4bbf335930cff3ca5d24a425f9 (patch)
treebca820ac25a5405a9a1409b082fac6eca397a5b1 /src/core/hle/kernel/svc.cpp
parent00b69a95277b69d7f47b03417eb0fbffe262635f (diff)
svc: Do nothing if svcOutputDebugString() is given a length of zero
While unlikely, it does avoid constructing a std::string and unnecessarily calling into the memory code if a game or executable decides to be really silly about their logging.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 07a6c40144..0b2a7e3cb7 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -274,6 +274,10 @@ static void Break(u64 reason, u64 info1, u64 info2) {
/// Used to output a message on a debug hardware unit - does nothing on a retail unit
static void OutputDebugString(VAddr address, u64 len) {
+ if (len == 0) {
+ return;
+ }
+
std::string str(len, '\0');
Memory::ReadBlock(address, str.data(), str.size());
LOG_DEBUG(Debug_Emulated, "{}", str);