From ec3d408da0ae60a685e69cd391bfc500c66b24fb Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 19 Sep 2021 07:51:33 -0700 Subject: [PATCH] HLE: Detect video buffer copies. These are common and can help us notify the texture cache appropriately. --- Core/HLE/ReplaceTables.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index efde566c56..91d172e991 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -160,6 +160,13 @@ static int Replace_memcpy() { NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, tag.c_str(), tag.size()); NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, tag.c_str(), tag.size()); + // It's pretty common that games will copy video data. + if (tag == "ReplaceMemcpy/VideoDecode" || tag == "ReplaceMemcpy/VideoDecodeRange") { + if (bytes == 512 * 272 * 4) { + gpu->NotifyVideoUpload(destPtr, bytes, 512, GE_FORMAT_8888); + } + } + return 10 + bytes / 4; // approximation } @@ -203,6 +210,13 @@ static int Replace_memcpy_jak() { NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, tag.c_str(), tag.size()); NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, tag.c_str(), tag.size()); + // It's pretty common that games will copy video data. + if (tag == "ReplaceMemcpy/VideoDecode" || tag == "ReplaceMemcpy/VideoDecodeRange") { + if (bytes == 512 * 272 * 4) { + gpu->NotifyVideoUpload(destPtr, bytes, 512, GE_FORMAT_8888); + } + } + return 5 + bytes * 8 + 2; // approximation. This is a slow memcpy - a byte copy loop.. }