; Copyright 2017 Ancestral Ghost / Wiwiland.net
; Updates by Daneel53
;
; Redistribution and use in source and binary forms, with or without modification,
; are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation and/or
; other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
; IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.

[Setup]
AppId=PFDSetup
AppName=Projet French Daggerfall (PFD)
AppVersion=0.34.0
VersionInfoVersion=0.34.0
DisableWelcomePage=no
AppPublisher=Wiwiland.net
VersionInfoCopyright=Wiwiland.net
AppPublisherURL=http://wiwiki.wiwiland.net/index.php/Daggerfall_:_Le_Projet_French_Daggerfall
AppSupportURL=http://wiwiki.wiwiland.net/index.php/Daggerfall_:_Le_Projet_French_Daggerfall
AppUpdatesURL=http://wiwiki.wiwiland.net/index.php/Daggerfall_:_Le_Projet_French_Daggerfall
DefaultDirName={code:GetInstallPath}
DisableDirPage=no
DirExistsWarning=yes
AlwaysShowDirOnReadyPage=yes
DefaultGroupName=Projet French Daggerfall
AllowNoIcons=yes
OutputBaseFilename=PFDSetup-0.34.0
SetupIconFile=DAGGER.ICO
Compression=lzma2/ultra
SolidCompression=yes
WizardImageFile=164x314.bmp
WizardSmallImageFile=55x58.bmp
VersionInfoDescription=The Elder Scrolls II Daggerfall French translation
VersionInfoProductName=PFD
VersionInfoProductVersion=0.34.0
AllowRootDirectory=True
EnableDirDoesntExistWarning=True
; During generation tests, output the setup into a RamDisk
OutputDir=R:\Output

[Languages]
Name: FR; MessagesFile: compiler:Languages\French.isl

[Types]
Name: "compact"; Description: "{code:CompactInstall}"
Name: "full"; Description: "{code:FullInstall}"
Name: "custom"; Description: "{code:CustomInstall}"; Flags: iscustom

[Code]
function FullInstall(Param : String) : String;
begin
  result := SetupMessage(msgFullInstallation);
end;

function CustomInstall(Param : String) : String;
begin
  result := SetupMessage(msgCustomInstallation);
end;

function CompactInstall(Param : String) : String;
begin
  result := SetupMessage(msgCompactInstallation);
end;

(* Détermine le répertoire d'installation de Daggerfall *)
function GetInstallPath(Param: String): String;
  var
    Path: String;
  Begin
    if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{75118CF3-44B5-411A-B3DD-C10432217693}', 'InstallLocation', Path) then
      (* Jeu déjà installé : The Elder Scrolls Anthology *)
      begin
        Insert('\DF\DAGGER', Path, Length(Path))
        Result := Path
      end  
    else if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\GOG.com\Games\1435829353', 'PATH', Path) then
      (* Jeu déjà installé via GOG Galaxy / GOG.COM *) 
      Result := Path
    else if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DaggerfallSetup_is1', 'Inno Setup: App Path', Path) then
      (* Jeu déjà installé par DaggerfallSetup *)
      (* On 64 bits OS the key is found in HKLM\SOFTWARE\WOW6432Node\Microsoft\... *)
      (* The above RegQueryStringValue works anyway because Windows does automatically the indirection to WOW6432Node on 64 bits OS *) 
      Result := Path  
    else
      (* Aucune installation de Daggerfall n'a été détectée *)
      (* On propose le chemin par defaut du Daggerfall original *)
      begin
        MsgBox('Aucune installation de Daggerfall détectée', mbInformation, MB_OK)
        (* Debug dir d'installation sur R: *)
        (* Result := 'R:\Daggerfall'; *)
        (* Dir d'installation par défaut sur C: *)
        Result := 'C:\Dagger';
      end;
end;

[Components]
Name: Main; Description: Projet French Daggerfall (basé sur Daggerfall 2.13 édition CompUSA), par Aggelon, ELOdry, Ferital & Daneel53; Types: full compact custom; Flags: Fixed
Name: NomsPropres; Description: Type de traduction.; Types: full compact custom;
Name: NomsPropres\VO; Description: Conserver les noms anglais (régions, villes...) des Elder Scrolls en VO; Types: full compact custom; Flags: Exclusive
Name: NomsPropres\VF; Description: [Partiel...] Utiliser les noms des traductions françaises officielles de Morrowind et ES suivants); Flags: Exclusive
Name: ExtraQuests; Description: Packs de quêtes non officiels; Types: full compact custom
Name: ExtraQuests\LiveByTheSword; Description: Live By The Sword par GhanBuriGhan : 5 quêtes pour la Guilde des Guerriers; Types: full
Name: ExtraQuests\XtraQuest; Description: XtraQuest 1, 2, 3, SE, Patch par SkeletonMan : 40 quêtes; Types: full
Name: ExtraQuests\FixedQuests; Description: FixedQuests par Donald Tipdon, nouvelles quêtes : 5 quêtes pour la Guilde des Voleurs; Types: full
;Name: ExtraQuests\QuestPack1A; Description: [Prochainement...] Pack #1A : Mages Guild par Azileron : 7 quêtes pour la Guilde des Mages; Flags: Fixed
Name: Fixes; Description: Correctifs non officiels Inclus en version française; Types: full compact custom; Flags: Fixed
Name: Fixes\FixedQuests ; Description: FixedQuests par Donald Tipdon, Correctifs : Correctif de quêtes; Types: full compact custom; Flags: Fixed
Name: Fixes\Dfqfix; Description: DFQFIX 3.3 par PLRDLF : Correctif de quêtes; Types: full compact custom; Flags: Fixed
Name: Fixes\Q0C00Y03 ; Description: Q0C00Y03 Fix par GhanBuriGhan : Correctif d'une quête; Types: full compact custom; Flags: Fixed
Name: Fixes\SPELL ; Description: SPELL.STD par Nwart : Correctif du sort de diminution; Types: full compact custom; Flags: Fixed
Name: Fixes\Factfix; Description: FACTIONFIX 1.2 par  PLRDLF : Correctif des factions; Types: full compact custom; Flags: Fixed
Name: Fixes\DFBIOGFIX; Description: DFBIOGFIX 1.2 par Deepfighter : Correctif des fichiers de biographies; Types: full compact custom; Flags: Fixed
Name: Fixes\DagSkills; Description: DagSkills 0.96 par Ferital & Daneel53 : Correctif de l'augmentation des compétences et attributs; Types: full compact custom; Flags: Fixed
Name: Fixes\MagicDef; Description: MAGIC.DEF par DelphiSnake : Correctif de sorts; Types: full compact custom; Flags: Fixed
Name: Fixes\HammerFix; Description: Hammerfell NPC Fix par Ferital : Correctif des NPC dans Hammerfell + textures des Dragontail Mountains; Types: full compact custom; Flags: Fixed
Name: Fixes\DOS32A; Description: DOS32 Advanced DOS Extender 9.1.2 by Narech K. : Permet d'éviter les corruptions de sauvegardes; Types: full compact custom; Flags: Fixed

[Files]    
Source: Fichiers\Sauvegarde\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: Fichiers\Docs\*; DestDir: {app}\Docs; Flags: ignoreversion recursesubdirs createallsubdirs
Source: {app}\FALL.EXE; DestDir: {app}\BackUp; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\*.QRC; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\*.QBN; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\*.IMG; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\*.TXT; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall recursesubdirs createallsubdirs
Source: {app}\ARENA2\TEXTURES.073; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\TEXTURES.333; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\BUTTONS.RCI; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\MAGIC.DEF; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\MAPS.BSA; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\MONSTER.BSA; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\POLITIC.PAK; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\SPELLS.STD; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\TEXT.RSC; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\FLATS.CFG; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\DAG2.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0000.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0001.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0002.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0004.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0005.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0006.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0007.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0008.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0009.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0010.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0013.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0014.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: {app}\ARENA2\ANIM0015.VID; DestDir: {app}\BackUp\ARENA2; Flags: external skipifsourcedoesntexist uninsneveruninstall
Source: Fichiers\QBN\Main\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: Fichiers\QBN\LiveByTheSword\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: ExtraQuests\LiveByTheSword
Source: Fichiers\QBN\XtraQuest\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: ExtraQuests\XtraQuest
Source: Fichiers\QBN\FixedQuests\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: ExtraQuests\FixedQuests
;Source: Fichiers\QBN\QuestPack1A\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: ExtraQuests\QuestPack1A
Source: Fichiers\NomsPropresVO\Main\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: Fichiers\NomsPropresVO\LiveByTheSword\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: ExtraQuests\LiveByTheSword
Source: Fichiers\NomsPropresVO\XtraQuest\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: ExtraQuests\XtraQuest
Source: Fichiers\NomsPropresVO\FixedQuests\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: ExtraQuests\FixedQuests
;Source: Fichiers\NomsPropresVO\QuestPack1A\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: ExtraQuests\QuestPack1A
Source: Fichiers\NomsPropresVF\Main\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Components: NomsPropres\VF

[Run]
Filename: "http://wiwiki.wiwiland.net/index.php?title=Daggerfall_:_Le_Projet_French_Daggerfall"; Flags: shellexec runasoriginaluser postinstall; Description: "Page internet du Projet French Daggerfall"

[InstallDelete]
Type: files; Name: {app}\ARENA2\books\BOK10000.TXT

[UninstallRun]
Filename: {app}\PFDR.BAT; Flags: runhidden nowait
