Things to neat up that I noticed with Hazel <3
This commit is contained in:
@@ -10,24 +10,25 @@ struct Disassembler {
|
||||
std::string full;
|
||||
u64 address;
|
||||
std::string mnemonic;
|
||||
std::array<std::string, 3> ops{};
|
||||
struct Operand {
|
||||
u32 color;
|
||||
std::string str;
|
||||
};
|
||||
std::array<Operand, 3> ops{};
|
||||
std::string comment;
|
||||
};
|
||||
|
||||
~Disassembler() { cs_close(&handle); }
|
||||
|
||||
static Disassembler &GetInstance(bool rsp = false) {
|
||||
static Disassembler ret(rsp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
[[nodiscard]] DisassemblyResult Disassemble(const u32 address, const u32 instruction) const {
|
||||
return details ? DisassembleDetailed(address, instruction) : DisassembleSimple(address, instruction);
|
||||
}
|
||||
|
||||
~Disassembler() { cs_close(&handle); }
|
||||
|
||||
private:
|
||||
[[nodiscard]] DisassemblyResult Disassemble(const u32 address) const;
|
||||
[[nodiscard]] DisassemblyResult DisassembleDetailed(u32 address, u32 instruction) const;
|
||||
[[nodiscard]] DisassemblyResult DisassembleSimple(u32 address, u32 instruction) const;
|
||||
|
||||
private:
|
||||
explicit Disassembler(const bool rsp) : rsp(rsp) {
|
||||
if (cs_open(CS_ARCH_MIPS, static_cast<cs_mode>((rsp ? CS_MODE_32 : CS_MODE_64) | CS_MODE_BIG_ENDIAN), &handle) !=
|
||||
CS_ERR_OK) {
|
||||
|
||||
Reference in New Issue
Block a user