From ad8da6e02f4331b83f92d7e64e72e037443ed312 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 21 Aug 2013 08:34:35 -0700 Subject: [PATCH] Report bad memory access (first time only.) --- Core/MemMapFunctions.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index b6e590b06f..76a71f9c90 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -15,14 +15,15 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common.h" -#include "Atomics.h" +#include "Common/Common.h" +#include "Common/Atomics.h" -#include "MemMap.h" -#include "Config.h" -#include "Host.h" +#include "Core/MemMap.h" +#include "Core/Config.h" +#include "Core/Host.h" +#include "Core/Reporting.h" -#include "MIPS/MIPS.h" +#include "Core/MIPS/MIPS.h" namespace Memory { @@ -52,6 +53,11 @@ u8 *GetPointer(const u32 address) } else { ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); + 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; + } if (!g_Config.bIgnoreBadMemAccess) { Core_EnableStepping(true); host->SetDebugMode(true); @@ -88,6 +94,11 @@ inline void ReadFromHardware(T &var, const u32 address) } else { WARN_LOG(MEMMAP, "ReadFromHardware: Invalid address %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); } + static bool reported = false; + if (!reported) { + Reporting::ReportMessage("ReadFromHardware: Invalid address %08x near PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); + reported = true; + } if (!g_Config.bIgnoreBadMemAccess) { Core_EnableStepping(true); host->SetDebugMode(true); @@ -120,6 +131,11 @@ inline void WriteToHardware(u32 address, const T data) } else { WARN_LOG(MEMMAP, "WriteToHardware: Invalid address %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); } + static bool reported = false; + if (!reported) { + Reporting::ReportMessage("WriteToHardware: Invalid address %08x near PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); + reported = true; + } if (!g_Config.bIgnoreBadMemAccess) { Core_EnableStepping(true); host->SetDebugMode(true);