diff options
| author | 2021-04-27 12:05:34 -0400 | |
|---|---|---|
| committer | 2021-04-27 12:48:15 -0400 | |
| commit | 724c19a307f31ce1122fb8047c86d5a126d0860f (patch) | |
| tree | 605b89f42d7897aac46f06add54c34201d9354bd /src/core/loader/nso.cpp | |
| parent | Merge pull request #6246 from lioncash/shadow (diff) | |
| download | yuzu-724c19a307f31ce1122fb8047c86d5a126d0860f.tar.gz yuzu-724c19a307f31ce1122fb8047c86d5a126d0860f.tar.xz yuzu-724c19a307f31ce1122fb8047c86d5a126d0860f.zip | |
loader: Resolve instances of variable shadowing
Eliminates variable shadowing cases across all the loaders to bring us
closer to enabling variable shadowing as an error in core.
Diffstat (limited to 'src/core/loader/nso.cpp')
| -rw-r--r-- | src/core/loader/nso.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 0c83dd666..f671afe02 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -56,11 +56,11 @@ bool NSOHeader::IsSegmentCompressed(size_t segment_num) const { | |||
| 56 | return ((flags >> segment_num) & 1) != 0; | 56 | return ((flags >> segment_num) & 1) != 0; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | AppLoader_NSO::AppLoader_NSO(FileSys::VirtualFile file) : AppLoader(std::move(file)) {} | 59 | AppLoader_NSO::AppLoader_NSO(FileSys::VirtualFile file_) : AppLoader(std::move(file_)) {} |
| 60 | 60 | ||
| 61 | FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) { | 61 | FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& in_file) { |
| 62 | u32 magic = 0; | 62 | u32 magic = 0; |
| 63 | if (file->ReadObject(&magic) != sizeof(magic)) { | 63 | if (in_file->ReadObject(&magic) != sizeof(magic)) { |
| 64 | return FileType::Error; | 64 | return FileType::Error; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| @@ -72,15 +72,15 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) { | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, Core::System& system, | 74 | std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, Core::System& system, |
| 75 | const FileSys::VfsFile& file, VAddr load_base, | 75 | const FileSys::VfsFile& nso_file, VAddr load_base, |
| 76 | bool should_pass_arguments, bool load_into_process, | 76 | bool should_pass_arguments, bool load_into_process, |
| 77 | std::optional<FileSys::PatchManager> pm) { | 77 | std::optional<FileSys::PatchManager> pm) { |
| 78 | if (file.GetSize() < sizeof(NSOHeader)) { | 78 | if (nso_file.GetSize() < sizeof(NSOHeader)) { |
| 79 | return std::nullopt; | 79 | return std::nullopt; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | NSOHeader nso_header{}; | 82 | NSOHeader nso_header{}; |
| 83 | if (sizeof(NSOHeader) != file.ReadObject(&nso_header)) { | 83 | if (sizeof(NSOHeader) != nso_file.ReadObject(&nso_header)) { |
| 84 | return std::nullopt; | 84 | return std::nullopt; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| @@ -92,8 +92,8 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, Core::S | |||
| 92 | Kernel::CodeSet codeset; | 92 | Kernel::CodeSet codeset; |
| 93 | Kernel::PhysicalMemory program_image; | 93 | Kernel::PhysicalMemory program_image; |
| 94 | for (std::size_t i = 0; i < nso_header.segments.size(); ++i) { | 94 | for (std::size_t i = 0; i < nso_header.segments.size(); ++i) { |
| 95 | std::vector<u8> data = | 95 | std::vector<u8> data = nso_file.ReadBytes(nso_header.segments_compressed_size[i], |
| 96 | file.ReadBytes(nso_header.segments_compressed_size[i], nso_header.segments[i].offset); | 96 | nso_header.segments[i].offset); |
| 97 | if (nso_header.IsSegmentCompressed(i)) { | 97 | if (nso_header.IsSegmentCompressed(i)) { |
| 98 | data = DecompressSegment(data, nso_header.segments[i]); | 98 | data = DecompressSegment(data, nso_header.segments[i]); |
| 99 | } | 99 | } |
| @@ -136,7 +136,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, Core::S | |||
| 136 | pi_header.insert(pi_header.begin() + sizeof(NSOHeader), program_image.data(), | 136 | pi_header.insert(pi_header.begin() + sizeof(NSOHeader), program_image.data(), |
| 137 | program_image.data() + program_image.size()); | 137 | program_image.data() + program_image.size()); |
| 138 | 138 | ||
| 139 | pi_header = pm->PatchNSO(pi_header, file.GetName()); | 139 | pi_header = pm->PatchNSO(pi_header, nso_file.GetName()); |
| 140 | 140 | ||
| 141 | std::copy(pi_header.begin() + sizeof(NSOHeader), pi_header.end(), program_image.data()); | 141 | std::copy(pi_header.begin() + sizeof(NSOHeader), pi_header.end(), program_image.data()); |
| 142 | } | 142 | } |
| @@ -183,8 +183,8 @@ AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process, Core::Sy | |||
| 183 | Core::Memory::DEFAULT_STACK_SIZE}}; | 183 | Core::Memory::DEFAULT_STACK_SIZE}}; |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules) { | 186 | ResultStatus AppLoader_NSO::ReadNSOModules(Modules& out_modules) { |
| 187 | modules = this->modules; | 187 | out_modules = this->modules; |
| 188 | return ResultStatus::Success; | 188 | return ResultStatus::Success; |
| 189 | } | 189 | } |
| 190 | 190 | ||