;;===========================================================================
;;            Title:     Gravis UltraSound Install
;;            Version:   4.09
;;            Date:      10/31/94
;;
;; Revision History
;;  4.12 - installation 4.00 transfer all control to setgus
;;         now it only copy files over.
;;  4.11 - 3.58 ***Make sure you change current dir to c: before swapping out
;;  4.10A- special version for Sound Buddy
;;  4.10 - updated modifications on instgrps.ini to accomodate the new working
;;         directory feature of instgrps.exe
;;  4.09 - fixed more of readme; copy the other readmes to disks
;;  4.08 - added Gravis Europe to Help
;;  4.08 - changed 'apparent version' to 3.56 ; renamed gv to readme
;;         taken out SBOS option
;;  4.07 - deleted integr8.....
;;  4.06 - added digest and integr8 to take advantage of repeated waveforms
;;         saved 400k
;;  4.05 - Removed use of Sonarc (commented them out); changed param passed
;;         to parse.exe
;;  4.04 - Removed references to SB check (commented out all blaster check)
;;  4.03 - Removed references to SB check (By setting [Blaster] = N
;;  4.00 - Add DecompressPatch & RestorePatches to accommodate the new
;;         Sonarc patch compression used in install disks
;;       - remove references to GUSMOD as it is not shipped anymore
;;       - made read manual addendum works
;; Future: ErrorCodes   - used through out program to report errors
;;         ReturnStatus - used as a return value from a function
;;
;; Notes: QueAllFiles - Group 1 = Setup Files
;;                      Group 2 = DOS Software
;;                      Group 3 = Win Software
;;                      Because sonarc is used the installation size must
;;                          be hand calculated
;;
;;===========================================================================

;;===========================================================================
;;
;;++++++++++++++++++++++++++ DEFINE VARIABLES +++++++++++++++++++++++++++++++
;;
;;===========================================================================

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Define Variables
;;======================================

;; -----------------
;;  Custom InstalIt Variables
;; -----------------
DefineVariables

;; -----------------
;;    #Defines
;; -----------------
						 ;; Name to display on top of
						 ;;  screen
Text    [TitleLine]  := "ù F1=Help         Gravis UltraSound (GUS) Installation - V4.00     CTRL+X=Exit ù"
Text    [ReadmeName] := "README"                 ;; Name of readme for this
                                                 ;;  install
Text    [StatOK]     := "û"                      ;; Status characters used
Text    [StatNOTOK]  := "x"                      ;;  during install
Text    [StatSkip]   := "."

;; -----------------
;;    Variables
;; -----------------
Logical [GUSSetup]    := NoCharacter             ;; Do we need to run GUS Setup?
Logical [DoneSetup]                              ;; Have we run the Setup yet?
Logical [DOGusInst] := NoCharacter               ;; What Install we doing
Logical [FullInst]  := NoCharacter               ;; Are we doing FULL Install?


Text    [UltraDIR]                               ;; Determine ULTRADIR Enviro
						 ;;  If it there then we will
						 ;;  default to this directory
Text    [RestFile]                               ;; File names to restore
Text    [ReadmeDir]                              ;; Where the README and
						 ;;  viewer are currently
						 ;;  located.
Text    [BackSrcName]                            ;; Backup Source
Text    [BackDestName]                           ;;        Destination
Text    [BackDir]                                ;;        Directory

Text    [WinDir]                                 ;; Windows Directory
Text    [WinSysPath]                             ;; Path to users SYSTEM.INI
Text    [WinConPath]                             ;;  and CONTROL.INI (Win)


Text    [DispMsg]                                ;; Message to display at
						 ;;  the bottom of the screen
Text    [ChkGUSInst]                             ;; Variable used to pass to
Text    [MemGUSInst]                             ;;  shell program to detect
						 ;;  the presense of the GUS
						 ;;  and its Memory address
Text    [DOSShell]                               ;; Determine if the user
						 ;;  is using a DOS shell
						 ;;  other than COMMAND.COM
Text    [FromDirectory]                          ;; Where the user typed
						 ;;  install from
Number  [CurLine]                                ;; Current line read in
Number  [TotalLines]                             ;; Total Line count for file
Number  [InstSize]                               ;; Number of bytes for Full
						 ;;  Install
Number  [CurQueSize]                             ;; Current Size of Qued Files
Number  [InstStatus]  := 0                       ;; Status of Full Install

EndDefineVariables

;; -----------------
;;  Pre-Defined InstalIt Variables
;; -----------------
;;   [Dir1]     <UNUSED>
;;   [Dir2]     <UNUSED>
;;   [Dir3]     <UNUSED>
;;   [Dir4]     <UNUSED>
;;   [Dir5]     <UNUSED>
;;   [Dir6]     Store the current directory (Used during README view)
;;   [Dir7]     <UNUSED>
;;   [Dir8]     <UNUSED>
;;   [Dir9]     Temp Variable

;;   [Number1]  <UNUSED>
;;   [Number2]  <UNUSED>
;;   [Number3]  <UNUSED>
;;   [Number4]  <UNUSED>
;;   [Number5]  <UNUSED>
;;   [Number6]  <UNUSED>
;;   [Number7]  Temp Variable                    ;; String Lengths
;;   [Number8]  Temp Variable                    ;; String Lengths
;;   [Number9]  Temp Variable                    ;; Including Drive space
						 ;;  reamining and more

;;   [String1]  <UNUSED>
;;   [String2]  <UNUSED>
;;   [String3]  <UNUSED>
;;   [String4]  <UNUSED>
;;   [String5]  <UNUSED>
;;   [String6]  <UNUSED>
;;   [String7]  Temp Variable                    ;; Used by child scripts
;;   [String8]  Temp Variable
;;   [String9]  Temp Variable

;;   [YesorNo1] Verify installation onto double space drive
;;   [YesorNo2] Reboot computer now? Yes/No
;;   [YesorNo3] What to do if conflicting MIDI/WAV device?
;;   [YesorNo4] Hasn't tagged any configurations
;;   [YesorNo5] 16Bit Install Directory
;;   [YesorNo6] <UNUSED>
;;   [YesorNo7] <UNUSED>
;;   [YesorNo8] <UNUSED>
;;   [YesorNo9] Temp Variable                    ;; Used by child scripts

;;   [Point1]   Skip Windows Install cause could not locate directory
;;   [Point2]   Skip to end of Windows Setup (Modify Part)
;;   [Point3]   Skip ALL modifications (DOS and WIN)
;;   [Point4]   Ask user where to install software
;;   [Point5]   Skip Bonus Software
;;   [Point6]   Don't restore single file (something went wrong)
;;   [Point7]   Invalid drive selected for Bonus install
;;   [Point8]   Temp Variable                    ;; Used by child scripts
;;   [Point9]   Temp Variable
;;   [Point10]  Temp Variable
;;   [Point11]  <UNUSED>
;;   [Point12]  <UNUSED>
;;   [Point13]  <UNUSED>
;;   [Point14]  <UNUSED>
;;   [Point15]  <UNUSED>
;;   [Point16]  <UNUSED>
;;   [Point17]  <UNUSED>
;;   [Point18]  <UNUSED>
;;   [Point19]  <UNUSED>
;;   [Point20]  <UNUSED>

;;===========================================================================
;;
;;++++++++++++++++++++++++ DEFINE INSTALIT OPTIONS ++++++++++++++++++++++++++
;;
;;===========================================================================
;;SetTraceMode ON
SetBetaTestMode ON                              ;; Detailed Explanation
						 ;; of any error msgs
DelayScreenDraw                                  ;; Delays Screen draw
                                                 ;; until clearscreen
Logging Off                                      ;; Log files copied
SetAllowEscape Off                               ;; Don't allow ESC Key
SetBackupModeTo Sequential                       ;; When asking for BACKUP
                                                 ;; make filename seq.
SetCheckMarks On                                 ;; Turn on Checks
SetExitMessageTo "  Thank you for choosing UltraSound!  " ;; Msg to display
                                                   ;; when user has exited
SetModifyModeTo Undecided                        ;; Prompt user on how they
                                                 ;; would like to handle
                                                  ;; mods to CONFIG/AUTO/WIN
SetReadOnlyInquiry Off                           ;; Don't confirm overwrite
                                                 ;; of readonly files.
                                                 ;; ie: midi patches
SetOneMoment On
[FromDirectory] := CurrentDirectory              ;; Remember where we are

;;===========================================================================
;;
;;+++++++++++++++++++++++++++++ START OF CODE +++++++++++++++++++++++++++++++
;;
;;===========================================================================

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Check system settings before allowing to proceed to install
;;         û Main Memory - swaps to EMS/XMS
;;======================================
If MainMemory < 450                              ;; Min Memory Requirements
						 ;; Note: If user is using
						 ;;  an XMS/EMS mgr install
						 ;;  will swap for more memory
    Dialog PressAnyKey WhiteOnBlue UseHeader "Insufficent Memory"
	You only have MainMemoryK bytes of free convential memory. You
    need at least 520K to run this install. However, if you have
	XMS or EMS memory you may be ok. If you experience any problems
	please refer to your DOS manual on how to free up more
	convential memory.

	.cThe installation will now continue
    EndDialog
EndIf
                         ;;  other than COMSPEC
                         ;;  If so warn them. Should
						 ;;  not be a problem with
						 ;;  anything other than 4DOS
[DOSShell] := EnvironmentStringFor COMSPEC
If .NOT. [DOSShell] = Blankstring .AND. .NOT. [DOSShell] Contains COMMAND.COM
    Dialog PressAnyKey WhiteOnBlue UseHeader "DOS Shell Detected"
	It appears that you are using a DOS shell other than COMMAND.COM.
	This may not be a problem, however if you experience any problems
	with this install you may want to revert back to COMMAND.COM.
	Your current COMSPEC is:

	.c[DOSShell]

	.cThe installation will now continue
    EndDialog
EndIf

[FromDirectory] := CurrentDirectory              ;; Remember where we are
ChangeDirectoryTo [InstallFromDirectory]         ;; Change to users Installation
                                                 ;; directory. Reason being
                                                 ;; that they may have typed
                                                 ;; install from their path

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Odds and Ends before going to Main Menu
;;======================================
SetSupportInformation
  You may have a corrupted disk. Please try installing again.
  If unsuccessful, please contact Advanced Gravis Tech Support.

  Advanced Gravis
  Technical Support (9am-4pm PST)......1-604-431-1807
  Bulletin Board System (V32bis N81)...1-604-431-5927

  Advanced Gravis Europe
  Technical Support....................011-31-36-536-6011
  FAX..................................011-31-36-536-4443
EndSetSupportInformation


;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Opening Screen
;;======================================

[DoGusInst] := YesCharacter                      ;; installing the GUS
SetBackgroundCharTo B0                           ;; Set Bkgrd to Blue/White
[ReadmeDir] := CurrentDirectory                  ;; Where is the README?
Do DetermineSize                                 ;; Figure out how many
                                                 ;; bytes a total install
                                                 ;;  will take.
LetButton <F1> Do ShowHelp                       ;; F1 = Help

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Start of Main Menu
;;======================================

:MAIN
ClearScreen
Do TitleScreen

:DISPMAIN
GetMenuChoice WhiteOnLightBlue @xy(Center,9) Highlight 1 UseHeader "Installation Main Menu"
Install UltraSound Software
    ; Required for UltraSound Operation
Restore File(s)
    ; Restore a single or group of files
View Manual Addendum
    ; Read the Readme file
Exit
    ; Exit the Install and return to DOS
EndGetMenuChoice

InCase Choice is
=1: SetCompletionStatusTo Unfinished
    [InstStatus] := 0                                ;; Update Status Bar
    [DoneSetup] := NoCharacter
    [FullInst]  := YesCharacter
    QueAllFiles IfNewer NoInquiry
    Do CopyQuedFiles
    Do FinalSetup
;;    Dialog [YesOrNo2] WhiteOnBlue @xy(Center,9) UseHeader "Base Software Installation Complete"
;;    .cThis completes your base software installation.
;;    .c
;;    .cDo you want to install the Bonus Software?
;;    EndDialog
;;    If [YesOrNO2] = YesCharacter
;;       Do InstallBonus
;;    EndIf
    Do RunSetgus
=2: Do GetUserFile
=3: Do GetReadme                         ;; View Readme
    GOTO DispMain
=4: DO Bye
EndInCase

Goto MAIN                                        ;; Goto Main Menu


;;===========================================================================
;;
;;++++++++++++++++++++++++++ Start of Procedures ++++++++++++++++++++++++++++
;;
;;===========================================================================

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Do Final Setup stuff before install is done, ie: clean up ULTRAMIX.INI
;;           if the user does not have a MAX card.
;; Revised:  05/09/94 - Don't put PatchDir in default Melodic and Drum Bank
;;======================================
Procedure FinalSetup
;; ----------
;;  Configure ULTRAMIX.INI if the user does not have MAX card
;; ----------
If .NOT. [CodecAddr] = 0
    ModifyTextFile [InstallationDirectory]\ULTRAMIX.INI Quietly
    InSection [Output Levels]
	AddOrChangeLineWith (MIDI_Left=,,)    as "MIDI_Left=90"       at End
	AddOrChangeLineWith (MIDI_Right=,,)   as "MIDI_Right=90"      at End
	AddOrChangeLineWith (MIDI=,,)         as "MIDI=90"            at End
	AddOrChangeLineWith (Wave_Left=,,)    as "Wave_Left=93"       at End
	AddOrChangeLineWith (Wave_Right=,,)   as "Wave_Right=93"      at End
	AddOrChangeLineWith (Master=,,)       as "Master=100"         at End
    EndModifyTextFile
EndIf

  ;; ----------
  ;;  Configure PatchDir= in ULTRASND.INI
  ;; ----------
If FileExists [InstallationDirectory]\ULTRASND.INI
    [DispMsg] := "Configuring MIDI directory...                                                   "
    DO DisplayMsg
    ModifyTextFile [InstallationDirectory]\ULTRASND.INI Quietly
      InSection [Ultrasound]
	AddOrChangeLineWith (PatchDir,=,)     as "PatchDir=[InstallationDirectory]\MIDI\" at Beginning
      InSection [Melodic Bank 0]
	AddOrChangeLineWith (PatchDir,=,)     as "PatchDir=[InstallationDirectory]\MIDI\" at Beginning
      InSection [Drum Bank 0]
	AddOrChangeLineWith (PatchDir,=,)     as "PatchDir=[InstallationDirectory]\MIDI\" at Beginning
    EndModifyTextFile
  EndIf

;; FIND THE WINDOWS DIRECTORY
Do FindWindows
;;-----------------
;;  Setup Patch Maker INI file (NOTE: Changed directories to dirs)
;;-----------------
  If FileExists [InstallationDirectory]\PMAKER\PMAKER.EXE .OR. [FullInst] = YesCharacter .AND. .NOT. [WinDir] = BlankString
    [DispMsg] := "Configuring Patch Maker Lite...                                                 "
    DO DisplayMsg
    ModifyTextFile [WinDir]\PMAKER.INI Quietly
      InSection [Help]
	AddOrChangeLineWith (HelpFile=,,) as "HelpFile=[InstallationDirectory]\PMAKER\PMAKER.HLP" at End
      InSection [Files]
	AddOrChangeLineWith (ReferenceTone,=,) as "ReferenceTone=[InstallationDirectory]\PMAKER\SINE440.PAT" at End
      InSection [Filedirs]
	AddOrChangeLineWith (WaveDir=,,)  as "WaveDir=[InstallationDirectory]\PMAKER\"  at End
	AddOrChangeLineWith (PatchDir=,,) as "PatchDir=[InstallationDirectory]\PMAKER\" at End
    EndModifyTextFile
  EndIf

;;-----------------
;;  Update users BWCC.DLL
;;-----------------
  If FileExists [InstallationDirectory]\WINDOWS\BWCC.DLL
     If FileExists [WinDir]SYSTEM\BWCC.DLL      ;; Only copy file if not there
     Else
       If .NOT. [WinDir] = BlankString
	 CopyFiles From [InstallationDirectory]\WINDOWS to [WinDir]\SYSTEM Quietly
	    BWCC.DLL
	 EndCopyFiles
       EndIf
     EndIf
  EndIf

;;-----------------
;;  Update users Windows drivers
;;-----------------

  If FileExists [InstallationDirectory]\WINDOWS\GRVSULTR.386
     If .NOT. [WinDir] = BlankString
          CopyFiles From [InstallationDirectory]\WINDOWS to [WinDir]\SYSTEM Quietly
               GRVSULTR.386
           EndCopyFiles
     EndIf
  EndIf

  If FileExists [InstallationDirectory]\WINDOWS\ULTRASND.DRV
       If .NOT. [WinDir] = BlankString
     CopyFiles From [InstallationDirectory]\WINDOWS to [WinDir]\SYSTEM Quietly
        ULTRASND.DRV
	 EndCopyFiles
       EndIf
  EndIf
  If FileExists [InstallationDirectory]\WINDOWS\ULTMPORT.DRV
     If .NOT. [WinDir] = BlankString
     CopyFiles From [InstallationDirectory]\WINDOWS to [WinDir]\SYSTEM Quietly
        ULTMPORT.DRV
	 EndCopyFiles
     EndIf
  EndIf

  If FileExists [InstallationDirectory]\WINDOWS\MIDIMAP.CFG
     If .NOT. [WinDir] = BlankString
     CopyFiles From [InstallationDirectory]\WINDOWS to [WinDir]\SYSTEM Quietly
          MIDIMAP.CFG
     EndCopyFiles
     EndIf
  EndIf

;;-----------------
;;  Copy mixer/control panel help file to win\system
;;-----------------
 If FileExists [InstallationDirectory]\WINDOWS\ULTRAHLP.HLP
    If .NOT. [WinDir] = BlankString
        CopyFiles From [InstallationDirectory]\WINDOWS to [WinDir]\SYSTEM Quietly
            ULTRAHLP.HLP
        EndCopyFiles
        DeleteFiles from [InstallationDirectory]\WINDOWS Quietly
            ULTRAHLP.HLP
        EndDeleteFiles
     EndIf
  EndIf

  If FileExists [InstallationDirectory]\PMAKER\PMAKER.EXE .OR. [FullInst] = YesCharacter
    [DispMsg] := "Configuring Patch Maker Lite...                                                 "
    DO DisplayMsg
    ModifyTextFile [WinDir]\PMAKER.INI Quietly
      InSection [Help]
	AddOrChangeLineWith (HelpFile=,,) as "HelpFile=[InstallationDirectory]\PMAKER\PMAKER.HLP" at End
      InSection [Files]
	AddOrChangeLineWith (ReferenceTone,=,) as "ReferenceTone=[InstallationDirectory]\PMAKER\SINE440.PAT" at End
      InSection [Filedirs]
	AddOrChangeLineWith (WaveDir=,,)  as "WaveDir=[InstallationDirectory]\PMAKER\"  at End
	AddOrChangeLineWith (PatchDir=,,) as "PatchDir=[InstallationDirectory]\PMAKER\" at End
    EndModifyTextFile
  EndIf
Do WinInstGrps
EndProcedure

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Copy what ever files are qued up
;; Revision: 02/09/94 - Make sure ULTRASND.INI will always get copied on
;;                      a full install
;;======================================
Procedure CopyQuedFiles
  DO InstStatus

  If [FullInst] = YesCharacter
    [CurQueSize] := [InstSize]
  else
    [CurQueSize] := QueSize
  EndIf

  If [DoneSetup] = NoCharacter
    DO InstallWhere                              ;; Determine where to
    ClearScreen                                  ;;  install software
  EndIf                                          ;;  only ask if we
                                                 ;;  haven't asked already

  DO TitleScreen                                 ;; Clear off screen
						 ;;  before copying
  Logging On                                     ;; Turn logging info on
  SetLogFileTo [InstallationDirectory]\INSTALL.LOG ;; Keep a log of all
						   ;; files copied

  SetReplacementInquiry Off                      ;; Don't prompt user
						 ;;  to overwrite

						   ;; Backup old ULTRASND.INI
						   ;;  file and remove it to
						   ;;  make sure the new
						   ;;  ULTRASND.INI file is
						   ;;  copied
  DO InstStatus                                  ;; Update Status
  [ReadmeDir] := [InstallationDirectory]         ;; Where is the README?

  SetReplacementInquiry On                       ;; Don't prompt user
						 ;;  to overwrite. MUST
						 ;;  be set ON so IfNewer
						 ;;  and IfNotEqual will
						 ;;  work with GETQUEDFILES
  ClearScreen
  GetQuedFiles ShowJustOne                       ;; Do Actual Copying

  SetReplacementInquiry Off                      ;; Turn overwrite prompt
						 ;;  back on
  [InstStatus] := 6                              ;; Update Status Bar
  Do TitleScreen
  Logging Off                                    ;; Turn logging info Off
EndProcedure

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Figure Where to Install Files
;; Todo:     Test double space stuff
;;           Test drive space remaining stuff
;;           Should we not determine drive stuff? (Note only works if ULTRADIR)
;;             not set
;;======================================
Procedure InstallWhere
:Point4
    [UltraDIR] := EnvironmentStringFor ULTRADIR       ;; Check to see if ULTRADIR

    If [UltraDIR] = Blankstring                       ;;  Enviro variable set. If
						      ;;  not then default to
						      ;;  Installation Drive
						      ;;  plus ULTRASND
      DetermineInstallationDrive [CurQueSize] RequireFixed ConfirmRAM AllowNetwork ShowDrivesWithSpace
      [UltraDIR] := InstallationDrive:\ULTRASND
    Else
	TextBox WhiteOnBlue @xy(Center,19)
		NOTE: You are updating from a previous installation. Only those files
		which are newer or have changed since your last install will be copied.
	EndTextBox
    EndIf

    SetBottomLineAttrTo YellowOnRed
    SetBottomLineTo     "             Press <RETURN> to Accept and Proceed with Installation             "

    DetermineInstallationDirectory [UltraDIR] [CurQueSize] RequireFixed

    If [UltraDir] = Blankstring                  ;; Don't allow Empty
	Dialog PressAnyKey WhiteOnBlue @xy(Center,Center) UseHeader "No Installation Directory Selected"
	    You must choose a directory to install the UltraSound Software.
	EndDialog
	DO TitleScreen
	Goto Point4
    EndIf


						 ;; Check to see if install
						 ;;  drive is double space.
						 ;;  Only prompt if disk
						 ;;  space required is
						 ;;  within 2Mb of
						 ;;  available space
    [Number9] := FreeSpaceOnDrive InstallationDrive
    [Number9] := [Number9] + 2000000
    If DriveIsDoubleSpace InstallationDrive .AND. [Number9] < [CurQueSize]
	DO InstStatus
	Dialog [YesOrNo1] WhiteOnBlue @xy(Center,Center) UseHeader "Double Space Drive Detected"
	    Programs such as STACKER and DOUBLE SPACE may not
	    accurately report the true drive space remaining.
	    You have selected to install the UltraSound software
	    to such a drive. This drive may have just enough
	    space for the install.

	    .cAre you sure you wish to continue?
	EndDialog
	SetBottomLineAttrTo YellowOnRed
	SetBottomLineTo     "             Press <RETURN> to Accept and Proceed with Installation             "
	If [YesOrNo1] = NoCharacter
	    DO TitleScreen
	    GOTO Point4
	EndIf
    EndIf

EndProcedure

;;======================================
;; Author:   John Smith
;; Date:     04/07/93
;; Purpose:  Restore a Single File
;; Revision: 03/03/94 - Don't allow user to restore files which are created
;;                      during installation time.
;;======================================
Procedure GetUserFile
  Dialog [RestFile] WhiteOnBlue @xy(Center,11) 12
      Which file(s) do you wish to restore?
      Wildcards are accepted, ie: *.* *.?XE, etc...
  EndDialog
  If [RestFile] = Blankstring
      Goto Point6
  Endif
  If [RestFile] Contains \
      PopUp Please enter the file name with no path.
      Goto Point6
  EndIf
  If FileIsInLibrary [RestFile]
  else
     If [RestFile] Contains INSTGRPS.INI .OR. [RestFile] Contains PMAKER.INI
       PopUp This file is created during installation time. Please reinstall software.
     Else
       Dialog WhiteOnBlue UseHeader "File Not Found"
       That file is not available.  Please try again.

       EndDialog
       Goto Point6
     EndIf
  EndIf
  QueFiles
      [RestFile]
  EndQueFiles
  Do CopyQuedFiles
:Point6
EndProcedure


;;===========================================================================
;;
;;+++++++++++++++++++++++++ VARIOUS PROCEDURES ++++++++++++++++++++++++++++++
;;
;;===========================================================================

;;======================================
;; Author:   John Smith
;; Date:     04/09/93
;; Purpose:  What to Show User if they Select HELP
;;======================================
Procedure ShowHelp
  Dialog PressAnyKey YellowOnRed @xy(Center,Center)
      Should you experience any difficulties with the UltraSound
      installation you may contact Gravis customer service at:

      Advanced Gravis                       Advanced Gravis Europe
      #101-3750 North Fraser Way,           Antennestraat 70 Almere
      Burnaby, BC, Canada. V5J 5E9          Netherlands

      Technical Support
      1-604-431-1807 (9am-4pm PST)          011-31-36-536-6011

      Fax
      1-604-451-9358                        011-31-36-536-4443

      Bulletin Board System
      1-604-431-5927(V32bis N81)

      NOTE: These calls are Long Distance!! We strongly recommend
      you read the README file and the MANUAL before calling.

      Compuserve: GO PCVENB (71333,350)   InterNET EMail: tech@gravis.com
      AOL: Adv Gravis                     Genie: Page M805 Topic 6
  EndDialog
EndProcedure

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  View README file
;; Todo:     Test to make sure README stuff is ok
;;======================================
Procedure GetReadme
  If FileExists [ReadmeDir]\[ReadmeName]
    [Dir6] := CurrentDirectory
    ChangeDirectoryTo C:\
    If FileExists [InstallFromDirectory]README.EXE
      Run [InstallFromDirectory]README.EXE [InstallFromDirectory][ReadmeName] NoPrompt Swapout
    EndIf
    ChangeDirectoryTo [Dir6]
  EndIf
EndProcedure

;;======================================
;; Author:   John Smith
;; Date:     04/09/93
;; Purpose:  Display Exit Message
;; Test:     Check with SHARE.EXE loaded
;;======================================
Procedure Bye
  ChangeDirectoryTo [FromDirectory]
  SoLong
EndProcedure

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Put Title Bars on the Screen
;;======================================
Procedure TitleScreen
    SetTopLineAttrTo YellowOnBlue
    SetTopLineTo [TitleLine]

    TextBox WhiteOnMagenta @xy(Center,3)
    .cUltraSound by
    .cAdvanced Gravis Computer Technology Ltd.
    .cBurnaby, BC, Canada
    EndTextBox

    Do InstStatus
EndProcedure

;;======================================
;; Author:   John Smith
;; Date:     12/01/93
;; Purpose:  Display Status of Install to User
;; Todo:     Make all status things variables
;;======================================
Procedure InstStatus
    If [InstStatus] = 0
	SetBottomLineAttrTo WhiteOnBlue
	SetBottomLineTo     "               Remember to mail in your UltraSound registration!                "
    EndIf
EndProcedure

;;===========================================================================
;;
;;+++++++++++++++++++++++++ VARIOUS FUNCTIONS +++++++++++++++++++++++++++++++
;;
;;===========================================================================

;;======================================
;; Author:   John Smith
;; Date:     12/02/93
;; Purpose:  Determine Size in bytes for full install
;;======================================
Procedure DetermineSize
  If FileExists [InstallFromDrive]:*.001
    QueAllFiles                                  ;; Determine Total Size
    [InstSize] := QueSize                        ;; of Install.
    UnQueAllFiles
  EndIf
EndProcedure



;;======================================
;; Author:   John Smith
;; Date:     12/03/93
;; Purpose:  Display one line status message at bottom of screen
;;======================================
Procedure DisplayMsg
   If .NOT. [DispMsg] = Blankstring
     SetBottomLineAttrTo WhiteOnBlue
     SetBottomLineTo [DispMsg]
   EndIf
EndProcedure

;;======================================
;; Author:   Herman Liu
;; Date:     12/12/94
;; Purpose:  Run Setup without returning
;;======================================
Procedure RunSetgus
  Dialog
   Install has copied all necessary files to your installation directory

   .c Now SETUP will be run to setup the UltraSound
  EndDialog
  ChangeDirectoryTo [InstallationDirectory]
  RUN SETUP.EXE updateWinIni NORETURN
EndProcedure

Procedure FindWindows
  [WinDir] := [WindowsDirectory]
  If [WinDir] = Blankstring
      [WinDir] := FullPathTo WIN.COM Search AllFixed
      If .NOT. [WinDir] = Blankstring
	 [Number9] := LengthOf [WinDir]          ;; Last statement returns
	 [Number9] := [Number9] - 7              ;;  full path plus file
						 ;;  name. This will strip
						 ;;  the filename out so
						 ;;  we just get the
						 ;;  windows directory
	 [WinDir] := SubstringOf [WinDir] from 1 to [Number9]
      EndIf
  EndIf
  If .NOT. FileExists [WinDir]\SYSTEM.INI
     [WinDir] := Blankstring
  EndIf

;;  -----------------
;;    If We Couldn't Find the Users Windows Prompt Them
;;  -----------------
    If [WinDir] = Blankstring
	Beep
	Dialog [WinDir] WhiteOnRed @xy(Center,Center) UseHeader "No Microsoft Windows Found" 60
	    UltraSound install could not locate your Microsoft Windows
	    directory.  Please enter in the full path, including drive
	    letter of the Windows directory. Press return on a blank
	    line to skip the Windows install.
	EndDialog
    EndIf
EndProcedure

Procedure WinInstGrps
 [DispMsg] := "Installing Windows icons and program groups...                                  "
 DO DisplayMsg

   ModifyTextFile [WinDir]\INSTGRPS.INI Quietly
    InSection [general]
        AddOrChangeLineWith (AppName=,,) as "AppName=Gravis UltraSound" at End
    InSection [groups]
          AddOrChangeLineWith (3=,,) as "3=Gravis UltraSound" at End
    InSection [group 3]
        AddOrChangeLineWith (0=,,) as "0=[InstallationDirectory]\WINDOWS\MIXER.EXE,UltraSound Mixer,[InstallationDirectory]\WINDOWS\MIXER.EXE,0,[InstallationDirectory]\WINDOWS"  At End
        AddOrChangeLineWith (1=,,) as "1=[InstallationDirectory]\WINDOWS\PATCHMGR.EXE,Patch Manager,[InstallationDirectory]\WINDOWS\PATCHMGR.EXE,0,[InstallationDirectory]\WINDOWS" At End
        AddOrChangeLineWith (2=,,) as "2=[InstallationDirectory]\PMAKER\PMAKER.EXE,PatchMaker Lite,[InstallationDirectory]\PMAKER\PMAKER.EXE,0,[InstallationDirectory]\WINDOWS" At End
        AddOrChangeLineWith (3=,,) as "3=[InstallationDirectory]\WINDOWS\CONFIG.EXE,UltraSound Configuration,[InstallationDirectory]\WINDOWS\CONFIG.EXE,0,[WinDir]SYSTEM" At End
   EndModifyTextFile

;;-----------------
;;  Setup Patch Maker INI file (NOTE: Changed directories to dirs)
;;-----------------
  If FileExists [InstallationDirectory]\PMAKER\PMAKER.EXE .OR. [FullInst] = YesCharacter
    [DispMsg] := "Configuring Patch Maker Lite...                                                 "
    DO DisplayMsg
    ModifyTextFile [WinDir]\PMAKER.INI Quietly
      InSection [Help]
          AddOrChangeLineWith (HelpFile=,,) as "HelpFile=[InstallationDirectory]\PMAKER\PMAKER.HLP" at End
      InSection [Files]
          AddOrChangeLineWith (ReferenceTone,=,) as "ReferenceTone=[InstallationDirectory]\PMAKER\SINE440.PAT" at End
      InSection [Filedirs]
          AddOrChangeLineWith (WaveDir=,,)  as "WaveDir=[InstallationDirectory]\PMAKER\"  at End
          AddOrChangeLineWith (PatchDir=,,) as "PatchDir=[InstallationDirectory]\PMAKER\" at End
    EndModifyTextFile
  EndIf

EndProcedure


