Commit Graph
285 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5 d489a97e49 GameInfoCache: Odds and ends
GameInfoTex::Clear() only reset dataLoaded when there was data to clear, but
several paths deliberately set it on a file that turned out not to exist (the
ARCHIVE_ZIP case, the "no icon" fallback). Those kept dataLoaded across a
Clear(), so FinishPendingTextureLoads stamped timeLoaded again and the tex read
as permanently Failed().

PurgeType slept 10ms even when it had nothing to retry.

Fix three comments that no longer described the code: Clear() doesn't start a
thread, Priority() no longer calls GetFileLoader(), and the work item's
destructor doesn't touch the flags - Run() has to mark them itself, which is
worth stating since missing it strands them in pendingFlags for good.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzzCUp8y1ahgVueb1Cq92Y
2026-08-29 00:05:42 +02:00
Henrik RydgårdandClaude Opus 5 4132c185f4 GameInfoCache: Synchronize the rest of the worker's writes
The work item wrote title, id, id_version, region, errorString, hasConfig and
gameSizeUncompressed with no lock held, while the main thread reads them under
info->lock. title is the sharp one - an unsynchronized std::string write against
a locked read in GetTitle()/GetDBTitle() is a real data race, not just a stale
read. SetTitle() already existed and was used in exactly one of the six places.

The two expensive calls (HasGameConfig, which hits the file system, and
GetSizeUncompressedInBytes) stay outside the lock - the main thread takes it
every frame, so blocking on I/O under it would show up as UI stutter.

PurgeType read hasFlags/fileType/pendingFlags under mapLock_ only, racing the
worker's MarkReadyNoLock. It also erased entries without dropping their
textures, unlike Clear() - so a work item that finished just before PurgeType
took the lock could be left holding the last reference, and ~GameInfo would
then release GPU textures on a worker thread.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzzCUp8y1ahgVueb1Cq92Y
2026-08-29 00:05:42 +02:00
Henrik RydgårdandClaude Opus 5 bdc68d659a GameInfoCache: Don't let a work item switch on an unidentified fileType
GetInfo() masked out any flag that a *pending* work item was already going to
fetch, FILE_TYPE included. But every work item starts by switching on
info->fileType, so "another item will compute it" isn't good enough - if that
item hadn't reached Identify_File yet, the second one fell through to default:,
marked its flags ready and loaded nothing. The data then looked present forever,
so e.g. a PIC1 requested while an ICON load was in flight could just never show
up. Easy to hit since the screens request different flag combinations for the
same path, and BackgroundAudio calls GetInfo from the audio thread.

Always redo the identification unless FILE_TYPE is already in hasFlags (i.e.
final), and have Run() switch on a local copy so a concurrent item can't shift
it underneath us mid-switch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzzCUp8y1ahgVueb1Cq92Y
2026-08-29 00:05:42 +02:00
Henrik RydgårdandClaude Opus 5 658418c0fb GameInfoCache: Fix three logic errors
- The SND branch for PSP_DISC_DIRECTORY set pic1.dataLoaded instead of
  sndDataLoaded, copy-pasted from the PIC1 branch above it. Asking for SND
  without PIC1 left pic1 marked as loaded with no data, so SetupTexture
  stamped timeLoaded and pic1.Failed() stayed true for good.

- The SIZE branch wrote two locals that were only ever 0 into saveDataSize
  and installDataSize, wiping what a previous SAVEDATA_SIZE fetch computed
  while hasFlags still claimed it was valid.

- GetDBTitle() returned the filename when a title existed but PARAM_SFO
  didn't, and an empty string in the opposite case - the condition was
  inverted. Look up the DB when we have an id_version, then fall back the
  same way GetTitle() does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzzCUp8y1ahgVueb1Cq92Y
2026-08-29 00:05:42 +02:00
Henrik Rydgård e9cdb2b20f UI work for VSH (Windows and ImGui) 2026-08-24 11:13:00 +02:00
Henrik RydgårdandClaude Opus 5 396f9e802d GameInfoCache: report the firmware updater bundled on a game disc
Adds GameInfoFlags::BUNDLED_UPDATE_INFO, holding the version, title, size
and timestamp of the updater in PSP_GAME/SYSDIR/UPDATE. It comes from the
PARAM.SFO and the directory entry next to the archive, so it's a couple of
small reads on the ISOFileSystem the worker already has open - no
decryption, and DATA.BIN itself is only sniffed for its magic. Only
computed for ISOs; everything else is marked complete with an empty struct.

ISOFileSystem now parses the date out of the ISO9660 directory record,
stored as Unix UTC seconds and reported as the PSP's atime/ctime/mtime.
Those used to always read back as zero, so games calling sceIoGetstat on a
UMD file saw 1900 where hardware gives the mastering date.

Shown on GameScreen as e.g. "Firmware update on disc: 6.60 (2011-10-05),
25.6 MB".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0149QcTVgZEXKXbgHyvXF4ZY
2026-08-23 16:44:38 +02:00
James0124 b9f46e2acb Extracted ISOs: Fix savedata size not showing on the game info screen
`PSP_DISC_DIRECTORY` was the only `IdentifiedFileType` with possible `PARAM.SFO` that didn't mark `PARAM_SFO` ready inside the switch,
causing `GetSaveDataDirectories` to bail out and return an empty vector and the game info UI to show no savedata size info.
2026-08-10 01:01:13 +02:00
Henrik Rydgård 3ae31d0811 Increase the newly imposed icon size limit (VeryMelon had some extreme icon) 2026-08-03 11:04:12 +02:00
Henrik Rydgård a7b1b319ce Limit PNG decode dimensions to prevent decompression bombs
pngLoadPtr allocated the decoded buffer directly from attacker-controlled
PNG IHDR dimensions with no upper bound, so browsing a crafted game icon
or savedata could trigger a multi-gigabyte allocation.

- Add maxWidth/maxHeight parameters to pngLoadPtr (default 8192x8192)
  and reject images larger than the limits.
- Thread the limits through LoadTextureLevelsFromFileData,
  CreateTextureFromFileData, and CreateTextureFromFile.
- Limit game icons to 256x128 in GameInfoCache and IconCache.
2026-08-01 11:41:24 +02:00
Henrik Rydgård a47a388517 Unbreak loading homebrew. Followup to #21894, oops 2026-07-08 19:32:37 +02:00
Henrik Rydgård d9eb513600 TabHolder sanity check. Code cleanup. 2026-05-13 17:18:42 +02:00
Henrik Rydgård 3325cbe6b2 Remove the legacy icon images for zip/rar/7z. Include this in the regular gamelist so search works for them. 2026-05-03 18:43:48 +02:00
Herman Semenoff 8f4fb77f79 gameinfocache: fbmanager: use const ref and modernize to for range C++17
From #21606
2026-04-28 10:54:55 +02:00
Henrik Rydgård 0e55129fab Prepare for dumping NPDRM isos, use shared_ptr to manage lifetime of BlockDevice 2026-03-19 13:59:04 +01:00
Henrik Rydgård e50199ad0a Fix the gemini-written video player to actually work 2026-02-26 09:33:26 +01:00
Henrik Rydgård dac8ccff1d Gamescreen: Reload savedataSize on open 2026-02-23 11:48:34 +01:00
Henrik Rydgård 2bc43810a8 Improve display of homebrew without an icon in the game browser 2026-02-10 11:26:01 +01:00
Henrik Rydgård a92ff89d5f Clean up the OSD click callback code 2026-02-09 13:08:44 +01:00
Henrik Rydgård cdd9d34af9 Improve handling of UMD Video (still unsupported but show background and icon, fix info screen) 2026-02-03 13:46:59 +01:00
Henrik Rydgård 998d385119 Bubble up CSO corruption errors so the user can see them 2026-02-03 11:57:05 +01:00
Henrik Rydgård 19a6232b48 Improve handling of the UMD VIDEO error case (no, we still don't support them) 2026-01-28 14:32:38 +01:00
Henrik Rydgård 24f2deeb2e Improve file identification.
Fixes #21154
2026-01-28 10:21:09 +01:00
Henrik Rydgård 1d16d6be6a Workaround for a shutdown destruction order problem.
Part of #21055
2026-01-02 14:36:16 +01:00
Henrik Rydgård 567aac0359 Avoid holding a lock while calculating the size of savedata or homebrew.
Should fix some ANRs.
2026-01-01 14:05:52 +01:00
Henrik Rydgård b8fced5b41 Path code cleanup, move some UI code (#21037)
* Move a bunch of path logic into Core/Util/PathUtil.cpp/h

.

* Move GameImageView out from SaveDataScreen

* More cleanup, add a translation string
2025-11-25 00:44:24 +01:00
Henrik Rydgård 77c7ba1435 Rework the pause screen in portrait mode. Right-align popup menus if too far to the right on the screen. 2025-11-22 14:31:01 +01:00
Henrik Rydgård 4edb8e53cd Just some renaming and cleanup 2025-11-04 23:39:56 +01:00
Henrik Rydgård b1d14d8221 More upload UI polish 2025-10-27 12:20:24 +01:00
Henrik Rydgård 8aa1987d77 Disallow configs and cheats for GE dumps, don't try to get icons for dumps loaded from HTTP 2025-10-16 15:15:03 +02:00
Henrik Rydgård 44902bffdd Make logging work in these callbacks, and clarify the future solution 2025-09-05 10:31:27 +02:00
Henrik Rydgård 97cfca8f18 Cleanup the Game info screen code. Fixes issue with it not loading sometimes. 2025-09-03 11:57:13 +02:00
Henrik Rydgård 3c6acf37dd Split loading of PIC0/PIC1 (don't need PIC0 most of the time) 2025-08-02 23:20:13 +02:00
Henrik Rydgård 77f9a27c35 Add a way for errors to bubble up out of BlockDevice creation 2025-06-07 12:30:20 +02:00
Henrik Rydgård 4c631e77f5 RetroAchievements: Show region when showing the info popu. Refactor region detection a little. 2025-06-01 11:34:59 +02:00
Henrik Rydgård 71533ac2b7 Trash handling is too high level for FileUtil, move it up. 2025-04-15 17:42:24 +02:00
Henrik Rydgård 7712cf5331 When deleting important files like savedata or games, move to trash.
This currently only works on Windows, where it changes the Delete button
to "Move to trash".
2025-04-10 09:02:44 +02:00
Henrik Rydgård bc3d4fe477 Fix a rare UI race condition (if 'region' changed on a background thread) 2025-04-02 17:27:46 +02:00
Henrik Rydgård f3c1fa7c05 Quick sanity check for EBOOT deletion. Fixes #20187, although arguably we should be even stricter. 2025-03-31 12:30:47 +02:00
Henrik Rydgård a50b303a38 Redesign the recent files API a bit. 2025-03-26 17:59:30 +01:00
Henrik Rydgård ee90971762 Fix layout issue on savedata screen
Fixes #20030
2025-02-25 09:47:42 -06:00
Henrik Rydgård 4b2bce388c Minor error handling improvements, remove redundant Exists checks 2025-02-18 10:56:49 -06:00
Henrik Rydgård 8b340aa4ed Refactor out the replacement icon loading, use for EBOOTs too. 2025-02-13 11:00:07 -06:00
LunaMoo ed9b202671 Basic custom icon support (through texture replacement)
uses path textures/gameID/icon.png, or icon.png from textures.zip.

requires restart to re-load icons.
2025-02-13 10:47:58 -06:00
Henrik Rydgård 5c1eaf1933 Faster savedata deletion 2024-11-30 02:44:01 +01:00
Henrik Rydgård f60e66b186 GameInfoCache: Use directory prefix filtering to speed things up.
Probably not much improvement in practice.
2024-11-29 11:14:52 +01:00
Henrik Rydgård 59a56d66c7 Add a "reason" argument to sleep_ms().
sleep_ms() should generally be avoided when possible. This can be used to try
to track down unnecessary sleeps by adding some logging.

This commit on its own doesn't actually add any logging.
2024-11-21 15:28:51 +01:00
Henrik Rydgård 8fbe46ab9e Prevent soft-locking the emulator on invalid PBP files, or crashes in some cases. 2024-10-03 18:38:54 +02:00
Henrik Rydgård 8186f14a57 Much more UI work on savedata import
fix
2024-09-07 15:28:57 +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 ecdc7940f4 Android: Fix issue where shortcuts wouldn't override the currently running game. 2024-05-14 00:02:59 +02:00