DebugInterface: Make GetRawMemoryString return a std::string

This commit is contained in:
Lioncash
2016-10-07 09:56:02 -04:00
parent 3245ca236a
commit ee71d70738
6 changed files with 30 additions and 44 deletions

View File

@ -2,16 +2,15 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Core/Debugger/PPCDebugInterface.h"
#include <string>
#include "Common/GekkoDisassembler.h"
#include "Common/StringUtil.h"
#include "Core/Core.h"
#include "Core/Debugger/Debugger_SymbolMap.h"
#include "Core/Debugger/PPCDebugInterface.h"
#include "Core/HW/DSP.h"
#include "Core/HW/Memmap.h"
#include "Core/Host.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
@ -48,24 +47,19 @@ std::string PPCDebugInterface::Disassemble(unsigned int address)
}
}
void PPCDebugInterface::GetRawMemoryString(int memory, unsigned int address, char* dest,
int max_size)
std::string PPCDebugInterface::GetRawMemoryString(int memory, unsigned int address)
{
if (IsAlive())
{
if (memory || PowerPC::HostIsRAMAddress(address))
{
snprintf(dest, max_size, "%08X%s", ReadExtraMemory(memory, address), memory ? " (ARAM)" : "");
}
else
{
strcpy(dest, memory ? "--ARAM--" : "--------");
}
}
else
{
strcpy(dest, "<unknwn>"); // bad spelling - 8 chars
const bool is_aram = memory != 0;
if (is_aram || PowerPC::HostIsRAMAddress(address))
return StringFromFormat("%08X%s", ReadExtraMemory(memory, address), is_aram ? " (ARAM)" : "");
return is_aram ? "--ARAM--" : "--------";
}
return "<unknwn>"; // bad spelling - 8 chars
}
unsigned int PPCDebugInterface::ReadMemory(unsigned int address)