;; INSTALIT SCRIPT TEMPLATE FILE STANDARD.STF
;;  Compatible with:  INSTALIT/D/B version 3.0 and higher
;;  Incompatible with:  INSTALIT/P (uses DefineVariables), INSTALIT/W
;;  Shipped as script version 1.0

;;  Designed for general use with products a singloffering two optional
;;  modules and possibly requiring basic changes to AUTOEXEC.BAT
;;  and/or CONFIG.SYS.  Reads a Script Data File in order to adapt
;;  to the job at hand.

DefineVariables

Logical [InstalledFlag] := NoCharacter
Logical [SoundFlag] := NoCharacter
Logical [DigitalFX] := NoCharacter
Text [GraphicsCard]
Text [CPUType]
Text [MainMemory]
Text [EMSVersion]
Text [EMSMemory]
Number [MainMemorynum]
Number [EMSMemoryUsable]
Text [CurrentSpeedSetting]
Text [RecSpeedSetting]
Text [CurrentSoundCard]
Text [RecSoundCard]
Number [CurrentSoundCardNum]
Number [RecSoundCardNum]
Number [RecMainMemory]
Number [ReqMainMemory]
Number [EMSMainMemRec]
Number [EMSMainMemReq]
Number [EMSDigitalRec]
Number [EMSDigitalReq]
Number [NoEMSMainMemRec]
Number [NoEMSMainMemReq]
Text [DriverName]

EndDefineVariables


[EMSMainMemRec] := 530
[EMSMainMemReq] := 500

[EMSDigitalRec] := 550
[EMSDigitalReq] := 550

[NoEMSMainMemRec] := 588
[NoEMSMainMemReq] := 558

[DriverName] := adl_w220.ims

;;;;;;
;;
;; Begin Script
;;
;;;;;;

[InstallationDirectory] := CurrentDirectory

If TotalSpaceOnDrive [InstallFromDrive] > 4000000
  [InstalledFlag] := YesCharacter
else
  [InstalledFlag] := NoCharacter
  ChangeDirectoryTo [InstallFromDrive]:\
Endif

Do SetupInstalit

ClearScreen

Do CheckSystem

:mainmenu

ClearScreen

Do ShowSystemSummary

GetMenuChoice @xy(Center,12) UseHeader "MAIN MENU"
  Install TIE Fighter Demo from Floppy Disks
    ;Copies the TIE Fighter demo from the floppy disks onto your
    ;Hard Disk drive.
  Set Sound Board Configuration
    ;Allows you to select the sound board you would like to
    ;use with the TIE Fighter demo program.
  Set Machine Speed
    ;Allows you to select the speed rating that the TIE fighter demo
    ;assumes for your computer.
  Read the READ.ME file
    ;Allows you to read the file READ.ME which contains important
    ;information about installing and playing the TIE Fighter demo.
  Read the FLIGHT.HLP file
    ;Allows you to read the file FLIGHT.HLP which contains instructions
    ;on how to play the TIE Fighter demo.
  Exit
    ;Exits this program and returns to the DOS prompt.
EndGetMenuChoice

InCase choice is
  =1:  Do InstallXwing
  =2:  Do SetSoundBoard
  =3:  Do SetMachineSpeed
  =4:  Do ShowReadMe
  =5:  Do ShowKeys
  =6:  Do ExitInstallation
EndInCase

GoTo mainmenu



Procedure InstallXwing

  QueAllFiles

  DetermineInstallationDrive QueSize RequireFixed

  [InstallationDirectory] := InstallationDrive:\TIEDEMO

  DetermineInstallationDirectory QueSize

  OpenCopyWindow

  CopyFiles
    READ.ME
    FLIGHT.HLP
    INSTALL.EXE
    DETECT.EXE
  EndCopyFiles

  CloseCopyWindow

  GetQuedFiles ShowJustOne
  
  If QueSize <> 0  ;; Some files were selected but not installed if <> 0
    UnqueAllFiles  ;; Remove uninstalled files from que
    Dialog PressAKey WhiteOnRed UseHeader "Installation Failed"
      Install failed to copy all of the files necessary to
      run the TIE Fighter demo.  The TIE Fighter demo will not run.
    EndDialog
    ForceError
    SoLong
  else
    [InstalledFlag] := YesCharacter
  Endif

EndProcedure



Procedure SetSoundBoard

;;  Dialog [YesOrNo1] WhiteOnRed UseHeader "Sound Card Warning"
;;    WARNING! Manual selection of a sound card may lead to 
;;    unpredictable results.  Also, low memory conditions may
;;    cause the selection made here to be ignored.  For further
;;    information please read the file READ.ME.
;;
;;    Are you sure you want to manually select a sound card?
;;  EndDialog

  [YesOrNo1] := YesCharacter

  ClearScreen
  If [YesOrNo1] = YesCharacter

    [DriverName] := adl_w220.ims
    [DigitalFX] := YesCharacter

    GetMenuChoice UseHeader "SOUND CARD MENU"
      AdLib and compatibles
        ;Selects AdLib synthesized music and sound effects.
        ;No digitized speech or sound.
      Roland
        ;Selects Roland synthesized music and sound effects.
        ;No digitized speech or sound.
      General MIDI (GMIDI)
        ;Selects General MIDI synthesized music and sound effects.
        ;No digitized speech or sound.
      SoundBlaster
        ;Selects AdLib synthesized music and sound effects,
        ;with digitized speech.
      SoundBlaster Pro and compatibles
        ;Selects AdLib synthesized music and sound effects,
        ;with digitized sound effects and speech.
      Roland with SoundBlaster
        ;Selects Roland synthesized music and sound effects,
        ;with digitized sound effects and speech played
        ;through the SoundBlaster card.
      General MIDI with SoundBlaster
        ;Selects General MIDI synthesized music and sound effects,
        ;with digitized sound effects and speech played
        ;through the SoundBlaster card.
      Select I/O Port Address for SoundBlaster
        ;Allows you to select an I/O port other than the default of
        ;220 for your SoundBlaster or compatible.
      No Sound
        ;No music or sound effects.
      Exit
        ;Return to the Main Installation Menu.
    EndGetMenuChoice
    
    InCase choice is
      =1:  [CurrentSoundCard] := AdLib
           [CurrentSoundCardNum] := 1
           [SoundFlag] := YesCharacter
      =2:  [CurrentSoundCard] := Roland
           [CurrentSoundCardNum] := 2
           [SoundFlag] := YesCharacter
      =3:  [CurrentSoundCard] := GMIDI
           [CurrentSoundCardNum] := 3
           [SoundFlag] := YesCharacter
      =4:  [CurrentSoundCard] := SoundBlaster
           [CurrentSoundCardNum] := 4
           [SoundFlag] := YesCharacter
           [DigitalFX] := NoCharacter
      =5:  [CurrentSoundCard] := SoundBlaster
           [CurrentSoundCardNum] := 4
           [SoundFlag] := YesCharacter
      =6:  [CurrentSoundCard] := Roland with SoundBlaster
           [CurrentSoundCardNum] := 5
           [SoundFlag] := YesCharacter
      =7:  [CurrentSoundCard] := GMIDI with SoundBlaster
           [CurrentSoundCardNum] := 6
           [SoundFlag] := YesCharacter
      =8:  Do SelectPort
      =9:  [CurrentSoundCard] := No Sound
           [CurrentSoundCardNum] := 0
           [SoundFlag] := YesCharacter

    EndInCase

    If [EMSMemoryUsable] <= 64
      [RecMainMemory] := [NoEMSMainMemRec]
      [ReqMainMemory] := [NoEMSMainMemReq]
      If [MainMemorynum] < [NoEMSMainMemRec]
        Do LowMemory
      Endif
    else
      [RecMainMemory] := [EMSMainMemRec]
      [ReqMainMemory] := [EMSMainMemReq]
      If [MainMemorynum] < [EMSMainMemRec]
        Do LowMemory
      Endif
      If [EMSMemoryUsable] >= 256
        If [CurrentSoundCardNum] > 3
          [RecMainMemory] := [EMSDigitalRec]
          [ReqMainMemory] := [EMSDigitalReq]
        Endif
      Endif
    Endif

    If [CurrentSoundCardNum] > 3
      If [EMSMemoryUsable] < 256
        Do NoBlasterEMS
      else
        If [MainMemorynum] < [EMSDigitalRec]
          Do NoBlasterMain
        Endif
      Endif
    Endif

  Endif

EndProcedure



Procedure SelectPort

  GetMenuChoice UseHeader "SELECT I/O PORT ADDRESS"
    Default: 220
      ;This is the default I/O port address.
    I/O Port 210
      ;Select this option if your sound card uses I/O Port 210.
    I/O Port 230
      ;Select this option if your sound card uses I/O Port 230.
    I/O Port 240
      ;Select this option if your sound card uses I/O Port 240.
    I/O Port 250
      ;Select this option if your sound card uses I/O Port 250.
    I/O Port 260
      ;Select this option if your sound card uses I/O Port 260.
  EndGetMenuChoice

  InCase choice is
    =1:  [DriverName] := adl_w220.ims
    =2:  [DriverName] := adl_w210.ims
    =3:  [DriverName] := adl_w230.ims
    =4:  [DriverName] := adl_w240.ims
    =5:  [DriverName] := adl_w250.ims
    =6:  [DriverName] := adl_w260.ims
  EndInCase

  If [InstalledFlag] = YesCharacter
    ChangeDirectoryTo [InstallationDirectory]
    CopyFiles from [InstallationDirectory] to [InstallationDirectory] quietly
      [DriverName] as adlib_w.ims
    EndCopyFiles
  EndIf

EndProcedure






Procedure SetMachineSpeed

  Dialog [YesOrNo1] WhiteOnRed UseHeader "Machine Speed Warning"
    WARNING! Manual selection of Machine Speed may lead to 
    unpredictable results.  Please read the file READ.ME for
    more information on the correct setting for your computer.

    Are you sure you want to change your Machine Speed setting?
  EndDialog

  ClearScreen
  If [YesOrNo1] = YesCharacter
    GetMenuChoice UseHeader "MACHINE SPEED MENU"
      SLOW
        ;If you have an 80386SX CPU you should use this setting.
        ;Setting to MEDIUM or FAST is NOT RECOMMENDED.
      MEDIUM
        ;If you have an 80386 CPU this is the recommended setting.
        ;Some fast 80386's (33 Mhz or higher) may do well on the
        ;FAST setting.
      FAST
        ;If you have an 80486 CPU this is the recommended setting.
      Exit
        ;Return to the Main Installation Menu.
    EndGetMenuChoice
    
    InCase choice is
      =1:  [CurrentSpeedSetting] := SLOW
      =2:  [CurrentSpeedSetting] := MEDIUM
           if [RecSpeedSetting] = SLOW
             Do SlowCPUWarning
           Endif
      =3:  [CurrentSpeedSetting] := FAST
           if [RecSpeedSetting] = SLOW
             Do SlowCPUWarning
           Endif
           if [RecSpeedSetting] = MEDIUM
             Do SlowCPUWarning
           Endif
    EndInCase
  Endif

EndProcedure


Procedure SlowCPUWarning

  Dialog [YesOrNo1] WhiteOnRed UseHeader "Slow CPU Warning"
    WARNING!  This speed setting is not recommended for your
    computer.  The TIE Fighter demo may not be playable at
    this setting, and unpredictable events may occur.

    Are you sure you want to choose this setting?
  EndDialog
  if [YesOrNo1] = YesCharacter
  else
    [CurrentSpeedSetting] := SLOW
  Endif

EndProcedure




Procedure ShowSystemSummary  ;; System summary - change with care.

;;  SetShadows Off

  [String1] := [CurrentSoundCard]
  [String2] := BlankString

  If [CurrentSoundCardNum] = 4
    If [DigitalFX] = YesCharacter
      [String1] := SoundBlaster Pro
    Endif
  Endif

  If [CurrentSoundCardNum] > 3
    [String2] := (256K EMS required)
  Endif

  SetPopupBorderTo None

  TextBox @xy(Center,3) WhiteOnGreen UseHeader "HARDWARE CONFIGURATION"
    Operating System Version:  DOSVersion (3.1 or higher required)
    Machine Speed Setting:     [CurrentSpeedSetting] ([RecSpeedSetting] recommended)
    Graphics Card:             [GraphicsCard] (VGA or MCGA required)
    Sound Card Setting:        [String1] [String2]
    Main Memory Present:       [MainMemory] ([RecMainMemory]K recommended, [ReqMainMemory]K required)
    EMS Memory Version:        [EMSVersion] (3.2 or higher required)
    EMS Memory Available:      [EMSMemory] ([EMSMemoryUsable]K will be used)
  EndTextBox

  SetPopupBorderTo Single

;;  SetShadows On

EndProcedure



Procedure SenseHardware

  [RecSpeedSetting] := FAST
  If 808X
    [RecSpeedSetting] := SLOW
  Endif
  If 80286
    [RecSpeedSetting] := SLOW
  Endif
  If 80386
    [RecSpeedSetting] := MEDIUM
  Endif

  [RecSoundCardNum] := 0
  [RecSoundCard] := No Sound

  Run detect quietly

  If DOSErrorCode <> 0
    Dialog PressAKey WhiteOnRed UseHeader "Hardware Detection Error"
      Install has encountered an error while attempting to detect
      the type of sound card in your system.

      Do you want to continue with installation anyway?
    EndDialog
  else
    [Number1] := DOSExitCode
    If [Number1] >= 32
      [RecSpeedSetting] := FAST
      [Number1] := DOSExitCode - 32
    else
      If [Number1] >= 16
        [RecSpeedSetting] := MEDIUM
        [Number1] := DOSExitCode - 16
      else
        [RecSpeedSetting] := SLOW
      Endif
    Endif

    [RecSoundCardNum] := [Number1]
    If [Number1] = 0
      [RecSoundCard] := No Sound
    Endif
    If [Number1] = 1
      [RecSoundCard] := AdLib
    Endif
    If [Number1] = 2
      [RecSoundCard] := Roland
    Endif
    If [Number1] = 3
      [RecSoundCard] := GMIDI
    Endif
  Endif

  If FileExists LANDRU.CFG
    ;; get settings from landru.cfg

    ExamineTextFile LANDRU.CFG

    [String1] := Line 1

    If [String1] = nosound
      [RecSoundCardNum] := 0
      [RecSoundCard] := No Sound
      [SoundFlag] := YesCharacter
    Endif
    If [String1] = adlib
      [RecSoundCardNum] := 1
      [RecSoundCard] := AdLib
      [SoundFlag] := YesCharacter
    Endif
    If [String1] = roland
      [RecSoundCardNum] := 2
      [RecSoundCard] := Roland
      [SoundFlag] := YesCharacter
    Endif
    If [String1] = gmidi
      [RecSoundCardNum] := 3
      [RecSoundCard] := GMIDI
      [SoundFlag] := YesCharacter
    Endif
    If [String1] = adlib_w
      [RecSoundCardNum] := 4
      [RecSoundCard] := SoundBlaster
      [SoundFlag] := YesCharacter
    Endif
    If [String1] = roland_w
      [RecSoundCardNum] := 5
      [RecSoundCard] := Roland with SoundBlaster
      [SoundFlag] := YesCharacter
    Endif
    If [String1] = gmidi_w
      [RecSoundCardNum] := 6
      [RecSoundCard] := GMIDI with SoundBlaster
      [SoundFlag] := YesCharacter
    Endif
    [CurrentSpeedSetting] := Line 2

    ForgetTextFile
  else
    [CurrentSpeedSetting] := [RecSpeedSetting]
  Endif

  if [RecSoundCardNum] <> 0
    [String1] := EnvironmentStringFor BLASTER
    If [String1] = BlankString
    else
      If [RecSoundCardNum] = 1
        [RecSoundCard] := SoundBlaster
        [RecSoundCardNum] := 4
      Endif
      If [RecSoundCardNum] = 2
        [RecSoundCard] := Roland with SoundBlaster
        [RecSoundCardNum] := 5
      Endif
      If [RecSoundCardNum] = 3
        [RecSoundCard] := GMIDI with SoundBlaster
        [RecSoundCardNum] := 6
      Endif
      [DigitalFX] := NoCharacter
      [String1] := EnvironmentStringFor SOUND
      If [String1] = C:\SBPRO
        [DigitalFX] := YesCharacter
      Endif
      If [String1] = D:\SBPRO
        [DigitalFX] := YesCharacter
      Endif
      If [String1] = E:\SBPRO
        [DigitalFX] := YesCharacter
      Endif
      If [String1] = F:\SBPRO
        [DigitalFX] := YesCharacter
      Endif
      If [String1] = G:\SBPRO
        [DigitalFX] := YesCharacter
      Endif
    Endif
  Endif


  If CGA
    [GraphicsCard] := CGA
  Endif
  If MDA
    [GraphicsCard] := MDA
  Endif
  If EGA
    [GraphicsCard] := EGA
  Endif
  If MCGA
    [GraphicsCard] := MCGA
  EndIf
  If VGA
    [GraphicsCard] := VGA
  EndIf
  If HGC
    [GraphicsCard] := HGC
  EndIf
  If HGCPlus
    [GraphicsCard] := HGC Plus
  EndIf
  [GraphicsCard] := VGA

  [Number1] := FreeRunMemory
  [Number2] := [Number1] + 410000
  [Number3] := [Number2] / 1024
  [MainMemory] := [Number3]K
  [MainMemorynum] := [Number3]

  If EMSVersion = 0
    [EMSVersion] := None
    [EMSMemory] := None
  else
    [EMSVersion] := EMSVersion
    [Number1] := ExpandedMemoryPagesActive
    [Number2] := [Number1] * 16
    [EMSMemory] := [Number2]K
    If EMSVersion >= 3.2
      If [Number2] > 896
        [EMSMemoryUsable] := 896
      else
        [EMSMemoryUsable] := [Number2]
      Endif
    else
      [EMSMemoryUsable] := 0
    Endif
  Endif

  If [EMSMemoryUsable] <= 64
    [RecMainMemory] := [NoEMSMainMemRec]
    [ReqMainMemory] := [NoEMSMainMemReq]
  else
    [RecMainMemory] := [EMSMainMemRec]
    [ReqMainMemory] := [EMSMainMemReq]
    If [EMSMemoryUsable] >= 256
      If [RecSoundCardNum] > 3
        [RecMainMemory] := [EMSDigitalRec]
        [ReqMainMemory] := [EMSDigitalReq]
      Endif
    Endif
  Endif

EndProcedure


Procedure CheckSystem

  Do SenseHardware

  If DOSVersion < 3.1
    Dialog [YesOrNo1] WhiteOnRed UseHeader "DOS Version Error"
      Install has detected that you are using a version
      of DOS older than version 3.1.  The TIE Fighter demo
      is not compatible with your version of DOS.

      Do you want to continue with installation anyway?
    EndDialog
    If [YesOrNo1] <> YesCharacter
      Do ExitInstallation
    Endif
  Endif

  [CurrentSoundCard] := [RecSoundCard]
  [CurrentSoundCardNum] := [RecSoundCardNum]

  If EMSVersion = 0
    If ExtendedMemoryPresent >= 64
      Do UseEMSNotice
    Endif
  else
    If EMSVersion < 3.2
      Dialog PressAKey WhiteOnRed UseHeader "EMS Version Error"
        Install has detected that you are using a version
        of EMS which is older than version 3.2.  The TIE 
        Fighter demo cannot use your EMS memory.  Please
        read the file READ.ME for more information.
      EndDialog
    else
      If [EMSMemoryUsable] < 896
        If ExtendedMemoryAvailable > 128
          Do UseEMSNotice
        else
          If XMSMemoryAvailable > 128
            Do UseEMSNotice
          Endif
        Endif
      Endif
    Endif
  Endif

  If [EMSMemoryUsable] <= 64
    If [MainMemorynum] < [NoEMSMainMemReq]
      Do NotEnoughMemory
    else
      If [MainMemorynum] < [NoEMSMainMemRec]
        Do LowMemory
        [CurrentSoundCardNum] := 0
        [RecSoundCardNum] := 0
        [CurrentSoundCard] := No Sound
        [RecSoundCard] := No Sound
      Endif
    Endif
  else
    If [MainMemorynum] < [EMSMainMemReq]
      Do NotEnoughMemory
    else
      If [MainMemorynum] < [EMSMainMemRec]
        Do LowMemory
        [CurrentSoundCardNum] := 0
        [RecSoundCardNum] := 0
        [CurrentSoundCard] := No Sound
        [RecSoundCard] := No Sound
      Endif
    Endif
    If [CurrentSoundCardNum] > 3
      If [EMSMemoryUsable] < 256
        Do NoBlasterEMS
        Do TurnOffBlaster
      else
        If [MainMemorynum] < [EMSDigitalRec]
          Do NoBlasterMain
          Do TurnOffBlaster
        Endif
      Endif
    Endif
  Endif

EndProcedure




Procedure UseEMSNotice

  Dialog PressAKey WhiteOnRed UseHeader "EMS Memory Advice"
    Install has detected that you have Extended Memory
    available that could be configured as EMS memory.
    Since the TIE Fighter demo can only use EMS, we
    recommend that you configure your system to use EMS.
    Please read the file READ.ME for more information.
  EndDialog

EndProcedure



Procedure LowMemory

  If [CurrentSoundCardNum] <> 0
    Dialog PressAKey WhiteOnRed UseHeader "Low Memory"
      Install has detected that you have too little
      memory to run the TIE Fighter demo with sound.
      The program will automatically turn all sound
      and music off, unless more memory is made available.
    EndDialog
  Endif

EndProcedure



Procedure NotEnoughMemory

  Dialog [YesOrNo1] WhiteOnRed UseHeader "Not Enough Memory"
    Install has detected that you do not have enough
    memory available to run the TIE Fighter demo.
    Please read the file READ.ME for information on
    how to make more memory available.
    The demo will not run without more memory available.

    Do you want to continue with installation anyway?
  EndDialog
  If [YesOrNo1] <> YesCharacter
    Do ExitInstallation
  Endif

EndProcedure




Procedure NoBlasterEMS

  Dialog PressAKey WhiteOnRed UseHeader "Not Enough EMS for SoundBlaster"
    Install has detected that you have too little EMS memory to
    run the TIE Fighter demo with digitized sound.  The program
    will automatically turn all digitized sound and speech off,
    unless more EMS memory is made available.
  EndDialog

EndProcedure




Procedure NoBlasterMain

  Dialog PressAKey WhiteOnRed UseHeader "Not Enough Main Memory for SoundBlaster"
    Install has detected that you have too little Main memory to
    run the TIE Fighter demo with digitized sound.  The program
    will automatically turn all digitized sound and speech off,
    unless more Main memory is made available.
  EndDialog

EndProcedure





Procedure TurnOffBlaster

  if [CurrentSoundCardNum] = 4
    [CurrentSoundCardNum] := 1
    [RecSoundCardNum] := 1
    [CurrentSoundCard] := AdLib
    [RecSoundCard] := AdLib
  Endif
  if [CurrentSoundCardNum] = 5
    [CurrentSoundCardNum] := 2
    [RecSoundCardNum] := 2
    [CurrentSoundCard] := Roland
    [RecSoundCard] := Roland
  Endif
  if [CurrentSoundCardNum] = 6
    [CurrentSoundCardNum] := 3
    [RecSoundCardNum] := 3
    [CurrentSoundCard] := GMIDI
    [RecSoundCard] := GMIDI
  Endif

EndProcedure



Procedure ExitInstallation

  ClearScreen

  [YesOrNo1] := YesCharacter

  If [CurrentSoundCardNum] = 0
    If [SoundFlag] = NoCharacter
      Dialog [YesOrNo1] WhiteOnRed UseHeader "Sound Card Selection Warning"
        Install has not been able to detect a Sound Card in your
        computer system.  If you have a Sound Card, you should
        select it by choosing 'Set Sound Card' from the MAIN MENU.
        If you have a Sound Card, and you do not select it, you
        will not hear any music or sound effects.  Please see
        the file READ.ME for more information.

        Are you sure you want to exit without setting a sound card?
      EndDialog
    Endif
  Endif

  if [YesOrNo1] = YesCharacter
    Dialog [YesOrNo1] ;; Ask whether to browse readme file, if any
      The file READ.ME contains important information.

      Do you wish to read it now?
    EndDialog
    If [YesOrNo1] = YesCharacter
      Do ShowReadMe
    EndIf

    Dialog [YesOrNo1] ;; Ask whether to browse readme file, if any
      The file FLIGHT.HLP contains instructions on how to play
      the TIE Fighter demo.

      Do you wish to read it now?
    EndDialog
    If [YesOrNo1] = YesCharacter
      Do ShowKeys
    EndIf

    If [InstalledFlag] = YesCharacter

      ChangeDirectoryTo [InstallationDirectory]

      If [CurrentSoundCardNum] = 0
        [String1] := nosound
      Endif
      If [CurrentSoundCardNum] = 1
        [String1] := adlib
      Endif
      If [CurrentSoundCardNum] = 2
        [String1] := roland
      Endif
      If [CurrentSoundCardNum] = 3
        [String1] := gmidi
      Endif
      If [CurrentSoundCardNum] = 4
        [String1] := adlib_w
        CopyFiles from [InstallationDirectory] to [InstallationDirectory] quietly
          [DriverName] as adlib_w.ims
        EndCopyFiles
      Endif
      If [CurrentSoundCardNum] = 5
        [String1] := roland_w
      Endif
      If [CurrentSoundCardNum] = 6
        [String1] := gmidi_w
      Endif


;;      If [CurrentSpeedSetting] = SLOW
;;        [String2] := slow
;;      Endif
;;      If [CurrentSpeedSetting] = MEDIUM
;;        [String2] := medium
;;      Endif
;;      If [CurrentSpeedSetting] = FAST
;;        [String2] := fast
;;      Endif

      CreateFile [InstallationDirectory]\LANDRU.CFG

      AppendFile [InstallationDirectory]\LANDRU.CFG
        [String1]
        [CurrentSpeedSetting]
        ems
        diff
      EndAppendFile

      If FileExists OPTIONS.CFG
      else
        If [CurrentSpeedSetting] = SLOW
          If [DigitalFX] = YesCharacter
            CopyFiles from [InstallationDirectory] to [InstallationDirectory] quietly
              SLOWYES.CFG as OPTIONS.CFG
            EndCopyFiles
          else
            CopyFiles from [InstallationDirectory] to [InstallationDirectory] quietly
              SLOWNO.CFG as OPTIONS.CFG
            EndCopyFiles
          Endif
        Endif
        If [CurrentSpeedSetting] = MEDIUM
          If [DigitalFX] = YesCharacter
            CopyFiles from [InstallationDirectory] to [InstallationDirectory] quietly
              MEDYES.CFG as OPTIONS.CFG
            EndCopyFiles
          else
            CopyFiles from [InstallationDirectory] to [InstallationDirectory] quietly
              MEDNO.CFG as OPTIONS.CFG
            EndCopyFiles
          Endif
        Endif
        If [CurrentSpeedSetting] = FAST
          If [DigitalFX] = YesCharacter
            CopyFiles from [InstallationDirectory] to [InstallationDirectory] quietly
              FASTYES.CFG as OPTIONS.CFG
            EndCopyFiles
          else
            CopyFiles from [InstallationDirectory] to [InstallationDirectory] quietly
              FASTNO.CFG as OPTIONS.CFG
            EndCopyFiles
          Endif
        Endif
      Endif

      SetExitMessageTo 	"Installation complete!  Enter TIEDEMO to play the demo."
    else
      SetExitMessageTo 	"The TIE Fighter demo has not been installed.  For help, call (415) 721-3333."
    Endif

    SoLong
  Endif

EndProcedure


Procedure ShowReadMe

  if [InstalledFlag] = YesCharacter
    If FileExists [InstallationDirectory]\READ.ME
      SetShadows Off
      ClearScreen
      BrowseFile [InstallationDirectory]\READ.ME WhiteOnBlue
      SetShadows On
    else 
      If FileExists READ.ME
        SetShadows Off
        ClearScreen
        BrowseFile READ.ME WhiteOnBlue
        SetShadows On
      else
        Popup Failed to find file READ.ME. Insert Disk 1 and try again.
      Endif
    Endif
  else
    If FileExists READ.ME
      SetShadows Off
      ClearScreen
      BrowseFile READ.ME WhiteOnBlue
      SetShadows On
    else
      If FileExists [InstallFromDrive]:\READ.ME
        SetShadows Off
        ClearScreen
        BrowseFile [InstallFromDrive]:\READ.ME WhiteOnBlue
        SetShadows On
      EndIf
    EndIf
  EndIf

EndProcedure


Procedure ShowKeys

  if [InstalledFlag] = YesCharacter
    If FileExists [InstallationDirectory]\FLIGHT.HLP
      SetShadows Off
      ClearScreen
      BrowseFile [InstallationDirectory]\FLIGHT.HLP WhiteOnBlue
      SetShadows On
    else 
      If FileExists FLIGHT.HLP
        SetShadows Off
        ClearScreen
        BrowseFile FLIGHT.HLP WhiteOnBlue
        SetShadows On
      else
        Popup Failed to find file FLIGHT.HLP. Insert Disk 1 and try again.
      Endif
    Endif
  else
    If FileExists FLIGHT.HLP
      SetShadows Off
      ClearScreen
      BrowseFile FLIGHT.HLP WhiteOnBlue
      SetShadows On
    else
      If FileExists [InstallFromDrive]:\FLIGHT.HLP
        SetShadows Off
        ClearScreen
        BrowseFile [InstallFromDrive]:\FLIGHT.HLP WhiteOnBlue
        SetShadows On
      EndIf
    EndIf
  EndIf

EndProcedure



Procedure SetupInstalit
  SetScreenAttrTo 	LightGrayOnBlack
  SetBackgroundCharTo   B1
  SetShadows 		On
  SetMainBorderTo 	None
  SetPopupBorderTo 	Single
  SetShadowAttrTo 	DarkGrayOnBlack
  SetPopupAttrTo 	WhiteOnBlue
  SetTopLineAttrTo 	WhiteOnDarkGray
  SetBottomLineAttrTo 	WhiteOnDarkGray
  SetBottomLineTo    "                                Press <Ctrl-X> to Exit                             "
  SetTopLineTo 		"                  TIE Fighter Demonstration Installation Program                   "
  SetCheckmarks		Off
  SetAllowExit 		On
  SetSupportInformation
    If you need assistance, please call LucasArts Product
    Support at (415) 721-3333, Monday through Friday,
    9:00 A.M. to 5:00 P.M. Pacific Standard Time.
  EndSetSupportInformation
EndProcedure


