V-Gears 0
Free Final Fantasy VII engine.
Disassembler Class Referenceabstract

Base class for disassemblers. More...

#include <Disassembler.h>

Inheritance diagram for Disassembler:

Public Member Functions

 Disassembler (InstVec &insts)
 Constructor for Disassembler. More...
 
virtual ~Disassembler ()=default
 Destructor. More...
 
virtual void Open (const char *filename)
 Open a file for disassembly. More...
 
void Disassemble ()
 Request disassembled instructions. More...
 
void DumpDisassembly (std::ostream &output)
 Outputs the disassembled code. More...
 

Protected Member Functions

virtual void DoDisassemble ()=0
 Performs disassembly. More...
 
virtual void DoDumpDisassembly (std::ostream &output)
 Outputs the disassembled code. More...
 
void ReadParams (InstPtr inst, const char *types)
 Read parameters and associate them with an instruction. More...
 
void ReadParams (InstPtr inst, const char *types, const std::vector< std::string > &params)
 Read parameters but it doesn't associate them with an instruction. More...
 
virtual ValuePtr ReadParameter (InstPtr inst, std::string type)
 Reads data for a single parameter. More...
 

Protected Attributes

std::unique_ptr< BinaryReaderstream_
 Used to perform file I/O. More...
 
InstVecinsts_
 List of disassembled instructions. More...
 
uint32 address_base_
 Base address where the script starts. More...
 
uint32 address_
 The current address. More...
 

Detailed Description

Base class for disassemblers.

Constructor & Destructor Documentation

◆ Disassembler()

Disassembler::Disassembler ( InstVec insts)

Constructor for Disassembler.

Parameters
[in]instsWhere disassembled instructions will be placed.

◆ ~Disassembler()

virtual Disassembler::~Disassembler ( )
virtualdefault

Destructor.

Member Function Documentation

◆ Disassemble()

void Disassembler::Disassemble ( )

Request disassembled instructions.

◆ DoDisassemble()

virtual void Disassembler::DoDisassemble ( )
protectedpure virtual

Performs disassembly.

Exceptions
UnknownOpcodeExceptionon unknown opcode.
std::exceptionon other failures.

Implemented in FieldDisassembler, and WorldDisassembler.

◆ DoDumpDisassembly()

void Disassembler::DoDumpDisassembly ( std::ostream &  output)
protectedvirtual

Outputs the disassembled code.

Parameters
[out]outputThe output stream.

◆ DumpDisassembly()

void Disassembler::DumpDisassembly ( std::ostream &  output)

Outputs the disassembled code.

Disassembles code if this has not already been done.

Parameters
[out]outputThe output stream.

◆ Open()

void Disassembler::Open ( const char *  filename)
virtual

Open a file for disassembly.

Parameters
[in]filenameThe file to Disassemble.

Reimplemented in FieldDisassembler.

◆ ReadParameter()

ValuePtr Disassembler::ReadParameter ( InstPtr  inst,
std::string  type 
)
protectedvirtual

Reads data for a single parameter.

Parameters
[in]instThe instruction the parameter will belong to. Unused.
[in]typeCharacter describing the type of the parameter.
Returns
The read data.

◆ ReadParams() [1/2]

void Disassembler::ReadParams ( InstPtr  inst,
const char *  types 
)
protected

Read parameters and associate them with an instruction.

Parameters
[in]instThe instruction to associate the parameters with.
[in]typesNUL-terminated string describing the type of each parameter.

◆ ReadParams() [2/2]

void Disassembler::ReadParams ( InstPtr  inst,
const char *  types,
const std::vector< std::string > &  params 
)
protected

Read parameters but it doesn't associate them with an instruction.

Parameters
[in]instThe instruction to associate the parameters with. Unused.
[in]typesNUL-terminated string describing the type of each parameter.
[in]paramsUnused.

Member Data Documentation

◆ address_

uint32 Disassembler::address_
protected

The current address.

◆ address_base_

uint32 Disassembler::address_base_
protected

Base address where the script starts.

◆ insts_

InstVec& Disassembler::insts_
protected

List of disassembled instructions.

◆ stream_

std::unique_ptr<BinaryReader> Disassembler::stream_
protected

Used to perform file I/O.


The documentation for this class was generated from the following files: