From 4b336335a8f7832e660edb6d0b896ad010a694e0 Mon Sep 17 00:00:00 2001 From: Chad Date: Mon, 5 Oct 2026 15:12:34 -0500 Subject: [PATCH] feat(libs): implement the APR gather and scatter reads sceAmprAprCommandBufferReadFileGather, ReadFileScatter, ReadFileGatherScatter and ResetGatherScatterState, with their measure functions. Signatures, argument checks and the read cursor follow ampr_emu: each read leaves the file, the next offset and the next destination; a gather reads at a new offset into the next destination, a scatter continues in the file into a new destination, and a gather-scatter takes both. Recording one needs a file read since the last reset, tracked in the command buffer object next to its type. sceAmprAprCommandBufferReadFile now applies the same length, offset and destination checks and rejects a null command buffer instead of dereferencing it. Co-Authored-By: Claude Opus 5.5 --- core/libs/prx/libSceAmpr/Export.cpp | 86 ++++++++++------ .../Apr/include/AprCommandBuffer.hpp | 13 ++- core/libs/prx/libkernel/Apr/src/Apr.cpp | 32 +++++- core/libs/tests/GuestAmpr.cpp | 97 +++++++++++++++++++ docs/dev/TechnicalDebt.md | 1 + 5 files changed, 192 insertions(+), 37 deletions(-) diff --git a/core/libs/prx/libSceAmpr/Export.cpp b/core/libs/prx/libSceAmpr/Export.cpp index f5bb93e89..bfb04045c 100644 --- a/core/libs/prx/libSceAmpr/Export.cpp +++ b/core/libs/prx/libSceAmpr/Export.cpp @@ -46,6 +46,29 @@ static bool ValidWriteCounter_04_00(std::uint32_t counter, std::uint32_t access, static constexpr std::uint64_t MeasureInvalid = static_cast(SCE_KERNEL_ERROR_EINVAL); +static bool ValidReadLength(std::uint64_t length) { + return length != 0u && length <= 0x100000000ull; +} + +static bool ValidReadOffset(std::uint64_t offset) { + return offset < 0x10000000000ull; +} + +static bool ValidRead(const void* destination, std::uint64_t length, std::uint64_t offset) { + constexpr std::uint64_t userLimit = 0xF00000000000ull; + const auto address = reinterpret_cast(destination); + return ValidReadLength(length) && address <= userLimit && length <= userLimit - address && ValidReadOffset(offset); +} + +static int AppendRead(Apr::CommandBufferObject* buffer, Apr::Opcode opcode, std::uint32_t fileId, const void* destination, std::uint64_t size, std::uint64_t offset) { + if (!buffer) return SCE_KERNEL_ERROR_EINVAL; + if (opcode != Apr::Opcode::ReadFile && (buffer->recording & Apr::ScatterGatherValid) == 0u) return SCE_KERNEL_ERROR_EINVAL; + Apr::ReadFileCommand command{{opcode, sizeof(command)}, fileId, 0, reinterpret_cast(destination), size, offset}; + const int result = Append(buffer, &command, sizeof(command)); + if (result == 0) buffer->recording |= Apr::ScatterGatherValid; + return result; +} + static std::uint64_t NopBytes(std::uint32_t dwords) { return sizeof(Apr::CommandHeader) + std::uint64_t{dwords} * 4u; } @@ -167,33 +190,35 @@ int APS5_VABI sceAmprAprCommandBufferMapEnd() { int APS5_VABI sceAmprAprCommandBufferReadFile(Apr::CommandBufferObject* buffer, uint64_t* gatherState, uint64_t* scatterState, uint32_t fileId, void* destination, uint64_t size, uint64_t offset) { (void)gatherState; (void)scatterState; - Apr::ReadFileCommand command{}; - command.header = {Apr::Opcode::ReadFile, sizeof(command)}; - command.fileId = fileId; - command.destination = reinterpret_cast(destination); - command.size = size; - command.offset = offset; - return Append(buffer, &command, sizeof(command)); + if (!ValidRead(destination, size, offset)) return SCE_KERNEL_ERROR_EINVAL; + return AppendRead(buffer, Apr::Opcode::ReadFile, fileId, destination, size, offset); } -int APS5_VABI sceAmprAprCommandBufferReadFileGather() { - NotImplemented_nid_no_patch(__func__); - return 0; +int APS5_VABI sceAmprAprCommandBufferReadFileGather(Apr::CommandBufferObject* buffer, std::uint64_t* mapState, std::uint64_t* scatterGatherState, std::uint64_t size, std::uint64_t offset) { + (void)mapState; + (void)scatterGatherState; + if (!ValidReadLength(size) || !ValidReadOffset(offset)) return SCE_KERNEL_ERROR_EINVAL; + return AppendRead(buffer, Apr::Opcode::ReadFileGather, 0, nullptr, size, offset); } -int APS5_VABI sceAmprAprCommandBufferReadFileGatherScatter() { - NotImplemented_nid_no_patch(__func__); - return 0; +int APS5_VABI sceAmprAprCommandBufferReadFileGatherScatter(Apr::CommandBufferObject* buffer, std::uint64_t* mapState, std::uint64_t* scatterGatherState, void* destination, std::uint64_t size, std::uint64_t offset) { + (void)mapState; + (void)scatterGatherState; + if (!ValidRead(destination, size, offset)) return SCE_KERNEL_ERROR_EINVAL; + return AppendRead(buffer, Apr::Opcode::ReadFileGatherScatter, 0, destination, size, offset); } -int APS5_VABI sceAmprAprCommandBufferReadFileScatter() { - NotImplemented_nid_no_patch(__func__); - return 0; +int APS5_VABI sceAmprAprCommandBufferReadFileScatter(Apr::CommandBufferObject* buffer, std::uint64_t* mapState, std::uint64_t* scatterGatherState, void* destination, std::uint64_t size) { + (void)mapState; + (void)scatterGatherState; + if (!ValidRead(destination, size, 0)) return SCE_KERNEL_ERROR_EINVAL; + return AppendRead(buffer, Apr::Opcode::ReadFileScatter, 0, destination, size, 0); } -int APS5_VABI sceAmprAprCommandBufferResetGatherScatterState() { - NotImplemented_nid_no_patch(__func__); - return 0; +int APS5_VABI sceAmprAprCommandBufferResetGatherScatterState(Apr::CommandBufferObject* buffer) { + const int result = AppendCommand(buffer, Apr::Opcode::ResetGatherScatterState, Apr::ResetGatherScatterStateCommand{}); + if (result == 0) buffer->recording &= static_cast(~Apr::ScatterGatherValid); + return result; } int APS5_VABI sceAmprCommandBufferClearBuffer(Apr::CommandBufferObject* buffer) { @@ -397,24 +422,23 @@ uint32_t APS5_VABI sceAmprMeasureCommandSizeReadFile(void) { return sizeof(Apr::ReadFileCommand); } -int APS5_VABI sceAmprMeasureCommandSizeReadFileGather() { - NotImplemented_nid_no_patch(__func__); - return 0; +std::uint64_t APS5_VABI sceAmprMeasureCommandSizeReadFileGather(std::uint64_t size, std::uint64_t offset) { + if (!ValidReadLength(size) || !ValidReadOffset(offset)) return MeasureInvalid; + return sizeof(Apr::ReadFileCommand); } -int APS5_VABI sceAmprMeasureCommandSizeReadFileGatherScatter() { - NotImplemented_nid_no_patch(__func__); - return 0; +std::uint64_t APS5_VABI sceAmprMeasureCommandSizeReadFileGatherScatter(void* destination, std::uint64_t size, std::uint64_t offset) { + if (!ValidRead(destination, size, offset)) return MeasureInvalid; + return sizeof(Apr::ReadFileCommand); } -int APS5_VABI sceAmprMeasureCommandSizeReadFileScatter() { - NotImplemented_nid_no_patch(__func__); - return 0; +std::uint64_t APS5_VABI sceAmprMeasureCommandSizeReadFileScatter(void* destination, std::uint64_t size) { + if (!ValidRead(destination, size, 0)) return MeasureInvalid; + return sizeof(Apr::ReadFileCommand); } -int APS5_VABI sceAmprMeasureCommandSizeResetGatherScatterState() { - NotImplemented_nid_no_patch(__func__); - return 0; +std::uint64_t APS5_VABI sceAmprMeasureCommandSizeResetGatherScatterState() { + return sizeof(Apr::ResetGatherScatterStateCommand); } std::uint64_t APS5_VABI sceAmprMeasureCommandSizeSetMarker(const char* text) { diff --git a/core/libs/prx/libkernel/Apr/include/AprCommandBuffer.hpp b/core/libs/prx/libkernel/Apr/include/AprCommandBuffer.hpp index 1ac5932a8..99bd8beb7 100644 --- a/core/libs/prx/libkernel/Apr/include/AprCommandBuffer.hpp +++ b/core/libs/prx/libkernel/Apr/include/AprCommandBuffer.hpp @@ -8,7 +8,7 @@ // The guest treats both the command buffer object and its memory as opaque, so the encoding is ours. namespace Apr { -enum class BufferType : std::uint32_t { +enum class BufferType : std::uint16_t { Generic = 0, Apr = 1, }; @@ -19,9 +19,12 @@ struct CommandBufferObject { std::uint32_t offset; std::uint32_t numCommands; BufferType type; + std::uint16_t recording; }; static_assert(sizeof(CommandBufferObject) == 0x18, "guest reserves 0x18 bytes for sce::Ampr::CommandBuffer"); +inline constexpr std::uint16_t ScatterGatherValid = 1; + enum class Opcode : std::uint32_t { Nop = 0, ReadFile = 1, @@ -36,6 +39,10 @@ enum class Opcode : std::uint32_t { PushMarker = 10, PopMarker = 11, SetMarker = 12, + ReadFileGather = 13, + ReadFileScatter = 14, + ReadFileGatherScatter = 15, + ResetGatherScatterState = 16, }; struct CommandHeader { @@ -52,6 +59,10 @@ struct ReadFileCommand { std::uint64_t offset; }; +struct ResetGatherScatterStateCommand { + CommandHeader header; +}; + struct WriteAddressCommand { CommandHeader header; std::uint64_t address; diff --git a/core/libs/prx/libkernel/Apr/src/Apr.cpp b/core/libs/prx/libkernel/Apr/src/Apr.cpp index 79ab4fde2..7c652701b 100644 --- a/core/libs/prx/libkernel/Apr/src/Apr.cpp +++ b/core/libs/prx/libkernel/Apr/src/Apr.cpp @@ -239,8 +239,27 @@ TCommand _read(const Apr::CommandBufferObject& buffer, std::uint32_t cursor) { return command; } +struct ReadCursor { + bool valid = false; + std::uint32_t fileId = 0; + std::uint64_t nextDestination = 0; + std::uint64_t nextOffset = 0; +}; + +void _readResolved(Apr::Opcode opcode, Apr::ReadFileCommand command, ReadCursor& read) { + if (opcode != Apr::Opcode::ReadFile) { + if (!read.valid) throw std::runtime_error("APR: gather or scatter read without a preceding read"); + command.fileId = read.fileId; + if (opcode == Apr::Opcode::ReadFileGather) command.destination = read.nextDestination; + if (opcode == Apr::Opcode::ReadFileScatter) command.offset = read.nextOffset; + } + _readFile(command); + read = {true, command.fileId, command.destination + command.size, command.offset + command.size}; +} + void _execute(const Apr::CommandBufferObject& buffer) { std::uint32_t cursor = 0; + ReadCursor read; for (std::uint32_t index = 0; index < buffer.numCommands; ++index) { if (cursor + sizeof(Apr::CommandHeader) > buffer.offset) throw std::runtime_error("APR: truncated command buffer"); Apr::CommandHeader header; @@ -252,12 +271,15 @@ void _execute(const Apr::CommandBufferObject& buffer) { case Apr::Opcode::PopMarker: case Apr::Opcode::SetMarker: break; - case Apr::Opcode::ReadFile: { - Apr::ReadFileCommand command; - std::memcpy(&command, buffer.base + cursor, sizeof(command)); - _readFile(command); + case Apr::Opcode::ReadFile: + case Apr::Opcode::ReadFileGather: + case Apr::Opcode::ReadFileScatter: + case Apr::Opcode::ReadFileGatherScatter: + _readResolved(header.opcode, _read(buffer, cursor), read); + break; + case Apr::Opcode::ResetGatherScatterState: + read = {}; break; - } case Apr::Opcode::WriteAddress: { Apr::WriteAddressCommand command; std::memcpy(&command, buffer.base + cursor, sizeof(command)); diff --git a/core/libs/tests/GuestAmpr.cpp b/core/libs/tests/GuestAmpr.cpp index b2ff45a58..23106e798 100644 --- a/core/libs/tests/GuestAmpr.cpp +++ b/core/libs/tests/GuestAmpr.cpp @@ -4,7 +4,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -53,6 +55,16 @@ std::uint64_t APS5_VABI sceAmprMeasureCommandSizeWaitOnCounter_04_00(std::uint8_ std::uint64_t APS5_VABI sceAmprMeasureCommandSizeWriteCounter_04_00(std::uint8_t, std::uint8_t, std::uint64_t, std::uint8_t); int APS5_VABI sceAmprCommandBufferConstructNop(Apr::CommandBufferObject*, std::int16_t, const void*, std::uint32_t, const std::uint32_t*); int APS5_VABI sceAmprCommandBufferConstructMarker(Apr::CommandBufferObject*, std::uint32_t, const char*, const std::uint32_t*); +int APS5_VABI sceKernelAprResolveFilepathsToIds(const char**, std::uint32_t, std::uint32_t*, std::uint32_t*); +int APS5_VABI sceAmprAprCommandBufferReadFile(Apr::CommandBufferObject*, std::uint64_t*, std::uint64_t*, std::uint32_t, void*, std::uint64_t, std::uint64_t); +int APS5_VABI sceAmprAprCommandBufferReadFileGather(Apr::CommandBufferObject*, std::uint64_t*, std::uint64_t*, std::uint64_t, std::uint64_t); +int APS5_VABI sceAmprAprCommandBufferReadFileScatter(Apr::CommandBufferObject*, std::uint64_t*, std::uint64_t*, void*, std::uint64_t); +int APS5_VABI sceAmprAprCommandBufferReadFileGatherScatter(Apr::CommandBufferObject*, std::uint64_t*, std::uint64_t*, void*, std::uint64_t, std::uint64_t); +int APS5_VABI sceAmprAprCommandBufferResetGatherScatterState(Apr::CommandBufferObject*); +std::uint64_t APS5_VABI sceAmprMeasureCommandSizeReadFileGather(std::uint64_t, std::uint64_t); +std::uint64_t APS5_VABI sceAmprMeasureCommandSizeReadFileScatter(void*, std::uint64_t); +std::uint64_t APS5_VABI sceAmprMeasureCommandSizeReadFileGatherScatter(void*, std::uint64_t, std::uint64_t); +std::uint64_t APS5_VABI sceAmprMeasureCommandSizeResetGatherScatterState(); } static void Require(bool value) { if (!value) std::abort(); } @@ -400,6 +412,90 @@ void TestConstructed() { Require(empty.Offset() == 0 && empty.Commands() == 0); } +std::uint8_t FileByte(std::size_t offset) { + return static_cast(offset * 7u + 3u); +} + +bool MatchesFile(const std::uint8_t* data, std::size_t offset, std::size_t bytes) { + for (std::size_t index = 0; index < bytes; ++index) { + if (data[index] != FileByte(offset + index)) return false; + } + return true; +} + +void TestGatherScatter() { + const char* path = "ampr_gather_scatter.bin"; + { + std::ofstream file(path, std::ios::binary); + for (std::size_t offset = 0; offset < 4096; ++offset) file.put(static_cast(FileByte(offset))); + } + std::uint32_t fileId = 0; + std::uint32_t failed = 0; + Require(sceKernelAprResolveFilepathsToIds(&path, 1, &fileId, &failed) == 0); + + Recorder recorder; + auto* buffer = &recorder.buffer; + auto* map = &recorder.gatherState; + auto* state = &recorder.scatterState; + std::array first{}; + std::array second{}; + Require(sceAmprAprCommandBufferReadFileGather(buffer, map, state, 8, 0) == invalidArgument); + Require(sceAmprAprCommandBufferReadFileScatter(buffer, map, state, second.data(), 8) == invalidArgument); + Require(sceAmprAprCommandBufferReadFileGatherScatter(buffer, map, state, second.data(), 8, 0) == invalidArgument); + Require(recorder.Commands() == 0); + + Require(sceAmprAprCommandBufferReadFile(buffer, map, state, fileId, first.data(), 16, 100) == 0); + auto offset = recorder.Offset(); + auto commands = recorder.Commands(); + Require(sceAmprAprCommandBufferReadFileGather(buffer, map, state, 8, 500) == 0); + RequireAppended(recorder, offset, commands, Apr::Opcode::ReadFileGather, sceAmprMeasureCommandSizeReadFileGather(8, 500)); + offset = recorder.Offset(); + commands = recorder.Commands(); + Require(sceAmprAprCommandBufferReadFileScatter(buffer, map, state, second.data(), 8) == 0); + RequireAppended(recorder, offset, commands, Apr::Opcode::ReadFileScatter, sceAmprMeasureCommandSizeReadFileScatter(second.data(), 8)); + offset = recorder.Offset(); + commands = recorder.Commands(); + Require(sceAmprAprCommandBufferReadFileGatherScatter(buffer, map, state, second.data() + 32, 4, 1000) == 0); + RequireAppended(recorder, offset, commands, Apr::Opcode::ReadFileGatherScatter, sceAmprMeasureCommandSizeReadFileGatherScatter(second.data() + 32, 4, 1000)); + Require(sceAmprAprCommandBufferReadFileGather(buffer, map, state, 4, 2000) == 0); + Require(sceAmprAprCommandBufferReadFileScatter(buffer, map, state, first.data() + 40, 6) == 0); + offset = recorder.Offset(); + commands = recorder.Commands(); + Require(sceAmprAprCommandBufferResetGatherScatterState(buffer) == 0); + RequireAppended(recorder, offset, commands, Apr::Opcode::ResetGatherScatterState, sceAmprMeasureCommandSizeResetGatherScatterState()); + Require(sceAmprAprCommandBufferReadFileGather(buffer, map, state, 8, 0) == invalidArgument); + Require(sceAmprAprCommandBufferReadFileScatter(buffer, map, state, second.data(), 8) == invalidArgument); + Require(sceAmprAprCommandBufferReadFile(buffer, map, state, fileId, second.data() + 48, 4, 3000) == 0); + Require(sceAmprAprCommandBufferReadFileScatter(buffer, map, state, second.data() + 56, 4) == 0); + Require(recorder.Commands() == 9); + SubmitWithin10Seconds(recorder); + + Require(MatchesFile(first.data(), 100, 16) && MatchesFile(first.data() + 16, 500, 8)); + Require(MatchesFile(second.data(), 508, 8)); + Require(MatchesFile(second.data() + 32, 1000, 4) && MatchesFile(second.data() + 36, 2000, 4)); + Require(MatchesFile(first.data() + 40, 2004, 6)); + Require(MatchesFile(second.data() + 48, 3000, 4) && MatchesFile(second.data() + 56, 3004, 4)); + Require(first[24] == 0 && first[39] == 0 && second[8] == 0 && second[31] == 0 && second[40] == 0); + std::remove(path); + + const auto rejected = static_cast(static_cast(invalidArgument)); + auto* high = reinterpret_cast(std::uintptr_t{0xF00000000000ull}); + Recorder empty; + Require(sceAmprAprCommandBufferReadFile(&empty.buffer, map, state, fileId, first.data(), 0, 0) == invalidArgument); + Require(sceAmprAprCommandBufferReadFile(&empty.buffer, map, state, fileId, first.data(), 0x100000001ull, 0) == invalidArgument); + Require(sceAmprAprCommandBufferReadFile(&empty.buffer, map, state, fileId, first.data(), 4, 0x10000000000ull) == invalidArgument); + Require(sceAmprAprCommandBufferReadFile(&empty.buffer, map, state, fileId, high, 4, 0) == invalidArgument); + Require(sceAmprAprCommandBufferReadFile(nullptr, map, state, fileId, first.data(), 4, 0) == invalidArgument); + Require(empty.Offset() == 0 && empty.Commands() == 0); + Require(sceAmprMeasureCommandSizeReadFileGather(0, 0) == rejected); + Require(sceAmprMeasureCommandSizeReadFileGather(0x100000000ull, 0x10000000000ull - 1u) == sizeof(Apr::ReadFileCommand)); + Require(sceAmprMeasureCommandSizeReadFileGather(4, 0x10000000000ull) == rejected); + Require(sceAmprMeasureCommandSizeReadFileScatter(first.data(), 0x100000001ull) == rejected); + Require(sceAmprMeasureCommandSizeReadFileScatter(high, 4) == rejected); + Require(sceAmprMeasureCommandSizeReadFileGatherScatter(first.data(), 4, 0x10000000000ull) == rejected); + Require(sceAmprMeasureCommandSizeReadFileGatherScatter(nullptr, 4, 0) == sizeof(Apr::ReadFileCommand)); +} + } int main() { @@ -418,5 +514,6 @@ int main() { TestVersionedCommands(); TestVersionedCounters(); TestConstructed(); + TestGatherScatter(); return 0; } diff --git a/docs/dev/TechnicalDebt.md b/docs/dev/TechnicalDebt.md index 5615df0f0..cc45f9093 100644 --- a/docs/dev/TechnicalDebt.md +++ b/docs/dev/TechnicalDebt.md @@ -34,6 +34,7 @@ Throughout the project, every function at every stage either **does exactly what - [AMPR WriteAddressFromCounterPairOnCompletion](../../core/libs/prx/libSceAmpr/Export.cpp) (libSceAmpr) - the pair of an even counter n is assumed to give counter n in the low 32 bits and n + 1 in the high 32 bits. Wait compare values, wait flush and counter index ranges follow the [ampr_emu](https://github.com/drakmor/ampr_emu) reimplementation; the flush is accepted and has no effect, as commands run in order - [AMPR command sizes](../../core/libs/prx/libSceAmpr/Export.cpp) (libSceAmpr) - commands use the emulator's own encoding with an 8-byte header, so `Nop(n)` takes 8 + 4n bytes where the console record is n dwords including its header (`NopWithData(n)`: (n + 1) dwords). The measure functions agree with the appended sizes, but a title that pads to an exact offset or the end of the buffer with `Nop(remaining / 4)` gets `SCE_AMPR_ERROR_BUFFER_FULL` or a shifted offset. The at-start flag of the `_04_00` writes is ignored; commands run in order, each after the previous one completes - [AMPR counter access](../../core/libs/prx/libkernel/Apr/src/Apr.cpp) (libSceAmpr) - signatures and checks of `WaitOnCounter_04_00`, `WriteCounter_04_00`, `ConstructNop` and `ConstructMarker` taken from the [ampr_emu](https://github.com/drakmor/ampr_emu) reimplementation, which hands counter commands to the console and does not show their effect. The counters are taken as 32 bits each: the 8-byte access of counter n spans n (low) and n + 1 (high), the 2- and 1-byte accesses select a half or a byte of the counter by its offset, waits compare at the access width (signed and wrapped compares included), the AND mask applies to both sides and the atomic writes wrap within the access. The `ConstructNop` type is not recorded +- [APR gather and scatter reads](../../core/libs/prx/libkernel/Apr/src/Apr.cpp) (libSceAmpr) - signatures, argument checks and the read cursor taken from the [ampr_emu](https://github.com/drakmor/ampr_emu) reimplementation, not confirmed on a title: each read leaves the file, the next file offset and the next destination; a gather reads that file at a new offset into the next destination, a scatter continues in the file into a new destination, a gather-scatter takes both. Recording one needs a read file since the last `ResetGatherScatterState`; like ampr_emu, `sceAmprCommandBufferReset` keeps that state, and a gather or scatter with no read before it in the submitted buffer throws instead of returning `SCE_AMPR_ERROR_APR_INVALIDGATHERSCATTERSTATE` - [AMPR markers](../../core/libs/prx/libSceAmpr/Export.cpp) (libSceAmpr) - signatures taken from the [ampr_emu](https://github.com/drakmor/ampr_emu) reimplementation, not confirmed on a title: `sceAmprCommandBufferSetMarkerWithColor` takes the color by pointer, the push and measure variants by value. Colors are not recorded - [sceFontGetRenderScaledKerning](../../core/libs/prx/libSceFont/src/Render.cpp) (libSceFont) - arguments, the cleared output and the bound renderer check taken from `cellFontGetRenderScaledKerning` in [RPCS3](https://github.com/RPCS3/rpcs3/blob/master/rpcs3/Emu/Cell/Modules/cellFont.cpp) (PS3 predecessor of the library), not confirmed on a title. The kerning is the `sceFontGetKerning` one at the render scale - [sceFontGetPixelResolution](../../core/libs/prx/libSceFont/src/Library.cpp) (libSceFont) - signature taken from the IDA type database of [Orbital](https://github.com/AlexAltea/orbital/blob/master/tools/ida/db_types.json), not confirmed on a title. The value is the one the library's driver reports (64 for FreeType); the argument checks and the cleared output follow `sceFontGetLibrary`