1
0
Fork 1
forked from suyu/suyu

fs: don't enumerate hidden savedata size file

This commit is contained in:
Liam 2023-12-09 14:05:16 -05:00
parent c1924951ad
commit d597383ab2
3 changed files with 13 additions and 5 deletions

View file

@ -12,8 +12,6 @@
namespace FileSys { namespace FileSys {
constexpr char SAVE_DATA_SIZE_FILENAME[] = ".yuzu_save_size";
namespace { namespace {
void PrintSaveDataAttributeWarnings(SaveDataAttribute meta) { void PrintSaveDataAttributeWarnings(SaveDataAttribute meta) {
@ -197,7 +195,7 @@ SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,
GetFullPath(system, dir, SaveDataSpaceId::NandUser, type, title_id, user_id, 0); GetFullPath(system, dir, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);
const auto relative_dir = GetOrCreateDirectoryRelative(dir, path); const auto relative_dir = GetOrCreateDirectoryRelative(dir, path);
const auto size_file = relative_dir->GetFile(SAVE_DATA_SIZE_FILENAME); const auto size_file = relative_dir->GetFile(GetSaveDataSizeFileName());
if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize)) { if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize)) {
return {0, 0}; return {0, 0};
} }
@ -216,7 +214,7 @@ void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 us
GetFullPath(system, dir, SaveDataSpaceId::NandUser, type, title_id, user_id, 0); GetFullPath(system, dir, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);
const auto relative_dir = GetOrCreateDirectoryRelative(dir, path); const auto relative_dir = GetOrCreateDirectoryRelative(dir, path);
const auto size_file = relative_dir->CreateFile(SAVE_DATA_SIZE_FILENAME); const auto size_file = relative_dir->CreateFile(GetSaveDataSizeFileName());
if (size_file == nullptr) { if (size_file == nullptr) {
return; return;
} }

View file

@ -83,6 +83,10 @@ struct SaveDataSize {
u64 journal; u64 journal;
}; };
constexpr const char* GetSaveDataSizeFileName() {
return ".yuzu_save_size";
}
/// File system interface to the SaveData archive /// File system interface to the SaveData archive
class SaveDataFactory { class SaveDataFactory {
public: public:

View file

@ -246,7 +246,13 @@ static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vec
entries.reserve(entries.size() + new_data.size()); entries.reserve(entries.size() + new_data.size());
for (const auto& new_entry : new_data) { for (const auto& new_entry : new_data) {
entries.emplace_back(new_entry->GetName(), type, auto name = new_entry->GetName();
if (type == FileSys::EntryType::File && name == FileSys::GetSaveDataSizeFileName()) {
continue;
}
entries.emplace_back(name, type,
type == FileSys::EntryType::Directory ? 0 : new_entry->GetSize()); type == FileSys::EntryType::Directory ? 0 : new_entry->GetSize());
} }
} }