You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb mike.beach #rnx #ROBOMERGE-OWNER: Markus.Breyer #ROBOMERGE-AUTHOR: markus.breyer #ROBOMERGE-SOURCE: CL 8852703 via CL 8853914 via CL 8868791 #ROBOMERGE-BOT: (v426-8886397) [CL 8887873 by Markus Breyer in Main branch]
87 lines
2.3 KiB
C++
87 lines
2.3 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
ScriptDisassembler.h: Disassembler for Kismet bytecode.
|
|
=============================================================================*/
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/Script.h"
|
|
|
|
/**
|
|
* Kismet bytecode disassembler; Can be used to create a human readable version
|
|
* of Kismet bytecode for a specified structure or class.
|
|
*/
|
|
class FKismetBytecodeDisassembler
|
|
{
|
|
private:
|
|
TArray<uint8> Script;
|
|
FString Indents;
|
|
FOutputDevice& Ar;
|
|
public:
|
|
/**
|
|
* Construct a disassembler that will output to the specified archive.
|
|
*
|
|
* @param InAr The archive to emit disassembled bytecode to.
|
|
*/
|
|
SCRIPTDISASSEMBLER_API FKismetBytecodeDisassembler(FOutputDevice& InAr);
|
|
|
|
/**
|
|
* Disassemble all of the script code in a single structure.
|
|
*
|
|
* @param [in,out] Source The structure to disassemble.
|
|
*/
|
|
SCRIPTDISASSEMBLER_API void DisassembleStructure(UFunction* Source);
|
|
|
|
/**
|
|
* Disassemble all functions in any classes that have matching names.
|
|
*
|
|
* @param InAr The archive to emit disassembled bytecode to.
|
|
* @param ClassnameSubstring A class must contain this substring to be disassembled.
|
|
*/
|
|
SCRIPTDISASSEMBLER_API static void DisassembleAllFunctionsInClasses(FOutputDevice& Ar, const FString& ClassnameSubstring);
|
|
private:
|
|
|
|
// Reading functions
|
|
int32 ReadINT(int32& ScriptIndex);
|
|
uint64 ReadQWORD(int32& ScriptIndex);
|
|
uint8 ReadBYTE(int32& ScriptIndex);
|
|
FString ReadName(int32& ScriptIndex);
|
|
uint16 ReadWORD(int32& ScriptIndex);
|
|
float ReadFLOAT(int32& ScriptIndex);
|
|
CodeSkipSizeType ReadSkipCount(int32& ScriptIndex);
|
|
FString ReadString(int32& ScriptIndex);
|
|
FString ReadString8(int32& ScriptIndex);
|
|
FString ReadString16(int32& ScriptIndex);
|
|
|
|
EExprToken SerializeExpr(int32& ScriptIndex);
|
|
void ProcessCastByte(int32 CastType, int32& ScriptIndex);
|
|
void ProcessCommon(int32& ScriptIndex, EExprToken Opcode);
|
|
|
|
void InitTables();
|
|
|
|
template<typename T>
|
|
void Skip(int32& ScriptIndex)
|
|
{
|
|
ScriptIndex += sizeof(T);
|
|
}
|
|
|
|
void AddIndent()
|
|
{
|
|
Indents += TEXT(" ");
|
|
}
|
|
|
|
void DropIndent()
|
|
{
|
|
// Blah, this is awful
|
|
Indents = Indents.Left(Indents.Len() - 2);
|
|
}
|
|
|
|
template <typename T>
|
|
T* ReadPointer(int32& ScriptIndex)
|
|
{
|
|
return (T*)ReadQWORD(ScriptIndex);
|
|
}
|
|
};
|