mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-19 18:04:56 +00:00
src: Move certain headers in common
This commit is contained in:
parent
6e28ac711f
commit
17aefc1aef
73 changed files with 98 additions and 106 deletions
|
@ -1,35 +0,0 @@
|
|||
#include "Disassembler.h"
|
||||
#include <fmt/format.h>
|
||||
|
||||
Disassembler::Disassembler()
|
||||
{
|
||||
ZydisDecoderInit(&m_decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_STACK_WIDTH_64);
|
||||
ZydisFormatterInit(&m_formatter, ZYDIS_FORMATTER_STYLE_INTEL);
|
||||
}
|
||||
|
||||
Disassembler::~Disassembler()
|
||||
{
|
||||
}
|
||||
|
||||
void Disassembler::printInstruction(void* code,u64 address)//print a single instruction
|
||||
{
|
||||
ZydisDecodedInstruction instruction;
|
||||
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT_VISIBLE];
|
||||
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
|
||||
{
|
||||
printInst(instruction, operands,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);
|
||||
fmt::print("instruction: {}\n", szBuffer);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue