Commit Graph
133 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 b547e01c9d VSH: Boot games the XMB starts like any other game launch
A disc game or memory stick EBOOT started from the XMB used to be swapped in under the XMB's session,
so it ran without its PARAM.SFO, compat flags, game config, window title, savestates and so on.
Much of that is decided once, at boot (the memory map, the GPU backend, the shader cache), so
sceKernelLoadExec now asks the frontend for a reboot into the disc image or EBOOT (PSP_RequestBoot)
and stops. The app and headless boot it like a game from the game list.

The game keeps the XMB's launch args (CoreParameter::launchedFromVSH), so exiting boots the XMB
again, with the disc that's in the drive and those args, and the XMB comes back where it was without
auto-starting the disc. Homebrew keeps the disc that was in the drive. A disc whose executables are
all zeroes (the EUR Video Demo Disc's "game") still loads in place and fails back to the XMB.

In headless, the run carries on through the reboot, starting stopped under the debugger like the
first boot, since the reboot loses a pending cpu.runUntilTime.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 13:36:28 +02:00
Henrik RydgårdandClaude Opus 5.5 bf1f88d6e6 UMD: Tell video discs from game discs by UMD_DATA.BIN, and fix eject+insert while paused
- Fixes #22737

Some video discs (Spider-Man) have a PSP_GAME holding only a firmware update. We reported them as
game discs too, and the XMB said "The disc could not be read". The type now comes from the fourth
field of UMD_DATA.BIN (G, V, A; the EUR Video Demo Disc says GVA), with the directories as a
fallback, and PSP_GAME without SYSDIR/EBOOT.BIN doesn't make a mixed disc a game. Identify_File uses
the same check, so these discs list as UMD Video.

Ejecting and inserting a disc from the pause menu without resuming in between left the old disc in
the XMB: callback notifications don't queue, so the insert's argument replaced the eject's before
the drive callback ran. The insert now waits until the callback has seen the drive empty.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 10:46:59 +02:00
Henrik RydgårdandClaude Opus 5.5 61db5f9459 VSH: Insert UMD Video discs, and report what kind of disc is in the drive
A UMD Video image can now be inserted, and the drive's disc type (devctl
0x01F20001) comes from what's on the disc: PSP_GAME, UMD_VIDEO and UMD_AUDIO
each set their bit. With a video disc the XMB moves to the Video column,
shows the disc with its icon and background, and hands it to the firmware's
video player when selected. sceUmdGetDiscInfo still tells games they're on
a game disc.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 17:32:43 +02:00
Henrik RydgårdandClaude Opus 5.5 eee153b220 VSH: An empty UMD drive, and inserting a disc over the WebSocket debugger
The XMB, booted without a game, now starts with an empty drive: when
vsh_module loads with nothing at disc0:, the drive is marked empty, and
activating it tells the shell's drive callback (SceVshMediaDetectUMD)
there's no disc. Activation used to report a readable disc regardless,
so the shell asked for its type and showed "The disc could not be read."
The disc type devctl (0x01F20001) answers 0 without a disc, as JPCSP
does.

game.umd.insert (path) mounts a disc image into the empty drive and
calls the drive callback as inserting one does; game.umd.eject takes it
out. UmdMount() is UmdReplace() without its need for a disc already in.

Inserted into the 6.61 XMB, Daxter shows in the Game column with its
icon, background and animated preview, and launching it boots the game
to its title menu.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 17:32:43 +02:00
Henrik RydgårdandClaude Opus 5.5 5674c789ef sceUmd: Match hardware's parameter checks and wait timeouts
- A timeout of 0 to sceUmdWaitDriveStatWithTimer/CB means no timeout,
  not a tiny one (or 8ms for the CB version).
- Timeouts round like the event flag wait does.
- A wait with no timeout no longer times out right after a callback.
- sceUmdRegisterUMDCallBack only accepts callbacks.
- sceUmdActivate requires the name to be exactly "disc0:", and it and
  sceUmdDeactivate/sceUmdGetDiscInfo reject kernel pointers.
- sceUmdDeactivate needs a name in mode 2.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 09:19:32 -06:00
Henrik RydgårdandClaude Opus 5.5 eda92c4ef2 Callbacks: Track callback nesting per thread, one level deep
Replaces the global in-callback counter with each thread's own mipscall
chain, so several threads can be inside callbacks at once, and other
threads' callbacks (better priority ones right away) run while one is.
Verified against pspautotests threads/callbacks/otherthread, recursion
and intrnotify:

- A callback nests only one level: a CB wait that would go deeper never
  returns on hardware, so the callback is left pending instead.
- A non-CB wait inside a callback no longer runs callbacks because of
  the CB wait the callback interrupted.
- Callbacks for a waiting thread are only taken when it beats both the
  running thread and every ready one. After an interrupt (which runs on
  the idle thread) that's the thread about to resume, not idle.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 15:59:25 -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) <noreply@anthropic.com>
2026-09-28 11:32:07 -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) <noreply@anthropic.com>
2026-09-28 09:34:06 -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) <noreply@anthropic.com>
2026-09-28 09:34:05 -06:00
Henrik Rydgård 86fcfdc60a Add some new function names that were cracked from NIDs by zecoxao
He used Claude, never thought of this use case, but it's logical - it
can go reverse engineer the functions to come up with likely names,
making it easier to match the SHA1 hash. (NIDs are truncated SHA1 hashes
of names, except in firmwares later than around 3.50).
2026-09-10 15:52:53 -06:00
Henrik Rydgård e9a3449ede More MIPSState * plumbing (manual) 2026-08-12 14:02:19 +02:00
Henrik Rydgård 4e1ff145a5 Logging update 2025-05-27 17:48:23 +02:00
Henrik Rydgård f98b313234 Logging fix 2025-04-02 18:30:43 +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 34169cdb8e More error code consolidation 2025-02-04 11:53:22 -06: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 3ce72f87d3 Another batch of log cleanup 2025-01-28 09:31:38 +01: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 3fd5190271 Add a comment, some additional cleanup 2024-01-16 09:07:09 +01:00
Henrik Rydgård 1f60247749 Fix hang when changing UMD with retroachievements enabled
Fixes #17976
2023-09-12 14:17:50 +02:00
Henrik Rydgård 67cb466ee1 Allow using a file browser to choose UMDs during disc change. 2023-09-04 21:43:10 +02:00
Henrik Rydgård 18e6da2e3d rc_client: Hook up UMD change (untested) 2023-07-08 21:47:19 +02:00
Henrik Rydgård d586ec0d5e Don't create Host objects except in headless/unittest 2023-03-25 10:47:01 +01:00
Henrik Rydgård fc1732cc22 Move NotifySwitchUMDUpdated 2023-03-21 13:37:19 +01:00
Henrik Rydgård dda8635c89 Move three notifications out of Host 2023-03-21 13:37:19 +01:00
Henrik Rydgård 2e16e83159 It never ends... 2021-05-13 10:39:16 +02:00
Unknown W. Brackets 74f08bee2a Umd: Fix thread wakeup.
Oops.  Not sure how I left this flag flipped.  Was not waking threads.
2021-04-15 11:16:56 -07:00
Henrik Rydgård 9783a2ec79 Merge pull request #13970 from unknownbrackets/umd-wait-stat
Correct UMD stat waiting when changing discs
2021-04-11 08:06:03 +02:00
Unknown W. Brackets cfb52bf69e Umd: Disallow waiting on status that can't occur.
Per tests, CHANGED is not waitable.
2021-01-24 13:21:25 -08:00
Unknown W. Brackets 871a0f9492 Umd: Wake waiting threads on eject/insert. 2021-01-24 12:11:42 -08:00
Unknown W. Brackets f81250660a Umd: Delay common wait drive stat funcs.
These are sometimes used in loading or loops, and take time.  This should
reduce spin looping.
2021-01-24 11:49:25 -08:00
Unknown W. Brackets 06f8ab5a49 SaveState: Make event restoring more obvious.
We still must restore all events, but everything can be taken care of
during the save state load.
2020-12-28 13:29:19 -08:00
shenweip a0fe0e38c1 SwicthUMD:Only update Switch UMD item of Windows menu instead of entire UI. 2020-10-22 17:45:29 +08:00
Henrik Rydgård 4f43cff5ca Move fileutil, net, image loaders, ui to Common. (#13506)
* Move and rename file_util/fd_util to Common/File/FileUtil and DirListing

Let's also move net while we're at it.

Move the ZIM/PNG loaders over to Common.

Move the UI framework into Common

iOS buildfix

* Buildfix

* Buildfixes

* Apple buildfix

* This typo again..

* UWP buildfix

* Fix build of PPSSPPQt, such as it is (it's not in good condition...)

* Guess what? Another buildfix.
2020-10-04 20:48:47 +02:00
Unknown W. Brackets b8342fb8ec SaveState: Rename ChunkFile files to Serialize.
Makes more sense and less weird than ChunkFileDoMap, etc.
2020-08-10 08:04:05 +00:00
Unknown W. Brackets 1dc5ee424b SaveState: Split out Do types to reduce headers. 2020-08-10 08:03:44 +00:00
Unknown W. Brackets 4b4e3432cd SaveState: Split Do() into a separate header. 2020-08-10 08:03:41 +00:00
Henrik Rydgård c5e0b799d9 Remove category from _assert_msg_ functions. We don't filter these by category anyway.
Fixes the inconsistency where we _assert_ didn't take a category but
_assert_msg_ did.
2020-07-19 20:33:25 +02:00
shenweip 9be8fc6c69 Oops. 2020-01-04 11:14:32 +08:00
shenweip 9fa4ae7b15 fix 2020-01-04 09:11:15 +08:00
shenweip 458f8cfac3 minor fix 2020-01-02 16:45:01 +08:00
shenweip d09543ebd7 Move umd replace to loaders. 2020-01-02 14:56:24 +08:00
Henrik Rydgård d7770307f3 Change some log levels to verbose 2018-05-27 21:53:27 +02:00
Henrik Rydgard 5ce73f7264 Restore calls to UpdateUI from sceUmd, now that it's faster. 2017-04-05 11:46:41 +02:00
Henrik Rydgard a029195f57 Forgot one line 2017-04-04 10:14:07 +02:00
Henrik Rydgard 0a0aa02aae Win32: Enable/disable menu items when a menu is popped down. Allows us to avoid calling UpdateUI from sceUmd. Should fix #9546 2017-04-04 10:11:03 +02:00
sum2012 1f2f044164 Fix Dies irae Amantes amentes umd switch 2017-01-30 21:39:42 +08:00
Henrik Rydgard 03b607f389 Better way of updating menus on UMD switching calls 2017-01-29 11:41:31 +01:00
sum2012 860661dc14 Build fix for non-windows
First step to fix UnitTest
2017-01-29 03:56:49 +08:00
sum2012 2c58d34f3e Add save status 2017-01-29 03:38:28 +08:00