diff options
| -rw-r--r-- | src/core/memory.cpp | 13 | ||||
| -rw-r--r-- | src/core/memory.h | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 7b23c189c..2e578f189 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Copyright 2021 Citra Emulator Project | 1 | // Copyright 2015 Citra Emulator Project |
| 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 | ||
| @@ -235,7 +235,7 @@ struct Memory::Impl { | |||
| 235 | [&system = system, &dest_buffer](const VAddr current_vaddr, | 235 | [&system = system, &dest_buffer](const VAddr current_vaddr, |
| 236 | const std::size_t copy_amount, | 236 | const std::size_t copy_amount, |
| 237 | const u8* const host_ptr) { | 237 | const u8* const host_ptr) { |
| 238 | if (!UNSAFE) { | 238 | if constexpr (!UNSAFE) { |
| 239 | system.GPU().FlushRegion(current_vaddr, copy_amount); | 239 | system.GPU().FlushRegion(current_vaddr, copy_amount); |
| 240 | } | 240 | } |
| 241 | std::memcpy(dest_buffer, host_ptr, copy_amount); | 241 | std::memcpy(dest_buffer, host_ptr, copy_amount); |
| @@ -268,7 +268,7 @@ struct Memory::Impl { | |||
| 268 | }, | 268 | }, |
| 269 | [&system = system, &src_buffer](const VAddr current_vaddr, | 269 | [&system = system, &src_buffer](const VAddr current_vaddr, |
| 270 | const std::size_t copy_amount, u8* const host_ptr) { | 270 | const std::size_t copy_amount, u8* const host_ptr) { |
| 271 | if (!UNSAFE) { | 271 | if constexpr (!UNSAFE) { |
| 272 | system.GPU().InvalidateRegion(current_vaddr, copy_amount); | 272 | system.GPU().InvalidateRegion(current_vaddr, copy_amount); |
| 273 | } | 273 | } |
| 274 | std::memcpy(host_ptr, src_buffer, copy_amount); | 274 | std::memcpy(host_ptr, src_buffer, copy_amount); |
| @@ -390,9 +390,10 @@ struct Memory::Impl { | |||
| 390 | } else { | 390 | } else { |
| 391 | // Switch page type to uncached if now uncached | 391 | // Switch page type to uncached if now uncached |
| 392 | switch (page_type) { | 392 | switch (page_type) { |
| 393 | case Common::PageType::Unmapped: | 393 | case Common::PageType::Unmapped: // NOLINT(bugprone-branch-clone) |
| 394 | // It is not necessary for a process to have this region mapped into its address | 394 | // It is not necessary for a process to have this region mapped into its address |
| 395 | // space, for example, a system module need not have a VRAM mapping. | 395 | // space, for example, a system module need not have a VRAM mapping. |
| 396 | break; | ||
| 396 | case Common::PageType::Memory: | 397 | case Common::PageType::Memory: |
| 397 | // There can be more than one GPU region mapped per CPU region, so it's common | 398 | // There can be more than one GPU region mapped per CPU region, so it's common |
| 398 | // that this area is already unmarked as cached. | 399 | // that this area is already unmarked as cached. |
| @@ -666,8 +667,8 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) { | |||
| 666 | 667 | ||
| 667 | bool Memory::IsValidVirtualAddress(const VAddr vaddr) const { | 668 | bool Memory::IsValidVirtualAddress(const VAddr vaddr) const { |
| 668 | const Kernel::KProcess& process = *system.CurrentProcess(); | 669 | const Kernel::KProcess& process = *system.CurrentProcess(); |
| 669 | const auto& pageTable = process.PageTable().PageTableImpl(); | 670 | const auto& page_table = process.PageTable().PageTableImpl(); |
| 670 | const auto [pointer, type] = pageTable.pointers[vaddr >> PAGE_BITS].PointerType(); | 671 | const auto [pointer, type] = page_table.pointers[vaddr >> PAGE_BITS].PointerType(); |
| 671 | return pointer != nullptr || type == Common::PageType::RasterizerCachedMemory; | 672 | return pointer != nullptr || type == Common::PageType::RasterizerCachedMemory; |
| 672 | } | 673 | } |
| 673 | 674 | ||
diff --git a/src/core/memory.h b/src/core/memory.h index 9122cbab9..b5721b740 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Copyright 2021 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 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 | ||