Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Savedata: Update filelist on file erasure #16239

Merged
merged 1 commit into from
Oct 16, 2022

Conversation

unknownbrackets
Copy link
Collaborator

Also stop reporting as "not coded."

Basically, this is the reason to use it over just deleting the file directly. Also, per some quick tests, SECURE vs non-SECURE doesn't seem to matter. Both happily delete a file created using WRITEDATASECURE or WRITEDATA, and both update the file list.

-[Unknown]

@unknownbrackets unknownbrackets added this to the v1.14.0 milestone Oct 16, 2022
Copy link
Owner

@hrydgard hrydgard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two nitpicks.

@@ -382,6 +385,40 @@ int SavedataParam::DeleteData(SceUtilitySavedataParam* param) {
ClearCaches();
pspFileSystem.RemoveFile(filePath);

// Update PARAM.SFO to remove the file, if it was ni the list.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ni the list/in the list

@@ -382,6 +385,40 @@ int SavedataParam::DeleteData(SceUtilitySavedataParam* param) {
ClearCaches();
pspFileSystem.RemoveFile(filePath);

// Update PARAM.SFO to remove the file, if it was ni the list.
std::shared_ptr<ParamSFOData> sfoFile = LoadCachedSFO(sfoPath);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be a unique_ptr, right? (less overhead, though hardly matters here)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoadCachedSFO() returns a shared_ptr, because it returns a common pointer from a cache but you can clear its cache, so I just wanted to be safe from any crashes. For example, saving a file loads the SFO data, then clears the SFO cache (because it modifies things.)

It definitely can't be a unique_ptr, because the whole point of LoadCachedSFO() is to reuse the already loaded SFO data. Would not want it freed on each use.

-[Unknown]

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, yeah, should have gone looking inside LoadCachedSFO.

This is correct, ignore me.

Also stop reporting as "not coded."
@hrydgard hrydgard merged commit 51c359c into hrydgard:master Oct 16, 2022
@unknownbrackets unknownbrackets deleted the savedata-erase branch October 16, 2022 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants