-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 management screen #7808
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
084aad7
Make GameInfoCache understand PSP savedata as a "game" type. Use it t…
hrydgard 381e0c0
Implement basic savedata UI. Not much actual functionality yet but ca…
hrydgard 00094e0
More work on savedata UI.
hrydgard 2951440
Improve savedata UI layout more, fix deletion of save states
hrydgard b56f21e
More savedata UI polish
hrydgard 2a88b1e
Buildfix for gcc
hrydgard 954735b
Recursive size calculation for PBP directory games. Other minor updates
hrydgard 556eeef
Move savedata manager to a new Tools category in Settings
hrydgard 56ed0f9
Localization fixes
hrydgard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ enum PSPDirectories { | |
DIRECTORY_SAVEDATA, | ||
DIRECTORY_PAUTH, | ||
DIRECTORY_DUMP, | ||
DIRECTORY_SAVESTATE, | ||
}; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ GameInfo::~GameInfo() { | |
delete fileLoader; | ||
} | ||
|
||
bool GameInfo::DeleteGame() { | ||
bool GameInfo::Delete() { | ||
switch (fileType) { | ||
case FILETYPE_PSP_ISO: | ||
case FILETYPE_PSP_ISO_NP: | ||
|
@@ -63,9 +63,9 @@ bool GameInfo::DeleteGame() { | |
return true; | ||
} | ||
case FILETYPE_PSP_PBP_DIRECTORY: | ||
case FILETYPE_PSP_SAVEDATA_DIRECTORY: | ||
{ | ||
// TODO: This could be handled by Core/Util/GameManager too somehow. | ||
|
||
const char *directoryToRemove = filePath_.c_str(); | ||
INFO_LOG(HLE, "Deleting %s", directoryToRemove); | ||
if (!File::DeleteDirRecursively(directoryToRemove)) { | ||
|
@@ -76,6 +76,12 @@ bool GameInfo::DeleteGame() { | |
return true; | ||
} | ||
case FILETYPE_PSP_ELF: | ||
case FILETYPE_PPSSPP_SAVESTATE: | ||
case FILETYPE_UNKNOWN_BIN: | ||
case FILETYPE_UNKNOWN_ELF: | ||
case FILETYPE_ARCHIVE_RAR: | ||
case FILETYPE_ARCHIVE_ZIP: | ||
case FILETYPE_ARCHIVE_7Z: | ||
{ | ||
const char *fileToRemove = filePath_.c_str(); | ||
deleteFile(fileToRemove); | ||
|
@@ -90,13 +96,27 @@ bool GameInfo::DeleteGame() { | |
u64 GameInfo::GetGameSizeInBytes() { | ||
switch (fileType) { | ||
case FILETYPE_PSP_PBP_DIRECTORY: | ||
case FILETYPE_PSP_SAVEDATA_DIRECTORY: | ||
{ | ||
std::vector<FileInfo> fileInfo; | ||
getFilesInDir(filePath_.c_str(), &fileInfo); | ||
int64_t sizeSum = 0; | ||
// Note: getFileInDir does not fill in fileSize properly. | ||
for (size_t i = 0; i < fileInfo.size(); i++) { | ||
FileInfo finfo; | ||
getFileInfo(fileInfo[i].fullName.c_str(), &finfo); | ||
if (!finfo.isDirectory) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, a PBP directory is not unlikely to have subdirectories. -[Unknown] |
||
sizeSum += finfo.size; | ||
} | ||
// TODO: Need to recurse here. | ||
return 0; | ||
return sizeSum; | ||
} | ||
default: | ||
return GetFileLoader()->FileSize(); | ||
} | ||
} | ||
|
||
// Not too meaningful if the object itself is a savedata directory... | ||
std::vector<std::string> GameInfo::GetSaveDataDirectories() { | ||
std::string memc = GetSysDirectory(DIRECTORY_SAVEDATA); | ||
|
||
|
@@ -117,6 +137,9 @@ std::vector<std::string> GameInfo::GetSaveDataDirectories() { | |
} | ||
|
||
u64 GameInfo::GetSaveDataSizeInBytes() { | ||
if (fileType == FILETYPE_PSP_SAVEDATA_DIRECTORY || fileType == FILETYPE_PPSSPP_SAVESTATE) { | ||
return 0; | ||
} | ||
std::vector<std::string> saveDataDir = GetSaveDataDirectories(); | ||
|
||
u64 totalSize = 0; | ||
|
@@ -132,7 +155,7 @@ u64 GameInfo::GetSaveDataSizeInBytes() { | |
filesSizeInDir += finfo.size; | ||
} | ||
if (filesSizeInDir < 0xA00000) { | ||
//Generally the savedata size in a dir shouldn't be more than 10MB. | ||
// HACK: Generally the savedata size in a dir shouldn't be more than 10MB. | ||
totalSize += filesSizeInDir; | ||
} | ||
filesSizeInDir = 0; | ||
|
@@ -141,6 +164,9 @@ u64 GameInfo::GetSaveDataSizeInBytes() { | |
} | ||
|
||
u64 GameInfo::GetInstallDataSizeInBytes() { | ||
if (fileType == FILETYPE_PSP_SAVEDATA_DIRECTORY || fileType == FILETYPE_PPSSPP_SAVESTATE) { | ||
return 0; | ||
} | ||
std::vector<std::string> saveDataDir = GetSaveDataDirectories(); | ||
|
||
u64 totalSize = 0; | ||
|
@@ -156,7 +182,7 @@ u64 GameInfo::GetInstallDataSizeInBytes() { | |
filesSizeInDir += finfo.size; | ||
} | ||
if (filesSizeInDir >= 0xA00000) { | ||
// Generally the savedata size in a dir shouldn't be more than 10MB. | ||
// HACK: Generally the savedata size in a dir shouldn't be more than 10MB. | ||
// This is probably GameInstall data. | ||
totalSize += filesSizeInDir; | ||
} | ||
|
@@ -371,6 +397,33 @@ class GameInfoWorkItem : public PrioritizedWorkQueueItem { | |
} | ||
break; | ||
|
||
case FILETYPE_PSP_SAVEDATA_DIRECTORY: | ||
{ | ||
SequentialHandleAllocator handles; | ||
VirtualDiscFileSystem umd(&handles, gamePath_.c_str()); | ||
|
||
// Alright, let's fetch the PARAM.SFO. | ||
std::string paramSFOcontents; | ||
if (ReadFileToString(&umd, "/PARAM.SFO", ¶mSFOcontents, 0)) { | ||
lock_guard lock(info_->lock); | ||
info_->paramSFO.ReadSFO((const u8 *)paramSFOcontents.data(), paramSFOcontents.size()); | ||
info_->ParseParamSFO(); | ||
} | ||
|
||
ReadFileToString(&umd, "/ICON0.PNG", &info_->iconTextureData, &info_->lock); | ||
info_->iconDataLoaded = true; | ||
if (info_->wantFlags & GAMEINFO_WANTBG) { | ||
ReadFileToString(&umd, "/PIC1.PNG", &info_->pic1TextureData, &info_->lock); | ||
info_->pic1DataLoaded = true; | ||
} | ||
break; | ||
} | ||
|
||
case FILETYPE_PPSSPP_SAVESTATE: | ||
{ | ||
break; | ||
} | ||
|
||
case FILETYPE_PSP_DISC_DIRECTORY: | ||
{ | ||
info_->fileType = FILETYPE_PSP_ISO; | ||
|
@@ -399,6 +452,7 @@ class GameInfoWorkItem : public PrioritizedWorkQueueItem { | |
} | ||
break; | ||
} | ||
|
||
case FILETYPE_PSP_ISO: | ||
case FILETYPE_PSP_ISO_NP: | ||
{ | ||
|
@@ -517,7 +571,6 @@ class GameInfoWorkItem : public PrioritizedWorkQueueItem { | |
}; | ||
|
||
|
||
|
||
GameInfoCache::~GameInfoCache() { | ||
Clear(); | ||
} | ||
|
@@ -531,18 +584,6 @@ void GameInfoCache::Shutdown() { | |
StopProcessingWorkQueue(gameInfoWQ_); | ||
} | ||
|
||
void GameInfoCache::Save() { | ||
// TODO | ||
} | ||
|
||
void GameInfoCache::Load() { | ||
// TODO | ||
} | ||
|
||
void GameInfoCache::Decimate() { | ||
// TODO | ||
} | ||
|
||
void GameInfoCache::Clear() { | ||
if (gameInfoWQ_) | ||
gameInfoWQ_->Flush(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, why? The goal is to capture time in
__IoCompleteAsyncIO
essentially.-[Unknown]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to remove it because our profiler can't handle entering the same scope recursively.
However shouldn't have done it in this branch, and should probably rather have fixed the profiler :)