Commit Graph

38 Commits

Author SHA1 Message Date
eljackjoestar-cmd 9a0c59570c feat(ajm): decode Opus surround mapping family 2026-10-12 02:28:14 +04:00
Adrià 40d50b3f16
Merge pull request #2395 from ArchitDewan/fix/atrac9-gradient-bounds
fix(ajm): reject ATRAC9 gradients beyond decoder bounds
2026-10-11 10:29:27 +02:00
raghav314 29c0814c90 fix(ajm): an Opus run stops before the next packet once the output has no room for its frame
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 13:00:50 +05:30
raghav314 26bd36df84 fix(ajm): decode a single input buffer in place instead of copying its stated size
A job's inputs were joined into one vector before decoding, copying every
input buffer at its stated size. PPSA36082's FMOD submits Opus run jobs
whose one input buffer states 0xFFFFFE74 bytes (a remaining size that
went below zero) ahead of a single packet, so each such job copied about
4 GiB and sceAjmBatchStart took about a second; the mixer missed its
deadline and the title pushed silence. A job with one input buffer now
decodes from that buffer in place, reading only the packets it decodes;
jobs with several input buffers are joined as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 13:00:50 +05:30
MathiasDevelopes e8209307e9 feat(libSceAjm): implement sceAjmBatchJobDecodeSplit and sceAjmBatchJobSetResampleParametersEx
sceAjmBatchJobDecodeSplit queues a split run job with the stream
sideband, as sceAjmBatchJobDecode does for a single buffer pair.
sceAjmBatchJobSetResampleParametersEx with a zero ratio change per
sample sets the ratio as sceAjmBatchJobSetResampleParameters does; a
non-zero change throws, since its ramp is unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 18:24:54 +02:00
Dean c323d49386
Merge pull request #2052 from esatturan/fix/ajm-atrac9-gapless-segments
fix(ajm): decode an ATRAC9 run's whole input and follow gapless segments
2026-10-10 18:36:09 +13:00
Dean 9ac075e8c0
Merge pull request #1926 from fisherjoey/fix/exit-teardown-order
fix(ajm, apr): keep AJM and APR state alive through static teardown
2026-10-10 17:42:42 +13:00
Joey Fisher f2d201fbbf fix(ajm, apr): keep AJM and APR state alive through static teardown
AJM's instance and batch tables and APR's file, directory and AMM
state were namespace-scope statics, destroyed by std::exit while the
title's threads keep calling the libraries. A decoder thread then read
a freed instance (an unknown codec), sceAjmBatchWait no longer found
its batch, and APR resolved file ids through a freed vector. The state
is now allocated once and never destroyed.
2026-10-09 20:14:04 -06:00
esatturan 9c95d4810e fix(ajm): decode an ATRAC9 run's whole input and follow gapless segments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:29:58 +03:00
Archit Dewan 4a5cd6e40b fix(ajm): reject ATRAC9 gradients beyond decoder bounds 2026-10-09 13:53:46 -04:00
LeandroLP23 c2231a821a fix(ajm): throw for a null buffer list with a nonzero count
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:37:04 +02:00
LeandroLP23 2bdb979e69 fix: clear the GCC warnings in ProfileOutput, fopen, Ajm batch jobs and the SHA-256 test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:37:04 +02:00
Joey Fisher 24623021cd fix(ajm): decode multichannel ATRAC9 streams
Config 0x30 (the ambisonic layout, 4 to 16 channels) was rejected at instance init, so Demon's Souls asserted in
its audio player and crashed entering the tutorial level. Each channel is decoded as a mono stream and the
blocks are interleaved.
2026-10-08 15:44:01 -06:00
Arvind Frøiland 5019c1eee8 refactor(libSceAjm.native): name the WVorbis stubs by their NIDs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:24:25 +09:00
Claude 121d9332b5
build(libs): strip the MinGW static runtime flags once for all libraries
Every library CMakeLists.txt ended with the same block removing -static,
-static-libgcc and -static-libstdc++ from CMAKE_EXE_LINKER_FLAGS on MinGW,
because core/libs/CMakeLists.txt only removed them after adding the library
directories. Remove them before the libc and library directories are added
so each directory inherits the stripped flags, and drop the 52 copies.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017pTZqAyVSZy2FZmaqakPHZ
2026-10-07 10:10:38 +00:00
alfalfa-star e91fe0f063 feat(libs): declare the exports PPSA14632 imports that no library provides
LEGO Horizon Adventures imports 19 functions that no library exports
and no open pull request adds, so it fails eager binding. They are
declared as throwing stubs. The two libSceAjmWVorbis imports have no
known name and are exported by NID from libSceAjm.native.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 07:10:13 +02:00
raghav314 72be77590c feat(ajm): implement sceAjmBatchJobSetResampleParameters and sceAjmBatchJobGetResampleInfo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 05:36:31 +05:30
Dean e323c1f2b9
Merge pull request #909 from adriadam10/feat/ajm-batch-job-get-info
feat(libSceAjm.native): implement sceAjmBatchJobGetInfo
2026-10-07 10:08:12 +13:00
Adrià Franch 05de11ac1e feat(libSceAjm.native): implement sceAjmBatchJobGetInfo
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-06 18:01:46 +02:00
Celegans12 5e18e84f33 feat(ajm): implement sceAjmBatchJobControl
sceAjmBatchJobControl threw. It now appends a control job that keeps
the sideband input pointer and runs at sceAjmBatchStart: RESET (bit 13)
clears the context as sceAjmBatchJobClearContext does, INITIALIZE
(bit 14) initializes the codec, and SIDEBAND_GAPLESS_DECODE (bit 45)
overwrites the gapless total and skip counts, in this order.

The sideband input holds the gapless decode first, then the codec's
initialize parameters: 8 bytes for ATRAC9, 12 for Opus, none for MP3.
The output is the 8-byte result. Other flags, INITIALIZE for other
codecs, and other sizes throw. SIDEBAND_GAPLESS_DECODE without RESET
throws too: RPCSX and shadPS4 keep zero counts there. The bits and the
order follow shadPS4 (PS4), the overwrite with RESET follows RPCSX, and
the sizes follow the one title seen.
2026-10-06 14:45:10 +02:00
Dean 52ae2270fc
Merge pull request #768 from adriadam10/feat/ajm-mp3-parse-ofl
feat(ajm): parse the original file length in sceAjmDecMp3ParseFrame
2026-10-06 12:41:38 +13:00
Adrià Franch fc96f96ac5 feat(ajm): parse the original file length in sceAjmDecMp3ParseFrame
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-06 00:26:19 +02:00
raghav314 c0c34cc83c feat(ajm): implement sceAjmBatchCancel
sceAjmBatchStart processes every job before it returns the batch id, so a
batch that has not been waited on is never pending: cancelling it returns 0.
A batch that was never issued or was already waited on returns INVALID_BATCH,
and a context id that was never issued returns INVALID_CONTEXT, as in shadPS4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 03:45:33 +05:30
raghav314 23c2816d21 fix(ajm): release a batch when sceAjmBatchWait returns
sceAjmBatchStart records the batch id it hands out and sceAjmBatchWait
removes it. Waiting on a batch id that was never issued or was already
waited on returns INVALID_BATCH instead of 0, as in shadPS4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 20:36:40 +05:30
raghav314 2771eeea77 feat(ajm): implement DecodeSingle, GetGaplessDecode and GetCodecInfo
sceAjmBatchJobDecodeSingle runs a single-frame decode job with the stream
sideband. sceAjmBatchJobGetGaplessDecode and sceAjmBatchJobGetCodecInfo
append run jobs without buffers that return the gapless-decode and codec-info
sidebands.

A run job without input or output buffers no longer decodes: it reports the
instance state with a zero result instead of PARTIAL_INPUT on MP3 and Opus.

RUN_GET_CODEC_INFO (bit 11) writes the ATRAC9 codec info after the gapless
sideband. Codec info for other codecs, and codec info together with
RUN_MULTIPLE_FRAMES, throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 05:55:12 +05:30
DotDebian f99be7e4d3 feat(ajm): implement sceAjmDecMp3ParseFrame
Read the MPEG audio frame header and report the frame size, channel
count, samples per channel, bitrate and sample rate. The signature,
the result layout and the rate tables follow shadPS4's reimplementation
of the PS4 library. Requesting the original file length throws: that
lookup is not implemented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 01:24:18 +02:00
Pacuka 3e5648dcf7 fix(ajm): refuse Opus rates other than 48 kHz and record the parameter layout as unknown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:28:19 +02:00
Pacuka 5ecf80e2f5 feat(ajm): decode Opus (codec 24) through FFmpeg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:26:57 +02:00
Dean 0bd34077b4
Merge pull request #455 from arreina/pr/libatrac9-bounds
fix(audio): bound ATRAC9 decoding to the superframe
2026-10-04 15:41:29 +13:00
Alberto Ruiz 9879deca69 fix(audio): bound ATRAC9 decoding to the superframe
LibAtrac9 read its bitstream without a length, so a corrupt ATRAC9 frame
made the decoder read past the end of the guest's buffer. Update the
submodule to 946e05a ("Prevent bitstream overruns"), whose decode
functions take the buffer size, and pass the bytes left in the
superframe from NGS2, AJM and Audiodec. The callers already reject a
frame that consumes more than the superframe holds.

ngs2_atrac9 places a synthetic corrupt superframe right before an
inaccessible page and expects the render to report the decode failure;
with the previous LibAtrac9 it crashes with a segmentation fault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R5WJS4ZdQynAJesCZKH5hb
2026-10-03 14:25:49 +02:00
Michon 8bbba91a04 fix(ajm): a decode job fits the 64-byte batch titles allocate
Batch jobs were stored as a 72-byte header plus 16 bytes per buffer, so one decode
job took 104 bytes. GTA V initializes its MP3 batches with 0x40 bytes, every
sceAjmBatchJobDecode returned SCE_AJM_ERROR_OUT_OF_RESOURCES and its streamed
music and speech stayed silent. A job is now a 32-byte record, its buffers, and
its parameters only when it has any; the MP3 test decodes through a 64-byte batch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-03 01:18:56 +02:00
Adrià Franch 2036697758 fix(ajm): convert planar 16-bit MP3 output from FFmpeg
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-02 09:20:45 +02:00
STL1te 6b36c050fe style: drop the branch's code comments per CONVENTIONS.md
Only the lines this branch added lose their comments; the commits before
keep them, with the reasoning behind each change, for whoever digs into
that code later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 21:25:29 +03:00
STL1te 028d465e98 feat(audio): AJM MP3 through FFmpeg, 16-bit and ambisonic AudioOut2, voice
- AJM codec 0 (MP3) decodes with FFmpeg, prebuilt through the
  ffmpeg-core submodule as in Kyty; sceAjmBatchJobDecode and the Run job;
  the PCM encoding follows the job flags; other codecs throw
- AudioOut2 ports of 16-bit integer samples, and the ambisonics speaker
  array decode for the reported layout
- the voice library for a console with no headset, with a frame size for
  voice ports

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 21:22:15 +03:00
devilismyfriend 91557ebade feat(audio): AudioOut2 SDL output queue, ATRAC9 decoder in libSceAjm.native
- AudioOut2: one SDL device per context; the hardware grain queue level
  is derived from the SDL queued bytes so the title's poll-and-push loop
  runs at real time; ports are mixed per push with 7.1 folded to stereo.
- libSceAjm.native: instance and batch APIs; ATRAC9 decoding with
  variable-size frames inside superframes, padding, gapless parameters
  and handle re-creation on re-initialisation.
- AudioOut v1: sceAudioOutOutput(handle, NULL) drains instead of
  throwing.

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
boykopovar abc72da741 feat(libs): define vabi macros + add to declarations 2026-09-10 08:07:03 +03:00
boykopovar 6123893998 feat(libs): throw not impl ex in every stub 2026-09-06 15:05:04 +03:00
boykopovar 59bee8d187 feat(libs): add libs function signatures 2026-08-20 23:18:16 +03:00