mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-27 03:15:34 +00:00
make ReadBlockunsafe and WriteBlockunsafe, ignore invalid pages.
This commit is contained in:
parent
d0082de82a
commit
db4b2bc798
|
@ -243,8 +243,13 @@ void MemoryManager::ReadBlockUnsafe(GPUVAddr src_addr, void* dest_buffer,
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const std::size_t copy_amount{
|
const std::size_t copy_amount{
|
||||||
std::min(static_cast<std::size_t>(page_size) - page_offset, remaining_size)};
|
std::min(static_cast<std::size_t>(page_size) - page_offset, remaining_size)};
|
||||||
const u8* src_ptr{page_table.pointers[page_index] + page_offset};
|
const u8* page_pointer = page_table.pointers[page_index];
|
||||||
std::memcpy(dest_buffer, src_ptr, copy_amount);
|
if (page_pointer) {
|
||||||
|
const u8* src_ptr{page_pointer + page_offset};
|
||||||
|
std::memcpy(dest_buffer, src_ptr, copy_amount);
|
||||||
|
} else {
|
||||||
|
std::memset(dest_buffer, 0, copy_amount);
|
||||||
|
}
|
||||||
page_index++;
|
page_index++;
|
||||||
page_offset = 0;
|
page_offset = 0;
|
||||||
dest_buffer = static_cast<u8*>(dest_buffer) + copy_amount;
|
dest_buffer = static_cast<u8*>(dest_buffer) + copy_amount;
|
||||||
|
@ -288,8 +293,11 @@ void MemoryManager::WriteBlockUnsafe(GPUVAddr dest_addr, const void* src_buffer,
|
||||||
while (remaining_size > 0) {
|
while (remaining_size > 0) {
|
||||||
const std::size_t copy_amount{
|
const std::size_t copy_amount{
|
||||||
std::min(static_cast<std::size_t>(page_size) - page_offset, remaining_size)};
|
std::min(static_cast<std::size_t>(page_size) - page_offset, remaining_size)};
|
||||||
u8* dest_ptr{page_table.pointers[page_index] + page_offset};
|
u8* page_pointer = page_table.pointers[page_index];
|
||||||
std::memcpy(dest_ptr, src_buffer, copy_amount);
|
if (page_pointer) {
|
||||||
|
u8* dest_ptr{page_pointer + page_offset};
|
||||||
|
std::memcpy(dest_ptr, src_buffer, copy_amount);
|
||||||
|
}
|
||||||
page_index++;
|
page_index++;
|
||||||
page_offset = 0;
|
page_offset = 0;
|
||||||
src_buffer = static_cast<const u8*>(src_buffer) + copy_amount;
|
src_buffer = static_cast<const u8*>(src_buffer) + copy_amount;
|
||||||
|
|
Loading…
Reference in a new issue