mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-04 14:02:45 +01:00
general: Resolve -Wunused-lambda-capture and C5233
This commit is contained in:
parent
6908ea2284
commit
c7e079a5d4
4 changed files with 24 additions and 29 deletions
|
@ -232,8 +232,8 @@ const std::vector<std::shared_ptr<NCA>>& XCI::GetNCAs() const {
|
||||||
|
|
||||||
std::shared_ptr<NCA> XCI::GetNCAByType(NCAContentType type) const {
|
std::shared_ptr<NCA> XCI::GetNCAByType(NCAContentType type) const {
|
||||||
const auto program_id = secure_partition->GetProgramTitleID();
|
const auto program_id = secure_partition->GetProgramTitleID();
|
||||||
const auto iter = std::find_if(
|
const auto iter =
|
||||||
ncas.begin(), ncas.end(), [this, type, program_id](const std::shared_ptr<NCA>& nca) {
|
std::find_if(ncas.begin(), ncas.end(), [type, program_id](const std::shared_ptr<NCA>& nca) {
|
||||||
return nca->GetType() == type && nca->GetTitleId() == program_id;
|
return nca->GetType() == type && nca->GetTitleId() == program_id;
|
||||||
});
|
});
|
||||||
return iter == ncas.end() ? nullptr : *iter;
|
return iter == ncas.end() ? nullptr : *iter;
|
||||||
|
|
|
@ -233,18 +233,17 @@ struct Memory::Impl {
|
||||||
current_vaddr, src_addr, size);
|
current_vaddr, src_addr, size);
|
||||||
std::memset(dest_buffer, 0, copy_amount);
|
std::memset(dest_buffer, 0, copy_amount);
|
||||||
},
|
},
|
||||||
[&dest_buffer](const std::size_t copy_amount, const u8* const src_ptr) {
|
[&](const std::size_t copy_amount, const u8* const src_ptr) {
|
||||||
std::memcpy(dest_buffer, src_ptr, copy_amount);
|
std::memcpy(dest_buffer, src_ptr, copy_amount);
|
||||||
},
|
},
|
||||||
[&system = system, &dest_buffer](const VAddr current_vaddr,
|
[&](const VAddr current_vaddr, const std::size_t copy_amount,
|
||||||
const std::size_t copy_amount,
|
|
||||||
const u8* const host_ptr) {
|
const u8* const host_ptr) {
|
||||||
if constexpr (!UNSAFE) {
|
if constexpr (!UNSAFE) {
|
||||||
system.GPU().FlushRegion(current_vaddr, copy_amount);
|
system.GPU().FlushRegion(current_vaddr, copy_amount);
|
||||||
}
|
}
|
||||||
std::memcpy(dest_buffer, host_ptr, copy_amount);
|
std::memcpy(dest_buffer, host_ptr, copy_amount);
|
||||||
},
|
},
|
||||||
[&dest_buffer](const std::size_t copy_amount) {
|
[&](const std::size_t copy_amount) {
|
||||||
dest_buffer = static_cast<u8*>(dest_buffer) + copy_amount;
|
dest_buffer = static_cast<u8*>(dest_buffer) + copy_amount;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -267,17 +266,16 @@ struct Memory::Impl {
|
||||||
"Unmapped WriteBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
|
"Unmapped WriteBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
|
||||||
current_vaddr, dest_addr, size);
|
current_vaddr, dest_addr, size);
|
||||||
},
|
},
|
||||||
[&src_buffer](const std::size_t copy_amount, u8* const dest_ptr) {
|
[&](const std::size_t copy_amount, u8* const dest_ptr) {
|
||||||
std::memcpy(dest_ptr, src_buffer, copy_amount);
|
std::memcpy(dest_ptr, src_buffer, copy_amount);
|
||||||
},
|
},
|
||||||
[&system = system, &src_buffer](const VAddr current_vaddr,
|
[&](const VAddr current_vaddr, const std::size_t copy_amount, u8* const host_ptr) {
|
||||||
const std::size_t copy_amount, u8* const host_ptr) {
|
|
||||||
if constexpr (!UNSAFE) {
|
if constexpr (!UNSAFE) {
|
||||||
system.GPU().InvalidateRegion(current_vaddr, copy_amount);
|
system.GPU().InvalidateRegion(current_vaddr, copy_amount);
|
||||||
}
|
}
|
||||||
std::memcpy(host_ptr, src_buffer, copy_amount);
|
std::memcpy(host_ptr, src_buffer, copy_amount);
|
||||||
},
|
},
|
||||||
[&src_buffer](const std::size_t copy_amount) {
|
[&](const std::size_t copy_amount) {
|
||||||
src_buffer = static_cast<const u8*>(src_buffer) + copy_amount;
|
src_buffer = static_cast<const u8*>(src_buffer) + copy_amount;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -301,8 +299,7 @@ struct Memory::Impl {
|
||||||
[](const std::size_t copy_amount, u8* const dest_ptr) {
|
[](const std::size_t copy_amount, u8* const dest_ptr) {
|
||||||
std::memset(dest_ptr, 0, copy_amount);
|
std::memset(dest_ptr, 0, copy_amount);
|
||||||
},
|
},
|
||||||
[&system = system](const VAddr current_vaddr, const std::size_t copy_amount,
|
[&](const VAddr current_vaddr, const std::size_t copy_amount, u8* const host_ptr) {
|
||||||
u8* const host_ptr) {
|
|
||||||
system.GPU().InvalidateRegion(current_vaddr, copy_amount);
|
system.GPU().InvalidateRegion(current_vaddr, copy_amount);
|
||||||
std::memset(host_ptr, 0, copy_amount);
|
std::memset(host_ptr, 0, copy_amount);
|
||||||
},
|
},
|
||||||
|
@ -313,22 +310,20 @@ struct Memory::Impl {
|
||||||
const std::size_t size) {
|
const std::size_t size) {
|
||||||
WalkBlock(
|
WalkBlock(
|
||||||
process, dest_addr, size,
|
process, dest_addr, size,
|
||||||
[this, &process, &dest_addr, &src_addr, size](const std::size_t copy_amount,
|
[&](const std::size_t copy_amount, const VAddr current_vaddr) {
|
||||||
const VAddr current_vaddr) {
|
|
||||||
LOG_ERROR(HW_Memory,
|
LOG_ERROR(HW_Memory,
|
||||||
"Unmapped CopyBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
|
"Unmapped CopyBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
|
||||||
current_vaddr, src_addr, size);
|
current_vaddr, src_addr, size);
|
||||||
ZeroBlock(process, dest_addr, copy_amount);
|
ZeroBlock(process, dest_addr, copy_amount);
|
||||||
},
|
},
|
||||||
[this, &process, &dest_addr](const std::size_t copy_amount, const u8* const src_ptr) {
|
[&](const std::size_t copy_amount, const u8* const src_ptr) {
|
||||||
WriteBlockImpl<false>(process, dest_addr, src_ptr, copy_amount);
|
WriteBlockImpl<false>(process, dest_addr, src_ptr, copy_amount);
|
||||||
},
|
},
|
||||||
[this, &system = system, &process, &dest_addr](
|
[&](const VAddr current_vaddr, const std::size_t copy_amount, u8* const host_ptr) {
|
||||||
const VAddr current_vaddr, const std::size_t copy_amount, u8* const host_ptr) {
|
|
||||||
system.GPU().FlushRegion(current_vaddr, copy_amount);
|
system.GPU().FlushRegion(current_vaddr, copy_amount);
|
||||||
WriteBlockImpl<false>(process, dest_addr, host_ptr, copy_amount);
|
WriteBlockImpl<false>(process, dest_addr, host_ptr, copy_amount);
|
||||||
},
|
},
|
||||||
[&dest_addr, &src_addr](const std::size_t copy_amount) {
|
[&](const std::size_t copy_amount) {
|
||||||
dest_addr += static_cast<VAddr>(copy_amount);
|
dest_addr += static_cast<VAddr>(copy_amount);
|
||||||
src_addr += static_cast<VAddr>(copy_amount);
|
src_addr += static_cast<VAddr>(copy_amount);
|
||||||
});
|
});
|
||||||
|
@ -575,7 +570,7 @@ struct Memory::Impl {
|
||||||
[vaddr]() {
|
[vaddr]() {
|
||||||
LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:016X}", sizeof(T) * 8, vaddr);
|
LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:016X}", sizeof(T) * 8, vaddr);
|
||||||
},
|
},
|
||||||
[&system = system, vaddr]() { system.GPU().FlushRegion(vaddr, sizeof(T)); });
|
[&]() { system.GPU().FlushRegion(vaddr, sizeof(T)); });
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
std::memcpy(&result, ptr, sizeof(T));
|
std::memcpy(&result, ptr, sizeof(T));
|
||||||
}
|
}
|
||||||
|
@ -599,7 +594,7 @@ struct Memory::Impl {
|
||||||
LOG_ERROR(HW_Memory, "Unmapped Write{} @ 0x{:016X} = 0x{:016X}", sizeof(T) * 8,
|
LOG_ERROR(HW_Memory, "Unmapped Write{} @ 0x{:016X} = 0x{:016X}", sizeof(T) * 8,
|
||||||
vaddr, static_cast<u64>(data));
|
vaddr, static_cast<u64>(data));
|
||||||
},
|
},
|
||||||
[&system = system, vaddr]() { system.GPU().InvalidateRegion(vaddr, sizeof(T)); });
|
[&]() { system.GPU().InvalidateRegion(vaddr, sizeof(T)); });
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
std::memcpy(ptr, &data, sizeof(T));
|
std::memcpy(ptr, &data, sizeof(T));
|
||||||
}
|
}
|
||||||
|
@ -613,7 +608,7 @@ struct Memory::Impl {
|
||||||
LOG_ERROR(HW_Memory, "Unmapped WriteExclusive{} @ 0x{:016X} = 0x{:016X}",
|
LOG_ERROR(HW_Memory, "Unmapped WriteExclusive{} @ 0x{:016X} = 0x{:016X}",
|
||||||
sizeof(T) * 8, vaddr, static_cast<u64>(data));
|
sizeof(T) * 8, vaddr, static_cast<u64>(data));
|
||||||
},
|
},
|
||||||
[&system = system, vaddr]() { system.GPU().InvalidateRegion(vaddr, sizeof(T)); });
|
[&]() { system.GPU().InvalidateRegion(vaddr, sizeof(T)); });
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
const auto volatile_pointer = reinterpret_cast<volatile T*>(ptr);
|
const auto volatile_pointer = reinterpret_cast<volatile T*>(ptr);
|
||||||
return Common::AtomicCompareAndSwap(volatile_pointer, data, expected);
|
return Common::AtomicCompareAndSwap(volatile_pointer, data, expected);
|
||||||
|
@ -628,7 +623,7 @@ struct Memory::Impl {
|
||||||
LOG_ERROR(HW_Memory, "Unmapped WriteExclusive128 @ 0x{:016X} = 0x{:016X}{:016X}",
|
LOG_ERROR(HW_Memory, "Unmapped WriteExclusive128 @ 0x{:016X} = 0x{:016X}{:016X}",
|
||||||
vaddr, static_cast<u64>(data[1]), static_cast<u64>(data[0]));
|
vaddr, static_cast<u64>(data[1]), static_cast<u64>(data[0]));
|
||||||
},
|
},
|
||||||
[&system = system, vaddr]() { system.GPU().InvalidateRegion(vaddr, sizeof(u128)); });
|
[&]() { system.GPU().InvalidateRegion(vaddr, sizeof(u128)); });
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
const auto volatile_pointer = reinterpret_cast<volatile u64*>(ptr);
|
const auto volatile_pointer = reinterpret_cast<volatile u64*>(ptr);
|
||||||
return Common::AtomicCompareAndSwap(volatile_pointer, data, expected);
|
return Common::AtomicCompareAndSwap(volatile_pointer, data, expected);
|
||||||
|
|
|
@ -442,7 +442,7 @@ void TextureCache<P>::WriteMemory(VAddr cpu_addr, size_t size) {
|
||||||
template <class P>
|
template <class P>
|
||||||
void TextureCache<P>::DownloadMemory(VAddr cpu_addr, size_t size) {
|
void TextureCache<P>::DownloadMemory(VAddr cpu_addr, size_t size) {
|
||||||
std::vector<ImageId> images;
|
std::vector<ImageId> images;
|
||||||
ForEachImageInRegion(cpu_addr, size, [this, &images](ImageId image_id, ImageBase& image) {
|
ForEachImageInRegion(cpu_addr, size, [&images](ImageId image_id, ImageBase& image) {
|
||||||
if (!image.IsSafeDownload()) {
|
if (!image.IsSafeDownload()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1502,7 +1502,7 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
|
||||||
image.flags &= ~ImageFlagBits::BadOverlap;
|
image.flags &= ~ImageFlagBits::BadOverlap;
|
||||||
lru_cache.Free(image.lru_index);
|
lru_cache.Free(image.lru_index);
|
||||||
const auto& clear_page_table =
|
const auto& clear_page_table =
|
||||||
[this, image_id](u64 page,
|
[image_id](u64 page,
|
||||||
std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>&
|
std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>&
|
||||||
selected_page_table) {
|
selected_page_table) {
|
||||||
const auto page_it = selected_page_table.find(page);
|
const auto page_it = selected_page_table.find(page);
|
||||||
|
|
|
@ -1661,8 +1661,8 @@ void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height,
|
||||||
for (u32 z = 0; z < depth; ++z) {
|
for (u32 z = 0; z < depth; ++z) {
|
||||||
const u32 depth_offset = z * height * width * 4;
|
const u32 depth_offset = z * height * width * 4;
|
||||||
for (u32 y_index = 0; y_index < rows; ++y_index) {
|
for (u32 y_index = 0; y_index < rows; ++y_index) {
|
||||||
auto decompress_stride = [data, width, height, depth, block_width, block_height, output,
|
auto decompress_stride = [data, width, height, block_width, block_height, output, rows,
|
||||||
rows, cols, z, depth_offset, y_index] {
|
cols, z, depth_offset, y_index] {
|
||||||
const u32 y = y_index * block_height;
|
const u32 y = y_index * block_height;
|
||||||
for (u32 x_index = 0; x_index < cols; ++x_index) {
|
for (u32 x_index = 0; x_index < cols; ++x_index) {
|
||||||
const u32 block_index = (z * rows * cols) + (y_index * cols) + x_index;
|
const u32 block_index = (z * rows * cols) + (y_index * cols) + x_index;
|
||||||
|
|
Loading…
Reference in a new issue