summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar german772023-09-21 21:08:41 -0600
committerGravatar german772023-09-23 20:13:36 -0600
commitd2cd08e3e13f51cc1997072622376a9961bcac0a (patch)
treef94c22ededd6ed81bfc79df129c6730454cfe4fc /src/core
parentyuzu: Add button to boot mii edit from firmware (diff)
downloadyuzu-d2cd08e3e13f51cc1997072622376a9961bcac0a.tar.gz
yuzu-d2cd08e3e13f51cc1997072622376a9961bcac0a.tar.xz
yuzu-d2cd08e3e13f51cc1997072622376a9961bcac0a.zip
service: ns: Implement GetSharedFontInOrderOfPriorityForSystem
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/ns/iplatform_service_manager.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/core/hle/service/ns/iplatform_service_manager.cpp b/src/core/hle/service/ns/iplatform_service_manager.cpp
index 6c2f5e70b..46268be95 100644
--- a/src/core/hle/service/ns/iplatform_service_manager.cpp
+++ b/src/core/hle/service/ns/iplatform_service_manager.cpp
@@ -144,7 +144,7 @@ IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const ch
144 {3, &IPlatformServiceManager::GetSharedMemoryAddressOffset, "GetSharedMemoryAddressOffset"}, 144 {3, &IPlatformServiceManager::GetSharedMemoryAddressOffset, "GetSharedMemoryAddressOffset"},
145 {4, &IPlatformServiceManager::GetSharedMemoryNativeHandle, "GetSharedMemoryNativeHandle"}, 145 {4, &IPlatformServiceManager::GetSharedMemoryNativeHandle, "GetSharedMemoryNativeHandle"},
146 {5, &IPlatformServiceManager::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"}, 146 {5, &IPlatformServiceManager::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"},
147 {6, nullptr, "GetSharedFontInOrderOfPriorityForSystem"}, 147 {6, &IPlatformServiceManager::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriorityForSystem"},
148 {100, nullptr, "RequestApplicationFunctionAuthorization"}, 148 {100, nullptr, "RequestApplicationFunctionAuthorization"},
149 {101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"}, 149 {101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"},
150 {102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"}, 150 {102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"},
@@ -262,8 +262,17 @@ void IPlatformServiceManager::GetSharedMemoryNativeHandle(HLERequestContext& ctx
262} 262}
263 263
264void IPlatformServiceManager::GetSharedFontInOrderOfPriority(HLERequestContext& ctx) { 264void IPlatformServiceManager::GetSharedFontInOrderOfPriority(HLERequestContext& ctx) {
265 // The maximum number of elements that can be returned is 6. Regardless of the available fonts
266 // or buffer size.
267 constexpr std::size_t MaxElementCount = 6;
265 IPC::RequestParser rp{ctx}; 268 IPC::RequestParser rp{ctx};
266 const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for 269 const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for
270 const std::size_t font_codes_count =
271 std::min(MaxElementCount, ctx.GetWriteBufferNumElements<u32>(0));
272 const std::size_t font_offsets_count =
273 std::min(MaxElementCount, ctx.GetWriteBufferNumElements<u32>(1));
274 const std::size_t font_sizes_count =
275 std::min(MaxElementCount, ctx.GetWriteBufferNumElements<u32>(2));
267 LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code); 276 LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code);
268 277
269 IPC::ResponseBuilder rb{ctx, 4}; 278 IPC::ResponseBuilder rb{ctx, 4};
@@ -280,9 +289,9 @@ void IPlatformServiceManager::GetSharedFontInOrderOfPriority(HLERequestContext&
280 } 289 }
281 290
282 // Resize buffers if game requests smaller size output 291 // Resize buffers if game requests smaller size output
283 font_codes.resize(std::min(font_codes.size(), ctx.GetWriteBufferNumElements<u32>(0))); 292 font_codes.resize(std::min(font_codes.size(), font_codes_count));
284 font_offsets.resize(std::min(font_offsets.size(), ctx.GetWriteBufferNumElements<u32>(1))); 293 font_offsets.resize(std::min(font_offsets.size(), font_offsets_count));
285 font_sizes.resize(std::min(font_sizes.size(), ctx.GetWriteBufferNumElements<u32>(2))); 294 font_sizes.resize(std::min(font_sizes.size(), font_sizes_count));
286 295
287 ctx.WriteBuffer(font_codes, 0); 296 ctx.WriteBuffer(font_codes, 0);
288 ctx.WriteBuffer(font_offsets, 1); 297 ctx.WriteBuffer(font_offsets, 1);