mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-19 18:04:56 +00:00
common: Move classes to common namespace
This commit is contained in:
parent
996aa9d17a
commit
303f086b14
21 changed files with 190 additions and 199 deletions
|
@ -1,35 +1,33 @@
|
|||
#include "common/disassembler.h"
|
||||
#include <fmt/format.h>
|
||||
|
||||
Disassembler::Disassembler()
|
||||
{
|
||||
namespace Common {
|
||||
|
||||
Disassembler::Disassembler() {
|
||||
ZydisDecoderInit(&m_decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_STACK_WIDTH_64);
|
||||
ZydisFormatterInit(&m_formatter, ZYDIS_FORMATTER_STYLE_INTEL);
|
||||
}
|
||||
|
||||
Disassembler::~Disassembler()
|
||||
{
|
||||
}
|
||||
Disassembler::~Disassembler() = default;
|
||||
|
||||
void Disassembler::printInstruction(void* code,u64 address)//print a single instruction
|
||||
{
|
||||
void Disassembler::printInstruction(void* code, u64 address) {
|
||||
ZydisDecodedInstruction instruction;
|
||||
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT_VISIBLE];
|
||||
ZyanStatus status = ZydisDecoderDecodeFull(&m_decoder, code, sizeof(code), &instruction, operands);
|
||||
if (!ZYAN_SUCCESS(status))
|
||||
{
|
||||
ZyanStatus status = ZydisDecoderDecodeFull(&m_decoder, code, sizeof(code),
|
||||
&instruction, operands);
|
||||
if (!ZYAN_SUCCESS(status)) {
|
||||
fmt::print("decode instruction failed at {}\n", fmt::ptr(code));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
printInst(instruction, operands,address);
|
||||
}
|
||||
}
|
||||
|
||||
void Disassembler::printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,u64 address)
|
||||
{
|
||||
void Disassembler::printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands, u64 address) {
|
||||
const int bufLen = 256;
|
||||
char szBuffer[bufLen];
|
||||
ZydisFormatterFormatInstruction(&m_formatter, &inst, operands,inst.operand_count_visible, szBuffer, sizeof(szBuffer), address, ZYAN_NULL);
|
||||
ZydisFormatterFormatInstruction(&m_formatter, &inst, operands,inst.operand_count_visible,
|
||||
szBuffer, sizeof(szBuffer), address, ZYAN_NULL);
|
||||
fmt::print("instruction: {}\n", szBuffer);
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue