core: Resolve variable shadowing
This commit is contained in:
2
externals/cubeb
vendored
2
externals/cubeb
vendored
Submodule externals/cubeb updated: 1d66483ad2...616d773441
@@ -132,9 +132,9 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
|
||||
}
|
||||
}
|
||||
|
||||
void CoreTiming::AddTicks(u64 ticks) {
|
||||
this->ticks += ticks;
|
||||
downcount -= static_cast<s64>(ticks);
|
||||
void CoreTiming::AddTicks(u64 ticks_) {
|
||||
ticks += ticks_;
|
||||
downcount -= static_cast<s64>(ticks_);
|
||||
}
|
||||
|
||||
void CoreTiming::Idle() {
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
CpuManager& operator=(CpuManager&&) = delete;
|
||||
|
||||
/// Sets if emulation is multicore or single core, must be set before Initialize
|
||||
void SetMulticore(bool is_multicore) {
|
||||
this->is_multicore = is_multicore;
|
||||
void SetMulticore(bool multicore_state) {
|
||||
is_multicore = multicore_state;
|
||||
}
|
||||
|
||||
/// Sets if emulation is using an asynchronous GPU.
|
||||
void SetAsyncGpu(bool is_async_gpu) {
|
||||
this->is_async_gpu = is_async_gpu;
|
||||
void SetAsyncGpu(bool async_gpu_state) {
|
||||
is_async_gpu = async_gpu_state;
|
||||
}
|
||||
|
||||
void Initialize();
|
||||
|
||||
@@ -179,8 +179,8 @@ u32 XCI::GetSystemUpdateVersion() {
|
||||
if (update == nullptr)
|
||||
return 0;
|
||||
|
||||
for (const auto& file : update->GetFiles()) {
|
||||
NCA nca{file, nullptr, 0};
|
||||
for (const auto& update_file : update->GetFiles()) {
|
||||
NCA nca{update_file, nullptr, 0};
|
||||
|
||||
if (nca.GetStatus() != Loader::ResultStatus::Success)
|
||||
continue;
|
||||
@@ -262,8 +262,8 @@ VirtualDir XCI::ConcatenatedPseudoDirectory() {
|
||||
if (part == nullptr)
|
||||
continue;
|
||||
|
||||
for (const auto& file : part->GetFiles())
|
||||
out->AddFile(file);
|
||||
for (const auto& xci_file : part->GetFiles())
|
||||
out->AddFile(xci_file);
|
||||
}
|
||||
|
||||
return out;
|
||||
@@ -283,12 +283,12 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) {
|
||||
return Loader::ResultStatus::ErrorXCIMissingPartition;
|
||||
}
|
||||
|
||||
for (const VirtualFile& file : partition->GetFiles()) {
|
||||
if (file->GetExtension() != "nca") {
|
||||
for (const VirtualFile& part_file : partition->GetFiles()) {
|
||||
if (part_file->GetExtension() != "nca") {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto nca = std::make_shared<NCA>(file, nullptr, 0);
|
||||
auto nca = std::make_shared<NCA>(part_file, nullptr, 0);
|
||||
if (nca->IsUpdate()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ static u64 romfs_get_hash_table_count(u64 num_entries) {
|
||||
return count;
|
||||
}
|
||||
|
||||
void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir extension,
|
||||
std::shared_ptr<RomFSBuildDirectoryContext> parent) {
|
||||
std::vector<std::shared_ptr<RomFSBuildDirectoryContext>> child_dirs;
|
||||
|
||||
@@ -147,7 +147,8 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
|
||||
child->path = parent->path + "/" + kv.first;
|
||||
|
||||
if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr)
|
||||
if (extension != nullptr &&
|
||||
extension->GetFileRelative(child->path + ".stub") != nullptr)
|
||||
continue;
|
||||
|
||||
// Sanity check on path_len
|
||||
@@ -163,7 +164,8 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
|
||||
child->path = parent->path + "/" + kv.first;
|
||||
|
||||
if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr)
|
||||
if (extension != nullptr &&
|
||||
extension->GetFileRelative(child->path + ".stub") != nullptr)
|
||||
continue;
|
||||
|
||||
// Sanity check on path_len
|
||||
@@ -171,8 +173,8 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
|
||||
child->source = root_romfs->GetFileRelative(child->path);
|
||||
|
||||
if (ext != nullptr) {
|
||||
const auto ips = ext->GetFileRelative(child->path + ".ips");
|
||||
if (extension != nullptr) {
|
||||
const auto ips = extension->GetFileRelative(child->path + ".ips");
|
||||
|
||||
if (ips != nullptr) {
|
||||
auto patched = PatchIPS(child->source, ips);
|
||||
@@ -188,7 +190,7 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
}
|
||||
|
||||
for (auto& child : child_dirs) {
|
||||
this->VisitDirectory(root_romfs, ext, child);
|
||||
this->VisitDirectory(root_romfs, extension, child);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,10 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {
|
||||
// Read out of bounds.
|
||||
if (offset >= relocation.size)
|
||||
return 0;
|
||||
const auto relocation = GetRelocationEntry(offset);
|
||||
const auto section_offset = offset - relocation.address_patch + relocation.address_source;
|
||||
const auto bktr_read = relocation.from_patch;
|
||||
const auto relocation_entry = GetRelocationEntry(offset);
|
||||
const auto section_offset =
|
||||
offset - relocation_entry.address_patch + relocation_entry.address_source;
|
||||
const auto bktr_read = relocation_entry.from_patch;
|
||||
|
||||
const auto next_relocation = GetNextRelocationEntry(offset);
|
||||
|
||||
@@ -106,12 +107,12 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {
|
||||
return bktr_romfs->Read(data, length, section_offset);
|
||||
}
|
||||
|
||||
const auto subsection = GetSubsectionEntry(section_offset);
|
||||
const auto subsection_entry = GetSubsectionEntry(section_offset);
|
||||
Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(key, Core::Crypto::Mode::CTR);
|
||||
|
||||
// Calculate AES IV
|
||||
std::array<u8, 16> iv{};
|
||||
auto subsection_ctr = subsection.ctr;
|
||||
auto subsection_ctr = subsection_entry.ctr;
|
||||
auto offset_iv = section_offset + base_offset;
|
||||
for (std::size_t i = 0; i < section_ctr.size(); ++i)
|
||||
iv[i] = section_ctr[0x8 - i - 1];
|
||||
|
||||
@@ -280,14 +280,14 @@ NcaID PlaceholderCache::Generate() {
|
||||
return out;
|
||||
}
|
||||
|
||||
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir,
|
||||
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& directory,
|
||||
std::string_view path) const {
|
||||
const auto file = dir->GetFileRelative(path);
|
||||
const auto file = directory->GetFileRelative(path);
|
||||
if (file != nullptr) {
|
||||
return file;
|
||||
}
|
||||
|
||||
const auto nca_dir = dir->GetDirectoryRelative(path);
|
||||
const auto nca_dir = directory->GetDirectoryRelative(path);
|
||||
if (nca_dir == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -430,11 +430,11 @@ void RegisteredCache::ProcessFiles(const std::vector<NcaID>& ids) {
|
||||
}
|
||||
|
||||
void RegisteredCache::AccumulateYuzuMeta() {
|
||||
const auto dir = this->dir->GetSubdirectory("yuzu_meta");
|
||||
if (dir == nullptr)
|
||||
const auto directory = dir->GetSubdirectory("yuzu_meta");
|
||||
if (directory == nullptr)
|
||||
return;
|
||||
|
||||
for (const auto& file : dir->GetFiles()) {
|
||||
for (const auto& file : directory->GetFiles()) {
|
||||
if (file->GetExtension() != "cnmt")
|
||||
continue;
|
||||
|
||||
@@ -565,7 +565,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
|
||||
}
|
||||
|
||||
const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32);
|
||||
const auto meta_id = Common::HexStringToArray<16>(meta_id_raw);
|
||||
const auto hex_meta_id = Common::HexStringToArray<16>(meta_id_raw);
|
||||
|
||||
if ((*meta_iter)->GetSubdirectories().empty()) {
|
||||
LOG_ERROR(Loader,
|
||||
@@ -590,7 +590,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
|
||||
const auto result = RemoveExistingEntry(title_id);
|
||||
|
||||
// Install Metadata File
|
||||
const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, meta_id);
|
||||
const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, hex_meta_id);
|
||||
if (res != InstallResult::Success) {
|
||||
return res;
|
||||
}
|
||||
@@ -740,15 +740,15 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
|
||||
|
||||
bool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) {
|
||||
// Reasoning behind this method can be found in the comment for InstallEntry, NCA overload.
|
||||
const auto dir = this->dir->CreateDirectoryRelative("yuzu_meta");
|
||||
const auto directory = dir->CreateDirectoryRelative("yuzu_meta");
|
||||
const auto filename = GetCNMTName(cnmt.GetType(), cnmt.GetTitleID());
|
||||
if (dir->GetFile(filename) == nullptr) {
|
||||
auto out = dir->CreateFile(filename);
|
||||
if (directory->GetFile(filename) == nullptr) {
|
||||
auto out = directory->CreateFile(filename);
|
||||
const auto buffer = cnmt.Serialize();
|
||||
out->Resize(buffer.size());
|
||||
out->WriteBytes(buffer);
|
||||
} else {
|
||||
auto out = dir->GetFile(filename);
|
||||
auto out = directory->GetFile(filename);
|
||||
CNMT old_cnmt(out);
|
||||
// Returns true on change
|
||||
if (old_cnmt.UnionRecords(cnmt)) {
|
||||
|
||||
@@ -33,8 +33,8 @@ RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader, ContentProvider& provi
|
||||
|
||||
RomFSFactory::~RomFSFactory() = default;
|
||||
|
||||
void RomFSFactory::SetPackedUpdate(VirtualFile update_raw) {
|
||||
this->update_raw = std::move(update_raw);
|
||||
void RomFSFactory::SetPackedUpdate(VirtualFile update_raw_) {
|
||||
update_raw = std::move(update_raw_);
|
||||
}
|
||||
|
||||
ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const {
|
||||
|
||||
@@ -170,9 +170,9 @@ std::string SaveDataFactory::GetFullPath(Core::System& system, SaveDataSpaceId s
|
||||
SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,
|
||||
u128 user_id) const {
|
||||
const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);
|
||||
const auto dir = GetOrCreateDirectoryRelative(this->dir, path);
|
||||
const auto directory = GetOrCreateDirectoryRelative(dir, path);
|
||||
|
||||
const auto size_file = dir->GetFile(SAVE_DATA_SIZE_FILENAME);
|
||||
const auto size_file = directory->GetFile(SAVE_DATA_SIZE_FILENAME);
|
||||
if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize))
|
||||
return {0, 0};
|
||||
|
||||
@@ -185,9 +185,9 @@ SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,
|
||||
void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,
|
||||
SaveDataSize new_value) const {
|
||||
const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);
|
||||
const auto dir = GetOrCreateDirectoryRelative(this->dir, path);
|
||||
const auto directory = GetOrCreateDirectoryRelative(dir, path);
|
||||
|
||||
const auto size_file = dir->CreateFile(SAVE_DATA_SIZE_FILENAME);
|
||||
const auto size_file = directory->CreateFile(SAVE_DATA_SIZE_FILENAME);
|
||||
if (size_file == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ std::size_t ConcatenatedVfsFile::Write(const u8* data, std::size_t length, std::
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ConcatenatedVfsFile::Rename(std::string_view name) {
|
||||
bool ConcatenatedVfsFile::Rename(std::string_view name_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ VirtualDir LayeredVfsDirectory::GetDirectoryRelative(std::string_view path) cons
|
||||
return MakeLayeredDirectory(std::move(out));
|
||||
}
|
||||
|
||||
VirtualFile LayeredVfsDirectory::GetFile(std::string_view name) const {
|
||||
return GetFileRelative(name);
|
||||
VirtualFile LayeredVfsDirectory::GetFile(std::string_view name_) const {
|
||||
return GetFileRelative(name_);
|
||||
}
|
||||
|
||||
VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view name) const {
|
||||
return GetDirectoryRelative(name);
|
||||
VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view name_) const {
|
||||
return GetDirectoryRelative(name_);
|
||||
}
|
||||
|
||||
std::string LayeredVfsDirectory::GetFullPath() const {
|
||||
@@ -105,19 +105,19 @@ VirtualDir LayeredVfsDirectory::GetParentDirectory() const {
|
||||
return dirs[0]->GetParentDirectory();
|
||||
}
|
||||
|
||||
VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view name) {
|
||||
VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VirtualFile LayeredVfsDirectory::CreateFile(std::string_view name) {
|
||||
VirtualFile LayeredVfsDirectory::CreateFile(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view name) {
|
||||
bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view name_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayeredVfsDirectory::DeleteFile(std::string_view name) {
|
||||
bool LayeredVfsDirectory::DeleteFile(std::string_view name_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ std::size_t OffsetVfsFile::WriteBytes(const std::vector<u8>& data, std::size_t r
|
||||
return file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset);
|
||||
}
|
||||
|
||||
bool OffsetVfsFile::Rename(std::string_view name) {
|
||||
return file->Rename(name);
|
||||
bool OffsetVfsFile::Rename(std::string_view name_) {
|
||||
return file->Rename(name_);
|
||||
}
|
||||
|
||||
std::size_t OffsetVfsFile::GetOffset() const {
|
||||
|
||||
@@ -352,16 +352,16 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string&
|
||||
|
||||
RealVfsDirectory::~RealVfsDirectory() = default;
|
||||
|
||||
VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path) const {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
|
||||
VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path_) const {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(path_));
|
||||
if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) {
|
||||
return nullptr;
|
||||
}
|
||||
return base.OpenFile(full_path, perms);
|
||||
}
|
||||
|
||||
VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path) const {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
|
||||
VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path_) const {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(path_));
|
||||
if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -376,18 +376,23 @@ VirtualDir RealVfsDirectory::GetSubdirectory(std::string_view name) const {
|
||||
return GetDirectoryRelative(name);
|
||||
}
|
||||
|
||||
VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path) {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
|
||||
VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path_) {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path_));
|
||||
return base.CreateFile(full_path, perms);
|
||||
}
|
||||
|
||||
VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view path) {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
|
||||
std::shared_ptr<VfsFile> RealVfsDirectory::CreateFileRelative(std::string_view file_path) {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(file_path));
|
||||
return base.CreateFile(full_path, perms);
|
||||
}
|
||||
|
||||
std::shared_ptr<VfsDirectory> RealVfsDirectory::CreateDirectoryRelative(std::string_view dir_path_) {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(dir_path_));
|
||||
return base.CreateDirectory(full_path, perms);
|
||||
}
|
||||
|
||||
bool RealVfsDirectory::DeleteSubdirectoryRecursive(std::string_view name) {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(name));
|
||||
bool RealVfsDirectory::DeleteSubdirectoryRecursive(std::string_view dir_path) {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(dir_path));
|
||||
return base.DeleteDirectory(full_path);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,12 +103,12 @@ static bool FindAndRemoveVectorElement(std::vector<T>& vec, std::string_view nam
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VectorVfsDirectory::DeleteSubdirectory(std::string_view name) {
|
||||
return FindAndRemoveVectorElement(dirs, name);
|
||||
bool VectorVfsDirectory::DeleteSubdirectory(std::string_view name_) {
|
||||
return FindAndRemoveVectorElement(dirs, name_);
|
||||
}
|
||||
|
||||
bool VectorVfsDirectory::DeleteFile(std::string_view name) {
|
||||
return FindAndRemoveVectorElement(files, name);
|
||||
bool VectorVfsDirectory::DeleteFile(std::string_view name_) {
|
||||
return FindAndRemoveVectorElement(files, name_);
|
||||
}
|
||||
|
||||
bool VectorVfsDirectory::Rename(std::string_view name_) {
|
||||
@@ -116,11 +116,15 @@ bool VectorVfsDirectory::Rename(std::string_view name_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view name) {
|
||||
VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VirtualFile VectorVfsDirectory::CreateFile(std::string_view name) {
|
||||
std::shared_ptr<VfsDirectory> VectorVfsDirectory::CreateSubdirectory(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<VfsFile> VectorVfsDirectory::CreateFile(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ struct KernelCore::Impl {
|
||||
: synchronization{system}, time_manager{system}, global_handle_table{kernel}, system{
|
||||
system} {}
|
||||
|
||||
void SetMulticore(bool is_multicore) {
|
||||
this->is_multicore = is_multicore;
|
||||
void SetMulticore(bool multicore_state) {
|
||||
is_multicore = multicore_state;
|
||||
}
|
||||
|
||||
void Initialize(KernelCore& kernel) {
|
||||
|
||||
@@ -457,7 +457,7 @@ void WebBrowser::InitializeOffline() {
|
||||
Common::FS::DirectorySeparator::PlatformDefault);
|
||||
Common::FS::DeleteDirRecursively(temporary_dir);
|
||||
|
||||
u64 title_id = 0; // 0 corresponds to current process
|
||||
u64 tid = 0; // 0 corresponds to current process
|
||||
ASSERT(args[WebArgTLVType::ApplicationID].size() >= 0x8);
|
||||
std::memcpy(&title_id, args[WebArgTLVType::ApplicationID].data(), sizeof(u64));
|
||||
FileSys::ContentRecordType type = FileSys::ContentRecordType::Data;
|
||||
@@ -465,7 +465,7 @@ void WebBrowser::InitializeOffline() {
|
||||
switch (source) {
|
||||
case OfflineWebSource::OfflineHtmlPage:
|
||||
// While there is an AppID TLV field, in official SW this is always ignored.
|
||||
title_id = 0;
|
||||
tid = 0;
|
||||
type = FileSys::ContentRecordType::HtmlDocument;
|
||||
break;
|
||||
case OfflineWebSource::ApplicationLegalInformation:
|
||||
@@ -476,11 +476,11 @@ void WebBrowser::InitializeOffline() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (title_id == 0) {
|
||||
title_id = system.CurrentProcess()->GetTitleID();
|
||||
if (tid == 0) {
|
||||
tid = system.CurrentProcess()->GetTitleID();
|
||||
}
|
||||
|
||||
offline_romfs = GetApplicationRomFS(system, title_id, type);
|
||||
offline_romfs = GetApplicationRomFS(system, tid, type);
|
||||
if (offline_romfs == nullptr) {
|
||||
status = RESULT_UNKNOWN;
|
||||
LOG_ERROR(Service_AM, "Failed to find offline data for request!");
|
||||
|
||||
@@ -415,9 +415,9 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
|
||||
if (Settings::values.bcat_boxcat_local) {
|
||||
LOG_INFO(Service_BCAT, "Boxcat using local data by override, skipping download.");
|
||||
} else {
|
||||
Boxcat::Client client{path, title.title_id, title.build_id};
|
||||
Boxcat::Client bcat_client{path, title.title_id, title.build_id};
|
||||
|
||||
const auto res = client.DownloadLaunchParam();
|
||||
const auto res = bcat_client.DownloadLaunchParam();
|
||||
if (res != DownloadResult::Success) {
|
||||
LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@ public:
|
||||
}
|
||||
|
||||
bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) const {
|
||||
SystemClockContext context{};
|
||||
if (GetClockContext(system, context) != RESULT_SUCCESS) {
|
||||
SystemClockContext ctx{};
|
||||
if (GetClockContext(system, ctx) != RESULT_SUCCESS) {
|
||||
return {};
|
||||
}
|
||||
|
||||
s64 span{};
|
||||
if (context.steady_time_point.GetSpanBetween(
|
||||
GetSteadyClockCore().GetCurrentTimePoint(system), span) != RESULT_SUCCESS) {
|
||||
if (ctx.steady_time_point.GetSpanBetween(GetSteadyClockCore().GetCurrentTimePoint(system),
|
||||
span) != RESULT_SUCCESS) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -34,21 +34,21 @@ ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::Syst
|
||||
}
|
||||
|
||||
ResultCode StandardUserSystemClockCore::GetClockContext(Core::System& system,
|
||||
SystemClockContext& context) const {
|
||||
SystemClockContext& ctx) const {
|
||||
if (const ResultCode result{ApplyAutomaticCorrection(system, false)};
|
||||
result != RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return local_system_clock_core.GetClockContext(system, context);
|
||||
return local_system_clock_core.GetClockContext(system, ctx);
|
||||
}
|
||||
|
||||
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext& context) {
|
||||
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext& ctx) {
|
||||
UNREACHABLE();
|
||||
return ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ResultCode StandardUserSystemClockCore::SetClockContext(const SystemClockContext& context) {
|
||||
ResultCode StandardUserSystemClockCore::SetClockContext(const SystemClockContext& ctx) {
|
||||
UNREACHABLE();
|
||||
return ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@@ -63,13 +63,13 @@ ResultCode StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& s
|
||||
return ERROR_UNINITIALIZED_CLOCK;
|
||||
}
|
||||
|
||||
SystemClockContext context{};
|
||||
if (const ResultCode result{network_system_clock_core.GetClockContext(system, context)};
|
||||
SystemClockContext ctx{};
|
||||
if (const ResultCode result{network_system_clock_core.GetClockContext(system, ctx)};
|
||||
result != RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
local_system_clock_core.SetClockContext(context);
|
||||
local_system_clock_core.SetClockContext(ctx);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace Loader {
|
||||
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_,
|
||||
bool override_update)
|
||||
: AppLoader(std::move(file_)), override_update(override_update) {
|
||||
const auto dir = file->GetContainingDirectory();
|
||||
const auto file_dir = file->GetContainingDirectory();
|
||||
|
||||
// Title ID
|
||||
const auto npdm = dir->GetFile("main.npdm");
|
||||
const auto npdm = file_dir->GetFile("main.npdm");
|
||||
if (npdm != nullptr) {
|
||||
const auto res = metadata.Load(npdm);
|
||||
if (res == ResultStatus::Success)
|
||||
@@ -37,7 +37,7 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
|
||||
// Icon
|
||||
FileSys::VirtualFile icon_file = nullptr;
|
||||
for (const auto& language : FileSys::LANGUAGE_NAMES) {
|
||||
icon_file = dir->GetFile("icon_" + std::string(language) + ".dat");
|
||||
icon_file = file_dir->GetFile("icon_" + std::string(language) + ".dat");
|
||||
if (icon_file != nullptr) {
|
||||
icon_data = icon_file->ReadAllBytes();
|
||||
break;
|
||||
@@ -46,24 +46,23 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
|
||||
|
||||
if (icon_data.empty()) {
|
||||
// Any png, jpeg, or bmp file
|
||||
const auto& files = dir->GetFiles();
|
||||
const auto& files = file_dir->GetFiles();
|
||||
const auto icon_iter =
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
||||
return file->GetExtension() == "png" || file->GetExtension() == "jpg" ||
|
||||
file->GetExtension() == "bmp" || file->GetExtension() == "jpeg";
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& f) {
|
||||
return f->GetExtension() == "png" || f->GetExtension() == "jpg" ||
|
||||
f->GetExtension() == "bmp" || f->GetExtension() == "jpeg";
|
||||
});
|
||||
if (icon_iter != files.end())
|
||||
icon_data = (*icon_iter)->ReadAllBytes();
|
||||
}
|
||||
|
||||
// Metadata
|
||||
FileSys::VirtualFile nacp_file = dir->GetFile("control.nacp");
|
||||
FileSys::VirtualFile nacp_file = file_dir->GetFile("control.nacp");
|
||||
if (nacp_file == nullptr) {
|
||||
const auto& files = dir->GetFiles();
|
||||
const auto& files = file_dir->GetFiles();
|
||||
const auto nacp_iter =
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
||||
return file->GetExtension() == "nacp";
|
||||
});
|
||||
std::find_if(files.begin(), files.end(),
|
||||
[](const FileSys::VirtualFile& f) { return f->GetExtension() == "nacp"; });
|
||||
if (nacp_iter != files.end())
|
||||
nacp_file = *nacp_iter;
|
||||
}
|
||||
@@ -184,8 +183,8 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
||||
// Find the RomFS by searching for a ".romfs" file in this directory
|
||||
const auto& files = dir->GetFiles();
|
||||
const auto romfs_iter =
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
||||
return file->GetName().find(".romfs") != std::string::npos;
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& f) {
|
||||
return f->GetName().find(".romfs") != std::string::npos;
|
||||
});
|
||||
|
||||
// Register the RomFS if a ".romfs" file was found
|
||||
@@ -200,10 +199,10 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
||||
LoadParameters{metadata.GetMainThreadPriority(), metadata.GetMainThreadStackSize()}};
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(FileSys::VirtualFile& dir) {
|
||||
ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(FileSys::VirtualFile& romfs_dir) {
|
||||
if (romfs == nullptr)
|
||||
return ResultStatus::ErrorNoRomFS;
|
||||
dir = romfs;
|
||||
romfs_dir = romfs;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
@@ -230,12 +229,12 @@ bool AppLoader_DeconstructedRomDirectory::IsRomFSUpdatable() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_DeconstructedRomDirectory::ReadNSOModules(Modules& modules) {
|
||||
ResultStatus AppLoader_DeconstructedRomDirectory::ReadNSOModules(Modules& modules_) {
|
||||
if (!is_loaded) {
|
||||
return ResultStatus::ErrorNotInitialized;
|
||||
}
|
||||
|
||||
modules = this->modules;
|
||||
modules_ = modules;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
* @param file The directory containing the RomFS
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadRomFS(FileSys::VirtualFile& file) {
|
||||
virtual ResultStatus ReadRomFS(FileSys::VirtualFile& file_) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
* @param file The raw update NCA file (Program-type
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
virtual ResultStatus ReadUpdateRaw(FileSys::VirtualFile& file_) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
* @param file The raw manual RomFS of the game
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadManualRomFS(FileSys::VirtualFile& file) {
|
||||
virtual ResultStatus ReadManualRomFS(FileSys::VirtualFile& file_) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& file) {
|
||||
return LoadNroImpl(process, file.ReadAllBytes(), file.GetName());
|
||||
bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& nro_file) {
|
||||
return LoadNroImpl(process, nro_file.ReadAllBytes(), nro_file.GetName());
|
||||
}
|
||||
|
||||
AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process, Core::System& system) {
|
||||
|
||||
@@ -183,8 +183,8 @@ AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process, Core::Sy
|
||||
LoadParameters{Kernel::THREADPRIO_DEFAULT, Core::Memory::DEFAULT_STACK_SIZE}};
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules) {
|
||||
modules = this->modules;
|
||||
ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules_) {
|
||||
modules_ = modules;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,15 +121,15 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process, Core::Sy
|
||||
return result;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& file) {
|
||||
return secondary_loader->ReadRomFS(file);
|
||||
ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& nsp_file) {
|
||||
return secondary_loader->ReadRomFS(nsp_file);
|
||||
}
|
||||
|
||||
u64 AppLoader_NSP::ReadRomFSIVFCOffset() const {
|
||||
return secondary_loader->ReadRomFSIVFCOffset();
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& nsp_file) {
|
||||
if (nsp->IsExtractedType())
|
||||
return ResultStatus::ErrorNoPackedUpdate;
|
||||
|
||||
@@ -143,7 +143,7 @@ ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
if (nca_test->GetStatus() != ResultStatus::ErrorMissingBKTRBaseRomFS)
|
||||
return nca_test->GetStatus();
|
||||
|
||||
file = read;
|
||||
nsp_file = read;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
@@ -175,13 +175,13 @@ ResultStatus AppLoader_NSP::ReadControlData(FileSys::NACP& nacp) {
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSP::ReadManualRomFS(FileSys::VirtualFile& file) {
|
||||
ResultStatus AppLoader_NSP::ReadManualRomFS(FileSys::VirtualFile& romfs_file) {
|
||||
const auto nca =
|
||||
nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::HtmlDocument);
|
||||
if (nsp->GetStatus() != ResultStatus::Success || nca == nullptr)
|
||||
return ResultStatus::ErrorNoRomFS;
|
||||
file = nca->GetRomFS();
|
||||
return file == nullptr ? ResultStatus::ErrorNoRomFS : ResultStatus::Success;
|
||||
romfs_file = nca->GetRomFS();
|
||||
return romfs_file == nullptr ? ResultStatus::ErrorNoRomFS : ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSP::ReadBanner(std::vector<u8>& buffer) {
|
||||
|
||||
@@ -87,15 +87,15 @@ AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::Process& process, Core::Sy
|
||||
return result;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& file) {
|
||||
return nca_loader->ReadRomFS(file);
|
||||
ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& xci_file) {
|
||||
return nca_loader->ReadRomFS(xci_file);
|
||||
}
|
||||
|
||||
u64 AppLoader_XCI::ReadRomFSIVFCOffset() const {
|
||||
return nca_loader->ReadRomFSIVFCOffset();
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_XCI::ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
ResultStatus AppLoader_XCI::ReadUpdateRaw(FileSys::VirtualFile& xci_update) {
|
||||
u64 program_id{};
|
||||
nca_loader->ReadProgramId(program_id);
|
||||
if (program_id == 0)
|
||||
@@ -111,7 +111,7 @@ ResultStatus AppLoader_XCI::ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
if (nca_test->GetStatus() != ResultStatus::ErrorMissingBKTRBaseRomFS)
|
||||
return nca_test->GetStatus();
|
||||
|
||||
file = read;
|
||||
xci_update = read;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
@@ -140,13 +140,13 @@ ResultStatus AppLoader_XCI::ReadControlData(FileSys::NACP& control) {
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& file) {
|
||||
ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& xci_manual) {
|
||||
const auto nca = xci->GetSecurePartitionNSP()->GetNCA(xci->GetProgramTitleID(),
|
||||
FileSys::ContentRecordType::HtmlDocument);
|
||||
if (xci->GetStatus() != ResultStatus::Success || nca == nullptr)
|
||||
return ResultStatus::ErrorXCIMissingPartition;
|
||||
file = nca->GetRomFS();
|
||||
return file == nullptr ? ResultStatus::ErrorNoRomFS : ResultStatus::Success;
|
||||
xci_manual = nca->GetRomFS();
|
||||
return xci_manual == nullptr ? ResultStatus::ErrorNoRomFS : ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_XCI::ReadBanner(std::vector<u8>& buffer) {
|
||||
|
||||
Reference in New Issue
Block a user