Seregon/ShadPKG

A tool for deriving PKG packet encryption keys for ps4 written in c++

C++/47.3 KB/No license
common/decoder.h
ShadPKG / common / decoder.h
1// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3 
4#pragma once
5 
6#include <Zydis/Zydis.h>
7#include "common/singleton.h"
8#include "common/shadpkg_types.h"
9 
10namespace Common {
11 
12class DecoderImpl {
13public:
14 DecoderImpl();
15 ~DecoderImpl();
16 
17 std::string disassembleInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,
18 u64 address);
19 void printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands, u64 address);
20 void printInstruction(void* code, u64 address);
21 ZyanStatus decodeInstruction(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,
22 void* data, u64 size = 15);
23 
24private:
25 ZydisDecoder m_decoder;
26 ZydisFormatter m_formatter;
27};
28 
29using Decoder = Common::Singleton<DecoderImpl>;
30 
31} // namespace Common
32