mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-02 16:49:04 +00:00
Fix more MSVC warnings
This commit is contained in:
@@ -33,8 +33,6 @@ inline std::size_t GetPublicKeySize(u32 public_key_type) {
|
||||
}
|
||||
|
||||
bool Certificate::Load(std::vector<u8> file_data, std::size_t offset) {
|
||||
const auto total_size = static_cast<std::size_t>(file_data.size() - offset);
|
||||
|
||||
if (!signature.Load(file_data, offset)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -52,9 +52,8 @@ bool DPFSContainer::GetByte(u8& out, u8 level, u8 selector, u64 index) const {
|
||||
bool DPFSContainer::GetLevel3Data(std::vector<u8>& out) const {
|
||||
std::vector<u8> level3_data(descriptor.levels[2].size);
|
||||
for (std::size_t i = 0; i < level3_data.size(); i++) {
|
||||
auto level2_bit_index = i / std::pow(2, descriptor.levels[2].block_size);
|
||||
auto level1_bit_index =
|
||||
(level2_bit_index / 8) / std::pow(2, descriptor.levels[1].block_size);
|
||||
const u64 level2_bit_index = static_cast<u64>(i) >> descriptor.levels[2].block_size;
|
||||
const u64 level1_bit_index = (level2_bit_index / 8) >> descriptor.levels[1].block_size;
|
||||
|
||||
u8 level2_selector, level3_selector;
|
||||
if (!GetBit(level2_selector, 0, level1_selector, level1_bit_index) ||
|
||||
|
||||
@@ -75,7 +75,7 @@ bool Extdata::Init() {
|
||||
return false;
|
||||
}
|
||||
|
||||
DataContainer vsxe_container(std::move(vsxe_raw));
|
||||
const DataContainer vsxe_container(std::move(vsxe_raw));
|
||||
if (!vsxe_container.IsGood()) {
|
||||
return false;
|
||||
}
|
||||
@@ -88,14 +88,14 @@ bool Extdata::Init() {
|
||||
return Archive<Extdata>::Init(std::move(data));
|
||||
}
|
||||
|
||||
bool Extdata::ExtractFile(const std::string& path, std::size_t index) const {
|
||||
bool Extdata::ExtractFile(const std::string& path, u32 index) const {
|
||||
/// Maximum amount of device files a device directory can hold.
|
||||
constexpr u32 DeviceDirCapacity = 126;
|
||||
|
||||
u32 file_index = index + 1;
|
||||
u32 sub_directory_id = file_index / DeviceDirCapacity;
|
||||
u32 sub_file_id = file_index % DeviceDirCapacity;
|
||||
std::string device_file_path =
|
||||
const u32 file_index = index + 1;
|
||||
const u32 sub_directory_id = file_index / DeviceDirCapacity;
|
||||
const u32 sub_file_id = file_index % DeviceDirCapacity;
|
||||
const std::string device_file_path =
|
||||
fmt::format("{}{:08x}/{:08x}", data_path, sub_directory_id, sub_file_id);
|
||||
|
||||
auto container_data = ReadFile(device_file_path);
|
||||
@@ -104,7 +104,7 @@ bool Extdata::ExtractFile(const std::string& path, std::size_t index) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
DataContainer container(std::move(container_data));
|
||||
const DataContainer container(std::move(container_data));
|
||||
if (!container.IsGood()) {
|
||||
return false;
|
||||
}
|
||||
@@ -119,12 +119,10 @@ bool Extdata::ExtractFile(const std::string& path, std::size_t index) const {
|
||||
|
||||
ArchiveFormatInfo Extdata::GetFormatInfo() const {
|
||||
// This information is based on how Citra created the metadata in FS
|
||||
ArchiveFormatInfo format_info = {/* total_size */ 0,
|
||||
/* number_directories */ fs_info.maximum_directory_count,
|
||||
/* number_files */ fs_info.maximum_file_count,
|
||||
/* duplicate_data */ false};
|
||||
|
||||
return format_info;
|
||||
return {/* total_size */ 0,
|
||||
/* number_directories */ fs_info.maximum_directory_count,
|
||||
/* number_files */ fs_info.maximum_file_count,
|
||||
/* duplicate_data */ false};
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -34,7 +34,7 @@ private:
|
||||
bool Init();
|
||||
bool CheckMagic() const;
|
||||
std::vector<u8> ReadFile(const std::string& path) const;
|
||||
bool ExtractFile(const std::string& path, std::size_t index) const;
|
||||
bool ExtractFile(const std::string& path, u32 index) const;
|
||||
ArchiveFormatInfo GetFormatInfo() const;
|
||||
|
||||
bool is_good = false;
|
||||
|
||||
@@ -607,9 +607,8 @@ std::vector<u8> LoadSharedRomFS(const std::vector<u8>& data) {
|
||||
std::vector<u8> result(ivfc.levels[2].size);
|
||||
|
||||
// Calculation from ctrtool
|
||||
const std::size_t data_offset =
|
||||
offset + Common::AlignUp(sizeof(ivfc) + ivfc.master_hash_size,
|
||||
std::pow(2, ivfc.levels[2].block_size));
|
||||
const std::size_t data_offset = offset + Common::AlignUp(sizeof(ivfc) + ivfc.master_hash_size,
|
||||
(1 << ivfc.levels[2].block_size));
|
||||
if (!CheckedMemcpy(result.data(), data, data_offset, ivfc.levels[2].size)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -54,8 +54,6 @@ bool TitleMetadata::Load(const std::vector<u8> file_data, std::size_t offset) {
|
||||
}
|
||||
|
||||
bool TitleMetadata::Save(FileUtil::IOFile& file) {
|
||||
const std::size_t offset = file.Tell();
|
||||
|
||||
if (!file.IsOpen())
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user