From dc74778dea88dc2ba8032b5ce67dbbbfe3e540a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 9 Feb 2023 10:27:29 +0100 Subject: [PATCH] Do the last ones too --- Core/Debugger/MemBlockInfo.cpp | 11 ----------- Core/Debugger/MemBlockInfo.h | 2 -- Core/HLE/ReplaceTables.cpp | 7 ++++--- Core/HLE/sceAtrac.cpp | 7 ++++--- Core/HLE/sceDeflt.cpp | 7 ++++--- Core/HLE/sceKernelInterrupt.cpp | 14 ++++++++------ 6 files changed, 20 insertions(+), 28 deletions(-) diff --git a/Core/Debugger/MemBlockInfo.cpp b/Core/Debugger/MemBlockInfo.cpp index 909803b797..050a2968a0 100644 --- a/Core/Debugger/MemBlockInfo.cpp +++ b/Core/Debugger/MemBlockInfo.cpp @@ -548,17 +548,6 @@ static const char *FindWriteTagByFlag(MemBlockFlags flags, uint32_t start, uint3 return nullptr; } -std::string GetMemWriteTagAt(const char *prefix, uint32_t start, uint32_t size) { - const char *tag = FindWriteTagByFlag(MemBlockFlags::WRITE, start, size); - if (tag && strcmp(tag, "MemInit") != 0) - return std::string(prefix) + tag; - // Fall back to alloc and texture, especially for VRAM. We prefer write above. - tag = FindWriteTagByFlag(MemBlockFlags::ALLOC | MemBlockFlags::TEXTURE, start, size); - if (tag) - return std::string(prefix) + tag; - return StringFromFormat("%s%08x_size_%08x", prefix, start, size); -} - size_t FormatMemWriteTagAt(char *buf, size_t sz, const char *prefix, uint32_t start, uint32_t size) { const char *tag = FindWriteTagByFlag(MemBlockFlags::WRITE, start, size); if (tag && strcmp(tag, "MemInit") != 0) { diff --git a/Core/Debugger/MemBlockInfo.h b/Core/Debugger/MemBlockInfo.h index 839249f3a2..108423d53f 100644 --- a/Core/Debugger/MemBlockInfo.h +++ b/Core/Debugger/MemBlockInfo.h @@ -68,8 +68,6 @@ inline void NotifyMemInfo(MemBlockFlags flags, uint32_t start, uint32_t size, co std::vector FindMemInfo(uint32_t start, uint32_t size); std::vector FindMemInfoByFlag(MemBlockFlags flags, uint32_t start, uint32_t size); -std::string GetMemWriteTagAt(const char *prefix, uint32_t start, uint32_t size); -// Same as above but allocation-free. size_t FormatMemWriteTagAt(char *buf, size_t sz, const char *prefix, uint32_t start, uint32_t size); void MemBlockInfoInit(); diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index 93ac83c079..ea49f5855a 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -294,9 +294,10 @@ static int Replace_memcpy_swizzled() { RETURN(0); if (MemBlockInfoDetailed(pitch * h)) { - const std::string tag = GetMemWriteTagAt("ReplaceMemcpySwizzle/", srcPtr, pitch * h); - NotifyMemInfo(MemBlockFlags::READ, srcPtr, pitch * h, tag.c_str(), tag.size()); - NotifyMemInfo(MemBlockFlags::WRITE, destPtr, pitch * h, tag.c_str(), tag.size()); + char tagData[128]; + size_t tagSize = FormatMemWriteTagAt(tagData, sizeof(tagData), "ReplaceMemcpySwizzle/", srcPtr, pitch * h); + NotifyMemInfo(MemBlockFlags::READ, srcPtr, pitch * h, tagData, tagSize); + NotifyMemInfo(MemBlockFlags::WRITE, destPtr, pitch * h, tagData, tagSize); } return 10 + (pitch * h) / 4; // approximation diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index f336d8713b..dac70d4b27 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -1271,9 +1271,10 @@ u32 _AtracDecodeData(int atracID, u8 *outbuf, u32 outbufPtr, u32 *SamplesNum, u3 if (outbufPtr != 0) { u32 outBytes = numSamples * atrac->outputChannels_ * sizeof(s16); if (packetAddr != 0 && MemBlockInfoDetailed()) { - const std::string tag = GetMemWriteTagAt("AtracDecode/", packetAddr, packetSize); - NotifyMemInfo(MemBlockFlags::READ, packetAddr, packetSize, tag.c_str(), tag.size()); - NotifyMemInfo(MemBlockFlags::WRITE, outbufPtr, outBytes, tag.c_str(), tag.size()); + char tagData[128]; + size_t tagSize = FormatMemWriteTagAt(tagData, sizeof(tagData), "AtracDecode/", packetAddr, packetSize); + NotifyMemInfo(MemBlockFlags::READ, packetAddr, packetSize, tagData, tagSize); + NotifyMemInfo(MemBlockFlags::WRITE, outbufPtr, outBytes, tagData, tagSize); } else { NotifyMemInfo(MemBlockFlags::WRITE, outbufPtr, outBytes, "AtracDecode"); } diff --git a/Core/HLE/sceDeflt.cpp b/Core/HLE/sceDeflt.cpp index 985b89d543..d1a6da33e1 100644 --- a/Core/HLE/sceDeflt.cpp +++ b/Core/HLE/sceDeflt.cpp @@ -59,9 +59,10 @@ static int CommonDecompress(int windowBits, u32 OutBuffer, int OutBufferLength, } if (MemBlockInfoDetailed(stream.total_in, stream.total_out)) { - const std::string tag = GetMemWriteTagAt("sceDeflt/", InBuffer, stream.total_in); - NotifyMemInfo(MemBlockFlags::READ, InBuffer, stream.total_in, tag.c_str(), tag.size()); - NotifyMemInfo(MemBlockFlags::WRITE, OutBuffer, stream.total_out, tag.c_str(), tag.size()); + char tagData[128]; + size_t tagSize = FormatMemWriteTagAt(tagData, sizeof(tagData), "sceDeflt/", InBuffer, stream.total_in); + NotifyMemInfo(MemBlockFlags::READ, InBuffer, stream.total_in, tagData, tagSize); + NotifyMemInfo(MemBlockFlags::WRITE, OutBuffer, stream.total_out, tagData, tagSize); } return hleLogSuccessI(HLE, stream.total_out); diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index 2168df3eed..ec4b452a64 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -693,9 +693,10 @@ static u32 sysclib_memcpy(u32 dst, u32 src, u32 size) { memcpy(Memory::GetPointerWriteUnchecked(dst), Memory::GetPointerUnchecked(src), size); } if (MemBlockInfoDetailed(size)) { - const std::string tag = GetMemWriteTagAt("KernelMemcpy/", src, size); - NotifyMemInfo(MemBlockFlags::READ, src, size, tag.c_str(), tag.size()); - NotifyMemInfo(MemBlockFlags::WRITE, dst, size, tag.c_str(), tag.size()); + char tagData[128]; + size_t tagSize = FormatMemWriteTagAt(tagData, sizeof(tagData), "KernelMemcpy/", src, size); + NotifyMemInfo(MemBlockFlags::READ, src, size, tagData, tagSize); + NotifyMemInfo(MemBlockFlags::WRITE, dst, size, tagData, tagSize); } return dst; } @@ -796,9 +797,10 @@ static u32 sysclib_memmove(u32 dst, u32 src, u32 size) { memmove(Memory::GetPointerWriteUnchecked(dst), Memory::GetPointerUnchecked(src), size); } if (MemBlockInfoDetailed(size)) { - const std::string tag = GetMemWriteTagAt("KernelMemmove/", src, size); - NotifyMemInfo(MemBlockFlags::READ, src, size, tag.c_str(), tag.size()); - NotifyMemInfo(MemBlockFlags::WRITE, dst, size, tag.c_str(), tag.size()); + char tagData[128]; + size_t tagSize = FormatMemWriteTagAt(tagData, sizeof(tagData), "KernelMemmove/", src, size); + NotifyMemInfo(MemBlockFlags::READ, src, size, tagData, tagSize); + NotifyMemInfo(MemBlockFlags::WRITE, dst, size, tagData, tagSize); } return 0; }