diff options
| author | 2018-04-15 16:54:36 -0400 | |
|---|---|---|
| committer | 2018-04-15 16:54:36 -0400 | |
| commit | 44e09ba8076a31dca0da4a84104c8e4d12827cb0 (patch) | |
| tree | aaea9080ef960140ca9b7c475a1e8a8ef7d52d00 /src | |
| parent | Merge pull request #337 from Subv/used_buffers (diff) | |
| parent | pl_u: Use empty shared font if none is available. (diff) | |
| download | yuzu-44e09ba8076a31dca0da4a84104c8e4d12827cb0.tar.gz yuzu-44e09ba8076a31dca0da4a84104c8e4d12827cb0.tar.xz yuzu-44e09ba8076a31dca0da4a84104c8e4d12827cb0.zip | |
Merge pull request #338 from bunnei/unrequire-shared-font
pl_u: Use empty shared font if none is available.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/ns/pl_u.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index d5e0b5f14..7ff1ab664 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp | |||
| @@ -47,10 +47,10 @@ PL_U::PL_U() : ServiceFramework("pl:u") { | |||
| 47 | FileUtil::CreateFullPath(filepath); // Create path if not already created | 47 | FileUtil::CreateFullPath(filepath); // Create path if not already created |
| 48 | FileUtil::IOFile file(filepath, "rb"); | 48 | FileUtil::IOFile file(filepath, "rb"); |
| 49 | 49 | ||
| 50 | shared_font = std::make_shared<std::vector<u8>>(SHARED_FONT_MEM_SIZE); | ||
| 50 | if (file.IsOpen()) { | 51 | if (file.IsOpen()) { |
| 51 | // Read shared font data | 52 | // Read shared font data |
| 52 | ASSERT(file.GetSize() == SHARED_FONT_MEM_SIZE); | 53 | ASSERT(file.GetSize() == SHARED_FONT_MEM_SIZE); |
| 53 | shared_font = std::make_shared<std::vector<u8>>(static_cast<size_t>(file.GetSize())); | ||
| 54 | file.ReadBytes(shared_font->data(), shared_font->size()); | 54 | file.ReadBytes(shared_font->data(), shared_font->size()); |
| 55 | } else { | 55 | } else { |
| 56 | LOG_WARNING(Service_NS, "Unable to load shared font: %s", filepath.c_str()); | 56 | LOG_WARNING(Service_NS, "Unable to load shared font: %s", filepath.c_str()); |
| @@ -97,22 +97,19 @@ void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) { | |||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { | 99 | void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { |
| 100 | if (shared_font != nullptr) { | 100 | // TODO(bunnei): This is a less-than-ideal solution to load a RAM dump of the Switch shared |
| 101 | // TODO(bunnei): This is a less-than-ideal solution to load a RAM dump of the Switch shared | 101 | // font data. This (likely) relies on exact address, size, and offsets from the original |
| 102 | // font data. This (likely) relies on exact address, size, and offsets from the original | 102 | // dump. In the future, we need to replace this with a more robust solution. |
| 103 | // dump. In the future, we need to replace this with a more robust solution. | 103 | |
| 104 | 104 | // Map backing memory for the font data | |
| 105 | // Map backing memory for the font data | 105 | Core::CurrentProcess()->vm_manager.MapMemoryBlock( |
| 106 | Core::CurrentProcess()->vm_manager.MapMemoryBlock(SHARED_FONT_MEM_VADDR, shared_font, 0, | 106 | SHARED_FONT_MEM_VADDR, shared_font, 0, SHARED_FONT_MEM_SIZE, Kernel::MemoryState::Shared); |
| 107 | SHARED_FONT_MEM_SIZE, | 107 | |
| 108 | Kernel::MemoryState::Shared); | 108 | // Create shared font memory object |
| 109 | 109 | shared_font_mem = Kernel::SharedMemory::Create( | |
| 110 | // Create shared font memory object | 110 | Core::CurrentProcess(), SHARED_FONT_MEM_SIZE, Kernel::MemoryPermission::ReadWrite, |
| 111 | shared_font_mem = Kernel::SharedMemory::Create( | 111 | Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE, |
| 112 | Core::CurrentProcess(), SHARED_FONT_MEM_SIZE, Kernel::MemoryPermission::ReadWrite, | 112 | "PL_U:shared_font_mem"); |
| 113 | Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE, | ||
| 114 | "PL_U:shared_font_mem"); | ||
| 115 | } | ||
| 116 | 113 | ||
| 117 | LOG_DEBUG(Service_NS, "called"); | 114 | LOG_DEBUG(Service_NS, "called"); |
| 118 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 115 | IPC::ResponseBuilder rb{ctx, 2, 1}; |