From ff2f0d980ae613e64a9bc46ec4793b1a033426b3 Mon Sep 17 00:00:00 2001 From: David <25727384+ogniK5377@users.noreply.github.com> Date: Tue, 1 May 2018 13:28:36 -0700 Subject: GetSharedFontInOrderOfPriority (#381) * GetSharedFontInOrderOfPriority * Update pl_u.cpp * Ability to use ReadBuffer and WriteBuffer with different buffer indexes, fixed up GetSharedFontInOrderOfPriority * switched to NGLOG * Update pl_u.cpp * Update pl_u.cpp * language_code is actually language code and not index * u32->u64 * final cleanups --- src/core/hle/service/ns/pl_u.cpp | 27 ++++++++++++++++++++++++++- src/core/hle/service/ns/pl_u.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src/core/hle/service/ns') diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index c2a647e89..636af9a1e 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp @@ -37,7 +37,7 @@ PL_U::PL_U() : ServiceFramework("pl:u") { {2, &PL_U::GetSize, "GetSize"}, {3, &PL_U::GetSharedMemoryAddressOffset, "GetSharedMemoryAddressOffset"}, {4, &PL_U::GetSharedMemoryNativeHandle, "GetSharedMemoryNativeHandle"}, - {5, nullptr, "GetSharedFontInOrderOfPriority"}, + {5, &PL_U::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"}, }; RegisterHandlers(functions); @@ -116,4 +116,29 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { rb.PushCopyObjects(shared_font_mem); } +void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const u64 language_code{rp.Pop()}; // TODO(ogniK): Find out what this is used for + NGLOG_DEBUG(Service_NS, "called, language_code=%lx", language_code); + IPC::ResponseBuilder rb{ctx, 4}; + std::vector font_codes; + std::vector font_offsets; + std::vector font_sizes; + + // TODO(ogniK): Have actual priority order + for (size_t i = 0; i < SHARED_FONT_REGIONS.size(); i++) { + font_codes.push_back(static_cast(i)); + font_offsets.push_back(SHARED_FONT_REGIONS[i].offset); + font_sizes.push_back(SHARED_FONT_REGIONS[i].size); + } + + ctx.WriteBuffer(font_codes.data(), font_codes.size(), 0); + ctx.WriteBuffer(font_offsets.data(), font_offsets.size(), 1); + ctx.WriteBuffer(font_sizes.data(), font_sizes.size(), 2); + + rb.Push(RESULT_SUCCESS); + rb.Push(static_cast(LoadState::Done)); // Fonts Loaded + rb.Push(static_cast(font_codes.size())); +} + } // namespace Service::NS diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/pl_u.h index b175c9c44..fcc2acab7 100644 --- a/src/core/hle/service/ns/pl_u.h +++ b/src/core/hle/service/ns/pl_u.h @@ -21,6 +21,7 @@ private: void GetSize(Kernel::HLERequestContext& ctx); void GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx); void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); + void GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx); /// Handle to shared memory region designated for a shared font Kernel::SharedPtr shared_font_mem; -- cgit v1.2.3