Commit Graph
369 Commits
Author SHA1 Message Date
Henrik Rydgård 10a9d7bb31 De-claude some overly verbose comments 2026-09-14 10:42:55 -06:00
Henrik RydgårdandClaude Opus 5 6110a27b73 sceVideocodec: one layout helper for the eight frame buffers
Four places were each computing the same sizes and 64-byte-aligned offsets:
the allocation, the recovery sceMpegbase uses, and the readers on both sides.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-12 12:53:13 -06:00
Henrik RydgårdandClaude Opus 5 00770764a7 Run the real mpeg.prx in place of our sceMpeg HLE
Add flash0:/kd/mpeg.prx to the sceUtility module swap, hung off av_mpegbase,
so it loads when DisableHLEFlags::sceMpeg is set. Games that ship their own
sceMpeg_library on the disc never get here and just use theirs.

The piece that was missing to make it work: the access unit address mpeg.prx
passes to sceVideocodecDecode is in Media Engine space, which we can't read.
On hardware sceMpegBasePESpacketCopy DMA'd the payload there first. That copy
is ours, so it now gathers the blocks and sceVideocodec decodes from those,
falling back to main memory for any caller that points at it directly. The
gather is keyed by destination, because that call carries the audio payload
too - video to an ME address, audio to main memory - and handing an ATRAC
packet to the H.264 decoder gets you nothing.

With that, video/mpeg/basic gets a 144x80 frame out of real Sony code driving
our sceVideocodec through ffmpeg. The test still fails overall, as it did
before this branch - it is in tests_next.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-12 12:53:13 -06:00
Henrik RydgårdandClaude Opus 5 7c6f9d18b8 sceMpegbase: implement the colour conversion functions
Five of the six functions in this module were registered as nullptr, so any
caller reaching them got nothing. mpeg.prx needs all of them, and this is the
first of the pieces required before the real module can run in place of our
sceMpeg HLE.

The module gets its own file at the same time. It was a tail of sceMpeg.cpp,
which is long enough already, and everything below is new code for it.

sceMpegBaseCscAvc and sceMpegBaseCscAvcRange convert the ME's decoded output to
RGB. The 48-byte descriptor holds the frame size in macroblocks at 0x10 and
0x14 - it appears at 0x00/0x04 too, but scaled differently depending on which
path built it, so the second pair is the one every caller agrees on - and the
four luma buffers at 0x20. What they point at is not planar: luma arrives as
16-pixel-wide vertical strips alternating between buffers on every other line,
and chroma as Cb/Cr pairs interleaved across four more. All eight are untangled
into planes once per frame before converting, which keeps the pixel loop
readable.

sceMpegBaseCscInit carries the default buffer width for callers that pass zero.
sceMpegBaseCscSetPixelMode (0x0530BE4E - the official name isn't known) carries
the output format, in mpegbase's own numbering rather than the GE's: mpeg.prx
gets it by indexing a table of {1, 2, 3, 0} with the pixel mode the game gave
sceMpegAvcDecodeMode, making 0 ABGR8888 and 2 ABGR5551. Read as a GE mode it
turned Thrillville's black into blue.

sceMpegBaseYCrCbCopy copies the descriptor but not the buffers it points at,
and says so in its log - nothing seen so far needs more, and inventing the
buffer copy without something to test it against seemed worse than a note.

Behaviour is cross-checked against JPCSP, which implements all of these.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-12 11:52:09 -06:00
Henrik Rydgård c5e4d0d90d Rename the get-memory-pointer functions to make it clear where CPU exceptions can happen. 2026-08-12 14:06:16 +02:00
Henrik Rydgård 0596ee97f6 More memory access cleanup 2026-08-11 20:14:01 +02:00
Henrik Rydgård 9396030f02 More Read_U32 cleanup 2026-08-11 09:08:52 +02:00
Henrik Rydgård 66c8bfbcb2 Improve semantics 2026-08-10 10:11:24 +02:00
Henrik Rydgård ee1314f803 Add new TexCache logging channel 2026-07-18 11:57:56 +02:00
Henrik Rydgård 3d7817a5e3 Fix savestate issue 2026-07-10 12:28:44 +02:00
Dave Leaver 41c3eba296 Call the callback once from put, and have the action call it again if needed 2026-07-10 12:12:39 +02:00
Dave Leaver d31881f0bb cludge fix write position updating 2026-07-10 12:12:39 +02:00
sum2012 9c78c886e1 Fix multi-stream handling system that supports both selective ignoring and active stream switching
Fix #15606
But bypasses all  setAudioStream , MediaEngine state-changing or data-consuming calls.
2026-06-08 23:00:36 +08:00
sum2012 b26dcb3f9a Try to fix 'avail' test 2026-06-07 20:27:06 +08:00
sum2012 dad0707412 fIX AI deleted this line
Fix UFC 2010 video
2026-06-07 19:10:01 +08:00
sum2012 dd0fa10f89 Fix muti ringbuffer structures for mpeg
Fix #11934
2026-06-06 04:56:11 +08:00
Henrik Rydgård dad8df3860 More logspam reduction 2026-02-10 15:05:29 +01:00
Henrik Rydgård 841e4c8564 Add various checks trying to avoid various crashes found in Google Play crash reports. 2026-02-05 11:12:53 +01:00
Henrik Rydgård b64d7b217f Add a --root= command line argument to override what host0: is mounted to.
Fixes #20191
2026-01-06 20:41:35 +01:00
Henrik Rydgård 5f7a937466 Rename ValidSize to ClampValidSizeAt 2025-12-30 20:31:07 +01:00
Henrik Rydgård 602418aa1f Merge pull request #20957 from sum2012/mpeg-patch
Update Mpeg function
2025-11-06 23:19:52 +01:00
oltolm 122eddfe0f ffmpeg: update API for ffmpeg 8 2025-11-05 19:11:32 +01:00
sum2012 e2cd044c15 Update Mpeg function
By Minimax AI
https://agent.minimax.io/share/329845662670997?chat_type=0
2025-11-02 20:52:27 +08:00
Henrik Rydgård 9e3d57167f Show sceAac contexts in ImDebugger 2025-07-20 19:30:35 +02:00
Henrik Rydgård 43e79aba55 Give Mpeg and Atrac their own log categories 2025-06-24 21:36:04 +02:00
Henrik Rydgård 52a7709fb5 Log cleanup. Fix very minor memory leak 2025-04-14 22:38:22 +02:00
Henrik Rydgård 3cd1f2f832 sceAudioCodec: Fix AT3 and AAC playback (possibly limited to certain bitrates) but fixes Kosmodrones 2025-04-13 15:48:11 +02:00
Henrik Rydgård e90b91701f Warning fixes 2025-04-09 13:13:13 +02:00
Henrik Rydgård 9738a9511f Build and warning fixes 2025-04-07 23:17:56 +02:00
Henrik Rydgård efa022b754 Expose sceMpeg context to a future debugger window. Some general log cleanup. 2025-04-03 22:39:14 +02:00
Henrik Rydgård 521d386aec Warning, format fix 2025-04-02 09:26:04 +02:00
Henrik Rydgård 4e25f44eef Rename some module-related functions to include HLE where appropriate 2025-03-31 11:17:50 +02:00
Henrik Rydgård ea198dd593 Add mpeg error codes to the big enum 2025-03-21 20:44:46 +01:00
Henrik Rydgård eff9bd1fc3 mpeg: Minor cleanup 2025-03-19 11:41:17 +01:00
Henrik Rydgård 0f9c97c2a0 Another big batch of logging cleanup 2025-03-05 17:02:46 +01:00
Henrik Rydgård ad2791a9cf More HLE logging cleanup 2025-03-05 17:02:46 +01:00
Henrik Rydgård 28b2c7f540 HLE log rename part 1: Remove duplicate log functions. Return type should be determined by metadata. 2025-01-29 09:45:39 +01:00
Henrik Rydgård c7078f31fd Rename "networkInited" to g_adhocServerConnected, which is what it is 2025-01-20 20:58:22 +01:00
Henrik Rydgård 7d2ad6980e Another batch of changes 2025-01-20 12:20:21 +01:00
Henrik Rydgård 2523690584 Flip around so sceDelayResult is always outermost. Start using HLECall. 2025-01-20 12:20:18 +01:00
Henrik Rydgård 5316ec7ef7 Fix more misuse of the hleLog* functions 2025-01-19 13:09:30 +01:00
oltolm 9566065455 make compile on mingw-w64 2025-01-11 01:25:27 +01:00
Henrik Rydgård 3e198c53b2 More include cleanup 2024-12-18 13:57:26 +01:00
Henrik Rydgård 0df2a40487 Remove the "GPUInterface" base class. Not really useful, GPUCommon is pretty much the same thing. 2024-12-02 11:12:14 +01:00
Henrik Rydgård 2a05dce105 Show sceMp3 in audio codecs window 2024-11-27 10:35:11 +01:00
Henrik Rydgård 5926886c0c Some include cleanup, delete some obsolete code 2024-07-25 14:52:41 +02:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Henrik Rydgård 5b3be0d720 Update USE_FFMPEG checks 2024-04-10 18:40:02 +02:00
Andrew Udvare 930b7f644d ffmpeg: Improved fix for checking if const AVCodec* is necessary 2024-02-05 14:37:09 -05:00
Henrik Rydgård 3bd2b1c7a7 Merge pull request #18670 from Tatsh/ffmpeg
Fix compilation against newer ffmpeg versions
2024-01-14 14:16:36 +01:00