V-Gears 0
Free Final Fantasy VII engine.
BattleDataInstaller Class Reference

The battle data installer. More...

#include <BattleDataInstaller.h>

Collaboration diagram for BattleDataInstaller:

Classes

struct  CharacterData
 Playable character model info. More...
 
struct  CharacterModel
 Models for playable characters. More...
 
struct  Model
 Files to compose a model. More...
 
struct  SceneModel
 Models for battle scenes. More...
 

Public Member Functions

 BattleDataInstaller (const std::string input_dir, const std::string output_dir, Ogre::ResourceGroupManager *res_mgr)
 Constructor. More...
 
 ~BattleDataInstaller ()
 Destructor. More...
 
unsigned int InitializeScenes ()
 Prepares the installer for scene processing. More...
 
unsigned int InitializeModels ()
 Prepares the installer for 3D model processing. More...
 
unsigned int ProcessScene ()
 Processes the next battle scene. More...
 
unsigned int ProcessModel ()
 Processes the 3D model. More...
 
unsigned int ConvertModelsInit ()
 Prepres the installer for model conversion. More...
 
unsigned int ConvertModel ()
 Converts a model. More...
 
void WriteEnemies ()
 Writes enemy data to files. More...
 
void WriteAttacks ()
 Writes attack data to files. More...
 
void WriteFormations ()
 Writes formation data to files. More...
 
void WriteCharacterData ()
 Writes playable character data. More...
 
void WriteSceneData ()
 Writes battle scene data. More...
 

Private Member Functions

FileExtractGZipScene (File file)
 Extract a gzipped file. More...
 
std::string BuildEnemyFileName (Enemy enemy)
 Constructs a file name for the XML file to save an enemy to. More...
 
std::string BuildAttackFileName (Attack attack)
 Constructs a file name for the XML file to save an attack to. More...
 
void ExportMesh (const std::string outdir, const Ogre::MeshPtr &mesh)
 Exports a mesh to a file. More...
 
void GenerateRsdFiles (Model model, std::string path)
 Generates all required .rsd models for a model. More...
 
void DecompileHrc (File compiled, Model model, std::string path, std::string skeleton_name)
 Decompiles a compiled HRC file. More...
 
void DecompileSceneHrc (File compiled, Model model, std::string path, std::string skeleton_name)
 Decompiles a compiled HRC file. More...
 

Private Attributes

std::string input_dir_
 The path to the directory from which to read the PC game data. More...
 
std::string output_dir_
 The path to the directory where to save the V-Gears data. More...
 
Ogre::ResourceGroupManager * res_mgr_
 Pointer to the application resource manager. More...
 
std::function< void(std::string)> write_output_line_
 Function used to print text to the log output, line by line. More...
 
unsigned int next_scene_
 Next scene file to process;. More...
 
unsigned int total_scenes_
 Number of scenes in SCENE.BIN;. More...
 
File scene_bin_
 The original scene.bin file. More...
 
std::vector< File * > scenes_uncompressed_
 List of uncompressed scenes. More...
 
std::vector< BattleSceneFilescenes_
 Processed scenes. More...
 
std::vector< Enemyenemies_
 Enemy data read from the scenes;. More...
 
std::vector< CharacterDatacharacter_data_
 List of models for playable character;. More...
 
std::vector< SceneModelscene_data_
 List of models for battle scenes;. More...
 
std::map< int, std::string > enemy_map_
 Map of enemies, ID and xml file path. More...
 
std::vector< Attackattacks_
 Attack data read from the scenes;. More...
 
std::map< int, std::string > attack_map_
 Map of attacks, ID and xml file path. More...
 
std::vector< Formationformations_
 Formations data read from the scenes;. More...
 
std::map< int, std::string > formation_map_
 Map of formations, ID and xml file path. More...
 
std::vector< Filebattle_lgp_files_
 The files in the original battle.lgp file. More...
 
std::vector< std::string > battle_lgp_file_names_
 File names for the files in {. More...
 
unsigned int next_model_to_process_
 Next model to process;. More...
 
unsigned int next_model_to_convert_
 Next model to convert. More...
 
std::vector< Modelmodels_
 List of models files found in battle.lgp. More...
 
std::vector< std::string > materials_
 List of model materials;. More...
 

Detailed Description

The battle data installer.

Constructor & Destructor Documentation

◆ BattleDataInstaller()

BattleDataInstaller::BattleDataInstaller ( const std::string  input_dir,
const std::string  output_dir,
Ogre::ResourceGroupManager *  res_mgr 
)

Constructor.

Parameters
[in]input_dirPath to the directory containing the original data to parse.
[in]output_dirPath to the directory of the installation data.
[in]res_mgrThe application resource manager..

◆ ~BattleDataInstaller()

BattleDataInstaller::~BattleDataInstaller ( )

Destructor.

Member Function Documentation

◆ BuildAttackFileName()

std::string BattleDataInstaller::BuildAttackFileName ( Attack  attack)
private

Constructs a file name for the XML file to save an attack to.

The filename will be "dame/attack/[ID]_[NAME].xml" where [ID] is the attack ID, padded with '0' to a length of 4, and [NAME] is the attack name using only alphanumeric characters.

Parameters
[in]attackThe attack to be saved.
Returns
The name for the attack file.

◆ BuildEnemyFileName()

std::string BattleDataInstaller::BuildEnemyFileName ( Enemy  enemy)
private

Constructs a file name for the XML file to save an enemy to.

The filename will be "dame/enemy/[ID]_[NAME].xml" where [ID] is the enemy ID, padded with '0' to a length of 4, and [NAME] is the enemy name using only alphanumeric characters.

Parameters
[in]enemyThe enemy to be saved.
Returns
The name for the enemy file.

◆ ConvertModel()

unsigned int BattleDataInstaller::ConvertModel ( )

Converts a model.

Returns
The total number of converted models.

◆ ConvertModelsInit()

unsigned int BattleDataInstaller::ConvertModelsInit ( )

Prepres the installer for model conversion.

Returns
The total number of models to convert.

◆ DecompileHrc()

void BattleDataInstaller::DecompileHrc ( File  compiled,
Model  model,
std::string  path,
std::string  skeleton_name 
)
private

Decompiles a compiled HRC file.

To be used for battle enemy and playable character models, since they have a well-defined bone hierarchy. For battle background models, use {

See also
DecompileSceneHrc}. Note that this is not a general purpose HRC decompiler, it only works for files in battle.lgp.
Parameters
[in]compiledThe compiles HRC file.
[in]modelThe model.
[in]pathPath to save the decompiled file to.
[in]skeleton_nameName for the skeleton.

◆ DecompileSceneHrc()

void BattleDataInstaller::DecompileSceneHrc ( File  compiled,
Model  model,
std::string  path,
std::string  skeleton_name 
)
private

Decompiles a compiled HRC file.

To be used only for battle background HRC files, since they don't have a defined bone hierarchy, and every bone is assumed to be a child of the previous one. For enemy and playable character models, use {

See also
DecompileHrc}. Note that this is not a general purpose HRC decompiler, it only works for files in battle.lgp.
Parameters
[in]compiledThe compiles HRC file.
[in]modelThe model.
[in]pathPath to save the decompiled file to.
[in]skeleton_nameName for the skeleton.

◆ ExportMesh()

void BattleDataInstaller::ExportMesh ( const std::string  outdir,
const Ogre::MeshPtr &  mesh 
)
private

Exports a mesh to a file.

The file will have the mesh name.

Parameters
[in]outdirPath to the directory where the file will be saved.
[in]meshThe mesh to export.

◆ ExtractGZipScene()

File * BattleDataInstaller::ExtractGZipScene ( File  file)
private

Extract a gzipped file.

Parameters
[in]fileCompressed file.
Returns
Uncompressed file. NULL if errors were encountered (they will be logged to console).

◆ GenerateRsdFiles()

void BattleDataInstaller::GenerateRsdFiles ( Model  model,
std::string  path 
)
private

Generates all required .rsd models for a model.

Parameters
[in]modelModel information.
[in]pathOutput path.

◆ InitializeModels()

unsigned int BattleDataInstaller::InitializeModels ( )

Prepares the installer for 3D model processing.

Returns
The total number of models to process.

◆ InitializeScenes()

unsigned int BattleDataInstaller::InitializeScenes ( )

Prepares the installer for scene processing.

Returns
The total number of scenes to process.

◆ ProcessModel()

unsigned int BattleDataInstaller::ProcessModel ( )

Processes the 3D model.

Saves .hrc, .a and .p files for later conversion. .tex files are converted directly to png.

Returns
The total number of processed models.

◆ ProcessScene()

unsigned int BattleDataInstaller::ProcessScene ( )

Processes the next battle scene.

Returns
The total number of processed scenes.

◆ WriteAttacks()

void BattleDataInstaller::WriteAttacks ( )

Writes attack data to files.

◆ WriteCharacterData()

void BattleDataInstaller::WriteCharacterData ( )

Writes playable character data.

◆ WriteEnemies()

void BattleDataInstaller::WriteEnemies ( )

Writes enemy data to files.

◆ WriteFormations()

void BattleDataInstaller::WriteFormations ( )

Writes formation data to files.

◆ WriteSceneData()

void BattleDataInstaller::WriteSceneData ( )

Writes battle scene data.

Member Data Documentation

◆ attack_map_

std::map<int, std::string> BattleDataInstaller::attack_map_
private

Map of attacks, ID and xml file path.

◆ attacks_

std::vector<Attack> BattleDataInstaller::attacks_
private

Attack data read from the scenes;.

◆ battle_lgp_file_names_

std::vector<std::string> BattleDataInstaller::battle_lgp_file_names_
private

File names for the files in {.

See also
battle_lgp_files_}.

◆ battle_lgp_files_

std::vector<File> BattleDataInstaller::battle_lgp_files_
private

The files in the original battle.lgp file.

◆ character_data_

std::vector<CharacterData> BattleDataInstaller::character_data_
private

List of models for playable character;.

◆ enemies_

std::vector<Enemy> BattleDataInstaller::enemies_
private

Enemy data read from the scenes;.

◆ enemy_map_

std::map<int, std::string> BattleDataInstaller::enemy_map_
private

Map of enemies, ID and xml file path.

◆ formation_map_

std::map<int, std::string> BattleDataInstaller::formation_map_
private

Map of formations, ID and xml file path.

◆ formations_

std::vector<Formation> BattleDataInstaller::formations_
private

Formations data read from the scenes;.

◆ input_dir_

std::string BattleDataInstaller::input_dir_
private

The path to the directory from which to read the PC game data.

◆ materials_

std::vector<std::string> BattleDataInstaller::materials_
private

List of model materials;.

◆ models_

std::vector<Model> BattleDataInstaller::models_
private

List of models files found in battle.lgp.

◆ next_model_to_convert_

unsigned int BattleDataInstaller::next_model_to_convert_
private

Next model to convert.

◆ next_model_to_process_

unsigned int BattleDataInstaller::next_model_to_process_
private

Next model to process;.

◆ next_scene_

unsigned int BattleDataInstaller::next_scene_
private

Next scene file to process;.

◆ output_dir_

std::string BattleDataInstaller::output_dir_
private

The path to the directory where to save the V-Gears data.

◆ res_mgr_

Ogre::ResourceGroupManager* BattleDataInstaller::res_mgr_
private

Pointer to the application resource manager.

◆ scene_bin_

File BattleDataInstaller::scene_bin_
private

The original scene.bin file.

◆ scene_data_

std::vector<SceneModel> BattleDataInstaller::scene_data_
private

List of models for battle scenes;.

◆ scenes_

std::vector<BattleSceneFile> BattleDataInstaller::scenes_
private

Processed scenes.

◆ scenes_uncompressed_

std::vector<File*> BattleDataInstaller::scenes_uncompressed_
private

List of uncompressed scenes.

◆ total_scenes_

unsigned int BattleDataInstaller::total_scenes_
private

Number of scenes in SCENE.BIN;.

◆ write_output_line_

std::function<void(std::string)> BattleDataInstaller::write_output_line_
private

Function used to print text to the log output, line by line.


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