diff options
author | David <25727384+ogniK5377@users.noreply.github.com> | 2018-05-01 22:28:36 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-05-01 22:28:36 +0200 |
commit | ff2f0d980ae613e64a9bc46ec4793b1a033426b3 (patch) | |
tree | 337e684389231717c18c7bdd6c0bef85c294f24e /src | |
parent | Merge pull request #425 from lioncash/namespace (diff) | |
download | yuzu-ff2f0d980ae613e64a9bc46ec4793b1a033426b3.tar yuzu-ff2f0d980ae613e64a9bc46ec4793b1a033426b3.tar.gz yuzu-ff2f0d980ae613e64a9bc46ec4793b1a033426b3.tar.bz2 yuzu-ff2f0d980ae613e64a9bc46ec4793b1a033426b3.tar.lz yuzu-ff2f0d980ae613e64a9bc46ec4793b1a033426b3.tar.xz yuzu-ff2f0d980ae613e64a9bc46ec4793b1a033426b3.tar.zst yuzu-ff2f0d980ae613e64a9bc46ec4793b1a033426b3.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 40 | ||||
-rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 10 | ||||
-rw-r--r-- | src/core/hle/service/ns/pl_u.cpp | 27 | ||||
-rw-r--r-- | src/core/hle/service/ns/pl_u.h | 1 |
4 files changed, 54 insertions, 24 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index aa6ca1026..349bc11df 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -251,24 +251,26 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) { return RESULT_SUCCESS; } -std::vector<u8> HLERequestContext::ReadBuffer() const { +std::vector<u8> HLERequestContext::ReadBuffer(int buffer_index) const { std::vector<u8> buffer; - const bool is_buffer_a{BufferDescriptorA().size() && BufferDescriptorA()[0].Size()}; + const bool is_buffer_a{BufferDescriptorA().size() && BufferDescriptorA()[buffer_index].Size()}; if (is_buffer_a) { - buffer.resize(BufferDescriptorA()[0].Size()); - Memory::ReadBlock(BufferDescriptorA()[0].Address(), buffer.data(), buffer.size()); + buffer.resize(BufferDescriptorA()[buffer_index].Size()); + Memory::ReadBlock(BufferDescriptorA()[buffer_index].Address(), buffer.data(), + buffer.size()); } else { - buffer.resize(BufferDescriptorX()[0].Size()); - Memory::ReadBlock(BufferDescriptorX()[0].Address(), buffer.data(), buffer.size()); + buffer.resize(BufferDescriptorX()[buffer_index].Size()); + Memory::ReadBlock(BufferDescriptorX()[buffer_index].Address(), buffer.data(), + buffer.size()); } return buffer; } -size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size) const { - const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[0].Size()}; - const size_t buffer_size{GetWriteBufferSize()}; +size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const { + const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; + const size_t buffer_size{GetWriteBufferSize(buffer_index)}; if (size > buffer_size) { NGLOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, buffer_size); @@ -276,26 +278,28 @@ size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size) const { } if (is_buffer_b) { - Memory::WriteBlock(BufferDescriptorB()[0].Address(), buffer, size); + Memory::WriteBlock(BufferDescriptorB()[buffer_index].Address(), buffer, size); } else { - Memory::WriteBlock(BufferDescriptorC()[0].Address(), buffer, size); + Memory::WriteBlock(BufferDescriptorC()[buffer_index].Address(), buffer, size); } return size; } -size_t HLERequestContext::WriteBuffer(const std::vector<u8>& buffer) const { +size_t HLERequestContext::WriteBuffer(const std::vector<u8>& buffer, int buffer_index) const { return WriteBuffer(buffer.data(), buffer.size()); } -size_t HLERequestContext::GetReadBufferSize() const { - const bool is_buffer_a{BufferDescriptorA().size() && BufferDescriptorA()[0].Size()}; - return is_buffer_a ? BufferDescriptorA()[0].Size() : BufferDescriptorX()[0].Size(); +size_t HLERequestContext::GetReadBufferSize(int buffer_index) const { + const bool is_buffer_a{BufferDescriptorA().size() && BufferDescriptorA()[buffer_index].Size()}; + return is_buffer_a ? BufferDescriptorA()[buffer_index].Size() + : BufferDescriptorX()[buffer_index].Size(); } -size_t HLERequestContext::GetWriteBufferSize() const { - const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[0].Size()}; - return is_buffer_b ? BufferDescriptorB()[0].Size() : BufferDescriptorC()[0].Size(); +size_t HLERequestContext::GetWriteBufferSize(int buffer_index) const { + const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; + return is_buffer_b ? BufferDescriptorB()[buffer_index].Size() + : BufferDescriptorC()[buffer_index].Size(); } std::string HLERequestContext::Description() const { diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 8b35da4c9..6d4ed7648 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -164,19 +164,19 @@ public: } /// Helper function to read a buffer using the appropriate buffer descriptor - std::vector<u8> ReadBuffer() const; + std::vector<u8> ReadBuffer(int buffer_index = 0) const; /// Helper function to write a buffer using the appropriate buffer descriptor - size_t WriteBuffer(const void* buffer, size_t size) const; + size_t WriteBuffer(const void* buffer, size_t size, int buffer_index = 0) const; /// Helper function to write a buffer using the appropriate buffer descriptor - size_t WriteBuffer(const std::vector<u8>& buffer) const; + size_t WriteBuffer(const std::vector<u8>& buffer, int buffer_index = 0) const; /// Helper function to get the size of the input buffer - size_t GetReadBufferSize() const; + size_t GetReadBufferSize(int buffer_index = 0) const; /// Helper function to get the size of the output buffer - size_t GetWriteBufferSize() const; + size_t GetWriteBufferSize(int buffer_index = 0) const; template <typename T> SharedPtr<T> GetCopyObject(size_t index) { 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<u64>()}; // 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<u32> font_codes; + std::vector<u32> font_offsets; + std::vector<u32> 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<u32>(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<u8>(static_cast<u8>(LoadState::Done)); // Fonts Loaded + rb.Push<u32>(static_cast<u32>(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<Kernel::SharedMemory> shared_font_mem; |