summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-09-04 17:01:40 -0400
committerGravatar Zach Hilman2018-09-04 17:01:54 -0400
commitc913136eb215699f9c8d51a8fd56490b9df7657f (patch)
tree4564a416d8f200b69559164e2a50bdc690d49dbd /src
parentdrd: Parse title ID from program metadata (diff)
downloadyuzu-c913136eb215699f9c8d51a8fd56490b9df7657f.tar.gz
yuzu-c913136eb215699f9c8d51a8fd56490b9df7657f.tar.xz
yuzu-c913136eb215699f9c8d51a8fd56490b9df7657f.zip
bktr: Fix bucket overlap error
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/content_archive.cpp3
-rw-r--r--src/core/file_sys/nca_patch.cpp4
-rw-r--r--src/core/file_sys/patch_manager.cpp3
-rw-r--r--src/core/file_sys/patch_manager.h1
-rw-r--r--src/core/file_sys/romfs_factory.cpp1
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp2
-rw-r--r--src/core/loader/loader.cpp4
-rw-r--r--src/yuzu/main.cpp2
8 files changed, 11 insertions, 9 deletions
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp
index 1c093d94f..79bfb6fec 100644
--- a/src/core/file_sys/content_archive.cpp
+++ b/src/core/file_sys/content_archive.cpp
@@ -425,9 +425,6 @@ NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_off
425 } else { 425 } else {
426 files.push_back(std::move(dec)); 426 files.push_back(std::move(dec));
427 romfs = files.back(); 427 romfs = files.back();
428 const u64 raw_size =
429 MEDIA_OFFSET_MULTIPLIER * (header.section_tables[i].media_end_offset -
430 header.section_tables[i].media_offset);
431 } 428 }
432 } else if (section.raw.header.filesystem_type == NCASectionFilesystemType::PFS0) { 429 } else if (section.raw.header.filesystem_type == NCASectionFilesystemType::PFS0) {
433 u64 offset = (static_cast<u64>(header.section_tables[i].media_offset) * 430 u64 offset = (static_cast<u64>(header.section_tables[i].media_offset) *
diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp
index 1e93000d5..e0111bffc 100644
--- a/src/core/file_sys/nca_patch.cpp
+++ b/src/core/file_sys/nca_patch.cpp
@@ -50,7 +50,7 @@ size_t BKTR::Read(u8* data, size_t length, size_t offset) const {
50 } 50 }
51 51
52 if (!bktr_read) { 52 if (!bktr_read) {
53 ASSERT_MSG(section_offset > ivfc_offset, "Offset calculation negative."); 53 ASSERT_MSG(section_offset >= ivfc_offset, "Offset calculation negative.");
54 return base_romfs->Read(data, length, section_offset - ivfc_offset); 54 return base_romfs->Read(data, length, section_offset - ivfc_offset);
55 } 55 }
56 56
@@ -118,7 +118,7 @@ std::pair<size_t, size_t> BKTR::SearchBucketEntry(u64 offset, BlockType block,
118 118
119 size_t bucket_id = std::count_if(block.base_offsets.begin() + 1, 119 size_t bucket_id = std::count_if(block.base_offsets.begin() + 1,
120 block.base_offsets.begin() + block.number_buckets, 120 block.base_offsets.begin() + block.number_buckets,
121 [&offset](u64 base_offset) { return base_offset < offset; }); 121 [&offset](u64 base_offset) { return base_offset <= offset; });
122 122
123 const auto bucket = buckets[bucket_id]; 123 const auto bucket = buckets[bucket_id];
124 124
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index fa2fbe5e1..40675de35 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -2,10 +2,13 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "core/file_sys/content_archive.h"
5#include "core/file_sys/control_metadata.h" 6#include "core/file_sys/control_metadata.h"
6#include "core/file_sys/patch_manager.h" 7#include "core/file_sys/patch_manager.h"
7#include "core/file_sys/registered_cache.h" 8#include "core/file_sys/registered_cache.h"
9#include "core/file_sys/romfs.h"
8#include "core/hle/service/filesystem/filesystem.h" 10#include "core/hle/service/filesystem/filesystem.h"
11#include "core/loader/loader.h"
9 12
10namespace FileSys { 13namespace FileSys {
11 14
diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h
index c2626bc6c..28c7ae136 100644
--- a/src/core/file_sys/patch_manager.h
+++ b/src/core/file_sys/patch_manager.h
@@ -8,7 +8,6 @@
8#include <string> 8#include <string>
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "core/file_sys/nca_metadata.h" 10#include "core/file_sys/nca_metadata.h"
11#include "core/file_sys/romfs_factory.h"
12#include "core/file_sys/vfs.h" 11#include "core/file_sys/vfs.h"
13 12
14namespace FileSys { 13namespace FileSys {
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
index 33ec62491..d9d90939e 100644
--- a/src/core/file_sys/romfs_factory.cpp
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -12,6 +12,7 @@
12#include "core/file_sys/patch_manager.h" 12#include "core/file_sys/patch_manager.h"
13#include "core/file_sys/registered_cache.h" 13#include "core/file_sys/registered_cache.h"
14#include "core/file_sys/romfs_factory.h" 14#include "core/file_sys/romfs_factory.h"
15#include "core/hle/kernel/process.h"
15#include "core/hle/service/filesystem/filesystem.h" 16#include "core/hle/service/filesystem/filesystem.h"
16#include "core/loader/loader.h" 17#include "core/loader/loader.h"
17 18
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index e9d5bd774..04c9d750f 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -10,6 +10,7 @@
10#include "core/file_sys/bis_factory.h" 10#include "core/file_sys/bis_factory.h"
11#include "core/file_sys/errors.h" 11#include "core/file_sys/errors.h"
12#include "core/file_sys/mode.h" 12#include "core/file_sys/mode.h"
13#include "core/file_sys/registered_cache.h"
13#include "core/file_sys/romfs_factory.h" 14#include "core/file_sys/romfs_factory.h"
14#include "core/file_sys/savedata_factory.h" 15#include "core/file_sys/savedata_factory.h"
15#include "core/file_sys/sdmc_factory.h" 16#include "core/file_sys/sdmc_factory.h"
@@ -19,7 +20,6 @@
19#include "core/hle/service/filesystem/fsp_ldr.h" 20#include "core/hle/service/filesystem/fsp_ldr.h"
20#include "core/hle/service/filesystem/fsp_pr.h" 21#include "core/hle/service/filesystem/fsp_pr.h"
21#include "core/hle/service/filesystem/fsp_srv.h" 22#include "core/hle/service/filesystem/fsp_srv.h"
22#include "filesystem.h"
23 23
24namespace Service::FileSystem { 24namespace Service::FileSystem {
25 25
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 729b1ca08..fa43a2650 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -93,7 +93,7 @@ std::string GetFileTypeString(FileType type) {
93 return "unknown"; 93 return "unknown";
94} 94}
95 95
96constexpr std::array<const char*, 57> RESULT_MESSAGES{ 96constexpr std::array<const char*, 58> RESULT_MESSAGES{
97 "The operation completed successfully.", 97 "The operation completed successfully.",
98 "The loader requested to load is already loaded.", 98 "The loader requested to load is already loaded.",
99 "The operation is not implemented.", 99 "The operation is not implemented.",
@@ -143,7 +143,7 @@ constexpr std::array<const char*, 57> RESULT_MESSAGES{
143 "The AES Key Generation Source could not be found.", 143 "The AES Key Generation Source could not be found.",
144 "The SD Save Key Source could not be found.", 144 "The SD Save Key Source could not be found.",
145 "The SD NCA Key Source could not be found.", 145 "The SD NCA Key Source could not be found.",
146 "The NSP file is missing a Program-type NCA."}; 146 "The NSP file is missing a Program-type NCA.",
147 "The BKTR-type NCA has a bad BKTR header.", 147 "The BKTR-type NCA has a bad BKTR header.",
148 "The BKTR Subsection entry is not located immediately after the Relocation entry.", 148 "The BKTR Subsection entry is not located immediately after the Relocation entry.",
149 "The BKTR Subsection entry is not at the end of the media block.", 149 "The BKTR Subsection entry is not at the end of the media block.",
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 80a284513..dbe5bd8a4 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -32,6 +32,8 @@
32#include "core/crypto/key_manager.h" 32#include "core/crypto/key_manager.h"
33#include "core/file_sys/card_image.h" 33#include "core/file_sys/card_image.h"
34#include "core/file_sys/content_archive.h" 34#include "core/file_sys/content_archive.h"
35#include "core/file_sys/control_metadata.h"
36#include "core/file_sys/patch_manager.h"
35#include "core/file_sys/registered_cache.h" 37#include "core/file_sys/registered_cache.h"
36#include "core/file_sys/savedata_factory.h" 38#include "core/file_sys/savedata_factory.h"
37#include "core/file_sys/submission_package.h" 39#include "core/file_sys/submission_package.h"