Commit Graph
18 Commits
Author SHA1 Message Date
hypermoistandClaude Opus 5.5 aeb2346bb8 fix(libSceJpegDec): keep an input stream alive for the call reading it
parseStream and decodeStream held a reference into the stream map
outside streamMutex while the guest's input callback ran. A callback
that deleted the handle, or a delete or new parse on another thread,
erased the stream under the running call.

- The map holds shared streams; each call keeps its own stream until
  it returns, and the callback still runs outside streamMutex.
- A call that reaches a stream another call is still reading throws,
  as the console's answer is not known; the debt entry says so.
- Tests: deleting the handle from the callback during a parse and
  during a decode, and a decode re-entered from the callback.
- The test no longer requires parse operation 0x11 to throw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:03:57 +13:00
hypermoist c83ff8a84f docs(libSceJpegDec): state input-control gaps first and condense debt entry
Assisted-by: Antigravity:gemini-3.8-flash
2026-10-27 18:55:01 +13:00
hypermoist f3834c5d87 Merge remote-tracking branch 'upstream/main' into feat/jpegdec-input-control-m3
# Conflicts:
#	docs/dev/debt/libSceJpegDec.md
2026-10-27 18:52:03 +13:00
hypermoist b035153876 fix(libSceJpegDec): return 0x80650012 on malformed input-control parse
Match PS5 firmware 13.42 module behavior by returning 0x80650012
(DECODE_ERROR) rather than 0x80650010 when input-control parse ends
before the frame header or encounters malformed marker data. Drop
the throw assertions for unsupported down scale and missing header
decodes in GuestJpegDecInputControl.cpp as requested in review.

Assisted-by: Antigravity:gemini-3.8-flash
2026-10-27 18:51:31 +13:00
hypermistandClaude Opus 5.5 6361f29a64 docs(libSceJpegDec): cite firmware 13.60, not 12.00, for the decrypted modules
The firmware version comes from the SDK 0x13600007 recorded in each module's module-param segment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013XFS3FUfBtqCVfwmBrRQ6q
2026-10-24 01:04:47 +13:00
xXPBSXxandClaude Sonnet 5.5 c17085cad5 docs(debt): note how a title calls sceJpegDecDecode
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-23 11:27:03 +02:00
hypermistandClaude Opus 5.5 e7d5de2ed7 fix(libSceJpegDec): stop parsing a stream that can no longer form a frame header
The parse phase kept asking the callback for input until it ended. It now stops once the buffered bytes do not start with SOI, reach EOI or break the marker structure before a frame header, so a source that never ends cannot loop. The debt entry also notes that a stream stays in host memory when the work memory is freed without sceJpegDecDelete.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SNqSvnFwRBz3D76n476yw6
2026-10-23 04:08:05 +13:00
hypermistandClaude Opus 5.5 30b12ab173 feat(libSceJpegDec): stream JPEG input through a callback in sceJpegDecDecodeWithInputControl
The export takes the decoder handle, a 0x38-byte parameter block and an
image-info pointer. The block starts with an input callback and its
argument; the callback fills a {data, size} chunk and a negative result
or an empty chunk ends the input. Operation 0x10 parses the header and
fills the image info, and 0x20 continues the same stream, with a new
callback if given, and decodes into the image buffer. Bit 0 is the
decode mode. The decode checks match sceJpegDecDecode's and run before
any more input is read, and the result is the packed output size.

Both phases run through the same header, image-info and decode steps as
the memory-based calls, so the decode path is shared with
sceJpegDecDecode: its target checks and image writing move into helpers.

Read from libSceJpegDec.sprx, firmware 12.00, not measured on a console.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SNqSvnFwRBz3D76n476yw6
2026-10-23 02:05:18 +13:00
boykopovar bc730915a0 docs(jpegdec): retain remaining decoder compatibility gaps 2026-10-21 21:52:25 +03:00
boykopovar d0417623a7 fix(jpegdec): enforce component row buffer capacity 2026-10-21 21:52:25 +03:00
boykopovar c3eba45600 fix(jpegdec): recover image metadata and coefficient requirements 2026-10-21 21:52:24 +03:00
boykopovar a058d8d8fa fix(jpegdec): enforce native decode parameter limits 2026-10-21 21:52:23 +03:00
boykopovar 65f686c336 fix(jpegdec): restore error codes and work memory contract 2026-10-21 21:52:23 +03:00
al3w0f205 8ea3b5cab5 fix(libSceJpegDec): reject misaligned output buffers and oversized alpha values 2026-10-20 07:12:43 -05:00
Dean 587bb343e8 Merge pull request #8106 from juanpimg/feat/prx-declare-ps5-3.20-exports
feat(prx): declare the missing PS5 3.20 system exports
2026-10-20 21:13:30 +13:00
juanpimg 2f0ed638dc feat(prx): declare the missing PS5 3.20 system exports
AnyPS5 resolves a title's imports by NID, so a title that imports a system
function no library provides fails to load with an unresolved import. The
PS5 3.20 export inventory lists 193 such exports across 37 PS5 system
libraries AnyPS5 implements but does not provide.

Declare them as throwing stubs so those titles load and reach their next
blocker. Each declaration calls NotImplemented_nid_no_patch and returns 0;
none of them implements the function. Declarations with a credible
prototype use it and cite the source with a pinned commit, and the rest
are declared without parameters, which resolves the import without making
an ABI claim. The technical-debt files record the limitation per library.

libSceMbus and libSceSystemService are left out because pull request #7821
declares them. libSceAgc is left out because its exports are versioned, so
the 3.20 NID names a different symbol from the one AnyPS5 ships.
libSceAvPlayer.native is left out because it compiles libSceAvPlayer's
Export.cpp.

Names and NIDs come from the PS5 3.20 export inventory at
https://github.com/DNNDHH/PS5-3.20_Libs/tree/b2a77c09cd71c01f34c790cfbe98c751a13262ad
2026-10-19 23:16:55 +02:00
Federico Marras d65c969df8 feat(libSceJpegDec): decode with a down scale of 2, 4 or 8
sceJpegDecParseHeader and sceJpegDecDecode threw for every down scale
other than 1. SharpProspero's JpegDec.cs documents the factors 1, 2, 4
and 8 and output dimensions that account for the down scale.

Decoder::Jpeg gains DecodeScaled, which decodes through libjpeg-turbo's
scaled inverse DCT, and ScaledDimension, its rounded-up output size.
sceJpegDecParseHeader reports the scaled output size; sceJpegDecDecode
checks the pitch and image buffer against it, writes the scaled image
and packs the output size into its result. A down scale of 1 still
decodes as before. Decode modes other than 0, other down scales and a
down-scaled CMYK or YCCK image still throw.
2026-10-19 18:57:12 +02:00
RickandClaude Opus 5.5 95e51985d4 fix(libSceJpegDec): use the JpegDec parameter and image info layouts
The JpegDec structures were libScePngDec's under new names. OpenOrbis
jpeg.h and SharpProspero JpegDec.cs agree on a 12-byte create param, a
0x30-byte decode param with a coefficient buffer, decode mode and down
scale, and a 0x24-byte image info that reports the coefficient memory
size, the suitable CSC attribute and the output size.

Accept the CSC attributes 1 and 2 that SharpProspero passes, fill the
output size, component count, coefficient memory size and suitable
attribute, apply the requested alpha, and throw for decode modes other
than 0 and down scales other than 1.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-13 16:44:09 +02:00