102 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 9e69c1f9aa Savedata: Keep the IO thread out of the dialog's state
Replaces the temporary fix that did the hidden modes' IO inside Update.

The IO thread read and wrote the dialog's request, display state and save
list, all shared with the emulator thread, which kept using them to draw the
dialog and reload the request from the game.

Now the IO thread works on its own copy of the request, its own SavedataParam
and directory names resolved up front, and shares nothing else with the
emulator thread but the (locked) file system, MemoryStick_FreeSpace's cached
use and sceChnnlsv's scratch buffer and kirk state, the last two now under
locks too. It still reads and writes the game's buffers directly, like a PSP's
utility threads and sceIoReadAsync do, so a savestate waits for it before it
saves or loads memory. Save
bookkeeping, the save indicator and display changes happen on the emulator
thread when the results are taken, and only the request fields the IO changed
are copied back, so a game's own edits in the meantime survive.

Hidden modes take the results at the next Update (or, with Host IO timing,
the first Update that finds them done). The visible dialogs keep drawing and
take them once the IO is done; save and load used to stall the emulator
thread for the whole operation. Savestates keep results that haven't been
taken yet.

When the results land in PSP memory doesn't matter to games, so
utility/savedata/filelist now only prints them once the utility has finished.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-25 12:50:39 -06:00
Henrik RydgårdandClaude Opus 5.5 5a23bb2d94 Savedata: Pick the crypt mode the way the firmware does
secureVersion and the key only matter for the full 1536-byte request; the
older sizes always save without a key. Otherwise SDK 2.07+ uses the new
keyed hash for versions 0 and 3, older SDKs the old keyed hash for 0 and
no key for 3, and version 2 is always the old keyed hash.

Versions 0, 2 and 3 all require a key, and are rejected with SAVE_PARAM
otherwise - including 0, which we used to save without a key. Matches the
SFO modes and save errors recorded in utility/savedata/secureversion; what
remains there is load strictness when secureVersion doesn't match the
file, which we keep lenient for older saves.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-23 19:25:24 -06:00
Henrik Rydgård 6c324c6782 Minor cleanup 2026-01-01 13:47:19 +01:00
Henrik Rydgård f18715bb7c Some renaming 2024-07-16 22:04:41 +02:00
Henrik Rydgård cde71fc2b3 Misc cleanup 2024-07-16 22:04:41 +02:00
Henrik Rydgård b7f0a9029e More cleanup 2024-04-07 12:36:32 +02:00
Henrik Rydgård 79c553d004 Remove the zero-write in BuildHash 2024-04-07 12:31:45 +02:00
Henrik Rydgård 404600faa3 SavedataParam/ParamSFO: Minor code cleanups 2024-04-07 12:31:45 +02:00
Herman Semenov af41281761 [Core/Dialog/ELF/FileSystems/HLE/HW/Util] Added const reference for function params 2023-12-14 14:22:24 +03:00
Unknown W. Brackets a7b7bf7826 Global: Set many read-only params as const.
This makes what they do and which args to use clearer, if nothing else.
2022-12-10 21:13:36 -08:00
Unknown W. Brackets db5011d7f1 Savedata: Cache SFO data during processing.
This only caches between touching PSP code, in case something changes.
Reduces cases of multiple SFO lookups and reads.
2022-10-09 14:42:31 -07:00
Unknown W. Brackets 5bed35b293 Savedata: Skip and defer texture exist check.
We can skip if there's no UI.
2022-10-09 14:42:31 -07:00
Henrik Rydgård c9048c3748 Shrink the DeferredDrawcall struct, because why not. Assorted cleanup 2022-09-01 11:59:33 +02:00
Henrik Rydgård 70b9dcc9a3 Initialize a bunch of Dialog structs 2022-08-18 16:46:22 +02:00
Unknown W. Brackets e75d2a097b Savedata: Fix indeterminate timing of field update.
This makes the test pass consistently, instead of depending on thread
timing.
2022-01-26 00:31:30 -08:00
Henrik Rydgård de3d711616 Move FixPathCase to Common/File/Path 2021-09-11 21:17:23 +02:00
Henrik Rydgård 36079b86d0 Optimize away a couple of existence checks 2021-09-11 19:53:19 +02:00
Unknown W. Brackets 1b57739eb7 Debugger: Memcheck and tag loading savedata to RAM. 2021-04-03 18:28:22 -07:00
Unknown W. Brackets e85a8b0f5b Global: Cleanup class init order warnings. 2021-02-15 11:59:45 -08:00
shenweip 721696b9bc Fixes incorrect date of savedata.
Updates the date to the latest.
2020-12-14 00:27:23 +08:00
shenweip 81ad9a930a SaveData:Displays all saves like a PSP for LISTALLDELETE mode. 2020-10-05 00:00:28 +08:00
shenweip c84f9542d7 Savedata:Corrects the performances when the data is broken. 2020-10-01 15:41:27 +08:00
shenweip 925944d5b2 Savedata:Improves the deleting functions. 2020-10-01 00:39:14 +08:00
shenweip 290efbc349 Check whether there may be more than one save file names by mode. 2020-09-15 21:48:55 +08:00
Unknown W. Brackets f16a6b8abd MsgDialog: Show better error messages.
I think the PSP really did just show error codes, but that's not a reason
to keep that confusion going.  For common save errors, let's show the
messages.

Some games, for example, simply show the no data found error when you play
for the first time and trigger anything to check for data.
2020-07-13 18:24:05 -07:00
Unknown W. Brackets c4717fae2f Savedata: Reset data size when retrying hash.
It's even possible we might've not loaded the key before, so let's play it
safe and reset everything.

The previous fix only worked in some games, when dataSize was larger than
necessary.
2018-07-28 09:41:44 -07:00
Unknown W. Brackets 1976be48ab Savedata: Use file hash to validate hash mode.
This makes older PPSSPP save data also work, and also logs when save data
is detected as corrupt.
2018-06-30 12:17:52 -07:00
Unknown W. Brackets 46d7ead781 Savedata: Add validation on secureVersion param. 2018-06-24 15:30:33 -07:00
Unknown W. Brackets aad6377580 Savedata: Return result codes from Save/Load.
This doesn't change anything, yet.
2018-06-24 13:28:57 -07:00
Unknown W. Brackets d2be5beccc Savedata: Show icon for new saves more often.
In fact, it may even be wrong to show the new data icon in this case...

Also fixes crashes when save title is 128 characters long.

Should improve #9632.
2017-12-03 06:35:41 -08:00
Unknown W. Brackets 42c0e7d5dd Savedata: Handle disk full properly in GETSIZE.
Games use these fields to determine how much more space is needed to
create savedata.  Some also use it for install data.

This allows more games to properly report free space issues.
2017-10-14 21:55:38 -07:00
Chin 37f50a3792 Change to pass some arguments by reference 2015-03-01 16:49:00 +01:00
Unknown W. Brackets 2958c575a1 Check actual free disk space when games ask.
Windows only for the moment.
2014-11-01 00:33:19 -07:00
daniel229 70fac3a65e savedata 2014-10-03 15:16:12 +08:00
Unknown W. Brackets 30f8ec447a Hash and detect savedata hashmode correctly.
Fixes Persona 1 savedata compatibility.
2014-07-06 19:27:51 -07:00
Yifan Lu c5336d5817 Added printing of game save key to debug log when loading/saving 2014-03-22 16:13:30 +01:00
Unknown W. Brackets fe8ada4d7e Log the name of the save operation, not just #.
Makes it a lot easier to read...
2014-03-15 17:20:34 -07:00
Unknown W. Brackets 8d29b583e8 Reduce a few Core/Dialog/ includes. 2014-03-15 10:52:13 -07:00
sky-zer 2ba30e3f97 SceUtilitySavedataFileListEntry correction. 2014-01-28 00:24:56 +04:00
Unknown W. Brackets e00a244d1e Handled fixed-length strings in savedata properly. 2014-01-24 01:21:13 -08:00
Henrik Rydgård 87f203a5b8 More include untangling 2013-12-29 23:44:35 +01:00
Henrik Rydgård 79ff2f0ba8 Start untangling our include mess a little. 2013-12-29 23:34:45 +01:00
Unknown W. Brackets 2d3f0758c1 Dynamically manage PPGe images so 50+ are okay.
Otherwise, we try to allocate all at once and could run out of ram.

Should fix #2242.
2013-12-08 11:06:18 -08:00
Henrik Rydgård c9475b17b8 Merge pull request #4514 from shenweip/patch-3
Skip the read of secure files which are not in SFO.
2013-11-14 14:02:21 -08:00
Kingcom 7f9182033e Partially implement SCE_UTILITY_SAVEDATA_FOCUS_NAME 2013-11-12 10:10:56 +01:00
shenweip d3fbbebe16 Only skip when load fail. 2013-11-12 12:14:16 +08:00
shenweip c5a6e4653b Only check in secure mode. 2013-11-12 12:08:11 +08:00
shenweip 02ceb312cf Skip the load of secure files which are not in SFO. 2013-11-12 11:21:26 +08:00
shenweip 8a26da6e45 Load another files of save. 2013-11-03 23:52:16 +08:00
shenweip b9d655f602 Code CleanUp,make it clearer. 2013-11-03 23:10:05 +08:00