citra-emu
/
citra-canary
Archived
1
0
Fork 0

Minor style changes and use memcpy

This commit is contained in:
Zak Kurka 2018-10-20 18:10:32 -05:00
parent 2496ecbaf6
commit bf50bb06f1
1 changed files with 5 additions and 9 deletions

View File

@ -486,7 +486,7 @@ Loader::ResultStatus NCCHContainer::LoadSectionExeFS(const char* name, std::vect
if (FileUtil::Exists(override_ips) && strcmp(name, ".code") == 0) {
FileUtil::IOFile ips_file(override_ips, "rb");
size_t ips_file_size = ips_file.GetSize();
std::size_t ips_file_size = ips_file.GetSize();
std::vector<u8> ips(ips_file_size);
if (ips_file.IsOpen() &&
@ -543,15 +543,11 @@ Loader::ResultStatus NCCHContainer::ApplyIPS(std::vector<u8>& ips, std::vector<u
return Loader::ResultStatus::Error;
while (cursor < patch_length) {
u32 offset = (ips[cursor]) << 16 | (ips[cursor + 1]) << 8 | (ips[cursor + 2]);
u32 length = (ips[cursor + 3]) << 8 | (ips[cursor + 4]);
cursor += 5;
u32 offset = ips[cursor] << 16 | ips[cursor + 1] << 8 | ips[cursor + 2];
std::size_t length = ips[cursor + 3] << 8 | ips[cursor + 4];
for (int i = 0; i < length; i++) {
buffer[offset + i] = ips[cursor + i];
}
cursor += length;
std::memcpy(&buffer[offset], &ips[cursor + 5], length);
cursor += length + 5;
}
return Loader::ResultStatus::Success;