![]() |
V-Gears 0
Free Final Fantasy VII engine.
|
Represents the FF7 Field engine. More...
#include <FieldEngine.h>
Classes | |
class | Entity |
Represents an entity. More... | |
Public Member Functions | |
FieldEngine (FieldScriptFormatter &formatter, std::string script_name) | |
Constructor. More... | |
FieldEngine (const FieldEngine &engine)=delete | |
Copy constructor, disabled. More... | |
FieldEngine & | operator= (const FieldEngine &engine)=delete |
Copy constructor, disabled. More... | |
virtual std::unique_ptr< Disassembler > | GetDisassembler (InstVec &insts, const std::vector< unsigned char > &raw_script_data) override |
Retrieves the disasembler. More... | |
virtual std::unique_ptr< Disassembler > | GetDisassembler (InstVec &insts) override |
Retrieves the dissasembler. More... | |
virtual std::unique_ptr< CodeGenerator > | GetCodeGenerator (const InstVec &insts, std::ostream &output) override |
Retrieves the code generator. More... | |
virtual void | PostCFG (InstVec &insts, Graph graph) override |
Post-processing actions to apply to the scripts. More... | |
virtual bool | UsePureGrouping () const override |
Indicates if instructions are purely grouped. More... | |
std::map< std::string, int > | GetEntities () const |
Retrieves all entities in the map. More... | |
std::vector< FieldDecompiler::FieldEntity > | GetEntityList () const |
Retrieves all non-line entities in the map. More... | |
std::vector< FieldDecompiler::Line > | GetLineList () const |
Retrieves all line entities in the map. More... | |
std::map< size_t, Entity > | GetEntityIndexMap () const |
Retrieves all entities in the map. More... | |
void | AddEntityFunction (const std::string &entity_name, size_t entity_index, const std::string &func_name, size_t func_index) |
Adds a function to an entity. More... | |
void | MarkEntityAsLine (size_t entity_index, bool line, std::vector< float > point_a, std::vector< float > point_b) |
Marks an entity as a line. More... | |
bool | EntityIsLine (size_t entity_index) |
Checks if an entity has been marked as a line. More... | |
const Entity & | EntityByIndex (size_t index) const |
Retrieves an entity. More... | |
float | GetScaleFactor () const |
Retrieves the scale factor for the map. More... | |
const std::string & | GetScriptName () const |
Retrieves the script name. More... | |
![]() | |
virtual | ~Engine ()=default |
virtual std::unique_ptr< Disassembler > | GetDisassembler (InstVec &insts, const std::vector< unsigned char > &c) |
virtual std::unique_ptr< Disassembler > | GetDisassembler (InstVec &insts)=0 |
Retrieve the disassembler for the engine. More... | |
virtual std::unique_ptr< CodeGenerator > | GetCodeGenerator (const InstVec &insts, std::ostream &output)=0 |
Retrieve the code generator for the engine. More... | |
virtual void | PostCFG (InstVec &insts, Graph graph) |
Post-processing step after CFG analysis. More... | |
virtual bool | SupportsCodeFlow () const |
Whether or not code flow analysis is supported for this engine. More... | |
virtual bool | SupportsCodeGen () const |
Whether or not code generation is supported for this engine. More... | |
virtual void | GetVariants (std::vector< std::string > &variants) const |
Retrieves the names of all variants supported for this engine. More... | |
virtual bool | UsePureGrouping () const |
Whether or not to use "pure" grouping during code flow analysis. More... | |
Private Member Functions | |
void | RemoveExtraneousReturnStatements (InstVec &insts, Graph graph) |
Removes extraneous return statements. More... | |
void | RemoveTrailingInfiniteLoops (InstVec &insts, Graph graph) |
Removes trailing infinite loops. More... | |
FieldScriptFormatter & | formatter_ |
The script formatter. More... | |
std::map< size_t, Entity > | entity_index_map_ |
The entity index map for the field. More... | |
float | scale_factor_ |
The map scale factor. More... | |
std::string | script_name_ |
The script name. More... | |
void | MarkInfiniteLoopGroups (InstVec &insts, Graph graph) |
Tries to detect scripts with trailing infinite loops. More... | |
Additional Inherited Members | |
![]() | |
FuncMap | functions |
Map to functions in the current script, indexed by start address. More... | |
![]() | |
std::string | variant_ |
Engine variant to use for the script. More... | |
Represents the FF7 Field engine.
FieldEngine::FieldEngine | ( | FieldScriptFormatter & | formatter, |
std::string | script_name | ||
) |
Constructor.
[in] | formatter | The formatter to be used by the engine. |
[in] | script_name | The script name. |
|
delete |
Copy constructor, disabled.
[in] | engine | The engine to copy. |
void FieldEngine::AddEntityFunction | ( | const std::string & | entity_name, |
size_t | entity_index, | ||
const std::string & | func_name, | ||
size_t | func_index | ||
) |
Adds a function to an entity.
[in] | entity_name | Name of the entity. |
[in] | entity_index | Index of the entity. |
[in] | func_name | Name of the function. |
[in] | func_index | Index of the function. |
const FieldEngine::Entity & FieldEngine::EntityByIndex | ( | size_t | index | ) | const |
Retrieves an entity.
[in] | index | Index of the entity to retrieve. |
DecompilerException | if there is no entity at the specified index. |
bool FieldEngine::EntityIsLine | ( | size_t | entity_index | ) |
Checks if an entity has been marked as a line.
[in] | entity_index | Index of the entity to check. |
|
overridevirtual |
Retrieves the code generator.
[in] | insts | List of instructions. |
[in] | output | Pointer to the output (file, stream...). |
Implements Engine.
|
overridevirtual |
Retrieves the dissasembler.
[in] | insts | List of instructions. |
Implements Engine.
|
overridevirtual |
Retrieves the disasembler.
[in] | insts | List of instructions. |
[in] | raw_script_data | Script data, raw format. |
Reimplemented from Engine.
std::map< std::string, int > FieldEngine::GetEntities | ( | ) | const |
Retrieves all entities in the map.
|
inline |
Retrieves all entities in the map.
std::vector< FieldDecompiler::FieldEntity > FieldEngine::GetEntityList | ( | ) | const |
Retrieves all non-line entities in the map.
std::vector< FieldDecompiler::Line > FieldEngine::GetLineList | ( | ) | const |
Retrieves all line entities in the map.
float FieldEngine::GetScaleFactor | ( | ) | const |
Retrieves the scale factor for the map.
const std::string & FieldEngine::GetScriptName | ( | ) | const |
Retrieves the script name.
void FieldEngine::MarkEntityAsLine | ( | size_t | entity_index, |
bool | line, | ||
std::vector< float > | point_a, | ||
std::vector< float > | point_b | ||
) |
Marks an entity as a line.
[in] | entity_index | Index of the entity. |
[in] | line | True to mark the entity as a line, false to unmark it. |
[in] | point_a | First point of the line. Can be null if line is false. |
[in] | point_b | Second point of the line. Can be null if line is false. |
Tries to detect scripts with trailing infinite loops.
In FF7 some scripts ends with an infinite loop to keep it alive. In VGears this isn't required, and can cause infinite loops, so they can be removed. This function marks them, so they can be deleted withsee FieldEngine::RemoveTrailingInfiniteLoops}.
|
delete |
Copy constructor, disabled.
[in] | engine | The engine to copy. |
Post-processing actions to apply to the scripts.
It actually does nothing. CFG stands for control flow group.
[in] | insts | Instruction list. |
[in] | graph | Code graph. |
Reimplemented from Engine.
Removes extraneous return statements.
Useful for scripts that only contain one one return statement.
[in,out] | insts | List of instructions to process. Extraneous return statements will be deleted from the instructions. |
[in] | graph | Code graph. Unused. |
Removes trailing infinite loops.
In FF7 some scripts ends with an infinite loop to keep it alive. In VGears this isn't required, and can cause infinite loops, so they can be removed.
[in,out] | insts | List of instructions to proccess. Trailing infinite loops will be deleted from the instructions. |
[in] | graph | Code graph. |
|
overridevirtual |
Indicates if instructions are purely grouped.
Reimplemented from Engine.
|
private |
The entity index map for the field.
|
private |
The script formatter.
|
private |
The map scale factor.
|
private |
The script name.