AnyPS5/docs/dev/TechnicalDebt.md

10 KiB

Project technical debt

Build

  • Building on Windows requires a specific version of mingw - MinGW-w64 GCC 15.2.0 (winlibs-gcc15, x86_64-ucrt-posix-seh)
  • Even compiled prx libraries on Windows require nearby (static linking of these dependencies causes conflicts):
    • libgcc_s_seh-1.dll
    • libstdc++-6.dll
    • libwinpthread-1.dll

Silent stubs

Throughout the project, every function at every stage either does exactly what it's supposed to or throws an exception. Everywhere... except:

  • libSceSaveDataDialog.native
  • libSceCommonDialog
  • libSceHmd implements only the disconnected-headset path: initialization succeeds, device queries report NotDetected, and opening a device returns DeviceDisconnected. Headset support, tracking, rendering and additional HMD exports are not implemented; SDK-level ABI compatibility and in-game behaviour remain unverified.
  • libSceNpCommerce - the PS Store icon show/hide calls do nothing
  • sceVideoOutOpen validates the priority and CPU affinity that the open param requests for the VideoOut service thread but does not apply them: the port's present and vblank threads are host threads, and guest priorities and affinities do not reach host scheduling
  • The shader recompiler skips baryctric coordinates (is not even passed to SpirvTargetOptions at row 212).
  • libSceAvPlayer: sceAvPlayerSetLogCallback accepts a callback that is never called, as the player produces no log messages, and sceAvPlayerSetAvailableBandwidth has no effect, as it governs HLS sources, which sceAvPlayerAddSource does not implement.
  • sceAvPlayerSetTrickSpeed (libSceAvPlayer) with a negative speed runs the clock backwards but delivers no frames; when a forward speed is set again, playback resumes from the rewound time.

Unknown function info

  • sceVideoOutOpen (libSceVideoOut) - the open param's first word is unknown (PPSA21564 passes 16; it is not the byte size, since the affinity mask is at offset 16); only 16 is accepted. Whether the param continues past offset 24 is also unknown
  • sceRtcParseDateTime (libSceRtc) - accepted format assumed to be the ISO 8601 subset YYYY-MM-DDTHH:MM:SS[.ffffff] (T/t/space separator, optional fractional seconds) with the sibling RFC 3339 zone suffix (Z or ±HH:MM); a string without a zone is taken as UTC, and anything outside this shape throws instead of returning a parse error, unverified against hardware
  • AMPR WaitOnAddress / WaitOnCounter (libSceAmpr) - compare encoding assumed to be the WAIT_REG_MEM one (0 always, 1 <, 2 <=, 3 ==, 4 !=, 5 >=, 6 >)
  • sceAgcSetSubmitMode (libSceAgc) - mode values unknown; only 0 is accepted
  • zARR5aCmkoY (libSceAgc) - unknown name, signature
  • qj7QZpgr9Uw (libSceAgc) - unknown name
  • fd5Bp5tGTgo (libSceAgc) - unknown name
  • dolOmWH+huQ (libSceAgc) - unknown name
  • V++UgBtQhn0 (libSceAgc) - unknown name
  • gQkqkLttcpw (libSceAgc) - unknown name, signature
  • sceKernelInternalMemoryGetModuleSegmentInfo (libkernel) - unknown signature
  • sceKernelSyncOnAddressWait (libkernel) - the only known caller passes a null timeout and a name string as the fourth argument; the timeout is assumed to point to microseconds like the other kernel waits, and the name is ignored
  • sceKernelMapNamedFlexibleMemoryInternal (libkernel) - flag 0x8000 unknown; only the sceKernelMapNamedFlexibleMemory flags are accepted
  • sceLibcInternalBacktraceForGame (libSceLibcInternal, implemented in libc) - unknown signature
  • sceLibcInternalHeapErrorReportForGame (libSceLibcInternal, implemented in libc) - unknown signature
  • __progname (libkernel) - unknown data export
  • pthread_barrierattr_setpshared (libkernel) - PTHREAD_PROCESS_SHARED throws: FreeBSD 9.0 libthr rejects it with EINVAL and 11.0 accepts it, and which one the console follows is unknown
  • sceSslClose (libSceSsl) - unknown signature
  • sceSslGetSerialNumber (libSceSsl) - unknown signature
  • X+4jdIS75P0 (libSceAudioIn) - unknown name, signature
  • AOWqIYsgVHs (libSceContentExport) - unknown name, signature
  • GQTObcITIXI (libSceShare) - unknown name, signature
  • BnMAMrsfVWo (libc) - unknown name, signature
  • AudioPropagation, AudioIn, NpSessionSignaling and PlayerInvitationDialog exports added without an implementation have assumed signatures
  • sceAvPlayerStartEx (libSceAvPlayer) - start info layout unknown; it is ignored and playback starts as with sceAvPlayerStart
  • sceAvPlayerInit / sceAvPlayerInitEx (libSceAvPlayer) - behaviour without a memory replacement unknown; frame and sample buffers then come from the guest heap
  • SceAvPlayerVideoEx (libSceAvPlayer) - frame rate field and encoding unknown; it is left zero in frame and stream info

Functional

  • Shader recompilation currently occurs right before it was transferred to Vulkan with caching, but should be moved to the relinker stage. For this purpose, shader/recompiler was written completely independently from libs/prx.
  • v_fma_f64 is fused exactly only for normal inputs: with a subnormal input it is a separate multiply and add, which rounds twice.
  • The executable file that relinker generates opens the console when launched, which is inconvenient for playability.
  • libSceJpegEnc encodes 4:2:2 sampling requests with 4:2:0 chroma subsampling, and grayscale requests as a 3-component JPEG with neutral chroma instead of a single-component one: the JPEG encoder (stb) only produces 3-component 4:2:0 and 4:4:4 images.
  • --to-intel does not lower RDPRU/MCOMMIT; the matcher fails the relink instead. SHA-1 instructions with a memory operand and SHA-256 instructions with a RIP-relative operand fail the relink.
  • The length-changing path of the instruction rewriter is not used by the converter: it does not adjust VEX/0F38/0F3A RIP-relative operands, data-to-code references (relocations, FDEs, jump tables) or segment sizes, so every substitution keeps the instruction length.
  • The Linux placement of the --to-intel stubs in the ELF patcher is covered only by a synthetic test.
  • The libc SSE4a trap emulation on Windows is superseded by --to-intel and remains only until the relinked title has been verified without it.
  • --to-intel guest module trampolines are covered only by a synthetic relinker test; no game title has been verified with them on Linux or Windows.
  • --to-intel replaces the approximate VEX.128 register forms of VRSQRTPS and VRCPPS with correctly rounded 1/sqrt(x) and 1/x, not with the AMD approximation: its tables are not public. Intel's approximation of 1/sqrt(1.0) is 0x3F7FF000, and two Newton-Raphson steps on it settle on 0.99999994 instead of 1.0; a renormalised identity quaternion then turns into a NaN axis in PPSA21564, which the console does not show. Refined results now reach the exact value; unrefined ones can still differ from the console in the low bits. Each site costs an out-of-line stub (two jumps, a spill below the red zone, SQRTPS/DIVPS). The 256-bit, scalar, legacy and memory forms keep the native instruction, as does a 4-byte site with no movable instruction after it for the jump (5 sites in PPSA21564).
  • sceKeyboardGetKey2Char (libSceKeyboard) translates only the 101-key (US) arrangement and throws for the 106-key (Japanese) one; Ctrl and Alt do not change the character.
  • libSceAudiodec throws for the 24-bit PCM word size (iBwPcm 0): its sample layout is unknown. ATRAC9 decoding is covered only by configuration and error tests, as no ATRAC9 encoder is available for a fixture.
  • libScePngEnc honours filter_type only as all filters (adaptive) or a single filter: the PNG encoder (stb) cannot restrict adaptive filtering to a subset, so the first filter in the mask is used.
  • libScePlayerInvitationDialog simulates dialog completion without displaying UI or sending invitations; its parameter ABI remains unverified.