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