Separate logging for GetPointer/GetPointerWrite

This commit is contained in:
Henrik Rydgård
2022-07-24 13:33:03 +02:00
parent e6403d7157
commit 861d66a4d4
2 changed files with 21 additions and 15 deletions
+2 -2
View File
@@ -1042,7 +1042,7 @@ static bool __IoRead(int &result, int id, u32 data_addr, int size, int &us) {
} else if (Memory::IsValidAddress(data_addr)) {
const std::string tag = "IoRead/" + IODetermineFilename(f);
NotifyMemInfo(MemBlockFlags::WRITE, data_addr, size, tag.c_str(), tag.size());
u8 *data = (u8 *)Memory::GetPointer(data_addr);
u8 *data = (u8 *)Memory::GetPointerUnchecked(data_addr);
u32 validSize = Memory::ValidSize(data_addr, size);
if (f->npdrm) {
result = npdrmRead(f, data, validSize);
@@ -2482,7 +2482,7 @@ static int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr,
u8 pgd_magic[4] = {0x00, 0x50, 0x47, 0x44};
if (Memory::IsValidAddress(indataPtr) && inlen == 16) {
memcpy(keybuf, Memory::GetPointer(indataPtr), 16);
memcpy(keybuf, Memory::GetPointerUnchecked(indataPtr), 16);
key_ptr = keybuf;
}else{
key_ptr = NULL;
+19 -13
View File
@@ -29,22 +29,15 @@
namespace Memory {
u8 *GetPointerWrite(const u32 address) {
if ((address & 0x3E000000) == 0x08000000) {
// RAM
return GetPointerWriteUnchecked(address);
} else if ((address & 0x3F800000) == 0x04000000) {
// VRAM
return GetPointerWriteUnchecked(address);
} else if ((address & 0xBFFFC000) == 0x00010000) {
// Scratchpad
return GetPointerWriteUnchecked(address);
} else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) {
// More RAM (remasters, etc.)
if ((address & 0x3E000000) == 0x08000000 || // RAM
(address & 0x3F800000) == 0x04000000 || // VRAM
(address & 0xBFFFC000) == 0x00010000 || // Scratchpad
((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize)) { // More RAM (remasters, etc.)
return GetPointerWriteUnchecked(address);
} else {
static bool reported = false;
if (!reported) {
Reporting::ReportMessage("Unknown GetPointer %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
Reporting::ReportMessage("Unknown GetPointerWrite %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
reported = true;
}
Core_MemoryException(address, currentMIPS->pc, MemoryExceptionType::WRITE_BLOCK);
@@ -53,7 +46,20 @@ u8 *GetPointerWrite(const u32 address) {
}
const u8 *GetPointer(const u32 address) {
return (const u8 *)GetPointerWrite(address);
if ((address & 0x3E000000) == 0x08000000 || // RAM
(address & 0x3F800000) == 0x04000000 || // VRAM
(address & 0xBFFFC000) == 0x00010000 || // Scratchpad
((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize)) { // More RAM (remasters, etc.)
return GetPointerUnchecked(address);
} else {
static bool reported = false;
if (!reported) {
Reporting::ReportMessage("Unknown GetPointer %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
reported = true;
}
Core_MemoryException(address, currentMIPS->pc, MemoryExceptionType::READ_BLOCK);
return nullptr;
}
}
template <typename T>