Browse Source

Split the media data installer and fixed three bugs in it

- There is an installer for the images and fonts, the sounds and the music, and a converter that runs the external programs. MediaDataInstaller keeps its public functions, which pass the calls on.
- The sound names and the images cut out of the menu textures are tables.
- Removed the video step of the installer, which was never reached. The videos of the game disks are converted as before.
- The third gateway and ladder arrows were saved over the second ones.
- The image of the "level" text was saved over the one of the "status" text. It is battle_level.png now.
- Skipping the kernel data also skipped the images and the fonts.
Iñigo Valentin 5 days ago
parent
commit
5957aea358

+ 4 - 0
src/installer/extractors/CMakeLists.txt

@@ -16,10 +16,14 @@ vgears_sources(
     KernelItems.cpp
     KernelItems.cpp
     KernelMateria.cpp
     KernelMateria.cpp
     KernelTextList.cpp
     KernelTextList.cpp
+    MediaConverter.cpp
     MediaDataInstaller.cpp
     MediaDataInstaller.cpp
+    MediaImageInstaller.cpp
     ModelsAndAnimationsDb.cpp
     ModelsAndAnimationsDb.cpp
     MovieCamera.cpp
     MovieCamera.cpp
+    MusicInstaller.cpp
     ScopedLgp.cpp
     ScopedLgp.cpp
+    SoundInstaller.cpp
     SpellModelInstaller.cpp
     SpellModelInstaller.cpp
     WindowFonts.cpp
     WindowFonts.cpp
     WorldInstaller.cpp
     WorldInstaller.cpp

+ 61 - 0
src/installer/extractors/MediaConverter.cpp

@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "installer/extractors/MediaConverter.h"
+#include "installer/steps/InstallLog.h"
+
+bool MediaConverter::ToolsReady(bool need_timidity){
+    if (!tools_resolved_){
+        tools_resolved_ = true;
+        const ExternalTools::Locations& locations = ExternalTools::CurrentLocations();
+        ffmpeg_tool_ = ExternalTools::FindFfmpeg(locations);
+        timidity_tool_ = ExternalTools::FindTimidity(locations);
+        if (ffmpeg_tool_.usable) InstallLog::Get().Add("Using " + ffmpeg_tool_.version + " (" + ffmpeg_tool_.path + ")");
+        else{
+            InstallLog::Get().Add(
+              "[WARNING] FFmpeg can't be used, so the sound effects and the music will not be converted (the "
+              "extracted .wav and .mid files are left in place): " + ffmpeg_tool_.problem
+            );
+        }
+        if (timidity_tool_.usable) InstallLog::Get().Add("Using " + timidity_tool_.version + " (" + timidity_tool_.path + ")");
+        else{
+            InstallLog::Get().Add(
+              "[WARNING] TiMidity can't be used, so the music will not be converted (the extracted .mid files are "
+              "left in place): " + timidity_tool_.problem
+            );
+        }
+    }
+    return ffmpeg_tool_.usable && (!need_timidity || timidity_tool_.usable);
+}
+
+void MediaConverter::Run(
+  const std::string& description, std::function<bool(std::string*)> job, std::function<void()> on_success
+){
+    if (!conversions_) conversions_ = std::make_unique<TaskPool>();
+    conversions_->Run([description, job, on_success](){
+        std::string error;
+        if (job(&error)){
+            if (on_success) on_success();
+        }
+        else{
+            // The source file is kept, since it hasn't been converted.
+            InstallLog::Get().Add("[WARNING] Could not convert " + description + ": " + error);
+        }
+    });
+}
+
+void MediaConverter::Wait(){
+    if (conversions_) conversions_->Wait();
+}

+ 88 - 0
src/installer/extractors/MediaConverter.h

@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+#include <functional>
+#include <memory>
+#include <string>
+#include "installer/steps/ExternalTools.h"
+#include "installer/steps/TaskPool.h"
+
+/**
+ * Converts the audio with external programs, in the background.
+ */
+class MediaConverter{
+
+    public:
+
+        /**
+         * Finds the conversion programs the first time it is called, and reports what is missing.
+         *
+         * @param[in] need_timidity True if TiMidity is needed too (the music).
+         * @return True if the programs are usable.
+         */
+        bool ToolsReady(bool need_timidity);
+
+        /**
+         * Runs a conversion in the background.
+         *
+         * A failed conversion is logged as a warning.
+         *
+         * @param[in] description What is being converted, for the log.
+         * @param[in] job Does the conversion. Returns false, and sets the error, if it fails.
+         * @param[in] on_success Called, in the background thread, if the conversion succeeds.
+         */
+        void Run(
+          const std::string& description, std::function<bool(std::string*)> job,
+          std::function<void()> on_success = nullptr
+        );
+
+        /**
+         * Waits until every audio conversion started by the install steps has finished.
+         *
+         * The conversions run in the background, so the other steps don't wait for them. Call it before using or
+         * deleting their results.
+         */
+        void Wait();
+
+        /**
+         * Retrieves the path of FFmpeg. {@see ToolsReady} has to be called first.
+         *
+         * @return The path.
+         */
+        const std::string& GetFfmpegPath() const{return ffmpeg_tool_.path;}
+
+        /**
+         * Retrieves the path of TiMidity. {@see ToolsReady} has to be called first.
+         *
+         * @return The path.
+         */
+        const std::string& GetTimidityPath() const{return timidity_tool_.path;}
+
+    private:
+
+        /**
+         * FFmpeg and TiMidity, found by {@see ToolsReady}.
+         */
+        ExternalTools::Tool ffmpeg_tool_;
+        ExternalTools::Tool timidity_tool_;
+        bool tools_resolved_ = false;
+
+        /**
+         * Threads that run the conversions. Created when the first conversion starts.
+         */
+        std::unique_ptr<TaskPool> conversions_;
+};

+ 16 - 1625
src/installer/extractors/MediaDataInstaller.cpp

@@ -13,1644 +13,35 @@
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  */
  */
 
 
-#include <string>
-#include <iostream>
-#include <cstdio>
-#include <OgreDataStream.h>
-#include <OgreResourceGroupManager.h>
-#include <OgreImage.h>
-#include <OgreColourValue.h>
-#include <boost/format.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-#include <tinyxml.h>
-#include "installer/formats/DiskImage.h"
-#include "MediaDataInstaller.h"
-#include "installer/steps/ExternalTools.h"
-#include "installer/steps/InstallLog.h"
-#include "MovieCamera.h"
-#include "SfxDump.h"
-#include "formats/lgp/LGPArchive.h"
-#include "formats/texture/TexFile.h"
-#include "installer/formats/TexFile.h"
-#include "WindowFonts.h"
-
-int MediaDataInstaller::TOTAL_SOUNDS = 750;
+#include "installer/extractors/MediaDataInstaller.h"
 
 
 MediaDataInstaller::MediaDataInstaller(
 MediaDataInstaller::MediaDataInstaller(
   const DiskImage& disk_image, const std::string output_dir, const bool keep_originals
   const DiskImage& disk_image, const std::string output_dir, const bool keep_originals
 ):
 ):
-  disk_image_(disk_image), output_dir_(output_dir), data_dir_(output_dir + "game/"), keep_originals_(keep_originals),
-    window_(*disk_image_.filePath("data/kernel/WINDOW.BIN")),
-    processed_sounds_(0),
-    menu_(VGears::LGPArchive(*disk_image_.filePath("data/menu/menu_us.lgp"), "LGP")),
-    midi_(VGears::LGPArchive(*disk_image_.filePath("data/midi/midi.lgp"), "LGP")),
-    processed_musics_(0),
-    processed_videos_(0)
-{
-    PopulateMaps();
-}
-
-
-void MediaDataInstaller::PopulateMaps(){
-    // Most data here comes from https://forums.qhimm.com/index.php?topic=15786.0
-    sound_map_[0] = "Cursor";
-    sound_description_[0] = "Cursor movement in windows and menus.";
-    sound_map_[1] = "Window|SaveReady";
-    sound_description_[1] = "Opening some windows, memory cards available on the save menu.";
-    sound_map_[2] = "Error|InvalidChoice";
-    sound_description_[2] = "Failure or error, selecting a greyed out option in a choice list.";
-    sound_map_[3] = "Back|Cancel";
-    sound_description_[3] = "Cancel button on choices, closing menus.";
-    sound_map_[4] = "Miss";
-    sound_description_[4] = "Hit miss during battle.";
-    sound_map_[5] = "Cure|Potion";
-    sound_description_[5] = "Cure spell or Potion during battle.";
-    sound_map_[6] = "HighPotion";
-    sound_description_[6] = "Hi-Potion during battle.";
-    sound_map_[7] = "Cure2|XPotion";
-    sound_description_[7] = "Cure2 or X-Potion during battle.";
-    sound_map_[8] = "Fire";
-    sound_description_[8] = "Fire spell.";
-    sound_map_[9] = "Fire2";
-    sound_description_[9] = "Fire 2 spell.";
-    sound_map_[10] = "Bolt";
-    sound_description_[10] = "Bolt spell.";
-    sound_map_[11] = "Bolt2|Thunder";
-    sound_description_[11] = "Bolt2 spell, sometimes thunder on fields (eg HoneyBee inn).";
-    sound_map_[12] = "MagicPrep";
-    sound_description_[12] = "Light that envolves a character when casting magic, summon...";
-    sound_map_[13] = "LeviathanWave";
-    sound_description_[13] = "Part of Leviathan summoning.";
-    sound_map_[14] = "GunHit";
-    sound_description_[14] = "Gun sound, heard on fields and battles.";
-    sound_map_[15] = "BarretShoot";
-    sound_description_[15] = "Barrets chain gun.";
-    sound_map_[16] = "LeviathanScream";
-    sound_description_[16] = "Part of Leviathan summoning.";
-    sound_map_[17] = "CloudHit";
-    sound_description_[17] = "Cloud sword hit.";
-    sound_map_[18] = "";
-    sound_description_[18] = "";
-    sound_map_[19] = "Grenade";
-    sound_description_[19] = "Grenade item in battle.";
-    sound_map_[20] = "Ladder|BattleItem";
-    sound_description_[20] = "Character grabbing a ladder on the fields, character reaching for an item during battle";
-    sound_map_[21] = "EnemyDeath";
-    sound_description_[21] = "When most enemies die.";
-    sound_map_[22] = "AeriCriticalHit";
-    sound_description_[22] = "Aeris staff critical hit.";
-    sound_map_[23] = "Ice";
-    sound_description_[23] = "Ice spell";
-    sound_map_[24] = "Bite";
-    sound_description_[24] = "enemy bite-type attack, dogs or behemoths. Similar to 399.";
-    sound_map_[25] = "Flee";
-    sound_description_[25] = "Footsteps escaping from battle.";
-    sound_map_[26] = "CloudCriticalHit";
-    sound_description_[26] = "Cloud sword critical hit";
-    sound_map_[27] = "FieldPunch";
-    sound_description_[27] = "Punch sound on fields.";
-    sound_map_[28] = "Ice3";
-    sound_description_[28] = "Ice3 spell.";
-    sound_map_[29] = "Demi";
-    sound_description_[29] = "Demi sound after dark matter launched.";
-    sound_map_[30] = "";
-    sound_description_[30] = "";
-    sound_map_[31] = "GateDecipher";
-    sound_description_[31] = "Part of Jessie opening the deciphered gate (second half).";
-    sound_map_[32] = "MeteoStrike";
-    sound_description_[32] = "Tifas Meteo Strike limit.";
-    sound_map_[33] = "HealingWind";
-    sound_description_[33] = "Aeris Healing Wind limit.";
-    sound_map_[34] = "Punch";
-    sound_description_[34] = "Enemy punch-type attack";
-    sound_map_[35] = "LimitAura";
-    sound_description_[35] = "Before any limit, the orange aura sound.";
-    sound_map_[36] = "ReactorCore";
-    sound_description_[36] = "Background ambient sound in deeper reactor areas.";
-    sound_map_[37] = "ReactorBackground";
-    sound_description_[37] = "Background ambient sound in less deep reactor areas.";
-    sound_map_[38] = "UnderwaterReactor";
-    sound_description_[38] = "Background ambient sound in the underwater reactor.";
-    sound_map_[39] = "BigShot";
-    sound_description_[39] = "Barrets Big Shot limit.";
-    sound_map_[40] = "SummonVanish";
-    sound_description_[40] = "When about to summon the party disappears.";
-    sound_map_[41] = "Elevator";
-    sound_description_[41] = "Elevator moving.";
-    sound_map_[42] = "BattleSwirl";
-    sound_description_[42] = "Sound during battle swirling before battles.";
-    sound_map_[43] = "ReelStop";
-    sound_description_[43] = "When a reel slot stops during battle (limits, arena...)";
-    sound_map_[44] = "Load";
-    sound_description_[44] = "Loading game?";
-    sound_map_[45] = "BarretCriticalHit";
-    sound_description_[45] = "Barrets critical gun hit.";
-    sound_map_[46] = "BarretMiss|StealMiss";
-    sound_description_[46] = "Barret missing hit, unsuccessful steal.";
-    sound_map_[47] = "BoostedJump";
-    sound_description_[47] = "Some kind of boosted jump, battles and/or fields?";
-    sound_map_[48] = "SmokeShot";
-    sound_description_[48] = "Enemy Smoke shot (and similar) attacks.";
-    sound_map_[49] = "AerisHit";
-    sound_description_[49] = "Aeris staff hit.";
-    sound_map_[50] = "On";
-    sound_description_[50] = "Switching something on";
-    sound_map_[51] = "GateUnlocked";
-    sound_description_[51] = "Part of Jessie opening the deciphered gate (second half).";
-    sound_map_[52] = "TrainDoor";
-    sound_description_[52] = "Train door sound.";
-    sound_map_[53] = "ReinforcedDoor.";
-    sound_description_[53] = "Some reinforced doors. In reactors?";
-    sound_map_[54] = "Jump";
-    sound_description_[54] = "Character jump on fields.";
-    sound_map_[55] = "Land";
-    sound_description_[55] = "Character landing after a jump on fields.";
-    sound_map_[56] = "Charge";
-    sound_description_[56] = "Enemy charge-type attack.";
-    sound_map_[57] = "Laser";
-    sound_description_[57] = "enemy laser-type attack.";
-    sound_map_[58] = "Beep";
-    sound_description_[58] = "Computer or machine beep sound.";
-    sound_map_[59] = "Alert";
-    sound_description_[59] = "Alarm sound.";
-    sound_map_[60] = "Computer|SetBomb";
-    sound_description_[60] = "operating some computers, setting Jessies bomb.";
-    sound_map_[61] = "Dodge";
-    sound_description_[61] = "Dodging an attack.";
-    sound_map_[62] = "Bio";
-    sound_description_[62] = "Bio spell.";
-    sound_map_[63] = "UNKNOWN63";
-    sound_description_[63] = "";
-    sound_map_[64] = "Slow";
-    sound_description_[64] = "Slow spell.";
-    sound_map_[65] = "Berserk";
-    sound_description_[65] = "Berserk spell.";
-    sound_map_[66] = "Shell";
-    sound_description_[66] = "Shell spell.";
-    sound_map_[67] = "Wall";
-    sound_description_[67] = "Wall spell.";
-    sound_map_[68] = "Cure3|Elixir";
-    sound_description_[68] = "Cure3 or Elixir during battle.";
-    sound_map_[69] = "Bol3";
-    sound_description_[69] = "Bolt3 spell.";
-    sound_map_[70] = "Quake";
-    sound_description_[70] = "Quake spell.";
-    sound_map_[71] = "Reflect";
-    sound_description_[71] = "Reflect spell.";
-    sound_map_[72] = "Sleepel";
-    sound_description_[72] = "Sleepel spell.";
-    sound_map_[73] = "Demi3";
-    sound_description_[73] = "Demi 3 spell, after the dark matter is launched.";
-    sound_map_[74] = "Demi2";
-    sound_description_[74] = "Demi 2 spell, after the dark matter is launched.";
-    sound_map_[75] = "Comet";
-    sound_description_[75] = "Comet spell.";
-    sound_map_[76] = "";
-    sound_description_[76] = "";
-    sound_map_[77] = "Tornado";
-    sound_description_[77] = "tornado spell.";
-    sound_map_[78] = "";
-    sound_description_[78] = "";
-    sound_map_[79] = "DemiShot";
-    sound_description_[79] = "Demi/2/3, before 29, 74 or 73.";
-    sound_map_[80] = "";
-    sound_description_[80] = "";
-    sound_map_[81] = "";
-    sound_description_[81] = "";
-    sound_map_[82] = "Haste";
-    sound_description_[82] = "Haste spell.";
-    sound_map_[83] = "Silence";
-    sound_description_[83] = "Silence spell.";
-    sound_map_[84] = "Break";
-    sound_description_[84] = "Break spell.";
-    sound_map_[85] = "Bolt3";
-    sound_description_[85] = "Bolt3 spell. All?";
-    sound_map_[86] = "Stop";
-    sound_description_[86] = "Stop spell.";
-    sound_map_[87] = "Quake3";
-    sound_description_[87] = "Quake3 spell.";
-    sound_map_[88] = "";
-    sound_description_[88] = "";
-    sound_map_[89] = "Bio2|Bio3";
-    sound_description_[89] = "Bio2 and Bio3 spells.";
-    sound_map_[90] = "Regen";
-    sound_description_[90] = "Regen spell.";
-    sound_map_[91] = "PoisonNull";
-    sound_description_[91] = "PoisonNull spell.";
-    sound_map_[92] = "";
-    sound_description_[92] = "";
-    sound_map_[93] = "Protect";
-    sound_description_[93] = "Protect spell.";
-    sound_map_[94] = "Wind";
-    sound_description_[94] = "Wind sound as background for some maps.";
-    sound_map_[95] = "";
-    sound_description_[95] = "";
-    sound_map_[96] = "Aparition";
-    sound_description_[96] = "Aparition of someone in fields?";
-    sound_map_[97] = "SearchScope";
-    sound_description_[97] = "Guard Scorpion Search Scope attack.";
-    sound_map_[98] = "100Needles";
-    sound_description_[98] = "100 Needles enemy skill.";
-    sound_map_[99] = "Seed";
-    sound_description_[99] = "Enemy seed-type attack.";
-    sound_map_[100] = "BeamGun";
-    sound_description_[100] = "Enemy beam-gun-type attack.";
-    sound_map_[101] = "";
-    sound_description_[101] = "";
-    sound_map_[102] = "";
-    sound_description_[102] = "";
-    sound_map_[103] = "";
-    sound_description_[103] = "Rage";
-    sound_map_[104] = "Enemy rage-type attack.";
-    sound_description_[104] = "";
-    sound_map_[105] = "";
-    sound_description_[105] = "";
-    sound_map_[106] = "RedLight|EnemyFlash";
-    sound_description_[106] = "Jenovas Red Light attack, enemy Flash attack.";
-    sound_map_[107] = "TetraLaser";
-    sound_description_[107] = "Enemy TetraLaser (and similar) attacks.";
-    sound_map_[108] = "RedXIIIHit";
-    sound_description_[108] = "RedXIII attack hit.";
-    sound_map_[109] = "";
-    sound_description_[109] = "Unknown ambient sound.";
-    sound_map_[110] = "";
-    sound_description_[110] = "Unknown ambient sound.";
-    sound_map_[111] = "";
-    sound_description_[111] = "Unknown ambient sound.";
-    sound_map_[112] = "";
-    sound_description_[112] = "Unknown ambient sound.";
-    sound_map_[113] = "";
-    sound_description_[113] = "Unknown ambient sound.";
-    sound_map_[114] = "";
-    sound_description_[114] = "Unknown ambient sound.";
-    sound_map_[115] = "";
-    sound_description_[115] = "Unknown ambient sound.";
-    sound_map_[116] = "";
-    sound_description_[116] = "Unknown ambient sound.";
-    sound_map_[117] = "Slap";
-    sound_description_[117] = "Slapping sound. Tifa vs Scarlet?";
-    sound_map_[118] = "Flush";
-    sound_description_[118] = "Enemy flush-type attack.";
-    sound_map_[119] = "DiamondFlash";
-    sound_description_[119] = "Enemy DiamondFlash attack. Diamond Weapon?";
-    sound_map_[120] = "";
-    sound_description_[120] = "";
-    sound_map_[121] = "DoorOpen";
-    sound_description_[121] = "Door opening";
-    sound_map_[122] = "VincentHit";
-    sound_description_[122] = "Vincent gun hit.";
-    sound_map_[123] = "";
-    sound_description_[123] = "";
-    sound_map_[124] = "Fascination";
-    sound_description_[124] = "Enemy Fascination attack.";
-    sound_map_[125] = "Drain|VampireTooth";
-    sound_description_[125] = "Drain spell, probably Vampire Tooth?";
-    sound_map_[126] = "DeBarrier";
-    sound_description_[126] = "DeBarrier spell.";
-    sound_map_[127] = "Resist";
-    sound_description_[127] = "Resist spell.";
-    sound_map_[128] = "WhiteWind";
-    sound_description_[128] = "White Wind enemy skill.";
-    sound_map_[129] = "MatraMagic";
-    sound_description_[129] = "Matra magic enemy skill.";
-    sound_map_[130] = "FlyingSickle";
-    sound_description_[130] = "Enemy Flying Sickle (and similar) attacks.";
-    sound_map_[131] = "Drums";
-    sound_description_[131] = "Sound of drums, when chocobo race prices are about to be revealed.";
-    sound_map_[132] = "Fall";
-    sound_description_[132] = "Falling sound.";
-    sound_map_[133] = "Despell";
-    sound_description_[133] = "Despell spell.";
-    sound_map_[134] = "Faint";
-    sound_description_[134] = "Fainting sound.";
-    sound_map_[135] = "NibelBurning";
-    sound_description_[135] = "Nibelheim burning sound.";
-    sound_map_[136] = "";
-    sound_description_[136] = "";
-    sound_map_[137] = "InkAttack";
-    sound_description_[137] = "Enemy Ink (and similar) attacks.";
-    sound_map_[138] = "Esuna";
-    sound_description_[138] = "Esuna spell.";
-    sound_map_[139] = "Beta";
-    sound_description_[139] = "Beta enemy skill.";
-    sound_map_[140] = "";
-    sound_description_[140] = "";
-    sound_map_[141] = "Fire3";
-    sound_description_[141] = "Fire3 spell.";
-    sound_map_[142] = "JunonAlarm";
-    sound_description_[142] = "Junon alarm.";
-    sound_map_[143] = "Electricity.";
-    sound_description_[143] = "Electricity effect, for example, in Sector 8 after bombing.";
-    sound_map_[144] = "BarrelLand";
-    sound_description_[144] = "Barrel landing effect in Sector 5 church.";
-    sound_map_[145] = "BarrelRoll";
-    sound_description_[145] = "Barrel rolling effect in Sector 5 church.";
-    sound_map_[146] = "";
-    sound_description_[146] = "";
-    sound_map_[147] = "Comet2";
-    sound_description_[147] = "Comet2 spell.";
-    sound_map_[148] = "Ailment";
-    sound_description_[148] = "Status ailment inflicted.";
-    sound_map_[149] = "Sensor";
-    sound_description_[149] = "Sensors or lasers on some fields, like the red ones blocking the party on the plate.";
-    sound_map_[150] = "TV";
-    sound_description_[150] = "Television transmitting.";
-    sound_map_[151] = "AribusterExplode";
-    sound_description_[151] = "Airbuster explosion on the field?";
-    sound_map_[152] = "CorneoSurprise";
-    sound_description_[152] = "Don Corneo surprised?";
-    sound_map_[153] = "Train";
-    sound_description_[153] = "Train running.";
-    sound_map_[154] = "FrogSong";
-    sound_description_[154] = "Frog Song enemy skill.";
-    sound_map_[155] = "MagicBreath";
-    sound_description_[155] = "MagicBreath enemy skill.";
-    sound_map_[156] = "AquaLung";
-    sound_description_[156] = "AquaLung enemy skill, and some similar enemy attacks.";
-    sound_map_[157] = "GoblinPunch";
-    sound_description_[157] = "Goblin Punch enemy skill.";
-    sound_map_[158] = "PresidentSteps";
-    sound_description_[158] = "President ShinRa footsteps on Reactor 5.";
-    sound_map_[159] = "Trine";
-    sound_description_[159] = "Trine enemy skill.";
-    sound_map_[160] = "PresidentFinger";
-    sound_description_[160] = "President ShinRa fingersnap.";
-    sound_map_[161] = "BadBreath1";
-    sound_description_[161] = "First part of Bad Breath enemy skill.";
-    sound_map_[162] = "BadBreath2";
-    sound_description_[162] = "Second part of Bad Breath enemy skill.";
-    sound_map_[163] = "MagicHammer";
-    sound_description_[163] = "MagicHammer enemy skill.";
-    sound_map_[164] = "Elevator2";
-    sound_description_[164] = "Other type of elevator: flipper, prison.";
-    sound_map_[165] = "";
-    sound_description_[165] = "";
-    sound_map_[166] = "";
-    sound_description_[166] = "";
-    sound_map_[167] = "RunLoud";
-    sound_description_[167] = "Loud footsteps running, like Barrets.";
-    sound_map_[168] = "Fire3All";
-    sound_description_[168] = "Fire3 spell, all targets.";
-    sound_map_[169] = "DrainingTentacles";
-    sound_description_[169] = "Enemy Draining Tentacles (and similar) attacks.";
-    sound_map_[170] = "Coin";
-    sound_description_[170] = "Coin sound. In fields, when somebody is paid, a coin inserted...";
-    sound_map_[171] = "Impact";
-    sound_description_[171] = "Some kind of impact?";
-    sound_map_[172] = "";
-    sound_description_[172] = "";
-    sound_map_[173] = "Monitor";
-    sound_description_[173] = "Some kind of monitor?";
-    sound_map_[174] = "";
-    sound_description_[174] = "";
-    sound_map_[175] = "ColdBreath";
-    sound_description_[175] = "Enemy Cold Breath attack.";
-    sound_map_[176] = "Mini";
-    sound_description_[176] = "Mini spell.";
-    sound_map_[177] = "PoisonBreath";
-    sound_description_[177] = "Enemy poison breath attack.";
-    sound_map_[178] = "";
-    sound_description_[178] = "";
-    sound_map_[179] = "WardDoor";
-    sound_description_[179] = "WardDoor?";
-    sound_map_[180] = "ElevatorRing";
-    sound_description_[180] = "Elevator button ring.";
-    sound_map_[181] = "RedCaravan";
-    sound_description_[181] = "Red caravan?";
-    sound_map_[182] = "MansionDoor";
-    sound_description_[182] = "Door in mansion?";
-    sound_map_[183] = "TrainWhistle";
-    sound_description_[183] = "Train whistle sound.";
-    sound_map_[184] = "IceCubes";
-    sound_description_[184] = "Ice cubes?";
-    sound_map_[185] = "Refuse";
-    sound_description_[185] = "Enemy Refuse attack.";
-    sound_map_[186] = "Shake";
-    sound_description_[186] = "Shake effect, like Tifa shaking a drink.";
-    sound_map_[187] = "";
-    sound_description_[187] = "";
-    sound_map_[188] = "";
-    sound_description_[188] = "";
-    sound_map_[189] = "Curtain";
-    sound_description_[189] = "Curtain slipping, as in the dress shop in Wall Market.";
-    sound_map_[190] = "MateriaGlow";
-    sound_description_[190] = "Materia glow effect.";
-    sound_map_[191] = "Helicopter";
-    sound_description_[191] = "Helicopters on fields";
-    sound_map_[192] = "Unlock";
-    sound_description_[192] = "Some king of unlock sound.";
-    sound_map_[193] = "Birdies";
-    sound_description_[193] = "Birdies of Mt. Corel, up close";
-    sound_map_[194] = "Boulder";
-    sound_description_[194] = "Boulder rolling.";
-    sound_map_[195] = "";
-    sound_description_[195] = "";
-    sound_map_[196] = "Chirping";
-    sound_description_[196] = "Birds chirping in Mt. Corel heard from the tracks.";
-    sound_map_[197] = "Appear";
-    sound_description_[197] = "Someone is appearing?";
-    sound_map_[198] = "BreakOpen";
-    sound_description_[198] = "Break open sound?";
-    sound_map_[199] = "AirBuster";
-    sound_description_[199] = "AirBuster humming sound?";
-    sound_map_[200] = "";
-    sound_description_[200] = "";
-    sound_map_[201] = "";
-    sound_description_[201] = "";
-    sound_map_[202] = "Collapse";
-    sound_description_[202] = "Collapsing, as in the Great glacier.";
-    sound_map_[203] = "";
-    sound_description_[203] = "";
-    sound_map_[204] = "BiggsThrown";
-    sound_description_[204] = "Biggs thrown away by Barret in the hideout.";
-    sound_map_[205] = "";
-    sound_description_[205] = "";
-    sound_map_[206] = "SaveLaunched";
-    sound_description_[206] = "Game loaded?";
-    sound_map_[207] = "";
-    sound_description_[207] = "";
-    sound_map_[208] = "TrainIgnite";
-    sound_description_[208] = "Train ignition sound.";
-    sound_map_[209] = "";
-    sound_description_[209] = "";
-    sound_map_[210] = "";
-    sound_description_[210] = "";
-    sound_map_[211] = "";
-    sound_description_[211] = "";
-    sound_map_[212] = "";
-    sound_description_[212] = "";
-    sound_map_[213] = "";
-    sound_description_[213] = "";
-    sound_map_[214] = "";
-    sound_description_[214] = "";
-    sound_map_[215] = "JunonElevator";
-    sound_description_[215] = "Elevator in Junon. Which one?";
-    sound_map_[216] = "Leap";
-    sound_description_[216] = "A leap?";
-    sound_map_[217] = "Snoring";
-    sound_description_[217] = "People snoring in fields.";
-    sound_map_[218] = "TentacleHit";
-    sound_description_[218] = "enemy tentacle hit, ie: The dogs with a tentacle.";
-    sound_map_[219] = "";
-    sound_description_[219] = "";
-    sound_map_[220] = "";
-    sound_description_[220] = "";
-    sound_map_[221] = "";
-    sound_description_[221] = "";
-    sound_map_[222] = "PunchCritical";
-    sound_description_[222] = "Enemy punch-type critical attack.";
-    sound_map_[223] = "Claw";
-    sound_description_[223] = "Enemy claw-type attack.";
-    sound_map_[224] = "Horn";
-    sound_description_[224] = "Enemy horn-type attack.";
-    sound_map_[225] = "Sting";
-    sound_description_[225] = "enemy sting-type attack.";
-    sound_map_[226] = "";
-    sound_description_[226] = "";
-    sound_map_[227] = "";
-    sound_description_[227] = "";
-    sound_map_[228] = "";
-    sound_description_[228] = "";
-    sound_map_[229] = "";
-    sound_description_[229] = "";
-    sound_map_[230] = "";
-    sound_description_[230] = "RapidMove";
-    sound_map_[231] = "Like Cloud dodging Barret in 7th Heaven.";
-    sound_description_[231] = "";
-    sound_map_[232] = "WaterGun";
-    sound_description_[232] = "Enemy water gun and similar attacks.";
-    sound_map_[233] = "Crazy";
-    sound_description_[233] = "When Cloud loses his mind.";
-    sound_map_[234] = "";
-    sound_description_[234] = "";
-    sound_map_[235] = "";
-    sound_description_[235] = "";
-    sound_map_[236] = "";
-    sound_description_[236] = "";
-    sound_map_[237] = "";
-    sound_description_[237] = "";
-    sound_map_[238] = "";
-    sound_description_[238] = "";
-    sound_map_[239] = "Crowd";
-    sound_description_[239] = "Crowd yelling, as in the Junon Parade.";
-    sound_map_[240] = "";
-    sound_description_[240] = "";
-    sound_map_[241] = "UnderwaterElevator";
-    sound_description_[241] = "Junon underwater reactor elevator.";
-    sound_map_[242] = "HiTechDoor";
-    sound_description_[242] = "Some hi-tech door. Hojos lab?";
-    sound_map_[243] = "";
-    sound_description_[243] = "Moogle";
-    sound_map_[244] = "Moogle Kupo sound";
-    sound_description_[244] = "Bark";
-    sound_map_[245] = "Dog barking on the fields.";
-    sound_description_[245] = "";
-    sound_map_[246] = "";
-    sound_description_[246] = "";
-    sound_map_[247] = "BigBomber";
-    sound_description_[247] = "Enemy Big Bomber and similar attacks.";
-    sound_map_[248] = "DoorClose";
-    sound_description_[248] = "Some door closing?";
-    sound_map_[249] = "Shower";
-    sound_description_[249] = "Shower sound on the fields.";
-    sound_map_[250] = "Price";
-    sound_description_[250] = "Winning a price, like in Gold Saucer.";
-    sound_map_[251] = "";
-    sound_description_[251] = "";
-    sound_map_[252] = "";
-    sound_description_[252] = "";
-    sound_map_[253] = "Chest";
-    sound_description_[253] = "Treasure chest opening";
-    sound_map_[254] = "Clothes";
-    sound_description_[254] = "Changing clothes.";
-    sound_map_[255] = "";
-    sound_description_[255] = "";
-    sound_map_[256] = "";
-    sound_description_[256] = "";
-    sound_map_[257] = "";
-    sound_description_[257] = "";
-    sound_map_[258] = "";
-    sound_description_[258] = "";
-    sound_map_[259] = "";
-    sound_description_[259] = "";
-    sound_map_[260] = "MenuCure";
-    sound_description_[260] = "Curing while on the menu, magic or items.";
-    sound_map_[261] = "Buy";
-    sound_description_[261] = "Buying something in shops.";
-    sound_map_[262] = "PlanetCry";
-    sound_description_[262] = "Cry of the planet.";
-    sound_map_[263] = "LifeStreamExit";
-    sound_description_[263] = "When Cloud exits the LifeStream?";
-    sound_map_[264] = "Springs";
-    sound_description_[264] = "Springs in battle? in the Great Glacier?";
-    sound_map_[265] = "";
-    sound_description_[265] = "";
-    sound_map_[266] = "MachineReact";
-    sound_description_[266] = "Some machine reacting.";
-    sound_map_[267] = "";
-    sound_description_[267] = "";
-    sound_map_[268] = "";
-    sound_description_[268] = "";
-    sound_map_[269] = "LongGunning";
-    sound_description_[269] = "When Barrett aims at the ruins of Sector 7. Identical to 304.";
-    sound_map_[270] = "";
-    sound_description_[270] = "";
-    sound_map_[271] = "VincentCriticalHit";
-    sound_description_[271] = "Vincent gun critical hit.";
-    sound_map_[272] = "ChocoboSad";
-    sound_description_[272] = "Chocobo battle sad sound.";
-    sound_map_[273] = "chocoboHappy";
-    sound_description_[273] = "Chocobo battle happy sound.";
-    sound_map_[274] = "ChocoboAngry";
-    sound_description_[274] = "Chocobo battle angry sound.";
-    sound_map_[275] = "";
-    sound_description_[275] = "";
-    sound_map_[276] = "RubyFlameThrower";
-    sound_description_[276] = "Ruby Weapon Flame Thrower attack.";
-    sound_map_[277] = "";
-    sound_description_[277] = "";
-    sound_map_[278] = "BeamGun2";
-    sound_description_[278] = "Part of an enemy beam gun attack?";
-    sound_map_[279] = "";
-    sound_description_[279] = "";
-    sound_map_[280] = "JunonElevatorAlt";
-    sound_description_[280] = "Another elevator at Junon?";
-    sound_map_[281] = "";
-    sound_description_[281] = "";
-    sound_map_[282] = "";
-    sound_description_[282] = "";
-    sound_map_[283] = "";
-    sound_description_[283] = "";
-    sound_map_[284] = "";
-    sound_description_[284] = "";
-    sound_map_[285] = "";
-    sound_description_[285] = "";
-    sound_map_[286] = "";
-    sound_description_[286] = "";
-    sound_map_[287] = "";
-    sound_description_[287] = "";
-    sound_map_[288] = "SouthernCross";
-    sound_description_[288] = "Enemy Southern Cross attack.";
-    sound_map_[289] = "TifaHit";
-    sound_description_[289] = "Tifa hit sound.";
-    sound_map_[290] = "Somersault";
-    sound_description_[290] = "Tifas Somersault limit";
-    sound_map_[291] = "";
-    sound_description_[291] = "";
-    sound_map_[292] = "";
-    sound_description_[292] = "";
-    sound_map_[293] = "";
-    sound_description_[293] = "";
-    sound_map_[294] = "";
-    sound_description_[294] = "";
-    sound_map_[295] = "";
-    sound_description_[295] = "";
-    sound_map_[296] = "";
-    sound_description_[296] = "";
-    sound_map_[297] = "";
-    sound_description_[297] = "";
-    sound_map_[298] = "";
-    sound_description_[298] = "";
-    sound_map_[299] = "";
-    sound_description_[299] = "";
-    sound_map_[300] = "";
-    sound_description_[300] = "";
-    sound_map_[301] = "DragonForce";
-    sound_description_[301] = "Dragon Force enemy skill.";
-    sound_map_[302] = "";
-    sound_description_[302] = "";
-    sound_map_[303] = "Tsunami";
-    sound_description_[303] = "Enemy Sewer Tsunami (and similar) attacks.";
-    sound_map_[304] = "LongGunningAlt";
-    sound_description_[304] = "When Barrett aims at the ruins of Sector 7. Identical to 269.";
-    sound_map_[305] = "";
-    sound_description_[305] = "";
-    sound_map_[306] = "";
-    sound_description_[306] = "";
-    sound_map_[307] = "Ultima";
-    sound_description_[307] = "Ultima spell.";
-    sound_map_[308] = "";
-    sound_description_[308] = "";
-    sound_map_[309] = "";
-    sound_description_[309] = "";
-    sound_map_[310] = "";
-    sound_description_[310] = "";
-    sound_map_[311] = "";
-    sound_description_[311] = "";
-    sound_map_[312] = "";
-    sound_description_[312] = "";
-    sound_map_[313] = "";
-    sound_description_[313] = "";
-    sound_map_[314] = "";
-    sound_description_[314] = "";
-    sound_map_[315] = "";
-    sound_description_[315] = "";
-    sound_map_[316] = "";
-    sound_description_[316] = "";
-    sound_map_[317] = "";
-    sound_description_[317] = "";
-    sound_map_[318] = "";
-    sound_description_[318] = "";
-    sound_map_[319] = "";
-    sound_description_[319] = "";
-    sound_map_[320] = "";
-    sound_description_[320] = "";
-    sound_map_[321] = "";
-    sound_description_[321] = "";
-    sound_map_[322] = "";
-    sound_description_[322] = "";
-    sound_map_[323] = "";
-    sound_description_[323] = "";
-    sound_map_[324] = "";
-    sound_description_[324] = "";
-    sound_map_[325] = "";
-    sound_description_[325] = "";
-    sound_map_[326] = "";
-    sound_description_[326] = "";
-    sound_map_[327] = "";
-    sound_description_[327] = "";
-    sound_map_[328] = "";
-    sound_description_[328] = "";
-    sound_map_[329] = "";
-    sound_description_[329] = "";
-    sound_map_[330] = "";
-    sound_description_[330] = "";
-    sound_map_[331] = "";
-    sound_description_[331] = "";
-    sound_map_[332] = "";
-    sound_description_[332] = "";
-    sound_map_[333] = "";
-    sound_description_[333] = "";
-    sound_map_[334] = "";
-    sound_description_[334] = "";
-    sound_map_[335] = "";
-    sound_description_[335] = "";
-    sound_map_[336] = "";
-    sound_description_[336] = "";
-    sound_map_[337] = "";
-    sound_description_[337] = "";
-    sound_map_[338] = "";
-    sound_description_[338] = "Masamune";
-    sound_map_[339] = "Masamune sound?";
-    sound_description_[339] = "";
-    sound_map_[340] = "";
-    sound_description_[340] = "";
-    sound_map_[341] = "";
-    sound_description_[341] = "";
-    sound_map_[342] = "YuffieHit";
-    sound_description_[342] = "Yuffie shuriken hit.";
-    sound_map_[343] = "";
-    sound_description_[343] = "";
-    sound_map_[344] = "";
-    sound_description_[344] = "";
-    sound_map_[345] = "LenoHit";
-    sound_description_[345] = "Leno rod hit.";
-    sound_map_[346] = "";
-    sound_description_[346] = "";
-    sound_map_[347] = "TifaCriticalHit";
-    sound_description_[347] = "Tifa critical hit.";
-    sound_map_[348] = "";
-    sound_description_[348] = "";
-    sound_map_[349] = "";
-    sound_description_[349] = "";
-    sound_map_[350] = "";
-    sound_description_[350] = "";
-    sound_map_[351] = "";
-    sound_description_[351] = "";
-    sound_map_[352] = "";
-    sound_description_[352] = "";
-    sound_map_[353] = "";
-    sound_description_[353] = "";
-    sound_map_[354] = "";
-    sound_description_[354] = "";
-    sound_map_[355] = "";
-    sound_description_[355] = "";
-    sound_map_[356] = "SavePoint";
-    sound_description_[356] = "Save point sound.";
-    sound_map_[357] = "Obtain";
-    sound_description_[357] = "Obtained something.";
-    sound_map_[358] = "DeathForce";
-    sound_description_[358] = "Death Force enemy skill.";
-    sound_map_[359] = "";
-    sound_description_[359] = "";
-    sound_map_[360] = "";
-    sound_description_[360] = "";
-    sound_map_[361] = "";
-    sound_description_[361] = "";
-    sound_map_[362] = "";
-    sound_description_[362] = "Shield";
-    sound_map_[363] = "Shield spell.";
-    sound_description_[363] = "";
-    sound_map_[364] = "";
-    sound_description_[364] = "";
-    sound_map_[365] = "BigGuard";
-    sound_description_[365] = "Big Guard enemy skill.";
-    sound_map_[366] = "Heartbeat";
-    sound_description_[366] = "ShinRa mansion heartbeat background effects. Heard in other places too.";
-    sound_map_[367] = "";
-    sound_description_[367] = "";
-    sound_map_[368] = "BladeBeam";
-    sound_description_[368] = "Clouds Blade Beam limit.";
-    sound_map_[369] = "FlareFirst";
-    sound_description_[369] = "First part of the Flare spell.";
-    sound_map_[370] = "FlareSecond";
-    sound_description_[370] = "Second part of the flare spell.";
-    sound_map_[371] = "";
-    sound_description_[371] = "";
-    sound_map_[372] = "";
-    sound_description_[372] = "";
-    sound_map_[373] = "MasamuneField";
-    sound_description_[373] = "The masamune used on fields.";
-    sound_map_[374] = "DemonLaugh";
-    sound_description_[374] = "Demon laugh heard on Gold Saucer.";
-    sound_map_[375] = "";
-    sound_description_[375] = "";
-    sound_map_[376] = "InnkeeperScream";
-    sound_description_[376] = "Gold Saucer innkeeper scream.";
-    sound_map_[377] = "";
-    sound_description_[377] = "";
-    sound_map_[378] = "Ocean";
-    sound_description_[378] = "Ocean sound?";
-    sound_map_[379] = "PhoenixTail";
-    sound_description_[379] = "Phoenix Tail used in battle.";
-    sound_map_[380] = "";
-    sound_description_[380] = "";
-    sound_map_[381] = "LimitLearned";
-    sound_description_[381] = "4th limit level learned.";
-    sound_map_[382] = "";
-    sound_description_[382] = "";
-    sound_map_[383] = "";
-    sound_description_[383] = "";
-    sound_map_[384] = "";
-    sound_description_[384] = "";
-    sound_map_[385] = "";
-    sound_description_[385] = "";
-    sound_map_[386] = "";
-    sound_description_[386] = "";
-    sound_map_[387] = "";
-    sound_description_[387] = "";
-    sound_map_[388] = "";
-    sound_description_[388] = "";
-    sound_map_[389] = "AirBusterBreak";
-    sound_description_[389] = "AirBuster malfunction sound.";
-    sound_map_[390] = "";
-    sound_description_[390] = "";
-    sound_map_[391] = "";
-    sound_description_[391] = "";
-    sound_map_[392] = "";
-    sound_description_[392] = "";
-    sound_map_[393] = "";
-    sound_description_[393] = "";
-    sound_map_[394] = "";
-    sound_description_[394] = "";
-    sound_map_[395] = "";
-    sound_description_[395] = "";
-    sound_map_[396] = "";
-    sound_description_[396] = "";
-    sound_map_[397] = "";
-    sound_description_[397] = "";
-    sound_map_[398] = "";
-    sound_description_[398] = "";
-    sound_map_[399] = "";
-    sound_description_[399] = "";
-    sound_map_[400] = "Whistle";
-    sound_description_[400] = "Heard when practicing for Junon parade.";
-    sound_map_[401] = "";
-    sound_description_[401] = "";
-    sound_map_[402] = "Sonar";
-    sound_description_[402] = "Submarine sonar.";
-    sound_map_[403] = "";
-    sound_description_[403] = "";
-    sound_map_[404] = "";
-    sound_description_[404] = "";
-    sound_map_[405] = "";
-    sound_description_[405] = "";
-    sound_map_[406] = "";
-    sound_description_[406] = "";
-    sound_map_[407] = "";
-    sound_description_[407] = "";
-    sound_map_[408] = "";
-    sound_description_[408] = "";
-    sound_map_[409] = "";
-    sound_description_[409] = "";
-    sound_map_[410] = "";
-    sound_description_[410] = "";
-    sound_map_[411] = "";
-    sound_description_[411] = "";
-    sound_map_[412] = "";
-    sound_description_[412] = "";
-    sound_map_[413] = "";
-    sound_description_[413] = "";
-    sound_map_[414] = "";
-    sound_description_[414] = "";
-    sound_map_[415] = "";
-    sound_description_[415] = "";
-    sound_map_[416] = "";
-    sound_description_[416] = "";
-    sound_map_[417] = "";
-    sound_description_[417] = "";
-    sound_map_[418] = "";
-    sound_description_[418] = "";
-    sound_map_[419] = "";
-    sound_description_[419] = "";
-    sound_map_[420] = "Life2";
-    sound_description_[420] = "Life2 spell.";
-    sound_map_[421] = "";
-    sound_description_[421] = "";
-    sound_map_[422] = "";
-    sound_description_[422] = "";
-    sound_map_[423] = "";
-    sound_description_[423] = "";
-    sound_map_[424] = "";
-    sound_description_[424] = "";
-    sound_map_[425] = "";
-    sound_description_[425] = "";
-    sound_map_[426] = "";
-    sound_description_[426] = "";
-    sound_map_[427] = "";
-    sound_description_[427] = "";
-    sound_map_[428] = "";
-    sound_description_[428] = "";
-    sound_map_[429] = "";
-    sound_description_[429] = "";
-    sound_map_[430] = "";
-    sound_description_[430] = "";
-    sound_map_[431] = "";
-    sound_description_[431] = "";
-    sound_map_[432] = "";
-    sound_description_[432] = "";
-    sound_map_[433] = "";
-    sound_description_[433] = "";
-    sound_map_[434] = "";
-    sound_description_[434] = "";
-    sound_map_[435] = "";
-    sound_description_[435] = "";
-    sound_map_[436] = "";
-    sound_description_[436] = "";
-    sound_map_[437] = "";
-    sound_description_[437] = "";
-    sound_map_[438] = "Applauses";
-    sound_description_[438] = "Applauses effect.";
-    sound_map_[439] = "";
-    sound_description_[439] = "";
-    sound_map_[440] = "";
-    sound_description_[440] = "";
-    sound_map_[441] = "";
-    sound_description_[441] = "";
-    sound_map_[442] = "";
-    sound_description_[442] = "";
-    sound_map_[443] = "";
-    sound_description_[443] = "";
-    sound_map_[444] = "MenuEquip";
-    sound_description_[444] = "Equipping something in menus.";
-    sound_map_[445] = "BossDeath";
-    sound_description_[445] = "A boss dying.";
-    sound_map_[446] = "";
-    sound_description_[446] = "";
-    sound_map_[447] = "Announcement.";
-    sound_description_[447] = "Anouncement sound, ie Gold Saucer PA calling jockeys.";
-    sound_map_[448] = "PHS";
-    sound_description_[448] = "PHS ringing.";
-    sound_map_[449] = "Freeze";
-    sound_description_[449] = "Freeze spell.";
-    sound_map_[450] = "";
-    sound_description_[450] = "";
-    sound_map_[451] = "";
-    sound_description_[451] = "";
-    sound_map_[452] = "Meow";
-    sound_description_[452] = "Meow spell.";
-    sound_map_[453] = "";
-    sound_description_[453] = "";
-    sound_map_[454] = "";
-    sound_description_[454] = "";
-    sound_map_[455] = "SadDog";
-    sound_description_[455] = "Sad dog sound.";
-    sound_map_[456] = "";
-    sound_description_[456] = "";
-    sound_map_[457] = "";
-    sound_description_[457] = "";
-    sound_map_[458] = "";
-    sound_description_[458] = "";
-    sound_map_[459] = "";
-    sound_description_[459] = "";
-    sound_map_[460] = "";
-    sound_description_[460] = "";
-    sound_map_[461] = "";
-    sound_description_[461] = "";
-    sound_map_[462] = "";
-    sound_description_[462] = "";
-    sound_map_[463] = "";
-    sound_description_[463] = "";
-    sound_map_[464] = "Slots";
-    sound_description_[464] = "Slots rolling.";
-    sound_map_[465] = "Truck";
-    sound_description_[465] = "A truck like the one Cloud and Zack ride.";
-    sound_map_[466] = "";
-    sound_description_[466] = "";
-    sound_map_[467] = "";
-    sound_description_[467] = "";
-    sound_map_[468] = "";
-    sound_description_[468] = "";
-    sound_map_[469] = "";
-    sound_description_[469] = "";
-    sound_map_[470] = "";
-    sound_description_[470] = "";
-    sound_map_[471] = "";
-    sound_description_[471] = "";
-    sound_map_[472] = "";
-    sound_description_[472] = "";
-    sound_map_[473] = "";
-    sound_description_[473] = "";
-    sound_map_[474] = "";
-    sound_description_[474] = "";
-    sound_map_[475] = "";
-    sound_description_[475] = "";
-    sound_map_[476] = "";
-    sound_description_[476] = "";
-    sound_map_[477] = "";
-    sound_description_[477] = "";
-    sound_map_[478] = "";
-    sound_description_[478] = "";
-    sound_map_[479] = "";
-    sound_description_[479] = "";
-    sound_map_[480] = "";
-    sound_description_[480] = "";
-    sound_map_[481] = "";
-    sound_description_[481] = "";
-    sound_map_[482] = "";
-    sound_description_[482] = "";
-    sound_map_[483] = "";
-    sound_description_[483] = "";
-    sound_map_[484] = "";
-    sound_description_[484] = "";
-    sound_map_[485] = "Point";
-    sound_description_[485] = "Earning points/GP.";
-    sound_map_[486] = "";
-    sound_description_[486] = "";
-    sound_map_[487] = "";
-    sound_description_[487] = "";
-    sound_map_[488] = "";
-    sound_description_[488] = "";
-    sound_map_[489] = "";
-    sound_description_[489] = "";
-    sound_map_[490] = "";
-    sound_description_[490] = "";
-    sound_map_[491] = "";
-    sound_description_[491] = "";
-    sound_map_[492] = "";
-    sound_description_[492] = "";
-    sound_map_[493] = "";
-    sound_description_[493] = "";
-    sound_map_[494] = "";
-    sound_description_[494] = "";
-    sound_map_[495] = "";
-    sound_description_[495] = "";
-    sound_map_[496] = "";
-    sound_description_[496] = "";
-    sound_map_[497] = "";
-    sound_description_[497] = "";
-    sound_map_[498] = "";
-    sound_description_[498] = "";
-    sound_map_[499] = "";
-    sound_description_[499] = "";
-    sound_map_[506] = "Do";
-    sound_description_[506] = "Piano Do note.";
-    sound_map_[507] = "Re";
-    sound_description_[507] = "Piano Re note.";
-    sound_map_[508] = "Mi";
-    sound_description_[508] = "Piano Mi note.";
-    sound_map_[509] = "Fa";
-    sound_description_[509] = "Piano Fa note.";
-    sound_map_[510] = "Sol";
-    sound_description_[510] = "Piano Sol note.";
-    sound_map_[511] = "La";
-    sound_description_[511] = "Piano La note.";
-    sound_map_[512] = "Si";
-    sound_description_[512] = "Piano Si note.";
-    sound_map_[513] = "DoP";
-    sound_description_[513] = "Piano Do up note.";
-    sound_map_[514] = "SolP";
-    sound_description_[514] = "Piano Sol up note.";
-    sound_map_[515] = "LaP";
-    sound_description_[515] = "Piano La up note.";
-    sound_map_[516] = "SiP";
-    sound_description_[516] = "Piano Si up note.";
-    // TODO: Fill this list with somewhat descriptive names.
-}
+  disk_image_(disk_image),
+  images_(disk_image_, output_dir + "game/", keep_originals),
+  sounds_(disk_image_, output_dir + "game/", keep_originals, converter_),
+  music_(disk_image_, output_dir + "game/", keep_originals, converter_)
+{}
 
 
 MediaDataInstaller::~MediaDataInstaller(){}
 MediaDataInstaller::~MediaDataInstaller(){}
 
 
-void MediaDataInstaller::InstallSprites(){
-    // Actually open the lgp as a file for reading
-    File menu(*disk_image_.filePath("data/menu/menu_us.lgp"));
-
-    // Also, open it as a LGP archive.
-    menu_.open(*disk_image_.filePath("data/menu/menu_us.lgp"), true);
-    menu_.load();
-
-
-    Ogre::StringVectorPtr file_list = menu_.list(true, true);
-    //std::cout << " " << file_list << " files \n";
-    VGears::LGPArchive::FileList files = menu_.GetFiles();
-
-    for (int i = 0; i < file_list->size(); i ++){
-        VGears::LGPArchive::FileEntry f = files.at(i);
-        if (
-          f.file_name != "barre.tex"
-          && f.file_name != "bins.tex"
-          && f.file_name != "cido.tex"
-          && f.file_name != "cloud.tex"
-          && f.file_name != "earith.tex"
-          && f.file_name != "ketc.tex"
-          && f.file_name != "pcefi.tex"
-          && f.file_name != "pcloud.tex"
-          && f.file_name != "red.tex"
-          && f.file_name != "tifa.tex"
-          && f.file_name != "yufi.tex"
-          && f.file_name != "buster.tex"
-          && f.file_name != "choco.tex"
-          && f.file_name != "btl_win_c_l.tex"
-          && f.file_name != "btl_win_a_h.tex"
-          && f.file_name != "btl_win_b_h.tex"
-          && f.file_name != "btl_win_b_l.tex"
-        ) continue;
-
-        // Save the TEX File
-        std::fstream out;
-        out.open(data_dir_ + "ui/images/" + f.file_name, std::ios::out);
-        menu.SetOffset(f.data_offset);
-        for (int j = 0; j < f.data_size; j ++) out << menu.readU8();
-        out.close();
-
-        // Open the TEX file and save PNGs.
-        std::string img_dir = data_dir_ + "ui/images/";
-        TexFile tex(data_dir_ + "ui/images/" + f.file_name);
-        if (f.file_name == "barre.tex")
-            tex.SavePng(img_dir + "characters/1.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "bins.tex")
-            tex.SavePng(img_dir + "characters/7.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "cido.tex")
-            tex.SavePng(img_dir + "characters/8.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "cloud.tex")
-            tex.SavePng(img_dir + "characters/0.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "earith.tex")
-            tex.SavePng(img_dir + "characters/3.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "ketc.tex")
-            tex.SavePng(img_dir + "characters/6.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "pcefi.tex")
-            tex.SavePng(img_dir + "characters/10.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "pcloud.tex")
-            tex.SavePng(img_dir + "characters/9.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "red.tex")
-            tex.SavePng(img_dir + "characters/4.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "tifa.tex")
-            tex.SavePng(img_dir + "characters/2.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "yufi.tex")
-            tex.SavePng(img_dir + "characters/5.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "buster.tex")
-            tex.SavePng(img_dir + "other/begin_menu.png", 0, 0, 150, 150, 0);
-        else if (f.file_name == "choco.tex")
-            tex.SavePng(img_dir + "other/choco.png", 0, 0, 83, 95, 0);
-        else if (f.file_name == "btl_win_c_l.tex"){
-            // Weapon (no index 0), armor, accessory icons, palette 1.
-            tex.SavePng(img_dir + "icons/item_weapon_1.png", 192, 0, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_weapon_2.png", 224, 0, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_weapon_3.png", 192, 32, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_weapon_4.png", 224, 32, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_weapon_5.png", 192, 64, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_weapon_6.png", 224, 64, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_weapon_7.png", 192, 96, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_weapon_8.png", 224, 96, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_armor.png", 192, 128, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_accessory.png", 224, 128, 32, 32, 1);
-            // Status effects battle animations, palette 1.
-            tex.SavePng(img_dir + "icons/status_2_0.png", 128, 188, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/status_2_1.png", 160, 188, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/status_2_2.png", 192, 188, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/status_2_3.png", 224, 188, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/status_7_0.png", 128, 219, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/status_7_1.png", 160, 219, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/status_7_2.png", 192, 219, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/status_7_3.png", 224, 219, 32, 32, 1);
-            // Door arrows, palette 9.
-            tex.SavePng(img_dir + "icons/pointer_gateway_0.png", 96, 160, 18, 12, 9);
-            tex.SavePng(img_dir + "icons/pointer_gateway_1.png", 128, 160, 18, 12, 9);
-            tex.SavePng(img_dir + "icons/pointer_gateway_1.png", 160, 160, 18, 12, 9);
-            tex.SavePng(img_dir + "icons/pointer_gateway_3.png", 192, 160, 18, 12, 9);
-            tex.SavePng(img_dir + "icons/pointer_gateway_4.png", 224, 160, 18, 12, 9);
-            // Ladder arrows, palette 4.
-            tex.SavePng(img_dir + "icons/pointer_ladder_0.png", 96, 160, 18, 12, 4);
-            tex.SavePng(img_dir + "icons/pointer_ladder_1.png", 128, 160, 18, 12, 4);
-            tex.SavePng(img_dir + "icons/pointer_ladder_1.png", 160, 160, 18, 12, 4);
-            tex.SavePng(img_dir + "icons/pointer_ladder_3.png", 192, 160, 18, 12, 4);
-            tex.SavePng(img_dir + "icons/pointer_ladder_4.png", 224, 160, 18, 12, 4);
-            // Recovery word, palette 4.
-            tex.SavePng(img_dir + "icons/battle_recovery.png", 64, 64, 212, 232, 64, 36, 20, 4);
-            // Death word, palette 2.
-            tex.SavePng(img_dir + "icons/battle_death.png", 64, 192, 64, 20, 2);
-            // Window borders and corners, palette 0
-            tex.SavePng(img_dir + "window/b_t.png", 0, 192, 32, 16, 0);
-            tex.SavePng(img_dir + "window/b_b.png", 32, 208, 32, 16, 0);
-            tex.SavePng(img_dir + "window/b_l.png", 0, 224, 16, 32, 0);
-            tex.SavePng(img_dir + "window/b_r.png", 48, 224, 16, 32, 0);
-            tex.SavePng(img_dir + "window/c_tl.png", 0, 208, 16, 16, 0);
-            tex.SavePng(img_dir + "window/c_tr.png", 16, 208, 16, 16, 0);
-            tex.SavePng(img_dir + "window/c_bl.png", 32, 192, 16, 16, 0);
-            tex.SavePng(img_dir + "window/c_br.png", 48, 192, 16, 16, 0);
-        }
-        else if (f.file_name == "btl_win_a_h.tex"){
-            // Items and weapon 0, palette 1.
-            tex.SavePng(img_dir + "icons/item_item.png", 192, 223, 32, 32, 1);
-            tex.SavePng(img_dir + "icons/item_weapon_0.png", 220, 223, 32, 32, 1);
-            // Battle bar and texts, palette 1.
-            tex.SavePng(img_dir + "icons/battle_bar.png", 32, 0, 76, 18, 1);
-            tex.SavePng(img_dir + "icons/battle_limit.png", 112, 0, 48, 10, 1);
-            tex.SavePng(img_dir + "icons/battle_hp.png", 160, 0, 28, 10, 1);
-            tex.SavePng(img_dir + "icons/battle_mp.png", 192, 0, 30, 10, 1);
-            tex.SavePng(img_dir + "icons/battle_time.png", 224, 162, 0, 16, 32, 14, 10, 1);
-            tex.SavePng(img_dir + "icons/battle_barrier.png", 112, 16, 76, 10, 1);
-            tex.SavePng(img_dir + "icons/battle_wait.png", 192, 16, 44, 10, 1);
-            tex.SavePng(img_dir + "icons/battle_1.png", 130, 34, 10, 12, 1);
-            tex.SavePng(img_dir + "icons/battle_2.png", 146, 34, 10, 12, 1);
-            tex.SavePng(img_dir + "icons/battle_3.png", 162, 34, 10, 12, 1);
-            tex.SavePng(img_dir + "icons/battle_4.png", 178, 34, 10, 12, 1);
-            tex.SavePng(img_dir + "icons/battle_5.png", 194, 34, 10, 12, 1);
-            tex.SavePng(img_dir + "icons/battle_mp_needed.png", 0, 40, 80, 24, 1);
-            // Some other battle text, palette 7.
-            tex.SavePng(img_dir + "icons/battle_all.png", 240, 32, 16, 16, 7);
-            tex.SavePng(img_dir + "icons/battle_x.png", 240, 16, 16, 16, 7);
-            // No growth materia slot and linker, palette 1.
-            tex.SavePng(img_dir + "icons/materia_slot_no_growth.png", 224, 63, 24, 24, 1);
-            tex.SavePng(img_dir + "icons/materia_slot_link.png", 227, 95, 14, 24, 1);
-            // Buttons, palette 7.
-            tex.SavePng(img_dir + "icons/bt_up.png", 160, 70, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_down.png", 192, 70, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_right.png", 160, 102, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_left.png", 192, 102, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_3.png", 192, 134, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_2.png", 224, 134, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_6.png", 192, 166, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_8.png", 224, 166, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_9.png", 192, 198, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_10.png", 224, 198, 26, 20, 7);
-            // Crossed out cursor, palette 7.
-            tex.SavePng(img_dir + "icons/cursor_crossed.png", 80, 32, 48, 32, 7);
-            // Sound settings, palette 1.
-            tex.SavePng(img_dir + "icons/settings_music.png", 101, 131, 30, 30, 1);
-            tex.SavePng(img_dir + "icons/settings_fx.png", 133, 131, 30, 30, 1);
-        }
-        else if (f.file_name == "btl_win_b_h.tex"){
-            // Don't take cursors fom here, they don't have shadows and are too narrow.
-            // Take them from btl_win_b_l.tex
-
-            // Menu and battle text, palette 1.
-            tex.SavePng(img_dir + "icons/slash.png", 176, 0, 8, 16, 1);
-            tex.SavePng(img_dir + "icons/battle_name.png", 0, 32, 52, 10, 1);
-            tex.SavePng(img_dir + "icons/battle_status.png", 0, 48, 64, 10, 1);
-            tex.SavePng(img_dir + "icons/battle_status.png", 144, 48, 52, 10, 1);
-            // Up/Down pointers, palette 1.
-            tex.SavePng(img_dir + "icons/pointer_up.png", 198, 0, 22, 16, 1);
-            tex.SavePng(img_dir + "icons/pointer_down.png", 230, 0, 22, 16, 1);
-            // Materia slot, palette 1.
-            tex.SavePng(img_dir + "icons/materia_slot.png", 0, 95, 24, 24, 1);
-            // Materia stuff, several plettes.
-            tex.SavePng(img_dir + "icons/materia_1.png", 3, 67, 18, 18, 4);
-            tex.SavePng(img_dir + "icons/materia_2.png", 3, 67, 18, 18, 5);
-            tex.SavePng(img_dir + "icons/materia_3.png", 3, 67, 18, 18, 8);
-            tex.SavePng(img_dir + "icons/materia_4.png", 3, 67, 18, 18, 9);
-            tex.SavePng(img_dir + "icons/materia_5.png", 3, 67, 18, 18, 10);
-            tex.SavePng(img_dir + "icons/materia_star_1.png", 32, 64, 23, 26, 4);
-            tex.SavePng(img_dir + "icons/materia_star_2.png", 32, 64, 23, 26, 5);
-            tex.SavePng(img_dir + "icons/materia_star_3.png", 32, 64, 23, 26, 8);
-            tex.SavePng(img_dir + "icons/materia_star_4.png", 32, 64, 23, 26, 9);
-            tex.SavePng(img_dir + "icons/materia_star_5.png", 32, 64, 23, 26, 10);
-            tex.SavePng(img_dir + "icons/materia_star_empty_1.png", 32, 96, 23, 26, 4);
-            tex.SavePng(img_dir + "icons/materia_star_empty_2.png", 32, 96, 23, 26, 5);
-            tex.SavePng(img_dir + "icons/materia_star_empty_3.png", 32, 96, 23, 26, 8);
-            tex.SavePng(img_dir + "icons/materia_star_empty_4.png", 32, 96, 23, 26, 9);
-            tex.SavePng(img_dir + "icons/materia_star_empty_5.png", 32, 96, 23, 26, 10);
-            // Buttons, palette 7.
-            tex.SavePng(img_dir + "icons/bt_1.png", 0, 134, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_4.png", 32, 134, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_5.png", 0, 166, 26, 20, 7);
-            tex.SavePng(img_dir + "icons/bt_7.png", 32, 16, 26, 20, 7);
-            // Some other battle text, palette 7.
-            tex.SavePng(img_dir + "icons/battle_inf.png", 36, 194, 26, 14, 7);
-            // Right pointer, palette 7.
-            tex.SavePng(img_dir + "icons/pointer_right.png", 4, 16, 10, 16, 7);
-            // Battle and menu bars, palette 1.
-            tex.SavePng(img_dir + "icons/battle_bar_barriers.png", 64, 32, 76, 24, 1);
-            tex.SavePng(img_dir + "icons/menu_bar.png", 16, 16, 126, 16, 1);
-            // Fonts, save all palettes, make one default.
-            for (int p = 0; p < 16; p ++){
-                // Digits font. Default palette 7.
-                tex.SavePng(img_dir + "fonts/digits_" + std::to_string(p) + ".png", 16, 0, 156, 16, p);
-                if (p == 7) tex.SavePng(img_dir + "fonts/digits.png", 16, 0, 156, 16, p);
-            }
-            for (int p = 0; p < 16; p ++){
-                // Time font. Default palette 12.
-                tex.SavePng(img_dir + "fonts/timer_" + std::to_string(p) + ".png", 32, 160, 224, 90, p);
-                if (p == 12) tex.SavePng(img_dir + "fonts/timer.png", 32, 160, 224, 90, p);
-            }
-            // Reels, palete 11.
-            tex.SavePng(img_dir + "reels/yeah.png", 64, 64, 64, 30, 11);
-            tex.SavePng(img_dir + "reels/luck.png", 64, 98, 64, 30, 11);
-            tex.SavePng(img_dir + "reels/hit.png", 128, 64, 64, 30, 11);
-            tex.SavePng(img_dir + "reels/bar.png", 128, 97, 64, 30, 11);
-            tex.SavePng(img_dir + "reels/miss.png", 192, 64, 64, 30, 11);
-            tex.SavePng(img_dir + "reels/choso.png", 192, 98, 64, 30, 11);
-
-        }
-        else if (f.file_name == "btl_win_b_l.tex"){
-            // Cursors, palette 1.
-            tex.SavePng(img_dir + "icons/cursor.png", 192, 16, 48, 32, 1);
-            tex.SavePng(img_dir + "icons/cursor_left.png", 144, 16, 48, 32, 1);
-            tex.SavePng(img_dir + "icons/pointer_position.png", 0, 192, 32, 26, 1);
-        }
-
-        // TODO: Extract arena reels from coloa.tex, colob.tex and coloc.tex
-
-        // Delete Tex file.
-        if (!keep_originals_) std::remove((data_dir_ + "ui/images/" + f.file_name).c_str());
-    }
-}
-
-bool MediaDataInstaller::InstallFonts(){
-    // WINDOW.BIN: the first file is the window graphics TIM, the second one the dialog font TIM.
-    WindowFonts::IndexImage window;
-    WindowFonts::IndexImage text;
-    for (u32 i = 0; i < 2; i ++){
-        const File tim = window_.ExtractGZip(i);
-        if (tim.GetFileSize() == 0) return false;
-        std::vector<u8> buffer(tim.GetFileSize());
-        tim.GetFileBuffer(buffer.data(), 0, buffer.size());
-        if (!WindowFonts::ReadTim4(buffer.data(), buffer.size(), i == 0 ? window : text)) return false;
-    }
-    const std::string font_dir = data_dir_ + "ui/fonts/";
-    WindowFonts::SavePng(WindowFonts::BuildTextFont(text), font_dir + "ffvii_en.png");
-    WindowFonts::SavePng(WindowFonts::BuildMenuFont(window), font_dir + "ffvii_menu.png");
-    WindowFonts::SavePng(WindowFonts::BuildDigitsFont(window), font_dir + "ffvii_digits.png");
-    WindowFonts::SavePng(WindowFonts::BuildTimerFont(window), font_dir + "ffvii_timer.png");
-    return true;
-}
-
-int MediaDataInstaller::InstallSoundsInit(){
-    std::unique_ptr<std::string> fmt_path = disk_image_.filePath("data/sound/audio.fmt");
-    std::unique_ptr<std::string> data_path = disk_image_.filePath("data/sound/audio.dat");
-    std::string sound_dir =
-      (boost::filesystem::path(data_dir_) / "audio" / "sounds").string();
-
-    if (!fmt_path){
-        std::cerr << "MediaDataInstaller: could not find data/sound/audio.fmt in the selected game data."
-                  << std::endl;
-    }
-    else if (!data_path){
-        std::cerr << "MediaDataInstaller: could not find data/sound/audio.dat in the selected game data."
-                  << std::endl;
-    }
-    else if (SfxDumpConvert(fmt_path->c_str(), data_path->c_str(), sound_dir.c_str()) != 0){
-        std::cerr << "MediaDataInstaller: failed to convert FFVII sound effects."
-                  << std::endl;
-    }
-    processed_sounds_ = 0;
-    return TOTAL_SOUNDS;
-}
-
-bool MediaDataInstaller::InstallSounds(){
-    if (ToolsReady(false)){
-        const std::string wav = data_dir_ + "audio/sounds/" + std::to_string(processed_sounds_) + ".wav";
-        const std::string ogg = data_dir_ + "audio/sounds/" + std::to_string(processed_sounds_) + ".ogg";
-        std::ifstream file(wav);
-        if (file.is_open()){
-            file.close();
-            // Converted in the background. The wav file is removed once it has been converted.
-            const std::string ffmpeg = ffmpeg_tool_.path;
-            const bool keep = keep_originals_;
-            RunConversion(
-              "sound " + std::to_string(processed_sounds_),
-              [ffmpeg, wav, ogg](std::string* error){return ExternalTools::ConvertToOgg(ffmpeg, wav, ogg, error);},
-              [wav, keep](){if (!keep) std::remove(wav.c_str());}
-            );
-            sounds_.push_back("audio/sounds/" + std::to_string(processed_sounds_) + ".ogg");
-        }
-        else{
-            sounds_.push_back("audio/sounds/INVALID.ogg");
-        }
-    }
-    processed_sounds_ ++;
-    if (processed_sounds_ >= TOTAL_SOUNDS) return true;
-    else return false;
-}
-
-void MediaDataInstaller::WriteSoundIndex(){
-    TiXmlDocument xml;
-    std::unique_ptr<TiXmlElement> container(new TiXmlElement("sounds"));
-    //for (string item : items_){
-    for (int id = 0; id < sounds_.size(); id ++){
-        std::string path = sounds_[id];
-        // A sound that could not be converted has no file, and listing it would make the game look for it.
-        if (path != "audio/sounds/INVALID.ogg" && !boost::filesystem::exists(data_dir_ + path)) continue;
-        std::unique_ptr<TiXmlElement> xml_sound(new TiXmlElement("sound"));
-        xml_sound->SetAttribute("file_name", path);
-        xml_sound->SetAttribute("name", id);
-        container->LinkEndChild(xml_sound.release());
-        // If there is a friendly name for this sound, add another entry
-        if (sound_map_.count(id) != 0 && sound_map_[id] != ""){
-            std::unique_ptr<TiXmlElement> xml_sound_name(new TiXmlElement("sound"));
-            xml_sound_name->SetAttribute("file_name", path);
-            std::string name = sound_map_[id];
-            xml_sound_name->SetAttribute("name", name);
-            xml_sound_name->SetAttribute("description", sound_description_[id]);
-            container->LinkEndChild(xml_sound_name.release());
-        }
-    }
-    xml.LinkEndChild(container.release());
-    xml.SaveFile(data_dir_ + "audio/sounds/_sounds.xml");
-}
-
-int MediaDataInstaller::InstallMusicsInit(){
-    // Read the music index file.
-    std::ifstream music_idx(*disk_image_.filePath("data/music/music.idx"));
-    int i = 0;
-    std::string name;
-    if (music_idx.is_open()){
-        while (std::getline(music_idx, name)){
-            // Newlines are very likely WINDOWS/DOS format, but check them all.
-            boost::replace_all(name, "\r\n", "");
-            boost::replace_all(name, "\n", "");
-            boost::replace_all(name, "\r", "");
-            musics_map_[i] = name;
-            i ++;
-        }
-        music_idx.close();
-    }
-
-    // Load midi_
-    midi_.load();
-
-    processed_musics_ = 0;
-    return midi_.list(true, true)->size();
-}
-
-bool MediaDataInstaller::InstallMusics(){
-    VGears::LGPArchive::FileEntry f = midi_.GetFiles().at(processed_musics_);
-
-    // Find the index in the map.
-    int index = 1000 + processed_musics_;
-    for (auto const& m : musics_map_){
-        if (m.second + ".mid" == f.file_name){
-            index = m.first;
-            break;
-        }
-    }
-
-    File midi(*disk_image_.filePath("data/midi/midi.lgp"));
-
-    std::fstream out;
-    out.open(data_dir_ + "audio/music/" + std::to_string(index) + ".mid", std::ios::out);
-    midi.SetOffset(f.data_offset);
-    for (int j = 0; j < f.data_size; j ++) out << midi.readU8();
-    out.close();
+void MediaDataInstaller::InstallSprites(){images_.InstallSprites();}
 
 
-    // Convert to ogg (TiMidity + FFMpeg).
-    const std::string midi_path = data_dir_ + "audio/music/" + std::to_string(index) + ".mid";
-    const std::string ogg_path = data_dir_ + "audio/music/" + std::to_string(index) + ".ogg";
-    const bool keep = keep_originals_;
-    if (ToolsReady(true)){
-        // Converted in the background. The midi file is removed once it has been converted.
-        const std::string timidity = timidity_tool_.path;
-        const std::string ffmpeg = ffmpeg_tool_.path;
-        RunConversion(
-          "music " + std::to_string(index),
-          [timidity, ffmpeg, midi_path, ogg_path](std::string* error){
-              return ExternalTools::ConvertMidiToOgg(timidity, ffmpeg, midi_path, ogg_path, error);
-          },
-          [midi_path, keep](){if (!keep) std::remove(midi_path.c_str());}
-        );
-    }
-    // Without the programs the midi file is the only copy of the track, so it stays.
+bool MediaDataInstaller::InstallFonts(){return images_.InstallFonts();}
 
 
-    musics_.push_back("audio/music/" + std::to_string(processed_musics_) + ".ogg");
-    processed_musics_ ++;
-    if (processed_musics_ == midi_.list(true, true)->size()) return true;
-    else return false;
-}
+int MediaDataInstaller::InstallSoundsInit(){return sounds_.InstallSoundsInit();}
 
 
-void MediaDataInstaller::InstallHQMusics(){
-    // Four tracks are not MIDI files: they are the WAV files of DATA/MUSIC (HEART.WAV, SATO.WAV,
-    // SENSUI.WAV and WIND.WAV). The index of the music (MUSIC.IDX) says which track is each one, and
-    // they are installed as the other ones are, with the number of the track as the name. Without
-    // them tracks 14, 64, 87 and 96 are missing (the music of junair2, for example).
-    std::vector<std::string> hq_musics = {"heart", "sato", "sensui", "wind"};
-    for (const std::string& hq_music : hq_musics){
-        int index = -1;
-        for (auto const& m : musics_map_){
-            if (m.second == hq_music){
-                index = m.first;
-                break;
-            }
-        }
-        if (index < 0){
-            InstallLog::Get().Add("[WARNING] The music " + hq_music + " is not in the index of the music.");
-            continue;
-        }
-        if (!ToolsReady(false)) continue;
-        const std::string ffmpeg = ffmpeg_tool_.path;
-        std::string upper = hq_music;
-        std::transform(upper.begin(), upper.end(), upper.begin(), ::toupper);
-        const std::unique_ptr<std::string> wav_path = disk_image_.filePath("data/music/" + upper + ".wav");
-        if (!wav_path || !boost::filesystem::exists(*wav_path)){
-            InstallLog::Get().Add("[WARNING] The file of the music " + hq_music + " was not found.");
-            continue;
-        }
-        const std::string wav = *wav_path;
-        const std::string ogg = data_dir_ + "audio/music/" + std::to_string(index) + ".ogg";
-        RunConversion(
-          "high quality music " + hq_music,
-          [ffmpeg, wav, ogg](std::string* error){return ExternalTools::ConvertToOgg(ffmpeg, wav, ogg, error);}
-        );
-    }
-    // The index lists the tracks by their position, and the MIDI files are four less than the tracks:
-    // the last ones (94 to 97) were left out of it. A track with no file is not written to the index.
-    int last_id = 0;
-    for (auto const& m : musics_map_) last_id = std::max(last_id, m.first);
-    for (int id = static_cast<int>(musics_.size()); id <= last_id; ++ id)
-        musics_.push_back("audio/music/" + std::to_string(id) + ".ogg");
-}
+bool MediaDataInstaller::InstallSounds(){return sounds_.InstallSounds();}
 
 
-bool MediaDataInstaller::ToolsReady(bool need_timidity){
-    if (!tools_resolved_){
-        tools_resolved_ = true;
-        const ExternalTools::Locations& locations = ExternalTools::CurrentLocations();
-        ffmpeg_tool_ = ExternalTools::FindFfmpeg(locations);
-        timidity_tool_ = ExternalTools::FindTimidity(locations);
-        if (ffmpeg_tool_.usable) InstallLog::Get().Add("Using " + ffmpeg_tool_.version + " (" + ffmpeg_tool_.path + ")");
-        else{
-            InstallLog::Get().Add(
-              "[WARNING] FFmpeg can't be used, so the sound effects and the music will not be converted (the "
-              "extracted .wav and .mid files are left in place): " + ffmpeg_tool_.problem
-            );
-        }
-        if (timidity_tool_.usable) InstallLog::Get().Add("Using " + timidity_tool_.version + " (" + timidity_tool_.path + ")");
-        else{
-            InstallLog::Get().Add(
-              "[WARNING] TiMidity can't be used, so the music will not be converted (the extracted .mid files are "
-              "left in place): " + timidity_tool_.problem
-            );
-        }
-    }
-    return ffmpeg_tool_.usable && (!need_timidity || timidity_tool_.usable);
-}
+void MediaDataInstaller::WriteSoundIndex(){sounds_.WriteSoundIndex();}
 
 
-void MediaDataInstaller::RunConversion(
-  const std::string& description, std::function<bool(std::string*)> job, std::function<void()> on_success
-){
-    if (!conversions_) conversions_ = std::make_unique<TaskPool>();
-    conversions_->Run([description, job, on_success](){
-        std::string error;
-        if (job(&error)){
-            if (on_success) on_success();
-        }
-        else{
-            // The source file is kept, since it hasn't been converted.
-            InstallLog::Get().Add("[WARNING] Could not convert " + description + ": " + error);
-        }
-    });
-}
+int MediaDataInstaller::InstallMusicsInit(){return music_.InstallMusicsInit();}
 
 
-void MediaDataInstaller::WaitForConversions(){
-    if (conversions_) conversions_->Wait();
-}
+bool MediaDataInstaller::InstallMusics(){return music_.InstallMusics();}
 
 
-void MediaDataInstaller::WriteMusicsIndex(){
-    TiXmlDocument xml;
-    std::unique_ptr<TiXmlElement> container(new TiXmlElement("musics"));
-    for (int id = 0; id < musics_.size(); id ++){
-        std::string path = musics_[id];
-        // A track that could not be converted has no file, and listing it would make the game look for it.
-        if (!boost::filesystem::exists(data_dir_ + path)) continue;
-        std::unique_ptr<TiXmlElement> xml_music(new TiXmlElement("music"));
-        xml_music->SetAttribute("file_name", path);
-        xml_music->SetAttribute("name", id);
-        xml_music->SetAttribute("loop", "0");
-        switch (id){
-            case 1:
-                xml_music->SetAttribute("default", "initial");
-                break;
-            case 6:
-                xml_music->SetAttribute("default", "battle");
-                break;
-            case 9:
-                xml_music->SetAttribute("default", "boss");
-                break;
-            case 13:
-                xml_music->SetAttribute("default", "world_map");
-                break;
-            case 43:
-                xml_music->SetAttribute("default", "chocobo_battle");
-                break;
-            case 45:
-                xml_music->SetAttribute("default", "victory");
-                break;
-            case 46:
-                xml_music->SetAttribute("default", "airship");
-                break;
-            case 50:
-                xml_music->SetAttribute("default", "chocobo_ride");
-                break;
-            case 57:
-                xml_music->SetAttribute("default", "game_over");
-                break;
-            case 70:
-                xml_music->SetAttribute("default", "world_map_danger");
-                break;
-            case 84:
-                xml_music->SetAttribute("default", "submarine");
-                break;
+void MediaDataInstaller::InstallHQMusics(){music_.InstallHQMusics();}
 
 
-        }
-        container->LinkEndChild(xml_music.release());
-        // If there is a friendly name for this sound, add another entry
-        if (musics_map_.count(id) != 0){
-            std::unique_ptr<TiXmlElement> xml_music_name(new TiXmlElement("music"));
-            xml_music_name->SetAttribute("file_name", path);
-            xml_music_name->SetAttribute("name", musics_map_[id]);
-            xml_music_name->SetAttribute("loop", "0");
-            container->LinkEndChild(xml_music_name.release());
-        }
-    }
-    xml.LinkEndChild(container.release());
-    xml.SaveFile(data_dir_ + "audio/music/_musics.xml");
-}
+void MediaDataInstaller::WaitForConversions(){converter_.Wait();}
 
 
-void MediaDataInstaller::InstallVideos(){
-    if (processed_videos_ < 0 || processed_videos_ >= videos_.size()) return;
-    const std::string output_dir = data_dir_ + "video/";
-    boost::filesystem::create_directories(output_dir);
-    const boost::filesystem::path source(videos_[processed_videos_]);
-    processed_videos_ ++;
-    if (ToolsReady(false)){
-        // The game can't decode these videos, so they are converted to frames and ogg sound, in the
-        // background. Videos that aren't avi files are not movies.
-        if (source.extension() != ".avi" && source.extension() != ".AVI") return;
-        const std::string ffmpeg = ffmpeg_tool_.path;
-        const std::string name = source.stem().string();
-        const std::string input = source.string();
-        const std::string camera_archive = (source.parent_path() / "moviecam.lgp").string();
-        const std::string directory = (boost::filesystem::path(output_dir) / name).string();
-        RunConversion(
-          "movie " + name,
-          [ffmpeg, input, directory, name, camera_archive](std::string* error){
-              return ExternalTools::ConvertMovie(
-                ffmpeg, input, directory, name, MovieCamera::LoadCamera(camera_archive, name),
-                error
-              );
-          },
-          nullptr
-        );
-        return;
-    }
-    const boost::filesystem::path destination = boost::filesystem::path(output_dir) / source.filename();
-    boost::filesystem::copy_file(source, destination, boost::filesystem::copy_options::overwrite_existing);
-}
+void MediaDataInstaller::WriteMusicsIndex(){music_.WriteMusicsIndex();}

+ 15 - 121
src/installer/extractors/MediaDataInstaller.h

@@ -15,21 +15,20 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <memory>
-#include <unordered_map>
+#include <string>
+#include "installer/extractors/MediaConverter.h"
+#include "installer/extractors/MediaImageInstaller.h"
+#include "installer/extractors/MusicInstaller.h"
+#include "installer/extractors/SoundInstaller.h"
 #include "installer/formats/DiskImage.h"
 #include "installer/formats/DiskImage.h"
-#include "formats/lgp/LGPArchive.h"
-#include "installer/formats/BinGZipFile.h"
-#include "installer/formats/TexFile.h"
-#include "installer/steps/ExternalTools.h"
-#include "installer/steps/TaskPool.h"
 
 
 /**
 /**
  * The media data installer.
  * The media data installer.
+ *
+ * It has an installer for the images, the sounds and the music, and passes the calls on to them.
  */
  */
 class MediaDataInstaller{
 class MediaDataInstaller{
 
 
-
     public:
     public:
 
 
         /**
         /**
@@ -46,11 +45,6 @@ class MediaDataInstaller{
          */
          */
         ~MediaDataInstaller();
         ~MediaDataInstaller();
 
 
-        /**
-         * Populates the audio name maps.
-         */
-        void PopulateMaps();
-
         /**
         /**
          * Extracts all images contained in the menu LGP file and installs them.
          * Extracts all images contained in the menu LGP file and installs them.
          *
          *
@@ -122,130 +116,30 @@ class MediaDataInstaller{
          */
          */
         void WriteMusicsIndex();
         void WriteMusicsIndex();
 
 
-        /**
-         * Copies the FMV videos.
-         */
-        void InstallVideos();
-
     private:
     private:
 
 
-        /**
-         * Runs a conversion in the background.
-         *
-         * A failed conversion is logged as a warning.
-         *
-         * @param[in] description What is being converted, for the log.
-         * @param[in] job Does the conversion. Returns false, and sets the error, if it fails.
-         * @param[in] on_success Called, in the background thread, if the conversion succeeds.
-         */
-        void RunConversion(
-          const std::string& description, std::function<bool(std::string*)> job,
-          std::function<void()> on_success = nullptr
-        );
-
-        /**
-         * Finds the conversion programs the first time it is called, and reports what is missing.
-         *
-         * @param[in] need_timidity True if TiMidity is needed too (the music).
-         * @return True if the programs are usable.
-         */
-        bool ToolsReady(bool need_timidity);
-
-        /**
-         * FFmpeg and TiMidity, found by {@see ToolsReady}.
-         */
-        ExternalTools::Tool ffmpeg_tool_;
-        ExternalTools::Tool timidity_tool_;
-        bool tools_resolved_ = false;
-
-        /**
-         * Threads that run the conversions. Created when the first conversion starts.
-         */
-        std::unique_ptr<TaskPool> conversions_;
-
-        /**
-         * Number of sound files to extract.
-         */
-        static int TOTAL_SOUNDS;
-		
         /**
         /**
          * The disk image to read the original data from.
          * The disk image to read the original data from.
          */
          */
         DiskImage disk_image_;
         DiskImage disk_image_;
 
 
         /**
         /**
-         * The path to the directory where to save the V-Gears data.
+         * Runs the audio conversions. Declared before the installers that use it.
          */
          */
-        std::string output_dir_;
+        MediaConverter converter_;
 
 
         /**
         /**
-         * Directory where the game data is installed (<install dir>/data/).
+         * Images and fonts.
          */
          */
-        std::string data_dir_;
+        MediaImageInstaller images_;
 
 
         /**
         /**
-         * The menu.lgp file.
+         * Sound effects.
          */
          */
-        VGears::LGPArchive menu_;
+        SoundInstaller sounds_;
 
 
         /**
         /**
-         * The WINDOW.BIN file.
+         * Music.
          */
          */
-        BinGZipFile window_;
-
-        /**
-         * Number of sounds already processed.
-         */
-        int processed_sounds_;
-
-        /**
-         * Map for sound files with descriptive names.
-         */
-        std::unordered_map<int, std::string> sound_map_;
-
-        /**
-         * Map for sound files with human readable descriptions.
-         */
-        std::unordered_map<int, std::string> sound_description_;
-
-        /**
-         * Sound data for each entry to write to the XML file
-         */
-        std::vector<std::string> sounds_;
-
-        /**
-         * Video files to copy
-         */
-        std::vector<std::string> videos_;
-
-        /**
-         * The midi.lgp file.
-         */
-        VGears::LGPArchive midi_;
-
-        /**
-         * Number of music tracks already processed.
-         */
-        int processed_musics_;
-
-        /**
-         * Number of video files already processed.
-         */
-        int processed_videos_;
-
-        /**
-         * Map for music files with descriptive names.
-         */
-        std::unordered_map<int, std::string> musics_map_;
-
-        /**
-         * Sound data for each entry to write to the XML file
-         */
-        std::vector<std::string> musics_;
-
-        /**
-         * If true, orginal files will not be deleted after conversion.
-         */
-        bool keep_originals_;
-
+        MusicInstaller music_;
 };
 };

+ 116 - 0
src/installer/extractors/MediaImageInstaller.cpp

@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <algorithm>
+#include <cstdio>
+#include <fstream>
+#include <iterator>
+#include "installer/extractors/MediaImageInstaller.h"
+#include "installer/extractors/WindowFonts.h"
+#include "installer/formats/TexFile.h"
+#include "installer/tables/MenuImages.h"
+
+MediaImageInstaller::MediaImageInstaller(
+  DiskImage& disk_image, const std::string& data_dir, const bool keep_originals
+):
+  disk_image_(disk_image), data_dir_(data_dir), keep_originals_(keep_originals),
+  menu_(VGears::LGPArchive(*disk_image.filePath("data/menu/menu_us.lgp"), "LGP")),
+  window_(*disk_image.filePath("data/kernel/WINDOW.BIN"))
+{}
+
+void MediaImageInstaller::InstallSprites(){
+    // Actually open the lgp as a file for reading
+    File menu(*disk_image_.filePath("data/menu/menu_us.lgp"));
+    // Also, open it as a LGP archive.
+    menu_.open(*disk_image_.filePath("data/menu/menu_us.lgp"), true);
+    menu_.load();
+
+    const std::string img_dir = data_dir_ + "ui/images/";
+    for (const VGears::LGPArchive::FileEntry& entry : menu_.GetFiles()){
+        const std::string& name = entry.file_name;
+        const bool used = std::any_of(
+          std::begin(MENU_IMAGES), std::end(MENU_IMAGES),
+          [&name](const MenuImage& image){return name == image.texture;}
+        );
+        if (!used) continue;
+
+        // Save the TEX File
+        std::fstream out;
+        out.open(img_dir + name, std::ios::out);
+        menu.SetOffset(entry.data_offset);
+        for (int j = 0; j < entry.data_size; j ++) out << menu.readU8();
+        out.close();
+
+        // Open the TEX file and save PNGs.
+        TexFile tex(img_dir + name);
+        SaveImages(tex, name);
+        // The fonts of numbers are in this texture.
+        if (name == "btl_win_b_h.tex") SaveNumberFonts(tex);
+
+        // Delete Tex file.
+        if (!keep_originals_) std::remove((img_dir + name).c_str());
+    }
+}
+
+void MediaImageInstaller::SaveImages(TexFile& tex, const std::string& texture) const{
+    const std::string img_dir = data_dir_ + "ui/images/";
+    for (const MenuImage& image : MENU_IMAGES){
+        if (texture != image.texture) continue;
+        tex.SavePng(
+          img_dir + image.image, image.x, image.y, image.width, image.height, image.palette
+        );
+    }
+    for (const MenuImagePair& image : MENU_IMAGE_PAIRS){
+        if (texture != image.texture) continue;
+        tex.SavePng(
+          img_dir + image.image, image.x1, image.x2, image.y1, image.y2, image.width1,
+          image.width2, image.height, image.palette
+        );
+    }
+}
+
+void MediaImageInstaller::SaveNumberFonts(TexFile& tex) const{
+    const std::string font_dir = data_dir_ + "ui/images/fonts/";
+    // Save all the palettes, and make one the default.
+    for (int p = 0; p < 16; p ++){
+        // Digits font. Default palette 7.
+        tex.SavePng(font_dir + "digits_" + std::to_string(p) + ".png", 16, 0, 156, 16, p);
+        if (p == 7) tex.SavePng(font_dir + "digits.png", 16, 0, 156, 16, p);
+    }
+    for (int p = 0; p < 16; p ++){
+        // Time font. Default palette 12.
+        tex.SavePng(font_dir + "timer_" + std::to_string(p) + ".png", 32, 160, 224, 90, p);
+        if (p == 12) tex.SavePng(font_dir + "timer.png", 32, 160, 224, 90, p);
+    }
+}
+
+bool MediaImageInstaller::InstallFonts(){
+    // WINDOW.BIN: the first file is the window graphics TIM, the second one the dialog font TIM.
+    WindowFonts::IndexImage window;
+    WindowFonts::IndexImage text;
+    for (u32 i = 0; i < 2; i ++){
+        const File tim = window_.ExtractGZip(i);
+        if (tim.GetFileSize() == 0) return false;
+        std::vector<u8> buffer(tim.GetFileSize());
+        tim.GetFileBuffer(buffer.data(), 0, buffer.size());
+        if (!WindowFonts::ReadTim4(buffer.data(), buffer.size(), i == 0 ? window : text)) return false;
+    }
+    const std::string font_dir = data_dir_ + "ui/fonts/";
+    WindowFonts::SavePng(WindowFonts::BuildTextFont(text), font_dir + "ffvii_en.png");
+    WindowFonts::SavePng(WindowFonts::BuildMenuFont(window), font_dir + "ffvii_menu.png");
+    WindowFonts::SavePng(WindowFonts::BuildDigitsFont(window), font_dir + "ffvii_digits.png");
+    WindowFonts::SavePng(WindowFonts::BuildTimerFont(window), font_dir + "ffvii_timer.png");
+    return true;
+}

+ 101 - 0
src/installer/extractors/MediaImageInstaller.h

@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+#include <string>
+#include "formats/lgp/LGPArchive.h"
+#include "installer/formats/BinGZipFile.h"
+#include "installer/formats/DiskImage.h"
+#include "installer/formats/TexFile.h"
+
+/**
+ * Installs the images of the interface and the fonts.
+ */
+class MediaImageInstaller{
+
+    public:
+
+        /**
+         * Constructor.
+         *
+         * @param[in] disk_image Disk image to extract the data from.
+         * @param[in] data_dir Directory of the installed game data.
+         * @param[in] keep_originals True to keep original data after conversion, false to remove.
+         */
+        MediaImageInstaller(
+          DiskImage& disk_image, const std::string& data_dir, const bool keep_originals
+        );
+
+        /**
+         * 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.
+         */
+        void InstallSprites();
+
+        /**
+         * Builds the font images from the textures in WINDOW.BIN and saves them in the "fonts" directory.
+         *
+         * The font XML files that describe them are part of the V-Gears data files. The fonts are always
+         * needed, so this doesn't depend on the images option.
+         *
+         * @return True if all the fonts were saved, false if WINDOW.BIN couldn't be read.
+         */
+        bool InstallFonts();
+
+    private:
+
+        /**
+         * Saves the images that are cut out of a texture.
+         *
+         * @param[in] tex The texture.
+         * @param[in] texture Name of the texture.
+         */
+        void SaveImages(TexFile& tex, const std::string& texture) const;
+
+        /**
+         * Saves the fonts of the digits and the timer, in every colour.
+         *
+         * @param[in] tex The texture that has them.
+         */
+        void SaveNumberFonts(TexFile& tex) const;
+
+        /**
+         * The disk image to read the original data from.
+         */
+        DiskImage& disk_image_;
+
+        /**
+         * Directory where the game data is installed (<install dir>/data/).
+         */
+        std::string data_dir_;
+
+        /**
+         * True to keep the original data once converted.
+         */
+        bool keep_originals_;
+
+        /**
+         * The menu.lgp file.
+         */
+        VGears::LGPArchive menu_;
+
+        /**
+         * The WINDOW.BIN file.
+         */
+        BinGZipFile window_;
+};

+ 204 - 0
src/installer/extractors/MusicInstaller.cpp

@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <algorithm>
+#include <cstdio>
+#include <fstream>
+#include <boost/algorithm/string.hpp>
+#include <boost/filesystem.hpp>
+#include <tinyxml.h>
+#include "common/File.h"
+#include "installer/extractors/MusicInstaller.h"
+#include "installer/steps/InstallLog.h"
+
+MusicInstaller::MusicInstaller(
+  DiskImage& disk_image, const std::string& data_dir, const bool keep_originals,
+  MediaConverter& converter
+):
+  disk_image_(disk_image), data_dir_(data_dir), keep_originals_(keep_originals),
+  converter_(converter),
+  midi_(VGears::LGPArchive(*disk_image.filePath("data/midi/midi.lgp"), "LGP"))
+{}
+
+int MusicInstaller::InstallMusicsInit(){
+    // Read the music index file.
+    std::ifstream music_idx(*disk_image_.filePath("data/music/music.idx"));
+    int i = 0;
+    std::string name;
+    if (music_idx.is_open()){
+        while (std::getline(music_idx, name)){
+            // Newlines are very likely WINDOWS/DOS format, but check them all.
+            boost::replace_all(name, "\r\n", "");
+            boost::replace_all(name, "\n", "");
+            boost::replace_all(name, "\r", "");
+            musics_map_[i] = name;
+            i ++;
+        }
+        music_idx.close();
+    }
+
+    // Load midi_
+    midi_.load();
+
+    processed_musics_ = 0;
+    return midi_.list(true, true)->size();
+}
+
+bool MusicInstaller::InstallMusics(){
+    VGears::LGPArchive::FileEntry f = midi_.GetFiles().at(processed_musics_);
+
+    // Find the index in the map.
+    int index = 1000 + processed_musics_;
+    for (auto const& m : musics_map_){
+        if (m.second + ".mid" == f.file_name){
+            index = m.first;
+            break;
+        }
+    }
+
+    File midi(*disk_image_.filePath("data/midi/midi.lgp"));
+
+    std::fstream out;
+    out.open(data_dir_ + "audio/music/" + std::to_string(index) + ".mid", std::ios::out);
+    midi.SetOffset(f.data_offset);
+    for (int j = 0; j < f.data_size; j ++) out << midi.readU8();
+    out.close();
+
+    // Convert to ogg (TiMidity + FFMpeg).
+    const std::string midi_path = data_dir_ + "audio/music/" + std::to_string(index) + ".mid";
+    const std::string ogg_path = data_dir_ + "audio/music/" + std::to_string(index) + ".ogg";
+    const bool keep = keep_originals_;
+    if (converter_.ToolsReady(true)){
+        // Converted in the background. The midi file is removed once it has been converted.
+        const std::string timidity = converter_.GetTimidityPath();
+        const std::string ffmpeg = converter_.GetFfmpegPath();
+        converter_.Run(
+          "music " + std::to_string(index),
+          [timidity, ffmpeg, midi_path, ogg_path](std::string* error){
+              return ExternalTools::ConvertMidiToOgg(timidity, ffmpeg, midi_path, ogg_path, error);
+          },
+          [midi_path, keep](){if (!keep) std::remove(midi_path.c_str());}
+        );
+    }
+    // Without the programs the midi file is the only copy of the track, so it stays.
+
+    musics_.push_back("audio/music/" + std::to_string(processed_musics_) + ".ogg");
+    processed_musics_ ++;
+    if (processed_musics_ == midi_.list(true, true)->size()) return true;
+    else return false;
+}
+
+void MusicInstaller::InstallHQMusics(){
+    // Four tracks are not MIDI files: they are the WAV files of DATA/MUSIC (HEART.WAV, SATO.WAV,
+    // SENSUI.WAV and WIND.WAV). The index of the music (MUSIC.IDX) says which track is each one, and
+    // they are installed as the other ones are, with the number of the track as the name. Without
+    // them tracks 14, 64, 87 and 96 are missing (the music of junair2, for example).
+    std::vector<std::string> hq_musics = {"heart", "sato", "sensui", "wind"};
+    for (const std::string& hq_music : hq_musics){
+        int index = -1;
+        for (auto const& m : musics_map_){
+            if (m.second == hq_music){
+                index = m.first;
+                break;
+            }
+        }
+        if (index < 0){
+            InstallLog::Get().Add("[WARNING] The music " + hq_music + " is not in the index of the music.");
+            continue;
+        }
+        if (!converter_.ToolsReady(false)) continue;
+        const std::string ffmpeg = converter_.GetFfmpegPath();
+        std::string upper = hq_music;
+        std::transform(upper.begin(), upper.end(), upper.begin(), ::toupper);
+        const std::unique_ptr<std::string> wav_path = disk_image_.filePath("data/music/" + upper + ".wav");
+        if (!wav_path || !boost::filesystem::exists(*wav_path)){
+            InstallLog::Get().Add("[WARNING] The file of the music " + hq_music + " was not found.");
+            continue;
+        }
+        const std::string wav = *wav_path;
+        const std::string ogg = data_dir_ + "audio/music/" + std::to_string(index) + ".ogg";
+        converter_.Run(
+          "high quality music " + hq_music,
+          [ffmpeg, wav, ogg](std::string* error){return ExternalTools::ConvertToOgg(ffmpeg, wav, ogg, error);}
+        );
+    }
+    // The index lists the tracks by their position, and the MIDI files are four less than the tracks:
+    // the last ones (94 to 97) were left out of it. A track with no file is not written to the index.
+    int last_id = 0;
+    for (auto const& m : musics_map_) last_id = std::max(last_id, m.first);
+    for (int id = static_cast<int>(musics_.size()); id <= last_id; ++ id)
+        musics_.push_back("audio/music/" + std::to_string(id) + ".ogg");
+}
+
+void MusicInstaller::WriteMusicsIndex(){
+    TiXmlDocument xml;
+    std::unique_ptr<TiXmlElement> container(new TiXmlElement("musics"));
+    for (int id = 0; id < musics_.size(); id ++){
+        std::string path = musics_[id];
+        // A track that could not be converted has no file, and listing it would make the game look for it.
+        if (!boost::filesystem::exists(data_dir_ + path)) continue;
+        std::unique_ptr<TiXmlElement> xml_music(new TiXmlElement("music"));
+        xml_music->SetAttribute("file_name", path);
+        xml_music->SetAttribute("name", id);
+        xml_music->SetAttribute("loop", "0");
+        switch (id){
+            case 1:
+                xml_music->SetAttribute("default", "initial");
+                break;
+            case 6:
+                xml_music->SetAttribute("default", "battle");
+                break;
+            case 9:
+                xml_music->SetAttribute("default", "boss");
+                break;
+            case 13:
+                xml_music->SetAttribute("default", "world_map");
+                break;
+            case 43:
+                xml_music->SetAttribute("default", "chocobo_battle");
+                break;
+            case 45:
+                xml_music->SetAttribute("default", "victory");
+                break;
+            case 46:
+                xml_music->SetAttribute("default", "airship");
+                break;
+            case 50:
+                xml_music->SetAttribute("default", "chocobo_ride");
+                break;
+            case 57:
+                xml_music->SetAttribute("default", "game_over");
+                break;
+            case 70:
+                xml_music->SetAttribute("default", "world_map_danger");
+                break;
+            case 84:
+                xml_music->SetAttribute("default", "submarine");
+                break;
+
+        }
+        container->LinkEndChild(xml_music.release());
+        // If there is a friendly name for this sound, add another entry
+        if (musics_map_.count(id) != 0){
+            std::unique_ptr<TiXmlElement> xml_music_name(new TiXmlElement("music"));
+            xml_music_name->SetAttribute("file_name", path);
+            xml_music_name->SetAttribute("name", musics_map_[id]);
+            xml_music_name->SetAttribute("loop", "0");
+            container->LinkEndChild(xml_music_name.release());
+        }
+    }
+    xml.LinkEndChild(container.release());
+    xml.SaveFile(data_dir_ + "audio/music/_musics.xml");
+}

+ 112 - 0
src/installer/extractors/MusicInstaller.h

@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+#include <string>
+#include <unordered_map>
+#include <vector>
+#include "formats/lgp/LGPArchive.h"
+#include "installer/extractors/MediaConverter.h"
+#include "installer/formats/DiskImage.h"
+
+/**
+ * Installs the music.
+ */
+class MusicInstaller{
+
+    public:
+
+        /**
+         * Constructor.
+         *
+         * @param[in] disk_image Disk image to extract the data from.
+         * @param[in] data_dir Directory of the installed game data.
+         * @param[in] keep_originals True to keep original data after conversion, false to remove.
+         * @param[in] converter Runs the audio conversions.
+         */
+        MusicInstaller(
+          DiskImage& disk_image, const std::string& data_dir, const bool keep_originals,
+          MediaConverter& converter
+        );
+
+        /**
+         * Prepares the installer for the sounds extraction.
+         *
+         * @return The total number of sounds to process.
+         */
+        int InstallMusicsInit();
+
+        /**
+         * Extracts the next music file contained in the midi.lgp, converts it and installs it.
+         *
+         * @return True if there are no more musics to extract, false otherwise.
+         */
+        bool InstallMusics();
+
+        /**
+         * Converts high quality musiscs to OGG.
+         *
+         * There are four of them.
+         */
+        void InstallHQMusics();
+
+        /**
+         * Writes the XML file with all music tracks.
+         */
+        void WriteMusicsIndex();
+
+    private:
+
+        /**
+         * The disk image to read the original data from.
+         */
+        DiskImage& disk_image_;
+
+        /**
+         * Directory where the game data is installed (<install dir>/data/).
+         */
+        std::string data_dir_;
+
+        /**
+         * True to keep the original data once converted.
+         */
+        bool keep_originals_;
+
+        /**
+         * Runs the audio conversions.
+         */
+        MediaConverter& converter_;
+
+        /**
+         * The midi.lgp file.
+         */
+        VGears::LGPArchive midi_;
+
+        /**
+         * Next track to extract.
+         */
+        int processed_musics_ = 0;
+
+        /**
+         * Map for music files with descriptive names.
+         */
+        std::unordered_map<int, std::string> musics_map_;
+
+        /**
+         * Sound data for each entry to write to the XML file
+         */
+        std::vector<std::string> musics_;
+};

+ 109 - 0
src/installer/extractors/SoundInstaller.cpp

@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <cstdio>
+#include <fstream>
+#include <iostream>
+#include <unordered_map>
+#include <boost/filesystem.hpp>
+#include <tinyxml.h>
+#include "installer/extractors/SoundInstaller.h"
+#include "installer/extractors/SfxDump.h"
+#include "installer/tables/SoundNames.h"
+
+const int SoundInstaller::TOTAL_SOUNDS = 750;
+
+SoundInstaller::SoundInstaller(
+  DiskImage& disk_image, const std::string& data_dir, const bool keep_originals,
+  MediaConverter& converter
+):
+  disk_image_(disk_image), data_dir_(data_dir), keep_originals_(keep_originals),
+  converter_(converter)
+{}
+
+int SoundInstaller::InstallSoundsInit(){
+    std::unique_ptr<std::string> fmt_path = disk_image_.filePath("data/sound/audio.fmt");
+    std::unique_ptr<std::string> data_path = disk_image_.filePath("data/sound/audio.dat");
+    std::string sound_dir =
+      (boost::filesystem::path(data_dir_) / "audio" / "sounds").string();
+
+    if (!fmt_path){
+        std::cerr << "MediaDataInstaller: could not find data/sound/audio.fmt in the selected game data."
+                  << std::endl;
+    }
+    else if (!data_path){
+        std::cerr << "MediaDataInstaller: could not find data/sound/audio.dat in the selected game data."
+                  << std::endl;
+    }
+    else if (SfxDumpConvert(fmt_path->c_str(), data_path->c_str(), sound_dir.c_str()) != 0){
+        std::cerr << "MediaDataInstaller: failed to convert FFVII sound effects."
+                  << std::endl;
+    }
+    processed_sounds_ = 0;
+    return TOTAL_SOUNDS;
+}
+
+bool SoundInstaller::InstallSounds(){
+    if (converter_.ToolsReady(false)){
+        const std::string wav = data_dir_ + "audio/sounds/" + std::to_string(processed_sounds_) + ".wav";
+        const std::string ogg = data_dir_ + "audio/sounds/" + std::to_string(processed_sounds_) + ".ogg";
+        std::ifstream file(wav);
+        if (file.is_open()){
+            file.close();
+            // Converted in the background. The wav file is removed once it has been converted.
+            const std::string ffmpeg = converter_.GetFfmpegPath();
+            const bool keep = keep_originals_;
+            converter_.Run(
+              "sound " + std::to_string(processed_sounds_),
+              [ffmpeg, wav, ogg](std::string* error){return ExternalTools::ConvertToOgg(ffmpeg, wav, ogg, error);},
+              [wav, keep](){if (!keep) std::remove(wav.c_str());}
+            );
+            sounds_.push_back("audio/sounds/" + std::to_string(processed_sounds_) + ".ogg");
+        }
+        else{
+            sounds_.push_back("audio/sounds/INVALID.ogg");
+        }
+    }
+    processed_sounds_ ++;
+    if (processed_sounds_ >= TOTAL_SOUNDS) return true;
+    else return false;
+}
+
+void SoundInstaller::WriteSoundIndex(){
+    std::unordered_map<int, const SoundName*> names;
+    for (const SoundName& name : SOUND_NAMES) names[name.id] = &name;
+    TiXmlDocument xml;
+    std::unique_ptr<TiXmlElement> container(new TiXmlElement("sounds"));
+    for (int id = 0; id < sounds_.size(); id ++){
+        std::string path = sounds_[id];
+        // A sound that could not be converted has no file, and listing it would make the game look for it.
+        if (path != "audio/sounds/INVALID.ogg" && !boost::filesystem::exists(data_dir_ + path)) continue;
+        std::unique_ptr<TiXmlElement> xml_sound(new TiXmlElement("sound"));
+        xml_sound->SetAttribute("file_name", path);
+        xml_sound->SetAttribute("name", id);
+        container->LinkEndChild(xml_sound.release());
+        // If there is a friendly name for this sound, add another entry
+        const auto found = names.find(id);
+        if (found != names.end() && found->second->name[0] != 0){
+            std::unique_ptr<TiXmlElement> xml_sound_name(new TiXmlElement("sound"));
+            xml_sound_name->SetAttribute("file_name", path);
+            xml_sound_name->SetAttribute("name", found->second->name);
+            xml_sound_name->SetAttribute("description", found->second->description);
+            container->LinkEndChild(xml_sound_name.release());
+        }
+    }
+    xml.LinkEndChild(container.release());
+    xml.SaveFile(data_dir_ + "audio/sounds/_sounds.xml");
+}

+ 98 - 0
src/installer/extractors/SoundInstaller.h

@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+#include <string>
+#include <vector>
+#include "installer/extractors/MediaConverter.h"
+#include "installer/formats/DiskImage.h"
+
+/**
+ * Installs the sound effects.
+ */
+class SoundInstaller{
+
+    public:
+
+        /**
+         * Constructor.
+         *
+         * @param[in] disk_image Disk image to extract the data from.
+         * @param[in] data_dir Directory of the installed game data.
+         * @param[in] keep_originals True to keep original data after conversion, false to remove.
+         * @param[in] converter Runs the audio conversions.
+         */
+        SoundInstaller(
+          DiskImage& disk_image, const std::string& data_dir, const bool keep_originals,
+          MediaConverter& converter
+        );
+
+        /**
+         * Prepares the installer for the sounds extraction.
+         *
+         * @return The total number of sounds to process.
+         */
+        int InstallSoundsInit();
+
+        /**
+         * Extracts the next sound file contained in the audio.dat file and installs it.
+         *
+         * @return True if there are no more sounds to extract, false otherwise.
+         */
+        bool InstallSounds();
+
+        /**
+         * Writes the XML file with all audio entries.
+         */
+        void WriteSoundIndex();
+
+    private:
+
+        /**
+         * Number of sound files to extract.
+         */
+        static const int TOTAL_SOUNDS;
+
+        /**
+         * The disk image to read the original data from.
+         */
+        DiskImage& disk_image_;
+
+        /**
+         * Directory where the game data is installed (<install dir>/data/).
+         */
+        std::string data_dir_;
+
+        /**
+         * True to keep the original data once converted.
+         */
+        bool keep_originals_;
+
+        /**
+         * Runs the audio conversions.
+         */
+        MediaConverter& converter_;
+
+        /**
+         * Next sound to extract.
+         */
+        int processed_sounds_ = 0;
+
+        /**
+         * Sound data for each entry to write to the XML file
+         */
+        std::vector<std::string> sounds_;
+};

+ 3 - 15
src/installer/steps/DataInstaller.cpp

@@ -84,9 +84,8 @@ const char* DataInstaller::StepGroup(int state){
         return "Field maps";
         return "Field maps";
     if (state == WM_MODELS) return "World map models";
     if (state == WM_MODELS) return "World map models";
     if (state >= WM_INIT && state <= WM_MAPS) return "World map";
     if (state >= WM_INIT && state <= WM_MAPS) return "World map";
-    if (state >= MEDIA_VIDEOS && state < FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT)
-        return "Videos";
-    if (state >= MEDIA_MUSICS_INIT && state < MEDIA_VIDEOS) return "Music";
+    if (state >= MEDIA_MUSICS_INIT && state < FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT)
+        return "Music";
     if (state >= MEDIA_SOUNDS_INIT && state < MEDIA_MUSICS_INIT) return "Sounds";
     if (state >= MEDIA_SOUNDS_INIT && state < MEDIA_MUSICS_INIT) return "Sounds";
     if (state == MEDIA_IMAGES) return "Images";
     if (state == MEDIA_IMAGES) return "Images";
     if (state >= KERNEL_PRICES && state < MEDIA_IMAGES) return "Kernel data";
     if (state >= KERNEL_PRICES && state < MEDIA_IMAGES) return "Kernel data";
@@ -247,7 +246,7 @@ float DataInstaller::Progress(){
             // Skip kernel data if option is set.
             // Skip kernel data if option is set.
             if (!options_.kernel){
             if (!options_.kernel){
                 write_output_line_("Skipping kernel data installation...", 2, true);
                 write_output_line_("Skipping kernel data installation...", 2, true);
-                installation_state_ = MEDIA_SOUNDS_INIT;
+                installation_state_ = MEDIA_IMAGES;
                 return CalcProgress();
                 return CalcProgress();
             }
             }
             write_output_line_("Parsing item and materia prices...", 2, true);
             write_output_line_("Parsing item and materia prices...", 2, true);
@@ -393,17 +392,6 @@ float DataInstaller::Progress(){
             // The index is written when the conversions, which run in the background, have finished.
             // The index is written when the conversions, which run in the background, have finished.
             installation_state_ = FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT;
             installation_state_ = FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT;
             return CalcProgress();
             return CalcProgress();
-        case MEDIA_VIDEOS:
-            // Skip videos if option is set.
-            if (!options_.videos){
-                write_output_line_("Skipping video installation...", 2, true);
-                installation_state_ = FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT;
-                return CalcProgress();
-            }
-            write_output_line_("Extracting videos...", 2, true);
-            media_installer_->InstallVideos();
-            installation_state_ = FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT;
-            return CalcProgress();
         case FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT:
         case FIELD_SPAWN_POINTS_AND_SCALE_FACTORS_INIT:
             // Skip fields if option is set.
             // Skip fields if option is set.
             if (!options_.fields && !options_.wm){
             if (!options_.fields && !options_.wm){

+ 0 - 5
src/installer/steps/DataInstaller.h

@@ -377,11 +377,6 @@ class DataInstaller{
              */
              */
             MEDIA_MUSICS_INDEX,
             MEDIA_MUSICS_INDEX,
 
 
-            /**
-             * Copies the FMV videos.
-             */
-            MEDIA_VIDEOS,
-
             /**
             /**
              * Initializer for {@see SPAWN_POINTS_AND_SCALE_FACTORS}.
              * Initializer for {@see SPAWN_POINTS_AND_SCALE_FACTORS}.
              */
              */

+ 223 - 0
src/installer/tables/MenuImages.h

@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+/**
+ * An image cut out of a texture of menu_us.lgp.
+ */
+struct MenuImage{
+
+    /**
+     * Name of the texture.
+     */
+    const char* texture;
+
+    /**
+     * Name of the image, in the folder of the interface images.
+     */
+    const char* image;
+
+    /**
+     * Position and size of the image in the texture.
+     */
+    unsigned int x, y, width, height;
+
+    /**
+     * Palette of the texture to use.
+     */
+    unsigned int palette;
+};
+
+/**
+ * An image made of two pieces of a texture, the second one at the right of the first.
+ */
+struct MenuImagePair{
+
+    /**
+     * Name of the texture.
+     */
+    const char* texture;
+
+    /**
+     * Name of the image, in the folder of the interface images.
+     */
+    const char* image;
+
+    /**
+     * Position of both pieces, their widths and their height, as used by TexFile::SavePng.
+     */
+    unsigned int x1, x2, y1, y2, width1, width2, height;
+
+    /**
+     * Palette of the texture to use.
+     */
+    unsigned int palette;
+};
+
+/**
+ * The images of the interface. If an image is listed twice, the last one is the one installed.
+ *
+ * The cursors of btl_win_b_h.tex are not used: they don't have shadows and are too narrow.
+ *
+ * TODO: Extract arena reels from coloa.tex, colob.tex and coloc.tex
+ */
+static const MenuImage MENU_IMAGES[] = {
+    // barre.tex
+    {"barre.tex", "characters/1.png", 0, 0, 83, 95, 0},
+    // bins.tex
+    {"bins.tex", "characters/7.png", 0, 0, 83, 95, 0},
+    // cido.tex
+    {"cido.tex", "characters/8.png", 0, 0, 83, 95, 0},
+    // cloud.tex
+    {"cloud.tex", "characters/0.png", 0, 0, 83, 95, 0},
+    // earith.tex
+    {"earith.tex", "characters/3.png", 0, 0, 83, 95, 0},
+    // ketc.tex
+    {"ketc.tex", "characters/6.png", 0, 0, 83, 95, 0},
+    // pcefi.tex
+    {"pcefi.tex", "characters/10.png", 0, 0, 83, 95, 0},
+    // pcloud.tex
+    {"pcloud.tex", "characters/9.png", 0, 0, 83, 95, 0},
+    // red.tex
+    {"red.tex", "characters/4.png", 0, 0, 83, 95, 0},
+    // tifa.tex
+    {"tifa.tex", "characters/2.png", 0, 0, 83, 95, 0},
+    // yufi.tex
+    {"yufi.tex", "characters/5.png", 0, 0, 83, 95, 0},
+    // buster.tex
+    {"buster.tex", "other/begin_menu.png", 0, 0, 150, 150, 0},
+    // choco.tex
+    {"choco.tex", "other/choco.png", 0, 0, 83, 95, 0},
+    // btl_win_c_l.tex
+    {"btl_win_c_l.tex", "icons/item_weapon_1.png", 192, 0, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_weapon_2.png", 224, 0, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_weapon_3.png", 192, 32, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_weapon_4.png", 224, 32, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_weapon_5.png", 192, 64, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_weapon_6.png", 224, 64, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_weapon_7.png", 192, 96, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_weapon_8.png", 224, 96, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_armor.png", 192, 128, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/item_accessory.png", 224, 128, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/status_2_0.png", 128, 188, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/status_2_1.png", 160, 188, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/status_2_2.png", 192, 188, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/status_2_3.png", 224, 188, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/status_7_0.png", 128, 219, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/status_7_1.png", 160, 219, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/status_7_2.png", 192, 219, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/status_7_3.png", 224, 219, 32, 32, 1},
+    {"btl_win_c_l.tex", "icons/pointer_gateway_0.png", 96, 160, 18, 12, 9},
+    {"btl_win_c_l.tex", "icons/pointer_gateway_1.png", 128, 160, 18, 12, 9},
+    {"btl_win_c_l.tex", "icons/pointer_gateway_2.png", 160, 160, 18, 12, 9},
+    {"btl_win_c_l.tex", "icons/pointer_gateway_3.png", 192, 160, 18, 12, 9},
+    {"btl_win_c_l.tex", "icons/pointer_gateway_4.png", 224, 160, 18, 12, 9},
+    {"btl_win_c_l.tex", "icons/pointer_ladder_0.png", 96, 160, 18, 12, 4},
+    {"btl_win_c_l.tex", "icons/pointer_ladder_1.png", 128, 160, 18, 12, 4},
+    {"btl_win_c_l.tex", "icons/pointer_ladder_2.png", 160, 160, 18, 12, 4},
+    {"btl_win_c_l.tex", "icons/pointer_ladder_3.png", 192, 160, 18, 12, 4},
+    {"btl_win_c_l.tex", "icons/pointer_ladder_4.png", 224, 160, 18, 12, 4},
+    {"btl_win_c_l.tex", "icons/battle_death.png", 64, 192, 64, 20, 2},
+    {"btl_win_c_l.tex", "window/b_t.png", 0, 192, 32, 16, 0},
+    {"btl_win_c_l.tex", "window/b_b.png", 32, 208, 32, 16, 0},
+    {"btl_win_c_l.tex", "window/b_l.png", 0, 224, 16, 32, 0},
+    {"btl_win_c_l.tex", "window/b_r.png", 48, 224, 16, 32, 0},
+    {"btl_win_c_l.tex", "window/c_tl.png", 0, 208, 16, 16, 0},
+    {"btl_win_c_l.tex", "window/c_tr.png", 16, 208, 16, 16, 0},
+    {"btl_win_c_l.tex", "window/c_bl.png", 32, 192, 16, 16, 0},
+    {"btl_win_c_l.tex", "window/c_br.png", 48, 192, 16, 16, 0},
+    // btl_win_a_h.tex
+    {"btl_win_a_h.tex", "icons/item_item.png", 192, 223, 32, 32, 1},
+    {"btl_win_a_h.tex", "icons/item_weapon_0.png", 220, 223, 32, 32, 1},
+    {"btl_win_a_h.tex", "icons/battle_bar.png", 32, 0, 76, 18, 1},
+    {"btl_win_a_h.tex", "icons/battle_limit.png", 112, 0, 48, 10, 1},
+    {"btl_win_a_h.tex", "icons/battle_hp.png", 160, 0, 28, 10, 1},
+    {"btl_win_a_h.tex", "icons/battle_mp.png", 192, 0, 30, 10, 1},
+    {"btl_win_a_h.tex", "icons/battle_barrier.png", 112, 16, 76, 10, 1},
+    {"btl_win_a_h.tex", "icons/battle_wait.png", 192, 16, 44, 10, 1},
+    {"btl_win_a_h.tex", "icons/battle_1.png", 130, 34, 10, 12, 1},
+    {"btl_win_a_h.tex", "icons/battle_2.png", 146, 34, 10, 12, 1},
+    {"btl_win_a_h.tex", "icons/battle_3.png", 162, 34, 10, 12, 1},
+    {"btl_win_a_h.tex", "icons/battle_4.png", 178, 34, 10, 12, 1},
+    {"btl_win_a_h.tex", "icons/battle_5.png", 194, 34, 10, 12, 1},
+    {"btl_win_a_h.tex", "icons/battle_mp_needed.png", 0, 40, 80, 24, 1},
+    {"btl_win_a_h.tex", "icons/battle_all.png", 240, 32, 16, 16, 7},
+    {"btl_win_a_h.tex", "icons/battle_x.png", 240, 16, 16, 16, 7},
+    {"btl_win_a_h.tex", "icons/materia_slot_no_growth.png", 224, 63, 24, 24, 1},
+    {"btl_win_a_h.tex", "icons/materia_slot_link.png", 227, 95, 14, 24, 1},
+    {"btl_win_a_h.tex", "icons/bt_up.png", 160, 70, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_down.png", 192, 70, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_right.png", 160, 102, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_left.png", 192, 102, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_3.png", 192, 134, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_2.png", 224, 134, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_6.png", 192, 166, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_8.png", 224, 166, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_9.png", 192, 198, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/bt_10.png", 224, 198, 26, 20, 7},
+    {"btl_win_a_h.tex", "icons/cursor_crossed.png", 80, 32, 48, 32, 7},
+    {"btl_win_a_h.tex", "icons/settings_music.png", 101, 131, 30, 30, 1},
+    {"btl_win_a_h.tex", "icons/settings_fx.png", 133, 131, 30, 30, 1},
+    // btl_win_b_h.tex
+    {"btl_win_b_h.tex", "icons/slash.png", 176, 0, 8, 16, 1},
+    {"btl_win_b_h.tex", "icons/battle_name.png", 0, 32, 52, 10, 1},
+    {"btl_win_b_h.tex", "icons/battle_status.png", 0, 48, 64, 10, 1},
+    {"btl_win_b_h.tex", "icons/battle_level.png", 144, 48, 52, 10, 1},
+    {"btl_win_b_h.tex", "icons/pointer_up.png", 198, 0, 22, 16, 1},
+    {"btl_win_b_h.tex", "icons/pointer_down.png", 230, 0, 22, 16, 1},
+    {"btl_win_b_h.tex", "icons/materia_slot.png", 0, 95, 24, 24, 1},
+    {"btl_win_b_h.tex", "icons/materia_1.png", 3, 67, 18, 18, 4},
+    {"btl_win_b_h.tex", "icons/materia_2.png", 3, 67, 18, 18, 5},
+    {"btl_win_b_h.tex", "icons/materia_3.png", 3, 67, 18, 18, 8},
+    {"btl_win_b_h.tex", "icons/materia_4.png", 3, 67, 18, 18, 9},
+    {"btl_win_b_h.tex", "icons/materia_5.png", 3, 67, 18, 18, 10},
+    {"btl_win_b_h.tex", "icons/materia_star_1.png", 32, 64, 23, 26, 4},
+    {"btl_win_b_h.tex", "icons/materia_star_2.png", 32, 64, 23, 26, 5},
+    {"btl_win_b_h.tex", "icons/materia_star_3.png", 32, 64, 23, 26, 8},
+    {"btl_win_b_h.tex", "icons/materia_star_4.png", 32, 64, 23, 26, 9},
+    {"btl_win_b_h.tex", "icons/materia_star_5.png", 32, 64, 23, 26, 10},
+    {"btl_win_b_h.tex", "icons/materia_star_empty_1.png", 32, 96, 23, 26, 4},
+    {"btl_win_b_h.tex", "icons/materia_star_empty_2.png", 32, 96, 23, 26, 5},
+    {"btl_win_b_h.tex", "icons/materia_star_empty_3.png", 32, 96, 23, 26, 8},
+    {"btl_win_b_h.tex", "icons/materia_star_empty_4.png", 32, 96, 23, 26, 9},
+    {"btl_win_b_h.tex", "icons/materia_star_empty_5.png", 32, 96, 23, 26, 10},
+    {"btl_win_b_h.tex", "icons/bt_1.png", 0, 134, 26, 20, 7},
+    {"btl_win_b_h.tex", "icons/bt_4.png", 32, 134, 26, 20, 7},
+    {"btl_win_b_h.tex", "icons/bt_5.png", 0, 166, 26, 20, 7},
+    {"btl_win_b_h.tex", "icons/bt_7.png", 32, 16, 26, 20, 7},
+    {"btl_win_b_h.tex", "icons/battle_inf.png", 36, 194, 26, 14, 7},
+    {"btl_win_b_h.tex", "icons/pointer_right.png", 4, 16, 10, 16, 7},
+    {"btl_win_b_h.tex", "icons/battle_bar_barriers.png", 64, 32, 76, 24, 1},
+    {"btl_win_b_h.tex", "icons/menu_bar.png", 16, 16, 126, 16, 1},
+    {"btl_win_b_h.tex", "reels/yeah.png", 64, 64, 64, 30, 11},
+    {"btl_win_b_h.tex", "reels/luck.png", 64, 98, 64, 30, 11},
+    {"btl_win_b_h.tex", "reels/hit.png", 128, 64, 64, 30, 11},
+    {"btl_win_b_h.tex", "reels/bar.png", 128, 97, 64, 30, 11},
+    {"btl_win_b_h.tex", "reels/miss.png", 192, 64, 64, 30, 11},
+    {"btl_win_b_h.tex", "reels/choso.png", 192, 98, 64, 30, 11},
+    // btl_win_b_l.tex
+    {"btl_win_b_l.tex", "icons/cursor.png", 192, 16, 48, 32, 1},
+    {"btl_win_b_l.tex", "icons/cursor_left.png", 144, 16, 48, 32, 1},
+    {"btl_win_b_l.tex", "icons/pointer_position.png", 0, 192, 32, 26, 1},
+};
+
+/**
+ * The images of the interface that are made of two pieces.
+ */
+static const MenuImagePair MENU_IMAGE_PAIRS[] = {
+    {"btl_win_c_l.tex", "icons/battle_recovery.png", 64, 64, 212, 232, 64, 36, 20, 4},
+    {"btl_win_a_h.tex", "icons/battle_time.png", 224, 162, 0, 16, 32, 14, 10, 1},
+};

+ 321 - 0
src/installer/tables/SoundNames.h

@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+/**
+ * The name of a sound effect of the game.
+ */
+struct SoundName{
+
+    /**
+     * Number of the sound.
+     */
+    int id;
+
+    /**
+     * Names of the sound. Several ones are separated by "|".
+     */
+    const char* name;
+
+    /**
+     * Where the sound is heard.
+     */
+    const char* description;
+};
+
+/**
+ * The sound effects that have a name or a description.
+ *
+ * Most of the data comes from https://forums.qhimm.com/index.php?topic=15786.0
+ *
+ * TODO: Fill this list with somewhat descriptive names.
+ */
+static const SoundName SOUND_NAMES[] = {
+    {0, "Cursor", "Cursor movement in windows and menus."},
+    {1, "Window|SaveReady", "Opening some windows, memory cards available on the save menu."},
+    {2, "Error|InvalidChoice", "Failure or error, selecting a greyed out option in a choice list."},
+    {3, "Back|Cancel", "Cancel button on choices, closing menus."},
+    {4, "Miss", "Hit miss during battle."},
+    {5, "Cure|Potion", "Cure spell or Potion during battle."},
+    {6, "HighPotion", "Hi-Potion during battle."},
+    {7, "Cure2|XPotion", "Cure2 or X-Potion during battle."},
+    {8, "Fire", "Fire spell."},
+    {9, "Fire2", "Fire 2 spell."},
+    {10, "Bolt", "Bolt spell."},
+    {11, "Bolt2|Thunder", "Bolt2 spell, sometimes thunder on fields (eg HoneyBee inn)."},
+    {12, "MagicPrep", "Light that envolves a character when casting magic, summon..."},
+    {13, "LeviathanWave", "Part of Leviathan summoning."},
+    {14, "GunHit", "Gun sound, heard on fields and battles."},
+    {15, "BarretShoot", "Barrets chain gun."},
+    {16, "LeviathanScream", "Part of Leviathan summoning."},
+    {17, "CloudHit", "Cloud sword hit."},
+    {19, "Grenade", "Grenade item in battle."},
+    {
+      20, "Ladder|BattleItem",
+      "Character grabbing a ladder on the fields, character reaching for an item during battle"
+    },
+    {21, "EnemyDeath", "When most enemies die."},
+    {22, "AeriCriticalHit", "Aeris staff critical hit."},
+    {23, "Ice", "Ice spell"},
+    {24, "Bite", "enemy bite-type attack, dogs or behemoths. Similar to 399."},
+    {25, "Flee", "Footsteps escaping from battle."},
+    {26, "CloudCriticalHit", "Cloud sword critical hit"},
+    {27, "FieldPunch", "Punch sound on fields."},
+    {28, "Ice3", "Ice3 spell."},
+    {29, "Demi", "Demi sound after dark matter launched."},
+    {31, "GateDecipher", "Part of Jessie opening the deciphered gate (second half)."},
+    {32, "MeteoStrike", "Tifas Meteo Strike limit."},
+    {33, "HealingWind", "Aeris Healing Wind limit."},
+    {34, "Punch", "Enemy punch-type attack"},
+    {35, "LimitAura", "Before any limit, the orange aura sound."},
+    {36, "ReactorCore", "Background ambient sound in deeper reactor areas."},
+    {37, "ReactorBackground", "Background ambient sound in less deep reactor areas."},
+    {38, "UnderwaterReactor", "Background ambient sound in the underwater reactor."},
+    {39, "BigShot", "Barrets Big Shot limit."},
+    {40, "SummonVanish", "When about to summon the party disappears."},
+    {41, "Elevator", "Elevator moving."},
+    {42, "BattleSwirl", "Sound during battle swirling before battles."},
+    {43, "ReelStop", "When a reel slot stops during battle (limits, arena...)"},
+    {44, "Load", "Loading game?"},
+    {45, "BarretCriticalHit", "Barrets critical gun hit."},
+    {46, "BarretMiss|StealMiss", "Barret missing hit, unsuccessful steal."},
+    {47, "BoostedJump", "Some kind of boosted jump, battles and/or fields?"},
+    {48, "SmokeShot", "Enemy Smoke shot (and similar) attacks."},
+    {49, "AerisHit", "Aeris staff hit."},
+    {50, "On", "Switching something on"},
+    {51, "GateUnlocked", "Part of Jessie opening the deciphered gate (second half)."},
+    {52, "TrainDoor", "Train door sound."},
+    {53, "ReinforcedDoor.", "Some reinforced doors. In reactors?"},
+    {54, "Jump", "Character jump on fields."},
+    {55, "Land", "Character landing after a jump on fields."},
+    {56, "Charge", "Enemy charge-type attack."},
+    {57, "Laser", "enemy laser-type attack."},
+    {58, "Beep", "Computer or machine beep sound."},
+    {59, "Alert", "Alarm sound."},
+    {60, "Computer|SetBomb", "operating some computers, setting Jessies bomb."},
+    {61, "Dodge", "Dodging an attack."},
+    {62, "Bio", "Bio spell."},
+    {63, "UNKNOWN63", ""},
+    {64, "Slow", "Slow spell."},
+    {65, "Berserk", "Berserk spell."},
+    {66, "Shell", "Shell spell."},
+    {67, "Wall", "Wall spell."},
+    {68, "Cure3|Elixir", "Cure3 or Elixir during battle."},
+    {69, "Bol3", "Bolt3 spell."},
+    {70, "Quake", "Quake spell."},
+    {71, "Reflect", "Reflect spell."},
+    {72, "Sleepel", "Sleepel spell."},
+    {73, "Demi3", "Demi 3 spell, after the dark matter is launched."},
+    {74, "Demi2", "Demi 2 spell, after the dark matter is launched."},
+    {75, "Comet", "Comet spell."},
+    {77, "Tornado", "tornado spell."},
+    {79, "DemiShot", "Demi/2/3, before 29, 74 or 73."},
+    {82, "Haste", "Haste spell."},
+    {83, "Silence", "Silence spell."},
+    {84, "Break", "Break spell."},
+    {85, "Bolt3", "Bolt3 spell. All?"},
+    {86, "Stop", "Stop spell."},
+    {87, "Quake3", "Quake3 spell."},
+    {89, "Bio2|Bio3", "Bio2 and Bio3 spells."},
+    {90, "Regen", "Regen spell."},
+    {91, "PoisonNull", "PoisonNull spell."},
+    {93, "Protect", "Protect spell."},
+    {94, "Wind", "Wind sound as background for some maps."},
+    {96, "Aparition", "Aparition of someone in fields?"},
+    {97, "SearchScope", "Guard Scorpion Search Scope attack."},
+    {98, "100Needles", "100 Needles enemy skill."},
+    {99, "Seed", "Enemy seed-type attack."},
+    {100, "BeamGun", "Enemy beam-gun-type attack."},
+    {103, "", "Rage"},
+    {104, "Enemy rage-type attack.", ""},
+    {106, "RedLight|EnemyFlash", "Jenovas Red Light attack, enemy Flash attack."},
+    {107, "TetraLaser", "Enemy TetraLaser (and similar) attacks."},
+    {108, "RedXIIIHit", "RedXIII attack hit."},
+    {109, "", "Unknown ambient sound."},
+    {110, "", "Unknown ambient sound."},
+    {111, "", "Unknown ambient sound."},
+    {112, "", "Unknown ambient sound."},
+    {113, "", "Unknown ambient sound."},
+    {114, "", "Unknown ambient sound."},
+    {115, "", "Unknown ambient sound."},
+    {116, "", "Unknown ambient sound."},
+    {117, "Slap", "Slapping sound. Tifa vs Scarlet?"},
+    {118, "Flush", "Enemy flush-type attack."},
+    {119, "DiamondFlash", "Enemy DiamondFlash attack. Diamond Weapon?"},
+    {121, "DoorOpen", "Door opening"},
+    {122, "VincentHit", "Vincent gun hit."},
+    {124, "Fascination", "Enemy Fascination attack."},
+    {125, "Drain|VampireTooth", "Drain spell, probably Vampire Tooth?"},
+    {126, "DeBarrier", "DeBarrier spell."},
+    {127, "Resist", "Resist spell."},
+    {128, "WhiteWind", "White Wind enemy skill."},
+    {129, "MatraMagic", "Matra magic enemy skill."},
+    {130, "FlyingSickle", "Enemy Flying Sickle (and similar) attacks."},
+    {131, "Drums", "Sound of drums, when chocobo race prices are about to be revealed."},
+    {132, "Fall", "Falling sound."},
+    {133, "Despell", "Despell spell."},
+    {134, "Faint", "Fainting sound."},
+    {135, "NibelBurning", "Nibelheim burning sound."},
+    {137, "InkAttack", "Enemy Ink (and similar) attacks."},
+    {138, "Esuna", "Esuna spell."},
+    {139, "Beta", "Beta enemy skill."},
+    {141, "Fire3", "Fire3 spell."},
+    {142, "JunonAlarm", "Junon alarm."},
+    {143, "Electricity.", "Electricity effect, for example, in Sector 8 after bombing."},
+    {144, "BarrelLand", "Barrel landing effect in Sector 5 church."},
+    {145, "BarrelRoll", "Barrel rolling effect in Sector 5 church."},
+    {147, "Comet2", "Comet2 spell."},
+    {148, "Ailment", "Status ailment inflicted."},
+    {149, "Sensor", "Sensors or lasers on some fields, like the red ones blocking the party on the plate."},
+    {150, "TV", "Television transmitting."},
+    {151, "AribusterExplode", "Airbuster explosion on the field?"},
+    {152, "CorneoSurprise", "Don Corneo surprised?"},
+    {153, "Train", "Train running."},
+    {154, "FrogSong", "Frog Song enemy skill."},
+    {155, "MagicBreath", "MagicBreath enemy skill."},
+    {156, "AquaLung", "AquaLung enemy skill, and some similar enemy attacks."},
+    {157, "GoblinPunch", "Goblin Punch enemy skill."},
+    {158, "PresidentSteps", "President ShinRa footsteps on Reactor 5."},
+    {159, "Trine", "Trine enemy skill."},
+    {160, "PresidentFinger", "President ShinRa fingersnap."},
+    {161, "BadBreath1", "First part of Bad Breath enemy skill."},
+    {162, "BadBreath2", "Second part of Bad Breath enemy skill."},
+    {163, "MagicHammer", "MagicHammer enemy skill."},
+    {164, "Elevator2", "Other type of elevator: flipper, prison."},
+    {167, "RunLoud", "Loud footsteps running, like Barrets."},
+    {168, "Fire3All", "Fire3 spell, all targets."},
+    {169, "DrainingTentacles", "Enemy Draining Tentacles (and similar) attacks."},
+    {170, "Coin", "Coin sound. In fields, when somebody is paid, a coin inserted..."},
+    {171, "Impact", "Some kind of impact?"},
+    {173, "Monitor", "Some kind of monitor?"},
+    {175, "ColdBreath", "Enemy Cold Breath attack."},
+    {176, "Mini", "Mini spell."},
+    {177, "PoisonBreath", "Enemy poison breath attack."},
+    {179, "WardDoor", "WardDoor?"},
+    {180, "ElevatorRing", "Elevator button ring."},
+    {181, "RedCaravan", "Red caravan?"},
+    {182, "MansionDoor", "Door in mansion?"},
+    {183, "TrainWhistle", "Train whistle sound."},
+    {184, "IceCubes", "Ice cubes?"},
+    {185, "Refuse", "Enemy Refuse attack."},
+    {186, "Shake", "Shake effect, like Tifa shaking a drink."},
+    {189, "Curtain", "Curtain slipping, as in the dress shop in Wall Market."},
+    {190, "MateriaGlow", "Materia glow effect."},
+    {191, "Helicopter", "Helicopters on fields"},
+    {192, "Unlock", "Some king of unlock sound."},
+    {193, "Birdies", "Birdies of Mt. Corel, up close"},
+    {194, "Boulder", "Boulder rolling."},
+    {196, "Chirping", "Birds chirping in Mt. Corel heard from the tracks."},
+    {197, "Appear", "Someone is appearing?"},
+    {198, "BreakOpen", "Break open sound?"},
+    {199, "AirBuster", "AirBuster humming sound?"},
+    {202, "Collapse", "Collapsing, as in the Great glacier."},
+    {204, "BiggsThrown", "Biggs thrown away by Barret in the hideout."},
+    {206, "SaveLaunched", "Game loaded?"},
+    {208, "TrainIgnite", "Train ignition sound."},
+    {215, "JunonElevator", "Elevator in Junon. Which one?"},
+    {216, "Leap", "A leap?"},
+    {217, "Snoring", "People snoring in fields."},
+    {218, "TentacleHit", "enemy tentacle hit, ie: The dogs with a tentacle."},
+    {222, "PunchCritical", "Enemy punch-type critical attack."},
+    {223, "Claw", "Enemy claw-type attack."},
+    {224, "Horn", "Enemy horn-type attack."},
+    {225, "Sting", "enemy sting-type attack."},
+    {230, "", "RapidMove"},
+    {231, "Like Cloud dodging Barret in 7th Heaven.", ""},
+    {232, "WaterGun", "Enemy water gun and similar attacks."},
+    {233, "Crazy", "When Cloud loses his mind."},
+    {239, "Crowd", "Crowd yelling, as in the Junon Parade."},
+    {241, "UnderwaterElevator", "Junon underwater reactor elevator."},
+    {242, "HiTechDoor", "Some hi-tech door. Hojos lab?"},
+    {243, "", "Moogle"},
+    {244, "Moogle Kupo sound", "Bark"},
+    {245, "Dog barking on the fields.", ""},
+    {247, "BigBomber", "Enemy Big Bomber and similar attacks."},
+    {248, "DoorClose", "Some door closing?"},
+    {249, "Shower", "Shower sound on the fields."},
+    {250, "Price", "Winning a price, like in Gold Saucer."},
+    {253, "Chest", "Treasure chest opening"},
+    {254, "Clothes", "Changing clothes."},
+    {260, "MenuCure", "Curing while on the menu, magic or items."},
+    {261, "Buy", "Buying something in shops."},
+    {262, "PlanetCry", "Cry of the planet."},
+    {263, "LifeStreamExit", "When Cloud exits the LifeStream?"},
+    {264, "Springs", "Springs in battle? in the Great Glacier?"},
+    {266, "MachineReact", "Some machine reacting."},
+    {269, "LongGunning", "When Barrett aims at the ruins of Sector 7. Identical to 304."},
+    {271, "VincentCriticalHit", "Vincent gun critical hit."},
+    {272, "ChocoboSad", "Chocobo battle sad sound."},
+    {273, "chocoboHappy", "Chocobo battle happy sound."},
+    {274, "ChocoboAngry", "Chocobo battle angry sound."},
+    {276, "RubyFlameThrower", "Ruby Weapon Flame Thrower attack."},
+    {278, "BeamGun2", "Part of an enemy beam gun attack?"},
+    {280, "JunonElevatorAlt", "Another elevator at Junon?"},
+    {288, "SouthernCross", "Enemy Southern Cross attack."},
+    {289, "TifaHit", "Tifa hit sound."},
+    {290, "Somersault", "Tifas Somersault limit"},
+    {301, "DragonForce", "Dragon Force enemy skill."},
+    {303, "Tsunami", "Enemy Sewer Tsunami (and similar) attacks."},
+    {304, "LongGunningAlt", "When Barrett aims at the ruins of Sector 7. Identical to 269."},
+    {307, "Ultima", "Ultima spell."},
+    {338, "", "Masamune"},
+    {339, "Masamune sound?", ""},
+    {342, "YuffieHit", "Yuffie shuriken hit."},
+    {345, "LenoHit", "Leno rod hit."},
+    {347, "TifaCriticalHit", "Tifa critical hit."},
+    {356, "SavePoint", "Save point sound."},
+    {357, "Obtain", "Obtained something."},
+    {358, "DeathForce", "Death Force enemy skill."},
+    {362, "", "Shield"},
+    {363, "Shield spell.", ""},
+    {365, "BigGuard", "Big Guard enemy skill."},
+    {366, "Heartbeat", "ShinRa mansion heartbeat background effects. Heard in other places too."},
+    {368, "BladeBeam", "Clouds Blade Beam limit."},
+    {369, "FlareFirst", "First part of the Flare spell."},
+    {370, "FlareSecond", "Second part of the flare spell."},
+    {373, "MasamuneField", "The masamune used on fields."},
+    {374, "DemonLaugh", "Demon laugh heard on Gold Saucer."},
+    {376, "InnkeeperScream", "Gold Saucer innkeeper scream."},
+    {378, "Ocean", "Ocean sound?"},
+    {379, "PhoenixTail", "Phoenix Tail used in battle."},
+    {381, "LimitLearned", "4th limit level learned."},
+    {389, "AirBusterBreak", "AirBuster malfunction sound."},
+    {400, "Whistle", "Heard when practicing for Junon parade."},
+    {402, "Sonar", "Submarine sonar."},
+    {420, "Life2", "Life2 spell."},
+    {438, "Applauses", "Applauses effect."},
+    {444, "MenuEquip", "Equipping something in menus."},
+    {445, "BossDeath", "A boss dying."},
+    {447, "Announcement.", "Anouncement sound, ie Gold Saucer PA calling jockeys."},
+    {448, "PHS", "PHS ringing."},
+    {449, "Freeze", "Freeze spell."},
+    {452, "Meow", "Meow spell."},
+    {455, "SadDog", "Sad dog sound."},
+    {464, "Slots", "Slots rolling."},
+    {465, "Truck", "A truck like the one Cloud and Zack ride."},
+    {485, "Point", "Earning points/GP."},
+    {506, "Do", "Piano Do note."},
+    {507, "Re", "Piano Re note."},
+    {508, "Mi", "Piano Mi note."},
+    {509, "Fa", "Piano Fa note."},
+    {510, "Sol", "Piano Sol note."},
+    {511, "La", "Piano La note."},
+    {512, "Si", "Piano Si note."},
+    {513, "DoP", "Piano Do up note."},
+    {514, "SolP", "Piano Sol up note."},
+    {515, "LaP", "Piano La up note."},
+    {516, "SiP", "Piano Si up note."},
+};