From 3d80d454ce6ec80456f071decab98be50e7f6dae Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 12 Nov 2016 16:19:10 +0100 Subject: [PATCH] HLE_OS: Implement %n in GetStringVA %n writes to a pointer that's provided as a parameter. We didn't have a custom implementation of this before, meaning that %n would trigger a write to the host memory instead of the emulated memory! --- Source/Core/Core/HLE/HLE_OS.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/Core/HLE/HLE_OS.cpp b/Source/Core/Core/HLE/HLE_OS.cpp index d181971e9d..300cb57cc6 100644 --- a/Source/Core/Core/HLE/HLE_OS.cpp +++ b/Source/Core/Core/HLE/HLE_OS.cpp @@ -137,6 +137,11 @@ std::string GetStringVA(u32 strReg) result += StringFromFormat("%x", (u32)Parameter); break; + case 'n': + PowerPC::HostWrite_U32(static_cast(result.size()), static_cast(Parameter)); + // %n doesn't output anything, so the result variable is untouched + break; + default: result += StringFromFormat(ArgumentBuffer.c_str(), Parameter); break;