mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 21:05:06 +01:00
Stub pl::RequestLoad
and pl::GetSharedFontInOrderOfPriority
Co-Authored-By: Timotej Leginus <35149140+timleg002@users.noreply.github.com>
This commit is contained in:
parent
782f9e37ee
commit
a7be4fd1e1
@ -7,6 +7,11 @@
|
||||
namespace skyline::service::pl {
|
||||
IPlatformServiceManager::IPlatformServiceManager(const DeviceState &state, ServiceManager &manager, SharedFontCore &core) : BaseService(state, manager), core(core) {}
|
||||
|
||||
Result IPlatformServiceManager::RequestLoad(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
Logger::Debug("Requested a shared font to be loaded: {}", request.Pop<u32>());
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IPlatformServiceManager::GetLoadState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
constexpr u32 FontLoaded{1}; //!< "All fonts have been loaded into memory"
|
||||
response.Push(FontLoaded);
|
||||
@ -30,4 +35,33 @@ namespace skyline::service::pl {
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IPlatformServiceManager::GetSharedFontInOrderOfPriority(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto languageCode{request.Pop<u64>()};
|
||||
|
||||
std::vector<u32> fontCodes{};
|
||||
std::vector<u32> fontOffsets{};
|
||||
std::vector<u32> fontSizes{};
|
||||
|
||||
// TODO: actual font priority
|
||||
for (u32 i{}; i < core.fonts.size(); i++) {
|
||||
fontCodes.push_back(i);
|
||||
auto region{core.fonts.at(i)};
|
||||
fontOffsets.push_back(region.offset);
|
||||
fontSizes.push_back(region.length);
|
||||
}
|
||||
|
||||
std::memset(request.outputBuf.at(0).data(), 0, request.outputBuf.at(0).size());
|
||||
std::memset(request.outputBuf.at(1).data(), 0, request.outputBuf.at(1).size());
|
||||
std::memset(request.outputBuf.at(2).data(), 0, request.outputBuf.at(2).size());
|
||||
|
||||
request.outputBuf.at(0).copy_from(fontCodes);
|
||||
request.outputBuf.at(1).copy_from(fontOffsets);
|
||||
request.outputBuf.at(2).copy_from(fontSizes);
|
||||
|
||||
response.Push<u8>(1); // Fonts are loaded
|
||||
response.Push(static_cast<u32>(fontCodes.size()));
|
||||
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,12 @@ namespace skyline::service::pl {
|
||||
public:
|
||||
IPlatformServiceManager(const DeviceState &state, ServiceManager &manager, SharedFontCore &core);
|
||||
|
||||
/**
|
||||
* @brief Requests a shared font to be loaded
|
||||
* @url https://switchbrew.org/wiki/Shared_Database_services#RequestLoad
|
||||
*/
|
||||
Result RequestLoad(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief Returns the loading state of the requested font
|
||||
* @url https://switchbrew.org/wiki/Shared_Database_services#GetLoadState
|
||||
@ -44,11 +50,19 @@ namespace skyline::service::pl {
|
||||
*/
|
||||
Result GetSharedMemoryNativeHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief Returns shared fonts information in order of priority, a bool to specify if the fonts are loaded or not and the font count
|
||||
* @url https://switchbrew.org/wiki/Shared_Database_services#GetSharedFontInOrderOfPriority
|
||||
*/
|
||||
Result GetSharedFontInOrderOfPriority(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IPlatformServiceManager, RequestLoad),
|
||||
SFUNC(0x1, IPlatformServiceManager, GetLoadState),
|
||||
SFUNC(0x2, IPlatformServiceManager, GetSize),
|
||||
SFUNC(0x3, IPlatformServiceManager, GetSharedMemoryAddressOffset),
|
||||
SFUNC(0x4, IPlatformServiceManager, GetSharedMemoryNativeHandle)
|
||||
SFUNC(0x4, IPlatformServiceManager, GetSharedMemoryNativeHandle),
|
||||
SFUNC(0x5, IPlatformServiceManager, GetSharedFontInOrderOfPriority)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user