; ImageFX Extras Installer Utility
;
; For ImageFX Release 2.0
;
; Written by Thomas Krehbiel
; Copyright © 1994 Nova Design, Inc.
;

(

   ;================================================================
   ; Setup
   ;================================================================

   ; script variables...

   (set diskname1 "ImageFX_Disk1:")          ; install disk name
   (set diskname2 "ImageFX_Disk2:")          ; second install disk name
   (set diskname3 "ImageFX_Disk3:")          ; third install disk name
   (set diskname4 "ImageFX_Disk4:")          ; third install disk name

   ; system information...

   (set osver (/ (getversion) 65536))        ; os version
   (set cputype (database "cpu"))            ; cpu type

   ;-------------------
   ; Warn user.
   (message "These hooks and modules were either not created by Nova Design, Inc., "
            "or are based on software not created or supported by Nova Design.  "
            "Because of this, Nova Design cannot provide technical support or "
            "upgrades or enhancements for these extras.  They are "
            "provided for your amusement only; use them at your own risk.  "
            "If you do not want to install them, click `Abort Install' now.")

   ;-------------------
   ; Pick a default directory for the installation...
   (set initialdir @default-dest)            ; defaults to biggest drive
   (if (getassign "ImageFX")
      (
         (set initialdir (getassign "ImageFX"))
      )
   )

   ;-------------------
   ; Ask where to install it...
   (set wheredir
      (askdir
         (prompt "Select the directory where you would like to install the "
                 "ImageFX Extras.")
         (help "Select the directory where you have installed ImageFX.  The "
               "extras will not work in any other directory.")
         (default initialdir)
      )
   )

   (set @default-dest wheredir)

   ;-------------------
   ; Ask what to install...
   (set todo
      (askoptions
         (prompt "Select the extras you would like to install:")
         (help "Check the boxes to indicate which extras you would "
               "like installed on your system.")
         (choices
            "MPEG Utilities"
            "PostScript® Loader"
            "PAR_PEG Loader"
            "Photo CDROM Loader"
            "Grafexa (Harlequin) Renderer"
         )
      )
   )

   (set mask_mpeg    1)
   (set mask_post    2)
   (set mask_parpeg  4)
   (set mask_pcd     8)
   (set mask_grfx    16)

   ;-------------------
   ; Copy LHEX to RAM: for speediness
   (copyfiles
      (prompt "")
      (help "")
      (source diskname1)
      (dest "RAM:")
      (choices "lhex")
   )

   ;================================================================
   ; DISK 2
   ;================================================================

   (askdisk
      (prompt "Please insert ImageFX Disk 2 in any drive.")
      (help "")
      (dest (substr diskname2 0 (- (strlen diskname2) 1)))
      (assigns)
   )

   (if (BITAND mask_mpeg todo)
      (
         (working "Installing MPEG Utilities...")
         (run ("RAM:lhex >CON:0/0//60/lhex/AUTO -a -f -w=%s x %sExtras3.lha" wheredir diskname2))
         (tooltype
            (prompt "")
            (help "")
            (dest (tackon wheredir "Browser"))
            (settooltype "MPEG" (tackon wheredir "MPEG/mp"))
         )
      )
   )
   (if (BITAND mask_parpeg todo)
      (
         (working "Installing PAR_PEG Loader...")
         (run ("RAM:lhex >CON:0/0//60/lhex/AUTO -a -f -w=%s x %sExtras2.lha Modules/Loaders/PAR_PEG" wheredir diskname2))
      )
   )
   (if (BITAND mask_pcd todo)
      (
         (working "Installing Photo CDROM Loader...")
         (run ("RAM:lhex >CON:0/0//60/lhex/AUTO -a -f -w=%s x %sExtras2.lha Modules/Loaders/PCD" wheredir diskname2))
      )
   )
   (if (BITAND mask_grfx todo)
      (
         (working "Installing Grafexa Render Module...")
         (run ("RAM:lhex >CON:0/0//60/lhex/AUTO -a -f -w=%s x %sExtras2.lha Modules/Render/Grafexa" wheredir diskname2))
      )
   )

   ;================================================================
   ; DISK 4
   ;================================================================

   (complete 0)

   (if (BITAND mask_post todo)
      (

         (askdisk
            (prompt "Please insert ImageFX Disk 4 in any drive.")
            (help "")
            (dest (substr diskname4 0 (- (strlen diskname4) 1)))
            (assigns)
         )

         (working "Installing PostScript Loader...")
         (run ("RAM:lhex >CON:0/0//60/lhex/AUTO -a -f -w=%s x %sExtras1.lha" wheredir diskname4))

         (delete "LIBS:hwgpost.library")

         (if (OR (= cputype "68000") (= cputype "68010"))
            (
               (copylib
                  (prompt "")
                  (help @copylib-help)
                  (source (tackon wheredir "libs/hwgpost.library"))
                  (dest "LIBS:")
                  (newname "hwgpost.library")
               )
            )
            ; else
            (
               (copylib
                  (prompt "")
                  (help @copylib-help)
                  (source (tackon wheredir "libs/hwgpost.library.20"))
                  (dest "LIBS:")
                  (newname "hwgpost.library")
               )
            )
         )
         (run ("delete %s all quiet" (tackon wheredir "libs")))

      )
   )

   ;================================================================
   ; Miscellaneous Setup
   ;================================================================

   ;================================================================
   ; Cleanup
   ;================================================================

   (run "Delete RAM:lhex QUIET")

   (complete 100)

   ; Installation complete!
)

;-----------------------------------------------------------------------
; Revision History:
;
;  8/25/94 tek
;     Created.
;
;  9/02/94 tek
;     Fixed so it actually works.
;
