Commit Graph

19 Commits

Author SHA1 Message Date
Pouare514 998016e789 fix(libs): drop stubs now owned by main after rebase 2026-10-09 20:13:56 +02:00
Pouare514 c67189fdee fix(libs): export host-colliding runtime names via _nid_postfix 2026-10-09 20:12:46 +02:00
Pouare514 b6c70b1135 fix(libs): rename loader stubs to recomputed real names, drop clashing ones 2026-10-09 20:12:31 +02:00
Pouare514 e96ec6da7d feat(libs): Deathloop loading support (Ampr, NetCtlApDialog, Party + stubs) 2026-10-09 20:11:35 +02:00
jdmagic 8ae350caaa fix(libSceAmpr): sceAmprCommandBufferClearBuffer returns the detached buffer
sceAmprCommandBufferClearBuffer detaches a command buffer's memory and
returns it so the caller can free it. It returned 0. PPSA01289 (Sackboy: A
Big Adventure) frees the result after every streaming read, so each read
leaked its 16 KiB command buffer until the allocator ran out of memory
during the first world load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 01:58:38 -04:00
Chad cf3d0f6fc7 feat(libs): implement the AMM PRT commands
sceAmprAmmCommandBufferMapAsPrt, AllocatePaForPrt, RemapIntoPrt and
UnmapToPrt, with the MapAsPrt and AllocatePaForPrt measures. Signatures,
checks and their order follow ampr_emu.

The executor keeps the PRT pages of the AMM ranges. Unbacked PRT pages
are zero-filled with GPU read access; AllocatePaForPrt backs each
unbacked page with a pool page and changes the type and protection of
backed ones; RemapIntoPrt moves a mapped range into a PRT range; and
UnmapToPrt returns the pages to the pool and zero-fills them again. A
plain map, unmap or remap over a PRT range ends it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:45:28 -05:00
Chad 6c21041d0d Merge branch 'feat/amm-core' into feat/amm-remap-protect 2026-10-05 15:41:57 -05:00
Chad 0cb5ca7203 fix(libs): take the AMM submit checks from ampr_emu
The AMM submit forms now return EINVAL for a priority above 2 and EPERM
for a null command buffer, in that order, as ampr_emu's
amm_validate_submit_args does, instead of EINVAL for a null buffer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:41:49 -05:00
Chad 166ea44993 feat(libs): implement the AMM remap, multimap and protection changes
libSceAmpr gains sceAmprAmmCommandBufferRemap, MultiMap, ModifyProtect
and ModifyMtypeProtect with their GPU mask forms and the eight measure
functions. Signatures and the protection and mask checks follow ampr_emu.

The executor keeps a page table of the AMM ranges: each page's physical
offset, protection, memory type and whether it came from the pool. A
remap moves the pages of a fully mapped range and leaves the old range
reserved; a multimap maps the same pages again; a pool page returns to
the pool only when its last mapping goes. A protection change applies
the masked bits page by page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:36:24 -05:00
Chad c16e59bfd5 feat(libs): implement the AMM map, map direct and unmap commands and the APR map region
libSceAmpr gains the AMM command buffer (constructor, destructor, map,
map direct and unmap, with their GPU mask forms and measures),
sceAmprAmmGiveDirectMemory, sceAmprAmmGetVirtualAddressRanges, the three
submit forms and sceAmprAmmWaitCommandBufferCompletion. The APR
MapBegin, MapDirectBegin and MapEnd commands and their measures record
the same map commands.

The libkernel executor now maps: a plain map takes pages from the direct
memory given to the mapper with usage 1, a direct map uses the given
offset, and an unmap returns the pages to that pool and leaves the range
reserved. The AMM ranges are reserved in the guest arena on first use.
Commands are walked by the buffer's byte offset so an AMM submission can
run raw command memory.

Signatures, the protection mask and the APR map rules follow ampr_emu;
the mapper model follows PS5PCEM. While an APR map region is open, a
second begin and every completion write return EPERM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:29:33 -05:00
Chad 4b336335a8 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 <noreply@anthropic.com>
2026-10-05 15:12:34 -05:00
Chad 636fb5edae feat(libs): implement the AMPR 04_00 counter commands and the construct helpers
sceAmprCommandBufferWaitOnCounter_04_00 and WriteCounter_04_00 take the
counter access size and offset, the wait mask and the write operation,
with their measure functions; ConstructNop records a nop with an optional
leading word and a payload of up to 60 bytes, and ConstructMarker records
the set, push and pop markers by type. Signatures and checks follow
ampr_emu.

The executor now reads and writes counters by access: the 8-byte access
of counter n spans n and n + 1, the 2- and 1-byte accesses a half or a
byte of the counter. Waits compare at the access width, so the signed and
wrapped compares see the field's own sign bit, and the atomic writes wrap
within the field. The legacy counter commands record a 4-byte access.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:02:30 -05:00
Chad 6f5cb736ae fix(libs): match the AMPR 04_00 measure checks of ampr_emu
The WriteAddressFromCounter_04_00 measure checks only the address and the
counter pair measure only the address and an even start, as in ampr_emu.
TechnicalDebt records that AMPR commands are larger than the console
records, which affects titles that pad with Nop to an exact offset, and
that the at-start flag of the 04_00 writes is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:48:45 -05:00
Chad 8289f30a03 feat(libs): implement the AMPR nops and the 04_00 completion writes
sceAmprCommandBufferNop/NopWithData and their measure functions record a
Nop of the requested dwords. The 04_00 forms of WaitOnAddress and of the
time counter, counter, counter pair and event queue writes record the
same commands as the current exports; their at-start flag has no effect,
as commands run in order. Argument checks follow ampr_emu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:28:50 -05:00
Chad a583dc7116 fix(libs): reject odd AMPR counter pairs and invalid write addresses
As in ampr_emu, a counter pair starts at an even counter, and the write
commands take a non-null, 8-byte aligned address; others return EINVAL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:27:00 -05:00
Chad 5018b69fba fix(libs): take the AMPR wait and counter signatures from ampr_emu
sceAmprCommandBufferWaitOnAddress took (address, reference, mask,
compare) and WaitOnCounter (counter, reference, compare), and both read
the compare value as WAIT_REG_MEM (0 always, 1 <, 2 <=, 3 ==, ...).
ampr_emu, which replaces libSceAmpr for retail titles on the console,
has (address, reference, compare, flush) and (counter, reference,
compare, flush) with the SCE compare values (0 ==, 1 > unsigned,
2 < unsigned, 3 !=), so waits were decoded as other comparisons and
could block forever or pass early.

WriteAddressFromCounterPairOnCompletion takes one counter index, not
two, and WriteKernelEventQueueOnCompletion an int id and no user data.
Counter indices above 127, compare values above 3, flush values above 1
and misaligned wait addresses return EINVAL, as in ampr_emu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:25:45 -05:00
DotDebian 638d3802ad feat(ampr): implement the command buffer markers
sceAmprCommandBufferPushMarker, PushMarkerWithColor, PopMarker, SetMarker
and SetMarkerWithColor record a marker command, and the matching
sceAmprMeasureCommandSize functions return its size. The APR executor
skips markers, as it does a nop.

Signatures follow the ampr_emu reimplementation of libSceAmpr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:10:16 +02:00
Michon 2b5f2d32d3 feat: export the AMPR command buffer waits and writes, sceAgcFuseShaderHalves, sceAgcSetSubmitMode, sceNpSessionSignalingCreateContext and sceNetEpollAbort
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 18:19:55 +02:00
devilismyfriend 9c2a75601d feat(libs): agc packet builders, savedata memory, offline service stubs
- libSceAgc: SetIndexCount, SetBaseIndirectArgs, DispatchIndirect, wait
  and write-data patch functions, relaxed checks for what titles send,
  NOP fillers for LOD stats and wait-until-safe, NotImplemented stubs.
- libSceSaveData.native: short mount points, backup events, save-data
  memory slots.
- user/system service, store dialog, video-out flip modes and queue-full
  error, pad read, fibers, offline behaviour for network/NP modules, and
  new export-only modules Ampr, JpegEnc, Json2, MsgDialog.native,
  NpCppWebApi, NpUtility.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177gthrWEBBfBu5xJDXgBfo
2026-09-25 16:27:49 -07:00