summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/BPStructs.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2024-04-07 11:13:25 +0200
committerJosJuice <josjuice@gmail.com>2024-04-09 21:08:57 +0200
commit54773bc5d2c847bc4e070a8a647b97a9fc76bcb0 (patch)
tree23974ba939d0a61c792e2fec2aca7e97758f59e0 /Source/Core/VideoCommon/BPStructs.cpp
parent69aca2fbfc88d08a17d36c03d51dd698eb9cce1b (diff)
VideoCommon: Remove calls to GetPointer
This fourth part of my series of patches to get rid of unsafe uses of GetPointer takes care of the "easy" cases in VideoCommon. Three uses of GetPointer now remain in Dolphin: VertexLoaderManager, TextureInfo, and the software renderer's TextureSampler.
Diffstat (limited to 'Source/Core/VideoCommon/BPStructs.cpp')
-rw-r--r--Source/Core/VideoCommon/BPStructs.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp
index 0b8540bd44..6e4bb981a8 100644
--- a/Source/Core/VideoCommon/BPStructs.cpp
+++ b/Source/Core/VideoCommon/BPStructs.cpp
@@ -602,7 +602,6 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager, XFStateManager&
{
auto& system = Core::System::GetInstance();
auto& memory = system.GetMemory();
- u8* src_ptr = memory.GetPointer(src_addr);
// AR and GB tiles are stored in separate TMEM banks => can't use a single memcpy for
// everything
@@ -612,10 +611,13 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager, XFStateManager&
{
if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE ||
tmem_addr_odd + TMEM_LINE_SIZE > TMEM_SIZE)
+ {
break;
+ }
- memcpy(texMem + tmem_addr_even, src_ptr + bytes_read, TMEM_LINE_SIZE);
- memcpy(texMem + tmem_addr_odd, src_ptr + bytes_read + TMEM_LINE_SIZE, TMEM_LINE_SIZE);
+ memory.CopyFromEmu(texMem + tmem_addr_even, src_addr + bytes_read, TMEM_LINE_SIZE);
+ memory.CopyFromEmu(texMem + tmem_addr_odd, src_addr + bytes_read + TMEM_LINE_SIZE,
+ TMEM_LINE_SIZE);
tmem_addr_even += TMEM_LINE_SIZE;
tmem_addr_odd += TMEM_LINE_SIZE;
bytes_read += TMEM_LINE_SIZE * 2;