Chore: Enable warnings as errors on MSVC (#6456)
* tests: add Sanity test for SplitFilename83 fix test fix test * disable `C4715:not all control paths return a value` for nihstro includes nihstro: no warn * Chore: Enable warnings as errors on msvc + fix warnings fixes some more warnings clang-format * more fixes * Externals: Add target_compile_options `/W0` nihstro-headers and ... Revert "disable `C4715:not all control paths return a value` for nihstro includes" This reverts commit 606d79b55d3044b744fb835025b8eb0f4ea5b757. * src\citra\config.cpp: ReadSetting: simplify type casting * settings.cpp: Get*Name: remove superflous logs
This commit is contained in:
parent
055a58f01e
commit
41f13456c0
71 changed files with 397 additions and 294 deletions
|
@ -85,6 +85,7 @@ std::u16string Path::AsU16Str() const {
|
|||
return {};
|
||||
case LowPathType::Invalid:
|
||||
case LowPathType::Binary:
|
||||
default:
|
||||
// TODO(yuriks): Add assert
|
||||
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
|
||||
return {};
|
||||
|
|
|
@ -144,45 +144,45 @@ void LayeredFS::LoadRelocations() {
|
|||
return;
|
||||
}
|
||||
|
||||
const FileUtil::DirectoryEntryCallable callback = [this,
|
||||
&callback](u64* /*num_entries_out*/,
|
||||
const std::string& directory,
|
||||
const std::string& virtual_name) {
|
||||
auto* parent = directory_path_map.at(directory.substr(patch_path.size() - 1));
|
||||
const FileUtil::DirectoryEntryCallable callback =
|
||||
[this, &callback]([[maybe_unused]] u64* num_entries_out, const std::string& directory,
|
||||
const std::string& virtual_name) {
|
||||
auto* parent = directory_path_map.at(directory.substr(patch_path.size() - 1));
|
||||
|
||||
if (FileUtil::IsDirectory(directory + virtual_name + DIR_SEP)) {
|
||||
const auto path = (directory + virtual_name + DIR_SEP).substr(patch_path.size() - 1);
|
||||
if (!directory_path_map.count(path)) { // Add this directory
|
||||
auto directory = std::make_unique<Directory>();
|
||||
directory->name = virtual_name;
|
||||
directory->path = path;
|
||||
directory->parent = parent;
|
||||
directory_path_map.emplace(path, directory.get());
|
||||
parent->directories.emplace_back(std::move(directory));
|
||||
LOG_INFO(Service_FS, "LayeredFS created directory {}", path);
|
||||
if (FileUtil::IsDirectory(directory + virtual_name + DIR_SEP)) {
|
||||
const auto path =
|
||||
(directory + virtual_name + DIR_SEP).substr(patch_path.size() - 1);
|
||||
if (!directory_path_map.count(path)) { // Add this directory
|
||||
auto child_dir = std::make_unique<Directory>();
|
||||
child_dir->name = virtual_name;
|
||||
child_dir->path = path;
|
||||
child_dir->parent = parent;
|
||||
directory_path_map.emplace(path, child_dir.get());
|
||||
parent->directories.emplace_back(std::move(child_dir));
|
||||
LOG_INFO(Service_FS, "LayeredFS created directory {}", path);
|
||||
}
|
||||
return FileUtil::ForeachDirectoryEntry(nullptr, directory + virtual_name + DIR_SEP,
|
||||
callback);
|
||||
}
|
||||
return FileUtil::ForeachDirectoryEntry(nullptr, directory + virtual_name + DIR_SEP,
|
||||
callback);
|
||||
}
|
||||
|
||||
const auto path = (directory + virtual_name).substr(patch_path.size() - 1);
|
||||
if (!file_path_map.count(path)) { // Newly created file
|
||||
auto file = std::make_unique<File>();
|
||||
file->name = virtual_name;
|
||||
file->path = path;
|
||||
file->parent = parent;
|
||||
file_path_map.emplace(path, file.get());
|
||||
parent->files.emplace_back(std::move(file));
|
||||
LOG_INFO(Service_FS, "LayeredFS created file {}", path);
|
||||
}
|
||||
const auto path = (directory + virtual_name).substr(patch_path.size() - 1);
|
||||
if (!file_path_map.count(path)) { // Newly created file
|
||||
auto file = std::make_unique<File>();
|
||||
file->name = virtual_name;
|
||||
file->path = path;
|
||||
file->parent = parent;
|
||||
file_path_map.emplace(path, file.get());
|
||||
parent->files.emplace_back(std::move(file));
|
||||
LOG_INFO(Service_FS, "LayeredFS created file {}", path);
|
||||
}
|
||||
|
||||
auto* file = file_path_map.at(path);
|
||||
file->relocation.type = 1;
|
||||
file->relocation.replace_file_path = directory + virtual_name;
|
||||
file->relocation.size = FileUtil::GetSize(directory + virtual_name);
|
||||
LOG_INFO(Service_FS, "LayeredFS replacement file in use for {}", path);
|
||||
return true;
|
||||
};
|
||||
auto* file = file_path_map.at(path);
|
||||
file->relocation.type = 1;
|
||||
file->relocation.replace_file_path = directory + virtual_name;
|
||||
file->relocation.size = FileUtil::GetSize(directory + virtual_name);
|
||||
LOG_INFO(Service_FS, "LayeredFS replacement file in use for {}", path);
|
||||
return true;
|
||||
};
|
||||
|
||||
FileUtil::ForeachDirectoryEntry(nullptr, patch_path, callback);
|
||||
}
|
||||
|
|
|
@ -119,12 +119,12 @@ NCCHContainer::NCCHContainer(const std::string& filepath, u32 ncch_offset, u32 p
|
|||
file = FileUtil::IOFile(filepath, "rb");
|
||||
}
|
||||
|
||||
Loader::ResultStatus NCCHContainer::OpenFile(const std::string& filepath, u32 ncch_offset,
|
||||
u32 partition) {
|
||||
this->filepath = filepath;
|
||||
this->ncch_offset = ncch_offset;
|
||||
this->partition = partition;
|
||||
file = FileUtil::IOFile(filepath, "rb");
|
||||
Loader::ResultStatus NCCHContainer::OpenFile(const std::string& filepath_, u32 ncch_offset_,
|
||||
u32 partition_) {
|
||||
filepath = filepath_;
|
||||
ncch_offset = ncch_offset_;
|
||||
partition = partition_;
|
||||
file = FileUtil::IOFile(filepath_, "rb");
|
||||
|
||||
if (!file.IsOpen()) {
|
||||
LOG_WARNING(Service_FS, "Failed to open {}", filepath);
|
||||
|
@ -597,12 +597,12 @@ Loader::ResultStatus NCCHContainer::ApplyCodePatch(std::vector<u8>& code) const
|
|||
}};
|
||||
|
||||
for (const PatchLocation& info : patch_paths) {
|
||||
FileUtil::IOFile file{info.path, "rb"};
|
||||
if (!file)
|
||||
FileUtil::IOFile patch_file{info.path, "rb"};
|
||||
if (!patch_file)
|
||||
continue;
|
||||
|
||||
std::vector<u8> patch(file.GetSize());
|
||||
if (file.ReadBytes(patch.data(), patch.size()) != patch.size())
|
||||
std::vector<u8> patch(patch_file.GetSize());
|
||||
if (patch_file.ReadBytes(patch.data(), patch.size()) != patch.size())
|
||||
return Loader::ResultStatus::Error;
|
||||
|
||||
LOG_INFO(Service_FS, "File {} patching code.bin", info.path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue