mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-24 18:25:34 +00:00
pl_u: Use empty shared font if none is available.
- Makes games work in lieu of shared_font.bin.
This commit is contained in:
parent
34264879b3
commit
ac628f139d
|
@ -47,10 +47,10 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
|
||||||
FileUtil::CreateFullPath(filepath); // Create path if not already created
|
FileUtil::CreateFullPath(filepath); // Create path if not already created
|
||||||
FileUtil::IOFile file(filepath, "rb");
|
FileUtil::IOFile file(filepath, "rb");
|
||||||
|
|
||||||
|
shared_font = std::make_shared<std::vector<u8>>(SHARED_FONT_MEM_SIZE);
|
||||||
if (file.IsOpen()) {
|
if (file.IsOpen()) {
|
||||||
// Read shared font data
|
// Read shared font data
|
||||||
ASSERT(file.GetSize() == SHARED_FONT_MEM_SIZE);
|
ASSERT(file.GetSize() == SHARED_FONT_MEM_SIZE);
|
||||||
shared_font = std::make_shared<std::vector<u8>>(static_cast<size_t>(file.GetSize()));
|
|
||||||
file.ReadBytes(shared_font->data(), shared_font->size());
|
file.ReadBytes(shared_font->data(), shared_font->size());
|
||||||
} else {
|
} else {
|
||||||
LOG_WARNING(Service_NS, "Unable to load shared font: %s", filepath.c_str());
|
LOG_WARNING(Service_NS, "Unable to load shared font: %s", filepath.c_str());
|
||||||
|
@ -97,22 +97,19 @@ void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
|
void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
|
||||||
if (shared_font != nullptr) {
|
|
||||||
// TODO(bunnei): This is a less-than-ideal solution to load a RAM dump of the Switch shared
|
// TODO(bunnei): This is a less-than-ideal solution to load a RAM dump of the Switch shared
|
||||||
// font data. This (likely) relies on exact address, size, and offsets from the original
|
// font data. This (likely) relies on exact address, size, and offsets from the original
|
||||||
// dump. In the future, we need to replace this with a more robust solution.
|
// dump. In the future, we need to replace this with a more robust solution.
|
||||||
|
|
||||||
// Map backing memory for the font data
|
// Map backing memory for the font data
|
||||||
Core::CurrentProcess()->vm_manager.MapMemoryBlock(SHARED_FONT_MEM_VADDR, shared_font, 0,
|
Core::CurrentProcess()->vm_manager.MapMemoryBlock(
|
||||||
SHARED_FONT_MEM_SIZE,
|
SHARED_FONT_MEM_VADDR, shared_font, 0, SHARED_FONT_MEM_SIZE, Kernel::MemoryState::Shared);
|
||||||
Kernel::MemoryState::Shared);
|
|
||||||
|
|
||||||
// Create shared font memory object
|
// Create shared font memory object
|
||||||
shared_font_mem = Kernel::SharedMemory::Create(
|
shared_font_mem = Kernel::SharedMemory::Create(
|
||||||
Core::CurrentProcess(), SHARED_FONT_MEM_SIZE, Kernel::MemoryPermission::ReadWrite,
|
Core::CurrentProcess(), SHARED_FONT_MEM_SIZE, Kernel::MemoryPermission::ReadWrite,
|
||||||
Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE,
|
Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE,
|
||||||
"PL_U:shared_font_mem");
|
"PL_U:shared_font_mem");
|
||||||
}
|
|
||||||
|
|
||||||
LOG_DEBUG(Service_NS, "called");
|
LOG_DEBUG(Service_NS, "called");
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
|
Loading…
Reference in a new issue