Do the last ones too

This commit is contained in:
Henrik Rydgård
2023-02-09 10:27:29 +01:00
parent c52db636ce
commit dc74778dea
6 changed files with 20 additions and 28 deletions
-11
View File
@@ -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) {
-2
View File
@@ -68,8 +68,6 @@ inline void NotifyMemInfo(MemBlockFlags flags, uint32_t start, uint32_t size, co
std::vector<MemBlockInfo> FindMemInfo(uint32_t start, uint32_t size);
std::vector<MemBlockInfo> 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();
+4 -3
View File
@@ -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
+4 -3
View File
@@ -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");
}
+4 -3
View File
@@ -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);
+8 -6
View File
@@ -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;
}