summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-10-29 21:53:57 -0400
committerGravatar Zach Hilman2018-11-15 12:47:36 -0500
commit8aa17f0480db67a514d3fc33e729f96f961ddee3 (patch)
treed3fff49d44c4b96638e5d56fba9630eb93fe9b60 /src/core
parentMerge pull request #1637 from FernandoS27/cache (diff)
downloadyuzu-8aa17f0480db67a514d3fc33e729f96f961ddee3.tar.gz
yuzu-8aa17f0480db67a514d3fc33e729f96f961ddee3.tar.xz
yuzu-8aa17f0480db67a514d3fc33e729f96f961ddee3.zip
pl_u: Resize buffers in shared font data getter to what game requests
Fixes unmapped spam in SMP and buffer size errors in some other games
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/ns/pl_u.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp
index 44accecb7..1066bf505 100644
--- a/src/core/hle/service/ns/pl_u.cpp
+++ b/src/core/hle/service/ns/pl_u.cpp
@@ -351,6 +351,14 @@ void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
351 font_sizes.push_back(region.size); 351 font_sizes.push_back(region.size);
352 } 352 }
353 353
354 // Resize buffers if game requests smaller size output.
355 font_codes.resize(
356 std::min<std::size_t>(font_codes.size(), ctx.GetWriteBufferSize(0) / sizeof(u32)));
357 font_offsets.resize(
358 std::min<std::size_t>(font_offsets.size(), ctx.GetWriteBufferSize(1) / sizeof(u32)));
359 font_sizes.resize(
360 std::min<std::size_t>(font_sizes.size(), ctx.GetWriteBufferSize(2) / sizeof(u32)));
361
354 ctx.WriteBuffer(font_codes, 0); 362 ctx.WriteBuffer(font_codes, 0);
355 ctx.WriteBuffer(font_offsets, 1); 363 ctx.WriteBuffer(font_offsets, 1);
356 ctx.WriteBuffer(font_sizes, 2); 364 ctx.WriteBuffer(font_sizes, 2);