mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
save-overlays: add entry size info
This commit is contained in:
parent
14b6d6291b
commit
3c37036f7a
@ -16,6 +16,7 @@
|
||||
#include "Loader/PSF.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Utilities/span.h"
|
||||
#include "Utilities/date_time.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <algorithm>
|
||||
@ -53,6 +54,23 @@ SaveDialogBase::~SaveDialogBase()
|
||||
{
|
||||
}
|
||||
|
||||
std::string SaveDataEntry::date() const
|
||||
{
|
||||
return date_time::fmt_time("%c", mtime);
|
||||
}
|
||||
|
||||
std::string SaveDataEntry::data_size() const
|
||||
{
|
||||
std::string metric = "KB";
|
||||
u64 sz = utils::aligned_div(size, 1000);
|
||||
if (sz > 1000)
|
||||
{
|
||||
metric = "MB";
|
||||
sz = utils::aligned_div(sz, 1000);
|
||||
}
|
||||
return fmt::format("%lu %s", sz, metric);
|
||||
}
|
||||
|
||||
// cellSaveData aliases (only for cellSaveData.cpp)
|
||||
using PSetList = vm::ptr<CellSaveDataSetList>;
|
||||
using PSetBuf = vm::ptr<CellSaveDataSetBuf>;
|
||||
@ -315,7 +333,7 @@ static error_code display_callback_result_error_message(ppu_thread& ppu, const C
|
||||
|
||||
static std::string get_confirmation_message(u32 operation, const SaveDataEntry& entry)
|
||||
{
|
||||
const std::string info = entry.title + "\n" + entry.subtitle + "\n" + entry.details;
|
||||
const std::string info = fmt::format("%s\n%s\n%s\n%s\n\n%s", entry.title, entry.subtitle, entry.date(), entry.data_size(), entry.details);
|
||||
|
||||
if (operation == SAVEDATA_OP_LIST_DELETE || operation == SAVEDATA_OP_FIXED_DELETE)
|
||||
{
|
||||
|
@ -352,6 +352,9 @@ struct SaveDataEntry
|
||||
s64 ctime{0};
|
||||
std::vector<uchar> iconBuf;
|
||||
bool isNew{false};
|
||||
|
||||
std::string date() const;
|
||||
std::string data_size() const;
|
||||
};
|
||||
|
||||
class SaveDialogBase
|
||||
|
@ -178,9 +178,9 @@ namespace rsx
|
||||
|
||||
for (auto& entry : save_entries)
|
||||
{
|
||||
const std::string modification_time = date_time::fmt_time("%c", entry.mtime);
|
||||
const std::string date_and_size = fmt::format("%s %s", entry.date(), entry.data_size());
|
||||
std::unique_ptr<overlay_element> e;
|
||||
e = std::make_unique<save_dialog_entry>(entry.subtitle, modification_time, entry.details, image_resource_id::raw_image, entry.iconBuf);
|
||||
e = std::make_unique<save_dialog_entry>(entry.subtitle, date_and_size, entry.details, image_resource_id::raw_image, entry.iconBuf);
|
||||
entries.emplace_back(std::move(e));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user