AnyPS5/docs/dev/debt/libSceJson2.md

3.1 KiB

libSceJson2 technical debt

Unknown function info

  • sce::Json::Parser::parse with a read callback (libSceJson2) - the callback's contract is taken from PPSA04540's: it returns 0 with the next character, and at the end of its data writes '\0' and returns -1. Characters are read until the callback returns non-zero or gives '\0', and the text read is then parsed as by the (text, size) overload, so trailing characters after the value are rejected as there. Whether the console stops reading at the end of the top-level value, and what it returns when the callback fails before the end, are unknown
  • sce::Json::Parser::parse (libSceJson2) - a number that overflows a double (e.g. 1e309) throws: whether the console rejects the document or stores an infinite real is unknown
  • sce::Json::InitParameter2, InitParameterRtti and InitParameterRtti2 (libSceJson2) - layouts inferred, not known. InitParameter2 is taken as the 40-byte object of SharpEmu and KytyPS5: the allocator, its user data, the file buffer size, the 32-bit special float format type at 0x18 and 12 bytes both zero, and both constructors zero all of it. InitParameterRtti2::setAllocatorRtti writes the allocation parameters and user data where setAllocator writes the allocator, as both references do; whether the console also marks the object as using RTTI allocation is unknown. InitParameterRtti's constructor writes the allocation parameters, user data and file buffer size to the first 24 bytes, an order inferred from its mangled arguments. The values of SpecialFloatFormatType and what they select are unknown, so setSpecialFloatFormatType stores any value and nothing reads it: Initializer::initialize(InitParameter2) ignores every field as initialize(InitParameter) does, serializing a non-finite real throws whatever the type, and whether the type lets the parser accept NaN or infinity is unknown. The setters return nothing; whether the console's return this is unknown

Functional