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

The media data installer. More...

#include <MediaDataInstaller.h>

Collaboration diagram for MediaDataInstaller:

Classes

struct  FmtFile
 The structure of each audio file pointer in a sound FMT file. More...
 

Public Member Functions

 MediaDataInstaller (const std::string input_dir, const std::string output_dir, const bool keep_originals, const bool no_ffmpeg, const bool no_timidity)
 Constructor. More...
 
 ~MediaDataInstaller ()
 Destructor. More...
 
void PopulateMaps ()
 Populates the audio name maps. More...
 
void InstallSprites ()
 Extracts all images contained in the menu LGP file and installs them. More...
 
int InstallSoundsInit ()
 Prepares the installer for the sounds extraction. More...
 
bool InstallSounds ()
 Extracts the next sound file contained in the audio.dat file and installs it. More...
 
void WriteSoundIndex ()
 Writes the XML file with all audio entries. More...
 
int InstallMusicsInit ()
 Prepares the installer for the sounds extraction. More...
 
bool InstallMusics ()
 Extracts the next music file contained in the midi.lgp, converts it and installs it. More...
 
void InstallHQMusics ()
 Converts high quality musiscs to OGG. More...
 
void WriteMusicsIndex ()
 Writes the XML file with all music tracks. 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...
 
VGears::LGPArchive menu_
 The menu.lgp file. More...
 
BinGZipFile window_
 The WINDOW.BIN file. More...
 
File fmt_
 The sounds .fmt file. More...
 
File dat_
 The sounds .dat file. More...
 
int processed_sounds_
 Number of sounds already processed. More...
 
std::unordered_map< int, std::string > sound_map_
 Map for sound files with descriptive names. More...
 
std::vector< std::string > sounds_
 Sound data for each entry to write to the XML file. More...
 
VGears::LGPArchive midi_
 The midi.lgp file. More...
 
int processed_musics_
 Number of music tracks already processed. More...
 
std::unordered_map< int, std::string > musics_map_
 Map for music files with descriptive names. More...
 
std::vector< std::string > musics_
 Sound data for each entry to write to the XML file. More...
 
bool keep_originals_
 If true, orginal files will not be deleted after conversion. More...
 
bool no_ffmpeg_
 Flag to prevent system calls to ffmpeg. More...
 
bool no_timidity_
 Flag to prevent system calls to timidity. More...
 

Static Private Attributes

static int TOTAL_SOUNDS = 723
 Number of sound files to extract. More...
 
static u8 WAV_HEADER [78]
 The standard WAV header. More...
 

Detailed Description

The media data installer.

Constructor & Destructor Documentation

◆ MediaDataInstaller()

MediaDataInstaller::MediaDataInstaller ( const std::string  input_dir,
const std::string  output_dir,
const bool  keep_originals,
const bool  no_ffmpeg,
const bool  no_timidity 
)

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]keep_originalsTrue to keep original data after conversion, false to remove.
[in]no_ffmpegTrue to prevent system calls to ffmpeg command, false to allow.
[in]no_timidityTrue to prevent system calls to timidity command, false to allow.

◆ ~MediaDataInstaller()

MediaDataInstaller::~MediaDataInstaller ( )

Destructor.

Member Function Documentation

◆ InstallHQMusics()

void MediaDataInstaller::InstallHQMusics ( )

Converts high quality musiscs to OGG.

There are four of them.

◆ InstallMusics()

bool MediaDataInstaller::InstallMusics ( )

Extracts the next music file contained in the midi.lgp, converts it and installs it.

Returns
True if there are no more musics to extract, false otherwise.

◆ InstallMusicsInit()

int MediaDataInstaller::InstallMusicsInit ( )

Prepares the installer for the sounds extraction.

Returns
The total number of sounds to process.

◆ InstallSounds()

bool MediaDataInstaller::InstallSounds ( )

Extracts the next sound file contained in the audio.dat file and installs it.

Returns
True if there are no more sounds to extract, false otherwise.

◆ InstallSoundsInit()

int MediaDataInstaller::InstallSoundsInit ( )

Prepares the installer for the sounds extraction.

Returns
The total number of sounds to process.

◆ InstallSprites()

void MediaDataInstaller::InstallSprites ( )

Extracts all images contained in the menu LGP file and installs them.

For composed textures, it extracts individual images. All images are saved under the "images" directory. This also includes font maps.

◆ PopulateMaps()

void MediaDataInstaller::PopulateMaps ( )

Populates the audio name maps.

◆ WriteMusicsIndex()

void MediaDataInstaller::WriteMusicsIndex ( )

Writes the XML file with all music tracks.

◆ WriteSoundIndex()

void MediaDataInstaller::WriteSoundIndex ( )

Writes the XML file with all audio entries.

Member Data Documentation

◆ dat_

File MediaDataInstaller::dat_
private

The sounds .dat file.

◆ fmt_

File MediaDataInstaller::fmt_
private

The sounds .fmt file.

◆ input_dir_

std::string MediaDataInstaller::input_dir_
private

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

◆ keep_originals_

bool MediaDataInstaller::keep_originals_
private

If true, orginal files will not be deleted after conversion.

◆ menu_

VGears::LGPArchive MediaDataInstaller::menu_
private

The menu.lgp file.

◆ midi_

VGears::LGPArchive MediaDataInstaller::midi_
private

The midi.lgp file.

◆ musics_

std::vector<std::string> MediaDataInstaller::musics_
private

Sound data for each entry to write to the XML file.

◆ musics_map_

std::unordered_map<int, std::string> MediaDataInstaller::musics_map_
private

Map for music files with descriptive names.

◆ no_ffmpeg_

bool MediaDataInstaller::no_ffmpeg_
private

Flag to prevent system calls to ffmpeg.

◆ no_timidity_

bool MediaDataInstaller::no_timidity_
private

Flag to prevent system calls to timidity.

◆ output_dir_

std::string MediaDataInstaller::output_dir_
private

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

◆ processed_musics_

int MediaDataInstaller::processed_musics_
private

Number of music tracks already processed.

◆ processed_sounds_

int MediaDataInstaller::processed_sounds_
private

Number of sounds already processed.

◆ sound_map_

std::unordered_map<int, std::string> MediaDataInstaller::sound_map_
private

Map for sound files with descriptive names.

◆ sounds_

std::vector<std::string> MediaDataInstaller::sounds_
private

Sound data for each entry to write to the XML file.

◆ TOTAL_SOUNDS

int MediaDataInstaller::TOTAL_SOUNDS = 723
staticprivate

Number of sound files to extract.

◆ WAV_HEADER

u8 MediaDataInstaller::WAV_HEADER
staticprivate
Initial value:
= {
0x52, 0x49, 0x46, 0x46, 0x70, 0x0B, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20,
0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x44, 0xAC, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00,
0x00, 0x04, 0x04, 0x00, 0x20, 0x00, 0xF4, 0x07, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xCC, 0x01,
0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF, 0x64, 0x61, 0x74, 0x61, 0x2A, 0x0B, 0x00, 0x00
}

The standard WAV header.

78 bytes to be written to every wav file before anything else.

◆ window_

BinGZipFile MediaDataInstaller::window_
private

The WINDOW.BIN file.


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