mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2026-02-24 20:43:04 +00:00
Full rebrand
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project & 2024 suyu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
@@ -370,7 +370,7 @@ std::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id,
|
||||
if (type == ContentRecordType::Meta && meta_id.find(title_id) != meta_id.end())
|
||||
return meta_id.at(title_id);
|
||||
|
||||
const auto res1 = CheckMapForContentRecord(yuzu_meta, title_id, type);
|
||||
const auto res1 = CheckMapForContentRecord(suyu_meta, title_id, type);
|
||||
if (res1)
|
||||
return res1;
|
||||
return CheckMapForContentRecord(meta, title_id, type);
|
||||
@@ -437,8 +437,8 @@ void RegisteredCache::ProcessFiles(const std::vector<NcaID>& ids) {
|
||||
}
|
||||
}
|
||||
|
||||
void RegisteredCache::AccumulateYuzuMeta() {
|
||||
const auto meta_dir = dir->GetSubdirectory("yuzu_meta");
|
||||
void RegisteredCache::AccumulateSuyuMeta() {
|
||||
const auto meta_dir = dir->GetSubdirectory("suyu_meta");
|
||||
if (meta_dir == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -449,7 +449,7 @@ void RegisteredCache::AccumulateYuzuMeta() {
|
||||
}
|
||||
|
||||
CNMT cnmt(file);
|
||||
yuzu_meta.insert_or_assign(cnmt.GetTitleID(), std::move(cnmt));
|
||||
suyu_meta.insert_or_assign(cnmt.GetTitleID(), std::move(cnmt));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ void RegisteredCache::Refresh() {
|
||||
|
||||
const auto ids = AccumulateFiles();
|
||||
ProcessFiles(ids);
|
||||
AccumulateYuzuMeta();
|
||||
AccumulateSuyuMeta();
|
||||
}
|
||||
|
||||
RegisteredCache::RegisteredCache(VirtualDir dir_, ContentProviderParsingFunction parsing_function)
|
||||
@@ -485,9 +485,9 @@ std::optional<u32> RegisteredCache::GetEntryVersion(u64 title_id) const {
|
||||
return meta_iter->second.GetTitleVersion();
|
||||
}
|
||||
|
||||
const auto yuzu_meta_iter = yuzu_meta.find(title_id);
|
||||
if (yuzu_meta_iter != yuzu_meta.cend()) {
|
||||
return yuzu_meta_iter->second.GetTitleVersion();
|
||||
const auto suyu_meta_iter = suyu_meta.find(title_id);
|
||||
if (suyu_meta_iter != suyu_meta.cend()) {
|
||||
return suyu_meta_iter->second.GetTitleVersion();
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
@@ -519,7 +519,7 @@ void RegisteredCache::IterateAllMetadata(
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto& kv : yuzu_meta) {
|
||||
for (const auto& kv : suyu_meta) {
|
||||
const auto& cnmt = kv.second;
|
||||
for (const auto& rec : cnmt.GetContentRecords()) {
|
||||
if (GetFileAtID(rec.nca_id) != nullptr && filter(cnmt, rec)) {
|
||||
@@ -668,7 +668,7 @@ InstallResult RegisteredCache::InstallEntry(const NCA& nca, TitleType type,
|
||||
mbedtls_sha256_ret(data.data(), data.size(), c_rec.hash.data(), 0);
|
||||
std::memcpy(&c_rec.nca_id, &c_rec.hash, 16);
|
||||
const CNMT new_cnmt(header, opt_header, {c_rec}, {});
|
||||
if (!RawInstallYuzuMeta(new_cnmt)) {
|
||||
if (!RawInstallSuyuMeta(new_cnmt)) {
|
||||
return InstallResult::ErrorMetaFailed;
|
||||
}
|
||||
return RawInstallNCA(nca, copy, overwrite_if_exists, c_rec.nca_id);
|
||||
@@ -693,7 +693,7 @@ InstallResult RegisteredCache::InstallEntry(const NCA& nca, const CNMTHeader& ba
|
||||
};
|
||||
const OptionalHeader opt_header{0, 0};
|
||||
const CNMT new_cnmt(header, opt_header, {base_record}, {});
|
||||
if (!RawInstallYuzuMeta(new_cnmt)) {
|
||||
if (!RawInstallSuyuMeta(new_cnmt)) {
|
||||
return InstallResult::ErrorMetaFailed;
|
||||
}
|
||||
return RawInstallNCA(nca, copy, overwrite_if_exists, base_record.nca_id);
|
||||
@@ -749,9 +749,9 @@ bool RegisteredCache::RemoveExistingEntry(u64 title_id) const {
|
||||
deleted_html || deleted_legal);
|
||||
}
|
||||
|
||||
// If patch entries for any program exist in yuzu meta, remove them
|
||||
// If patch entries for any program exist in suyu meta, remove them
|
||||
for (u8 i = 0; i < 0x10; i++) {
|
||||
const auto meta_dir = dir->CreateDirectoryRelative("yuzu_meta");
|
||||
const auto meta_dir = dir->CreateDirectoryRelative("suyu_meta");
|
||||
const auto filename = GetCNMTName(TitleType::Update, title_id + i);
|
||||
if (meta_dir->GetFile(filename)) {
|
||||
removed_data |= meta_dir->DeleteFile(filename);
|
||||
@@ -802,9 +802,9 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
|
||||
: InstallResult::ErrorCopyFailed;
|
||||
}
|
||||
|
||||
bool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) {
|
||||
bool RegisteredCache::RawInstallSuyuMeta(const CNMT& cnmt) {
|
||||
// Reasoning behind this method can be found in the comment for InstallEntry, NCA overload.
|
||||
const auto meta_dir = dir->CreateDirectoryRelative("yuzu_meta");
|
||||
const auto meta_dir = dir->CreateDirectoryRelative("suyu_meta");
|
||||
const auto filename = GetCNMTName(cnmt.GetType(), cnmt.GetTitleID());
|
||||
if (meta_dir->GetFile(filename) == nullptr) {
|
||||
auto out = meta_dir->CreateFile(filename);
|
||||
@@ -823,11 +823,11 @@ bool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) {
|
||||
}
|
||||
}
|
||||
Refresh();
|
||||
return std::find_if(yuzu_meta.begin(), yuzu_meta.end(),
|
||||
return std::find_if(suyu_meta.begin(), suyu_meta.end(),
|
||||
[&cnmt](const std::pair<u64, CNMT>& kv) {
|
||||
return kv.second.GetType() == cnmt.GetType() &&
|
||||
kv.second.GetTitleID() == cnmt.GetTitleID();
|
||||
}) != yuzu_meta.end();
|
||||
}) != suyu_meta.end();
|
||||
}
|
||||
|
||||
ContentProviderUnion::~ContentProviderUnion() = default;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project & 2024 suyu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
@@ -164,8 +164,8 @@ public:
|
||||
const VfsCopyFunction& copy = &VfsRawCopy);
|
||||
|
||||
// Due to the fact that we must use Meta-type NCAs to determine the existence of files, this
|
||||
// poses quite a challenge. Instead of creating a new meta NCA for this file, yuzu will create a
|
||||
// dir inside the NAND called 'yuzu_meta' and store the raw CNMT there.
|
||||
// poses quite a challenge. Instead of creating a new meta NCA for this file, suyu will create a
|
||||
// dir inside the NAND called 'suyu_meta' and store the raw CNMT there.
|
||||
// TODO(DarkLordZach): Author real meta-type NCAs and install those.
|
||||
InstallResult InstallEntry(const NCA& nca, TitleType type, bool overwrite_if_exists = false,
|
||||
const VfsCopyFunction& copy = &VfsRawCopy);
|
||||
@@ -184,13 +184,13 @@ private:
|
||||
std::function<bool(const CNMT&, const ContentRecord&)> filter) const;
|
||||
std::vector<NcaID> AccumulateFiles() const;
|
||||
void ProcessFiles(const std::vector<NcaID>& ids);
|
||||
void AccumulateYuzuMeta();
|
||||
void AccumulateSuyuMeta();
|
||||
std::optional<NcaID> GetNcaIDFromMetadata(u64 title_id, ContentRecordType type) const;
|
||||
VirtualFile GetFileAtID(NcaID id) const;
|
||||
VirtualFile OpenFileOrDirectoryConcat(const VirtualDir& open_dir, std::string_view path) const;
|
||||
InstallResult RawInstallNCA(const NCA& nca, const VfsCopyFunction& copy,
|
||||
bool overwrite_if_exists, std::optional<NcaID> override_id = {});
|
||||
bool RawInstallYuzuMeta(const CNMT& cnmt);
|
||||
bool RawInstallSuyuMeta(const CNMT& cnmt);
|
||||
|
||||
VirtualDir dir;
|
||||
ContentProviderParsingFunction parser;
|
||||
@@ -199,8 +199,8 @@ private:
|
||||
std::map<u64, NcaID> meta_id;
|
||||
// maps tid -> meta
|
||||
std::map<u64, CNMT> meta;
|
||||
// maps tid -> meta for CNMT in yuzu_meta
|
||||
std::map<u64, CNMT> yuzu_meta;
|
||||
// maps tid -> meta for CNMT in suyu_meta
|
||||
std::map<u64, CNMT> suyu_meta;
|
||||
};
|
||||
|
||||
enum class ContentProviderUnionSlot {
|
||||
|
||||
@@ -18,7 +18,7 @@ class System;
|
||||
namespace FileSys {
|
||||
|
||||
constexpr const char* GetSaveDataSizeFileName() {
|
||||
return ".yuzu_save_size";
|
||||
return ".suyu_save_size";
|
||||
}
|
||||
|
||||
using ProgramId = u64;
|
||||
|
||||
Reference in New Issue
Block a user