VERY experimental Nintendo Switch 2 emulator
C++
Use ReadBlockUnsafe on TIC and TSC reading
Fernando Sahmkowb33c627670e8
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cppindex 74403eed48..69401fcda5 100644--- a/src/video_core/engines/maxwell_3d.cpp+++ b/src/video_core/engines/maxwell_3d.cpp@@ -418,7 +418,7 @@ Texture::TICEntry Maxwell3D::GetTICEntry(u32 tic_index) const {const GPUVAddr tic_address_gpu{regs.tic.TICAddress() + tic_index * sizeof(Texture::TICEntry)};Texture::TICEntry tic_entry;- memory_manager.ReadBlock(tic_address_gpu, &tic_entry, sizeof(Texture::TICEntry));+ memory_manager.ReadBlockUnsafe(tic_address_gpu, &tic_entry, sizeof(Texture::TICEntry));ASSERT_MSG(tic_entry.header_version == Texture::TICHeaderVersion::BlockLinear ||tic_entry.header_version == Texture::TICHeaderVersion::Pitch,@@ -439,7 +439,7 @@ Texture::TSCEntry Maxwell3D::GetTSCEntry(u32 tsc_index) const {const GPUVAddr tsc_address_gpu{regs.tsc.TSCAddress() + tsc_index * sizeof(Texture::TSCEntry)};Texture::TSCEntry tsc_entry;- memory_manager.ReadBlock(tsc_address_gpu, &tsc_entry, sizeof(Texture::TSCEntry));+ memory_manager.ReadBlockUnsafe(tsc_address_gpu, &tsc_entry, sizeof(Texture::TSCEntry));return tsc_entry;}diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cppindex 3b9f6caf05..20d744c61b 100644--- a/src/video_core/memory_manager.cpp+++ b/src/video_core/memory_manager.cpp@@ -234,6 +234,7 @@ void MemoryManager::ReadBlockUnsafe(GPUVAddr src_addr, void* dest_buffer, std::swhile (remaining_size > 0) {const std::size_t copy_amount{std::min(static_cast<std::size_t>(page_size) - page_offset, remaining_size)};+ const u8* src_ptr{page_table.pointers[page_index] + page_offset};std::memcpy(dest_buffer, src_ptr, copy_amount);page_index++;page_offset = 0;@@ -277,6 +278,7 @@ void MemoryManager::WriteBlockUnsafe(GPUVAddr dest_addr, const void* src_buffer,while (remaining_size > 0) {const std::size_t copy_amount{std::min(static_cast<std::size_t>(page_size) - page_offset, remaining_size)};+ u8* dest_ptr{page_table.pointers[page_index] + page_offset};std::memcpy(dest_ptr, src_buffer, copy_amount);page_index++;page_offset = 0;