Commit Graph
48052 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 c70fc68261 Remove leftovers of 32-bit ARM Windows support
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 13:58:29 -06:00
Henrik RydgårdandClaude Opus 5.5 aad83c044f docs: Native debuggers vs. the memory fault handler
How to keep lldb and gdb from stopping on the faults the handler is meant
to catch, and the crash_*.prx tests as a quick check that it works.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 13:58:29 -06:00
Henrik RydgårdandClaude Opus 5.5 c4884040ee Mac/iOS: Hook up the memory fault handler, including on ARM64
Apple platforms now use the same SIGSEGV/SIGBUS handler as Linux instead of
a Mach exception port. The Mach port was only set on the installing thread,
which is the loader thread, not the one running JIT code. ARM64 had no
context definition at all.

Also pass the thread state (not the mcontext) to the handler, accept SIGBUS
fault codes, and fix restoring a disabled altstack on Darwin.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 13:54:23 -06:00
Henrik Rydgård 91a34056d0 Merge pull request #22373 from hrydgard/video-texture-clamp
Clamp sampling of video textures and direct-displayed video to the 480x272 frame
2026-09-28 13:46:00 -06:00
Henrik Rydgård 6cdfbe2c0d Merge pull request #22372 from hrydgard/search-raw-filename
Game browser search: also match the filename, minus extension
2026-09-28 13:36:33 -06:00
Henrik Rydgård 2ec92c10a3 Merge pull request #22370 from hrydgard/more-savestate-fixes
Claude code review: More savestate fixes
2026-09-28 12:12:40 -06:00
Henrik RydgårdandClaude Opus 5.5 ce3d8d37c5 Game browser search: also match the filename, minus extension
Works before the game's metadata has loaded.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:50:28 -06:00
Henrik RydgårdandClaude Opus 5.5 a4ce937f81 Savestate: Bounds-check BufferQueue and Atrac pending output, fix dummy JIT prefix
An interpreter state always claimed an uneaten VFPU prefix, which made a
JIT loading it run in unknown-prefix mode for the rest of the session.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:32:07 -06:00
Henrik RydgårdandClaude Opus 5.5 fc32d79596 Savestate: Fix reopening files on load
Drop an ISO handle whose file isn't in the loaded image instead of keeping
a null file, and don't reopen a directory file with exclusive create.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:32:07 -06:00
Henrik RydgårdandClaude Opus 5.5 cd94e414cd Savestate: Reset what older states lack instead of keeping pre-load values
Missing sections (videocodec, audiocodec, aac, mp3) and old-version
branches (impose, io, umd, gps, mic, display, font) left the session
before the load in place.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:32:07 -06:00
Henrik RydgårdandClaude Opus 5.5 8663ce2a33 Savestate: Save state that was missing from several modules
sceMpeg's AVC resource flag, whether the VSH is running, sceReg's handle
counter, sceNet's pending apctl events and product code block, and the
save dialog's copy of the original request (without which the first
Update after a load reloaded the request and lost its results).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:32:07 -06:00
Henrik RydgårdandClaude Opus 5.5 52299a5e17 Savestate: Save sceDmac and sceUsbCam, which were never called, and NpDrm
__DmacDoState and __UsbCamDoState existed but weren't in the module list,
so the memcpy deadline and camera state carried over from before a load.
The NpDrm licensee key wasn't saved or reset at all, so EDATA opened after
a load in a fresh session couldn't be decrypted.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:32:07 -06:00
Henrik RydgårdandClaude Opus 5.5 dd9adfdf60 HLE: Resolve imports of states from before HLE v3 with the flags of then
Without saved flags, those states were resolved against today's defaults,
and everything graduated since (sceMpeg, sceFont, the leaf libraries) ended
up on unresolved stubs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:32:07 -06:00
Henrik RydgårdandClaude Opus 5.5 bc88337a6a CoreTiming: Give events a state lacks the first id after the state's own
The first one got n-1, which is the state's last event, so that one moved
to a new id while its queued occurrences fired the newcomer. n-1 dates
from before RestoreRegisterEvent could fall back when out of range. Also
recompute a debugger run-until deadline against the loaded clock.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:32:07 -06:00
Henrik Rydgård 274c89d7f3 Merge pull request #22367 from hrydgard/savestate-fixes
Claude code review: Savestate fixes
2026-09-28 11:31:56 -06:00
Henrik Rydgård 49f92ebcb6 Merge pull request #22368 from hrydgard/remove-minimp3
Remove minimp3
2026-09-28 11:31:40 -06:00
Henrik Rydgård 3b10a9525c Merge pull request #22369 from hrydgard/compact-gpu-test-output
pspautotests: More compact gpu test output, increase timeout in debug builds
2026-09-28 11:31:18 -06:00
Henrik RydgårdandClaude Opus 5.5 3f44da709b Clamp sampling of video textures and direct-displayed video to the 480x272 frame
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:22:01 -06:00
Henrik RydgårdandClaude Opus 5.5 44d0c401d5 test.py: Give Debug builds three times the wall-clock timeout
gpu/clut/offset and gpu/commands/material take over 1s each in a Debug
build, and every so often pushed past the 5s limit mid-run, which reads
as a failure with truncated output.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 11:03:53 -06:00
Henrik RydgårdandClaude Opus 5.5 0c70d77573 AGENTS.md: Keep headless game runs short and fast
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 10:57:21 -06:00
Henrik RydgårdandClaude Opus 5.5 e0767e30a4 Savestate: Give sceFont's newer action types new ids in older states
Same as the exit callback: states from before them numbered the action
types without them, so the boot-time ids can belong to other types.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 10:57:21 -06:00
Henrik RydgårdandClaude Opus 5.5 58bae839e2 Savestate: Don't let AtracOutput take another event's id in older states
A state from before the event kept its boot-time id, which Atrac restores
first, so the event the state had under that id moved to a new one while
its queued occurrences kept firing AtracOutput. In Outrun 2006 that was
the vblank, and the game waited for it forever.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 10:57:21 -06:00
Henrik RydgårdandClaude Opus 5.5 761e2f3706 Remove minimp3
MP3 emulation already went through FFmpeg, leaving MiniMp3Audio dead.
The one live user was loading MP3 UI sound effects (custom achievement
sounds), which now splits the file into frames and decodes them with
the FFmpeg MP3 decoder.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 10:57:02 -06:00
Henrik RydgårdandClaude Opus 5.5 9f182a2a1b Update pspautotests: compact rendertarget test output
gpu/rendertarget/copy no longer prints a million pixels one at a time,
and runs in 0.17s under the interpreter rather than ~4.5s.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 10:32:42 -06:00
Henrik RydgårdandClaude Opus 5.5 bfd3633493 test.py: Give Debug builds three times the wall-clock timeout
gpu/clut/offset and gpu/commands/material take over 1s each in a Debug
build, and every so often pushed past the 5s limit mid-run, which reads
as a failure with truncated output.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 10:26:42 -06:00
Henrik RydgårdandClaude Opus 5.5 40a70b004c Savestate: Reset video frame tracking and ME busy time on load
Neither is serialized, and both went stale on load. The ME busy time was
measured against the pre-load clock, so loading an earlier state made the
next SAS/codec job wait until the old time came around, freezing the game.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:36:48 -06:00
Henrik RydgårdandClaude Opus 5.5 8d62ae04dd Savestate: Make verify compare memory without emuhacks, and not count
The write pass stores memory with the JIT's emuhacks cleared, but the
verify pass compared against memory that still had them, so it would
report a mismatch under a JIT. Only EMULATOR_DEVCTL__VERIFY_STATE runs it,
and nothing currently does. It also counted as a save in the generation.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:36:47 -06:00
Henrik RydgårdandClaude Opus 5.5 f96a58fb3e Savestate: Don't change the running game's state when saving
Some DoState code meant for after a load ran on every save:
- scePower reset the bus frequency a game set (and with a locked CPU
  speed, applied the current setting to the clock).
- sceDisplay reset the lag sync baseline, and could schedule lag sync in
  the measuring pass only, which failed the save.
- GPUState dirtied the texture, sceUmd notified the UI, and sceMpeg
  dropped a pending ringbuffer fix-up for an old state.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 2e5edcd298 Savestate: Don't break event callbacks when a save fails
CoreTiming::DoState replaced every event's callback with the anti-crash
one in every mode, relying on each module's restore to put it back. A save
that failed partway never got to those, and left the running game with
events that break into the debugger. The missing-section fallbacks then
also ran on the save: cheats and the mic re-registered events into the
wrong slots, and achievements reset the runtime.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 9140bc9548 Serialize: Report the first bad section, and start with no title
SetError overwrote the first bad section with whichever section a later
error came from, and an error before any section read an uninitialized
curTitle_.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 11e30e9456 Serialize: Don't read past a savestate title without a terminator
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 7ad9a64cf4 Serialize: Clear pointer maps and sets right after deleting their values
DoMap and DoSet cleared them, but only once the count had been read. A
state truncated right there left the deleted pointers in place, to be
freed again when the failed load reset the game.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 937c100af8 Savestate: Defer operations while the GE debugger holds a list
The list belongs to the sceGe call still in progress, whose end would have
run on the loaded CPU state. Also stop the camera and GPS when a state has
them off, don't restart capture when saving, and fix a double free of the
pmp frame queue (it only holds the media engine's own frame).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 0a687b9435 Savestate: Bounds-check sizes from the file, and plug leaks on load
Reject sizes past the end of the state before allocating (FPL, PGF,
achievements, SAS grain, savedata list, the memory fast path), fail
instead of desyncing on a SAS voice count mismatch, and free what old
states' paths and shrinking pointer containers dropped.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 7fa6be6a25 Serialize: Don't dereference unfilled pointers after a load fails
Containers of pointers are filled with nullptr and then DoClass'd, and
once an error switches the load to MODE_NOOP, every remaining element
called DoState on null.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 d6c74156b1 Savestate: Fix file handle reuse and leaks when reopening files
DirectoryFileSystem reused one entry across files, so a failed reopen
could seek another file's handle. VirtualDiscFileSystem leaked every open
handle on each load. MemoryStick ignored the saved free space basis.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 a4e169893f sceAudiocodec: Recreate decoders from the context on load
They were recreated without block size or extradata, which Atrac3 needs,
so it stayed silent after a load. Also drop the old decoders when the
state has none, and don't overflow on v1 states.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 490f08d220 Savestate: Fix action and exit callback handling on load
Delete the old HLE mips call actions instead of leaking them or keeping
stale ones, fail the load on an unknown action type instead of crashing,
and derive the exit-callback-pending flag from the loaded state.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 06e11fb176 Savestate: Rehash analyzed functions before writing replacements on load
The function list is from before the load, where other code (an overlay
module) may have been. Hashing it again from the loaded memory keeps the
hooks to code that actually matches.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 639e57c2bd Savestate: Keep pending adhocctl requests, so a waiting Init survives a load
With WLAN on and no server reachable, sceNetAdhocctlInit keeps its thread
waiting for the login. The load dropped the request, and the wait ended in
BUSY, which Init can't retry. Splinter Cell then ran its failure path with
a deleted event flag. Also stop freeing matching event buffers into the
restored allocator, and take the event lock when clearing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:06 -06:00
Henrik RydgårdandClaude Opus 5.5 4bfaab058b GPU: Reject savestates with display list ids out of range
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:05 -06:00
Henrik RydgårdandClaude Opus 5.5 84f64a9fdf Savedata: Don't free stale icon textures after a state load
The old icons stayed in PPGe's decimation list with kernel addresses from
before the load, and got freed out of whatever the loaded state had there.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:05 -06:00
Henrik RydgårdandClaude Opus 5.5 db071361b0 Savestate: Wait for the SAS and IO threads before touching memory
Both drained only in their own DoState, after memory and Atrac contexts
had already been replaced under a mix or read still in flight. Also fix
sceUmd loading umdActivated into the wrong variable, and count each save
once in saveStateGeneration (it also bumped in the measuring pass).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:05 -06:00
Henrik RydgårdandClaude Opus 5.5 d28b79960b Savestate: Fix loading kernel heaps and pre-exit-callback states
KernelHeap was missing from CreateByIDType, and an unknown type returned
without an error, desyncing the rest of the load. States from before exit
callbacks kept the boot-time action slot, which sceMpeg's restore took over.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:05 -06:00
Henrik RydgårdandClaude Opus 5.5 797957ea25 OSK: Fix a use-after-free when loading a savestate
DoState replaced native_ while holding a lock_guard on its mutex, so the
old NativeInput could be freed before the guard unlocked it. Crashed every
state load (e.g. Splinter Cell Essentials, anywhere in the game).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 09:34:05 -06:00
Henrik Rydgård 547d032995 Merge pull request #22359 from hrydgard/video-pacing-investigation
Video pacing investigation: Fix Ys I&II pacing by adding a cost model for video blits
2026-09-28 09:31:30 -06:00
Henrik Rydgård d2d9828288 Merge pull request #22360 from sum2012/memory_leak
Fix windows memory leak when close PPSSPP by Gemini
2026-09-28 09:29:52 -06:00
Henrik Rydgård 9fc4eb3e4d Merge pull request #22362 from 4RH1T3CT0R7/fix/caching-loader-eof
CachingFileLoader, DiskCachingFileLoader: keep the partial last block of the file
2026-09-27 08:16:16 -06:00
Artem Lytkin 670486d2f8 DiskCachingFileLoader: keep the partial last block of the file too
same problem since f7f92c5db. also only count blocks that were actually
allocated.
2026-09-27 15:31:17 +03:00
Artem Lytkin a3e84adab9 CachingFileLoader: keep the partial last block of the file
since 7e6405291 only full 64 KB reads get cached, so any read touching the
shorter last block of a file came back short. count blocks with
blocks_.size() too, so failed reads can't inflate the count until
MakeCacheSpaceFor loops forever. also stop read-ahead from asking the
backend for blocks past the end of the file.
2026-09-27 15:31:04 +03:00