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

The data installer. More...

#include <DataInstaller.h>

Collaboration diagram for DataInstaller:

Classes

struct  AdvancedOptions
 Advanced options available in the installer. More...
 

Public Member Functions

 DataInstaller (const std::string input_dir, const std::string output_dir, AdvancedOptions options, std::function< void(std::string, int, bool)> write_output_line)
 Installer constructor. More...
 
 ~DataInstaller ()
 Installer destructor. More...
 
float Progress ()
 Handle the installation progress. More...
 

Static Public Attributes

static float LINE_SCALE_FACTOR = 0.0078124970964f
 The scale factor for line point coordinates. More...
 

Private Types

enum  InstallationSteps {
  IDLE = 0 , CREATE_DIRECTORIES , INITIALIZE , BATTLE_SCENES_INIT ,
  BATTLE_SCENES_PROCESS , BATTLE_SCENES_WRITE_ATTACKS , BATTLE_SCENES_WRITE_ENEMIES , BATTLE_SCENES_WRITE_FORMATIONS ,
  BATTLE_MODELS_INIT , BATTLE_MODELS_PROCESS , BATTLE_MODELS_CONVERT_INIT , BATTLE_MODELS_CONVERT ,
  BATTLE_MODELS_WRITE_CHARACTERS , BATTLE_MODELS_WRITE_SCENES , KERNEL_PRICES , KERNEL_COMMANDS ,
  KERNEL_ATTACKS , KERNEL_CHARACTERS , KERNEL_ITEMS , KERNEL_GROWTH ,
  KERNEL_WEAPONS , KERNEL_ARMORS , KERNEL_ACCESSORIES , KERNEL_MATERIA ,
  KERNEL_KEY_ITEMS , KERNEL_SUMMON_NAMES , KERNEL_SAVEMAP , MEDIA_IMAGES ,
  MEDIA_SOUNDS_INIT , MEDIA_SOUNDS , MEDIA_SOUNDS_INDEX , MEDIA_MUSICS_INIT ,
  MEDIA_MUSICS , MEDIA_MUSICS_HQ , MEDIA_MUSICS_INDEX , FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT ,
  FIELD_SPAWN_POINTS_AND_SCALE_FACTORS , FIELD_CONVERT , FIELD_WRITE_INIT , FIELD_WRITE ,
  FIELD_WRITE_END , FIELD_CONVERT_MODELS_INIT , FIELD_CONVERT_MODELS , CLEAN ,
  STATE_COUNT , DONE = 100
}
 Installation steps. More...
 

Private Member Functions

const float CalcProgress ()
 Calculates the installation progress. More...
 
void CreateDir (const std::string &dir)
 Creates a directory in the outputh path. More...
 
void CreateDirectories ()
 Creates all directories required for the installation. More...
 
void CleanInstall ()
 Cleans up after the installation is complete. More...
 

Private Attributes

InstallationSteps installation_state_ = IDLE
 Current installation status. More...
 
int substeps_
 Substeps in the current installation step. More...
 
int cur_substep_
 Current substep in the current installation step. More...
 
int step_weight_ [STATE_COUNT]
 Weight of each installation step. More...
 
std::vector< std::string > field_model_names_
 List of field model names. More...
 
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...
 
AdvancedOptions options_
 Advanced options. More...
 
VGears::Application application_
 The installer application. More...
 
std::unique_ptr< ScopedLgpfields_lgp_
 LGP archive with field data. More...
 
std::unique_ptr< FieldDataInstallerfield_installer_
 The installer for fiel maps data. More...
 
std::unique_ptr< KernelDataInstallerkernel_installer_
 The installer for kernel data. More...
 
std::unique_ptr< MediaDataInstallermedia_installer_
 The installer for media files. More...
 
std::unique_ptr< BattleDataInstallerbattle_installer_
 The installer for battle data. More...
 
std::function< void(std::string msg, int level, bool progress)> write_output_line_
 Function used to print text to the log output, line by line. More...
 

Detailed Description

The data installer.

Member Enumeration Documentation

◆ InstallationSteps

Installation steps.

Enumerator
IDLE 

Installation not started.

CREATE_DIRECTORIES 

Create all directories required for the installation.

INITIALIZE 

Initialize data for installation.

BATTLE_SCENES_INIT 

Initializes the battle installer for scene processing.

BATTLE_SCENES_PROCESS 

Extracts battle scenes.

BATTLE_SCENES_WRITE_ATTACKS 

Writes attack data.

BATTLE_SCENES_WRITE_ENEMIES 

Writes enemy data.

BATTLE_SCENES_WRITE_FORMATIONS 

Writes enemy formation data.

BATTLE_MODELS_INIT 

Initializes the battle installer for 3D model processing.

BATTLE_MODELS_PROCESS 

Extracts 3D battle models.

BATTLE_MODELS_CONVERT_INIT 

Prepares for 3D battle model conversion.

BATTLE_MODELS_CONVERT 

Converts 3D battle models.

BATTLE_MODELS_WRITE_CHARACTERS 

Writes playable character model info.

BATTLE_MODELS_WRITE_SCENES 

Writtes battle scene model info.

KERNEL_PRICES 

Parses item and materia prices from ff7.exe.

KERNEL_COMMANDS 

Parses command data from KERNEL.BIN.

KERNEL_ATTACKS 

Parses attack data from KERNEL.BIN.

KERNEL_CHARACTERS 

Parses characters data from KERNEL.BIN.

KERNEL_ITEMS 

Parses item data from KERNEL.BIN.

KERNEL_GROWTH 

Parses growth data from KERNEL.BIN.

KERNEL_WEAPONS 

Parses weapon data from KERNEL.BIN.

KERNEL_ARMORS 

Parses armor data from KERNEL.BIN.

KERNEL_ACCESSORIES 

Parses accessory data from KERNEL.BIN.

KERNEL_MATERIA 

Parses materia data from KERNEL.BIN.

KERNEL_KEY_ITEMS 

Parses key item data data from KERNEL.BIN.

KERNEL_SUMMON_NAMES 

Parses summon names data from KERNEL.BIN.

KERNEL_SAVEMAP 

Parses the initial savemap from KERNEL.BIN.

MEDIA_IMAGES 

Extract game images and icons from menu.lgp.

MEDIA_SOUNDS_INIT 

Prepares the installer for sound extraction.

MEDIA_SOUNDS 

Extract game sounds.

MEDIA_SOUNDS_INDEX 

Build sounds index.

MEDIA_MUSICS_INIT 

Prepares the installer for music extraction.

MEDIA_MUSICS 

Extracts the game music.

MEDIA_MUSICS_HQ 

Extracts the game high quality music.

MEDIA_MUSICS_INDEX 

Build the music index.

FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT 

Initializer for {.

See also
SPAWN_POINTS_AND_SCALE_FACTORS}.
FIELD_SPAWN_POINTS_AND_SCALE_FACTORS 

Step that collects spawn points and sclae factors.

FIELD_CONVERT 

Step that convets fields to V-Gears format.

FIELD_WRITE_INIT 

Initializer for {.

See also
WRITE_MAPS}.
FIELD_WRITE 

Step that writes XML maps.

FIELD_WRITE_END 

Clean up after {.

See also
WRITE_MAPS}.
FIELD_CONVERT_MODELS_INIT 

Initializer for {.

See also
CONVERT_FIELD_MODELS}.
FIELD_CONVERT_MODELS 

Step that converts field models.

CLEAN 

Cleans up after the installation.

STATE_COUNT 

Number of installation steps.

DONE 

Installation finished.

Constructor & Destructor Documentation

◆ DataInstaller()

DataInstaller::DataInstaller ( const std::string  input_dir,
const std::string  output_dir,
AdvancedOptions  options,
std::function< void(std::string, int, bool)>  write_output_line 
)

Installer constructor.

Parameters
[in]input_dirPath to the directory containing the original data to parse.
[in]output_dirPath to the directory to write generated data to.
[in]optionsAdavanced options for the installer.
[in]write_output_linePointer to function to write output.

◆ ~DataInstaller()

DataInstaller::~DataInstaller ( )

Installer destructor.

Member Function Documentation

◆ CalcProgress()

const float DataInstaller::CalcProgress ( )
private

Calculates the installation progress.

Returns
Installation progress [0-100]

◆ CleanInstall()

void DataInstaller::CleanInstall ( )
private

Cleans up after the installation is complete.

◆ CreateDir()

void DataInstaller::CreateDir ( const std::string &  dir)
private

Creates a directory in the outputh path.

Parameters
[in]dirPath of the directory to create, relative to the output path.
Exceptions
std::runtime_errorIf the directory can't be created.

◆ CreateDirectories()

void DataInstaller::CreateDirectories ( )
private

Creates all directories required for the installation.

It also adds certain location to the resource group manager.

◆ Progress()

float DataInstaller::Progress ( )

Handle the installation progress.

Returns
Installation progress [0-100].

Member Data Documentation

◆ application_

VGears::Application DataInstaller::application_
private

The installer application.

It's a singleton so it can't be recreated. It will crash the second time round.

◆ battle_installer_

std::unique_ptr<BattleDataInstaller> DataInstaller::battle_installer_
private

The installer for battle data.

◆ cur_substep_

int DataInstaller::cur_substep_
private

Current substep in the current installation step.

◆ field_installer_

std::unique_ptr<FieldDataInstaller> DataInstaller::field_installer_
private

The installer for fiel maps data.

◆ field_model_names_

std::vector<std::string> DataInstaller::field_model_names_
private

List of field model names.

◆ fields_lgp_

std::unique_ptr<ScopedLgp> DataInstaller::fields_lgp_
private

LGP archive with field data.

◆ input_dir_

std::string DataInstaller::input_dir_
private

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

◆ installation_state_

InstallationSteps DataInstaller::installation_state_ = IDLE
private

Current installation status.

◆ kernel_installer_

std::unique_ptr<KernelDataInstaller> DataInstaller::kernel_installer_
private

The installer for kernel data.

◆ LINE_SCALE_FACTOR

float DataInstaller::LINE_SCALE_FACTOR = 0.0078124970964f
static

The scale factor for line point coordinates.

When a LINE opcode is found in the game scripts, the line points X and Y coordinates must be scaled down by this factor.

◆ media_installer_

std::unique_ptr<MediaDataInstaller> DataInstaller::media_installer_
private

The installer for media files.

◆ options_

AdvancedOptions DataInstaller::options_
private

Advanced options.

◆ output_dir_

std::string DataInstaller::output_dir_
private

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

◆ step_weight_

int DataInstaller::step_weight_[STATE_COUNT]
private

Weight of each installation step.

Used to calculate current progress.

◆ substeps_

int DataInstaller::substeps_
private

Substeps in the current installation step.

◆ write_output_line_

std::function<void(std::string msg, int level, bool progress)> DataInstaller::write_output_line_
private

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

Parameters
[in]msgthe message to write.
[in]levelLog level for the message.
[in]as_progressIf true, the text will also be set as the current text behind the progress bar.

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