mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-12 20:40:49 +00:00
Improve savedata UI layout more, fix deletion of save states
This commit is contained in:
parent
00094e0fcc
commit
29514408af
@ -76,6 +76,12 @@ bool GameInfo::Delete() {
|
||||
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,8 +96,21 @@ bool GameInfo::Delete() {
|
||||
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)
|
||||
sizeSum += finfo.size;
|
||||
}
|
||||
// TODO: Need to recurse here.
|
||||
return 0;
|
||||
return sizeSum;
|
||||
}
|
||||
default:
|
||||
return GetFileLoader()->FileSize();
|
||||
}
|
||||
@ -145,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;
|
||||
|
@ -96,8 +96,8 @@ class GameInfo {
|
||||
public:
|
||||
GameInfo()
|
||||
: disc_total(0), disc_number(0), region(-1), fileType(FILETYPE_UNKNOWN), paramSFOLoaded(false),
|
||||
iconTexture(NULL), pic0Texture(NULL), pic1Texture(NULL), wantFlags(0),
|
||||
timeIconWasLoaded(0.0), timePic0WasLoaded(0.0), timePic1WasLoaded(0.0),
|
||||
iconTexture(nullptr), pic0Texture(nullptr), pic1Texture(nullptr), wantFlags(0),
|
||||
lastAccessedTime(0.0), timeIconWasLoaded(0.0), timePic0WasLoaded(0.0), timePic1WasLoaded(0.0),
|
||||
gameSize(0), saveDataSize(0), installDataSize(0), fileLoader(nullptr) {}
|
||||
~GameInfo();
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "UI/MainScreen.h"
|
||||
#include "UI/GameInfoCache.h"
|
||||
#include "UI/ui_atlas.h"
|
||||
#include "UI/PauseScreen.h"
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Host.h"
|
||||
@ -51,15 +52,32 @@ public:
|
||||
parent->Add(root);
|
||||
if (!ginfo)
|
||||
return;
|
||||
LinearLayout *toprow = new LinearLayout(ORIENT_HORIZONTAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
root->Add(toprow);
|
||||
|
||||
std::string savedata_detail = ginfo->paramSFO.GetValueString("SAVEDATA_DETAIL");
|
||||
std::string savedata_title = ginfo->paramSFO.GetValueString("SAVEDATA_TITLE");
|
||||
if (ginfo->fileType == FILETYPE_PSP_SAVEDATA_DIRECTORY) {
|
||||
std::string savedata_detail = ginfo->paramSFO.GetValueString("SAVEDATA_DETAIL");
|
||||
std::string savedata_title = ginfo->paramSFO.GetValueString("SAVEDATA_TITLE");
|
||||
|
||||
root->Add(new TextView(savedata_detail, 0, false, new LinearLayoutParams(Margins(10, 5))));
|
||||
root->Add(new Spacer(3.0));
|
||||
root->Add(new InfoItem("Name", ginfo->title));
|
||||
root->Add(new InfoItem("Title", savedata_title));
|
||||
root->Add(new InfoItem("Size", StringFromFormat("%d", ginfo->gameSize)));
|
||||
if (ginfo->iconTexture) {
|
||||
toprow->Add(new Thin3DTextureView(ginfo->iconTexture, IS_FIXED, new LinearLayoutParams(Margins(10, 5))));
|
||||
}
|
||||
LinearLayout *topright = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0));
|
||||
topright->Add(new TextView(savedata_title, 0, false));
|
||||
topright->Add(new TextView(StringFromFormat("%d kB", ginfo->gameSize / 1024), 0, true));
|
||||
toprow->Add(topright);
|
||||
root->Add(new Spacer(3.0));
|
||||
root->Add(new TextView(savedata_detail, 0, true, new LinearLayoutParams(Margins(10, 0))));
|
||||
root->Add(new Spacer(3.0));
|
||||
} else {
|
||||
std::string image_path = ReplaceAll(savePath_, "ppst", "jpg");
|
||||
if (File::Exists(image_path)) {
|
||||
PrioritizedWorkQueue *wq = g_gameInfoCache.WorkQueue();
|
||||
toprow->Add(new AsyncImageFileView(image_path, IS_DEFAULT, wq, new UI::LayoutParams(500, 500/16*9)));
|
||||
} else {
|
||||
toprow->Add(new TextView("no screenshot"));
|
||||
}
|
||||
}
|
||||
|
||||
I18NCategory *di = GetI18NCategory("Dialog");
|
||||
LinearLayout *buttons = new LinearLayout(ORIENT_HORIZONTAL);
|
||||
@ -95,7 +113,8 @@ private:
|
||||
};
|
||||
|
||||
UI::EventReturn SavedataPopupScreen::OnDeleteButtonClick(UI::EventParams &e) {
|
||||
File::DeleteDirRecursively(savePath_);
|
||||
GameInfo *ginfo = g_gameInfoCache.GetInfo(nullptr, savePath_, GAMEINFO_WANTSIZE);
|
||||
ginfo->Delete();
|
||||
screenManager()->finishDialog(this, DR_NO);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
@ -108,7 +127,7 @@ static std::string CleanSaveString(std::string str) {
|
||||
}
|
||||
|
||||
void SavedataButton::Draw(UIContext &dc) {
|
||||
GameInfo *ginfo = g_gameInfoCache.GetInfo(dc.GetThin3DContext(), savePath_, 0);
|
||||
GameInfo *ginfo = g_gameInfoCache.GetInfo(dc.GetThin3DContext(), savePath_, GAMEINFO_WANTSIZE);
|
||||
Thin3DTexture *texture = 0;
|
||||
u32 color = 0, shadowColor = 0;
|
||||
using namespace UI;
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit 32a75bea4639bd361ebf1bd532f6969547d6e3ba
|
||||
Subproject commit ba829ad4aa7a4acbacbaa7f77233e037862443e4
|
Loading…
x
Reference in New Issue
Block a user