mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
Common: Introduce the new Gekko disassembler to Common.
This moves the Gekko disassembler to Common where it should be. Having it in the Bochs disassembly Externals is incorrect. Unlike the PowerPC disassembler prior however, this one is updated to have an API that is more fitting for C++. e.g. Not needing to specify a string buffer and size. It does all of this under the hood. This modifies all the DebuggingInterfaces as necessary to handle this.
This commit is contained in:
@ -2,7 +2,9 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "PowerPCDisasm.h"
|
||||
#include <string>
|
||||
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Host.h"
|
||||
@ -15,31 +17,37 @@
|
||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||
#include "Core/PowerPC/JitCommon/JitBase.h"
|
||||
|
||||
void PPCDebugInterface::Disassemble(unsigned int address, char *dest, int max_size)
|
||||
std::string PPCDebugInterface::Disassemble(unsigned int address)
|
||||
{
|
||||
// Memory::ReadUnchecked_U32 seemed to crash on shutdown
|
||||
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return;
|
||||
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
|
||||
return "";
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
if (Memory::IsRAMAddress(address, true, true))
|
||||
{
|
||||
u32 op = Memory::Read_Instruction(address);
|
||||
DisassembleGekko(op, address, dest, max_size);
|
||||
std::string disasm = GekkoDisassembler::Disassemble(op, address);
|
||||
|
||||
UGeckoInstruction inst;
|
||||
inst.hex = Memory::ReadUnchecked_U32(address);
|
||||
if (inst.OPCD == 1) {
|
||||
strcat(dest, " (hle)");
|
||||
|
||||
if (inst.OPCD == 1)
|
||||
{
|
||||
disasm += " (hle)";
|
||||
}
|
||||
|
||||
return disasm;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(dest, "(No RAM here)");
|
||||
return "(No RAM here)";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(dest, "<unknown>");
|
||||
return "<unknown>";
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user