Commit Graph
765 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5 14e8ba8486 Make numVBlanks atomic
The WebSocket debugger reads it from its own thread (input.buttons.press counts
down frames against it) while the CPU thread bumps it.

Note the input subscriber and broadcaster need no other changes for thread
safety: __CtrlUpdateButtons, __CtrlSetAnalogXY, __CtrlPeekButtons and
__CtrlPeekAnalog all take ctrlMutex internally, so routing them through
Core_RunOnCPUThread() would only add a blocking round trip.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
2026-08-17 13:11:16 +02:00
Henrik Rydgård 9f90512ef6 Make instruction cache invalidation (for us, jit cache invalidation) clearer 2026-08-16 16:59:52 +02:00
Henrik Rydgård 2096179dce Drive-by code cleanup 2026-08-15 18:31:20 +02: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 e9a3449ede More MIPSState * plumbing (manual) 2026-08-12 14:02:19 +02:00
Henrik Rydgård 1830945ca7 MpegDemux: fix heap-underflow rewind and add hard bounds to read8/skip
demux()'s "not enough data, rewind and try again next time" logic
unconditionally subtracted 4 (or 6) from m_index, assuming that many
bytes were consumed scanning for a start code. But the inner scan can
also exit via reaching the end of the buffer without finding a start
code at all, having consumed fewer bytes than that - when the buffer
holds under 4 bytes total, m_index goes negative, and the subsequent
memmove(m_buf, m_buf + m_index, size) then reads before the start of
m_buf. Clamp the rewind to 0.

read8()/skip() also had no bounds check against m_len (the actual
buffer allocation) at all - readPesHeader()'s header-length fields are
only cross-checked against the outer PES packet length, not against
how much data is actually available, so a crafted stream claiming a
long header could walk m_index past the buffer. Bound both against
m_len directly, at the lowest-level primitives so every caller is
covered.
2026-08-12 09:43:23 +02:00
Henrik Rydgård 90d8be9348 sceSasSetGrain/SasReverb: validate grain size and reverb preset index
sceSasSetGrain took no validation at all, unlike sceSasInit's grain
size check - a bad value could both throw on SasInstance::SetGrainSize's
allocation and, for a moderately large but successfully-allocated
value beyond PSP_SAS_MAX_GRAIN, read out of bounds of the fixed-size
mixTemp_ buffer during mixing. Apply the same bounds sceSasInit uses.

SasReverb::SetPreset() only checked the upper bound of `preset` before
indexing presets[], not the lower bound (-1 means "off"). The only
live HLE entry point (sceSasRevType) already clamps to [-1, 8], but
DoState() passes a savestate-deserialized value straight through with
no revalidation, so a corrupted/malicious savestate could index
presets[] negatively.
2026-08-12 09:43:23 +02:00
Henrik Rydgård bfbe44ad1c SimpleAudioDec: fix unsigned underflow and unvalidated stream-data size
FindNextMp3Sync() computed `sourcebuff.size() - 2` as the loop bound;
when size() is 0 or 1 this underflows to a huge size_t, turning the
scan into an out-of-bounds read. Reachable via sceMp3NotifyAddStreamData
followed by sceMp3Decode with as little as 1 pending byte.

AuNotifyAddStreamData() trusted the game-supplied `size` outright: a
negative value would make sourcebuff.resize() attempt a huge
allocation (via size_t underflow), an unbounded positive value grows
sourcebuff without limit, and the validated range didn't match the
actual read range (checked [AuBuf, AuBuf+size) while reading from
[AuBuf+offset, AuBuf+offset+size)). Validate size is positive and
capped to the buffer's declared capacity, and validate the range
actually read.
2026-08-12 09:43:23 +02:00
Henrik Rydgård 0596ee97f6 More memory access cleanup 2026-08-11 20:14:01 +02:00
Henrik Rydgård 3c81d6b121 More manual Read_U32 cleanup
Buildfix
2026-08-11 10:28:36 +02:00
Henrik Rydgård afe4d5beaf Buildfixes, dependency shuffling to make things more logical 2026-07-24 14:43:34 +02:00
Henrik Rydgård 78c9952731 Move Qt camera code out of Core 2026-07-24 12:06:15 +02:00
Henrik Rydgård 240a974e95 Remove direct dependency from Core to MacCameraHelper.mm 2026-07-24 12:06:15 +02:00
sum2012 e2c60f93ea Add comment 2026-07-16 20:49:52 +08:00
sum2012 10e78523f0 Fix MpegDemux by Gemini
Fix #13858

1.
Robust Header Detection: Updated MpegDemux::hasNextAudioFrame to scan the buffer for a valid header. This fixes the issue where leading garbage data (often present at chapter starts) would cause the demuxer to report "no data" and get stuck.
2.
ATRAC3+ Alignment: Fixed the header skip logic in demuxStream for the 0x90-0x9F range. It now correctly skips the 4-byte sub-header, ensuring audio frames are properly aligned.
These changes should resolve the "Audio end reach" errors and missing voice in Chapters 2-4
2026-07-16 06:17:17 +08:00
Henrik Rydgård 993c3a9c67 Avoid accurately computing disk space on iOS and Android (where it can be slow). Add a setting. 2026-07-14 22:22:29 +02:00
sum2012 d6477e808f Fix setAudioStream 2026-06-08 23:04:29 +08:00
Henrik Rydgård f60e27a9b7 Just some refactoring of the GPUStatistics struct, and more use of StringWriter 2026-05-29 14:40:31 +02:00
Henrik Rydgård e0a5a3e2bf iOS: Add basic deep link support.
Fixes #21577
2026-04-28 22:17:24 +02:00
Henrik Rydgård 811c4bc577 Remove the VblankListener callback mechanism, do direct calls instead
Should fix #21575
2026-04-28 16:27:12 +02:00
Henrik Rydgård 22b07849cf Add a missing lock 2026-03-13 11:35:10 +01:00
Henrik Rydgård e9930c77fd Show more info in sysinfo build config, including the FFMPEG version PPSSPP was built with 2026-03-02 00:24:19 +01:00
Henrik Rydgård e80c67df25 Fix check for top screen. Fixes a problem with input focus after game reset.
Reported by Flide, thanks!

However, there's some underlying bug in screen focus tracking, this just works around it by checking for top screen in a more reliable way.
2026-03-01 17:47:46 +01:00
Henrik Rydgård 40a5cd1509 Minor logging improvement, refresh gamescreen on deleted savedata 2026-02-19 16:05:00 +01:00
Henrik Rydgård f5b2df6111 Only clear vblank listeners on exec start, not flip listeners.
This needs kind of a different type of cleanup, actually, but that's for
later (I want to get rid of this registration mechanism entirely).

Fixes #21239
2026-02-11 15:38:18 +01:00
Henrik Rydgård 09b087f16f Resume gameplay immediately after choosing Reset on the pause screen. 2026-02-10 00:22:09 +01:00
Henrik Rydgård d9ba20ce99 Add sanity checks in GPU::PerformMemoryCopy and GPU::PerformMemorySet
Part of #21055
2026-01-01 14:43:14 +01:00
Henrik Rydgård f5a211884b Minor cleanups, comments
Comments and warnings
2025-12-30 20:31:06 +01:00
Henrik Rydgård c932c632a6 Add some sanity checks in SimpleAudioDec to avoid crashes 2025-12-30 20:31:06 +01:00
Henrik Rydgård 55d53bd29a Handle devices with really extreme DPIs. Fixes #21001
I thought I did this already but apparently not, or it got lost in a
branch.
2025-11-15 15:26:06 +01:00
Tolstoy Justin 673c1e76a9 Add macOS camera bridge and polish PSP camera emulation 2025-11-09 00:01:07 +00:00
oltolm 122eddfe0f ffmpeg: update API for ffmpeg 8 2025-11-05 19:11:32 +01:00
oltolm a9c45eaae4 MediaEngine: use "avpriv_stream_set_need_parsing" 2025-10-30 23:46:21 +01:00
Henrik Rydgård 5aeab28e9b Remove the "Percentage of framerate" frameskip type 2025-10-20 11:49:41 +02:00
Henrik Rydgård 5685331198 Unrelated sanity checks in audio 2025-09-12 12:17:27 -06:00
Henrik Rydgård e00ef04792 Granular queue: Use the current FPS to get an estimate for how long the maximum queue size should be. 2025-08-22 21:21:20 +02:00
Henrik Rydgård 07ad5ff372 Add more measurements to the granular mixer queue 2025-08-22 21:21:20 +02:00
Henrik Rydgård 8a76ac74fc Granule queue: Move masking to access instead of increment 2025-08-22 21:21:20 +02:00
Henrik Rydgård 5b0d8c06c6 Add debug UI for granule mixer 2025-08-22 21:21:19 +02:00
Henrik Rydgård a1d0f405b1 Remove quantization error thingy. Other cleanup 2025-08-22 21:21:19 +02:00
Henrik Rydgård db24efcfa4 Remove the inner class, since we're only working with a single stereo stream. 2025-08-22 21:21:19 +02:00
Henrik Rydgård 878975ad80 Rework granule mixer code style a little, optimize. 2025-08-22 21:21:19 +02:00
Henrik Rydgård 0fa7349f5a Integrate Dolphin's granule based audio resampler.
Removed parts of it that were not relevant.

Working, it seems. Not sure about the buffer size thing.

Not defaulting it for now

See #20146 and https://github.com/dolphin-emu/dolphin/pull/13352

..
2025-08-22 21:21:19 +02:00
Henrik Rydgård 0502d79c99 Remove the return value from NativeMix, correct mixing with other channel numbers than 2 2025-06-18 23:48:00 +02:00
Henrik Rydgård f595e83a44 Add computed buffer latency in ms to StereoResampler stats 2025-06-18 11:39:14 +02:00
Henrik Rydgård cc3fbb22e4 Change some stat arrays from double to float (to save mem bandwidth) 2025-06-18 11:00:27 +02:00
Henrik Rydgård 702c84e019 Code style fix in StereoResampler 2025-06-18 11:00:03 +02:00
Henrik Rydgård f537356bd2 Fix bug when setting reverb volume to 0 2025-06-12 11:39:46 +02:00
Henrik Rydgård d00f8f9401 Display: Don't clear display callback listeners when starting a new exec.
Fixes https://github.com/RetroAchievements/RAIntegration/issues/1186
2025-06-07 17:43:18 +02:00
Milan Nikolic 1c6a420cb4 Fix building without ffmpeg 2025-05-26 11:40:08 +02:00