summaryrefslogtreecommitdiffstats
path: root/src/core/loader/nso.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-20 18:14:10 +0200
committerGitHub <noreply@github.com>2018-07-20 18:14:10 +0200
commit86d1649b32f636bb91a3333843c45d4decd5a164 (patch)
tree24b855b62c595af879812f8febaac6f4234ac59d /src/core/loader/nso.cpp
parentMerge pull request #731 from lioncash/shadow (diff)
parentnso: Silence implicit sign conversion warnings (diff)
downloadyuzu-86d1649b32f636bb91a3333843c45d4decd5a164.tar
yuzu-86d1649b32f636bb91a3333843c45d4decd5a164.tar.gz
yuzu-86d1649b32f636bb91a3333843c45d4decd5a164.tar.bz2
yuzu-86d1649b32f636bb91a3333843c45d4decd5a164.tar.lz
yuzu-86d1649b32f636bb91a3333843c45d4decd5a164.tar.xz
yuzu-86d1649b32f636bb91a3333843c45d4decd5a164.tar.zst
yuzu-86d1649b32f636bb91a3333843c45d4decd5a164.zip
Diffstat (limited to 'src/core/loader/nso.cpp')
-rw-r--r--src/core/loader/nso.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index c66561bf4..06b1b33f4 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -69,29 +69,18 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) {
static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
const NsoSegmentHeader& header) {
std::vector<u8> uncompressed_data(header.size);
- const int bytes_uncompressed = LZ4_decompress_safe(
- reinterpret_cast<const char*>(compressed_data.data()),
- reinterpret_cast<char*>(uncompressed_data.data()), compressed_data.size(), header.size);
+ const int bytes_uncompressed =
+ LZ4_decompress_safe(reinterpret_cast<const char*>(compressed_data.data()),
+ reinterpret_cast<char*>(uncompressed_data.data()),
+ static_cast<int>(compressed_data.size()), header.size);
- ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(),
+ ASSERT_MSG(bytes_uncompressed == static_cast<int>(header.size) &&
+ bytes_uncompressed == static_cast<int>(uncompressed_data.size()),
"{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size());
return uncompressed_data;
}
-static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeader& header,
- size_t compressed_size) {
- std::vector<u8> compressed_data(compressed_size);
-
- file.Seek(header.offset, SEEK_SET);
- if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) {
- LOG_CRITICAL(Loader, "Failed to read {} NSO LZ4 compressed bytes", compressed_size);
- return {};
- }
-
- return DecompressSegment(compressed_data, header);
-}
-
static constexpr u32 PageAlignSize(u32 size) {
return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK;
}