
(complete 0)


;=============================================================================
; say hi!
(welcome)


;=============================================================================
; figure out what the user wants to do

(set completeInstall (askbool (prompt "\n\nDo you wish to perform a complete installation of the "
                                      "AmigaVision Player program, or do you wish to install "
                                      "a new AmigaVision videodisc driver?"
                              )
                              (choices "Install AmigaVision Player" "Install Videodisc Driver")
                              (help "Complete installation will create a drawer called AVPlayer. "
                                    "Into this drawer will be copied the AmigaVision Player "
                                    "program and all necessary support files.\n\n"
                                    "You only need to install a videodisc driver if you plan to "
                                    "run an AmigaVision Professional application which uses a "
                                    "videodisc player.\n\n"
                                    @askbool-help)
                     )
)


;=============================================================================
; get location where the main player should go
(if (= completeInstall TRUE)
(

(set target (askdir (prompt "Where do you want the AmigaVision Player "
                            "drawer installed?"
                    )
                    (help "This install procedure will create a drawer "
                          "called AVPlayer within the drawer or "
                          "partition you specify. \n\n"
                          @askdir-help)
                    (default @default-dest)
            )
)

(set target (tackon target "AVPlayer"))
(set @default-dest target)
(makedir target (infos))


;=============================================================================
; copy files to target

(complete 5)

(copyfiles (source "AV_Player:AVPlayer")
           (dest target)
           (infos)
)

(complete 25)

(copylib (source "AV_Player:Libs/avdb.library")
         (dest target)
)

(complete 30)

(copylib (source "AV_Player:Libs/avtextgad.library")
         (dest target)
)

(complete 40)

(copylib (source "AV_Player:Libs/camd.library")
         (dest "LIBS:")
)

(complete 50)

(copylib (source "AV_Player:Libs/realtime.library")
         (dest "LIBS:")
)

(complete 70)

(if (not (askbool (prompt "\nDo you wish to install a videodisc "
                          "driver to be used with the AmigaVision Player?"
                  )
                  (help "You must install a videodisc driver if you are going "
                        "to run an AmigaVision Professional application that uses "
                        "a videodisc player. \n\n"
                        @askbool-help)
                  (choices "Install Videodisc Driver" "Skip")
         )
    )
(
    (exit)
))

))

;=============================================================================
; Which videodisc driver should we plop on there...

(set vd (askchoice (prompt "Which videodisc driver should be installed?")
                   (help "You can install only one videodisc driver at a time.\n\n "
                         @askchoice-help)
                   (choices "NEC_PC-VCR"
                            "Panasonic_tq3032f"
                            "Philips_405"
                            "Philips_410"
                            "Philips_835"
                            "Pioneer_2200"
                            "Pioneer_4200"
                            "Pioneer_6000"
                            "Pioneer_6010"
                            "Pioneer_8000"
                            "Sony_1200"
                            "Sony_1500"
                            "Sony_1550"
                            "Sony_2000"
                            "Sony_Umatic9"
                    )
                    (default 0)
        )
)

(if (OR (= vd 0) (= vd 2))
(
    (set baud 1200)
)
(
    (if (OR (= vd 5) (= vd 6))
    (
        (set baud (askchoice (prompt "\nWhich baud rate should be used to communicate "
                                     "with the videodisc unit?"
                             )
                             (choices "1200 baud" "4800 baud")
                             (help @askchoice-help)
                             (default 0)
                  )
        )
        (if (= baud 0) (set baud 1200))
        (if (= baud 1) (set baud 4800))
    )
    (
        (set baud (askchoice (prompt "\nWhich baud rate should be used to communicate "
                                     "with the videodisc unit?"
                             )
                             (choices "1200 baud" "2400 baud" "4800 baud" "9600 baud")
                             (help @askchoice-help)
                             (default 0)
                  )
        )

        (if (= baud 0) (set baud 1200))
        (if (= baud 1) (set baud 2400))
        (if (= baud 2) (set baud 4800))
        (if (= baud 3) (set baud 9600))
    ))
))

(set vdname (select vd "NEC_PC-VCR"
                       "Panasonic_tq3032f_4800"
                       "Philips_405_1200"
                       "Philips_410_9600"
                       "Philips_835_9600"
                       "Pioneer_2200_4800"
                       "Pioneer_4200_4800"
                       "Pioneer_6000_9600"
                       "Pioneer_6010_9600"
                       "Pioneer_8000_4800"
                       "Sony_1200_9600"
                       "Sony_1500_9600"
                       "Sony_1550_9600"
                       "Sony_2000_9600"
                       "Sony_Umatic9_9600"
             )
)

(complete 60)

(if (askbool (prompt "\n\nIs the videodisc unit connected to the Amiga's built-in "
                     "serial port, or to an add-on serial port?"
             )
             (choices "Built-In Serial Port" "Add-On Serial Port")
             (help "A videodisc player connects to a computer through a serial port. "
                   "Your Amiga or CDTV unit came equipped with a built-in serial port "
                   "(found in the back of the machine). You can also attach additional "
                   "serial ports to your machine through a multi-port serial card.\n\n"
                   "Select \"Built-In Serial Port\" if your videodisc player is connected "
                   "to that port. Otherwise select \"Add-On Serial Port.\" \n\n"
                   @askbool-help)
    )
(
    (set device "serial.device")
    (set unit 1)
)
(
    (set device (askfile (prompt "Which device does the add-on serial port use? "
                                 "Refer to the documentation for your add-on "
                                 "serial port to obtain this information. "
                          )
                         (help "Select the device driver which your specific add-on serial "
                               "port uses. For example, the \"MorePorts\" multi-serial "
                               "board might use the file \"MorePorts.device.\" \n\n"
                               @askstring-help)
                         (default "DEVS:")
                )
    )
    (set unit (asknumber (prompt ("\n\nTo which unit of %s is the videodisc player connected?"
                                  device
                                 )
                         )
                         (default 1)
                         (help "Specify a number which represents the serial port that "
                               "your videodisc player is connected. The default port "
                               "number is \"1\". \n\n"
                               @asknumber-help)
              )
    )
))

(complete 70)

(copyfiles (source (cat "AV_Player:Devs/Players/" vdname))
           (dest "DEVS:Players")
)

; if copying the PC-VCR driver, also include TapeStamp
(if (= vd 0)
(
    (copyfiles (source "AV_Player:Devs/Players/TapeStamp")
               (dest "DEVS:Players")
    )
))

(complete 90)

(textfile (dest "DEVS:player-units")
          (append "0 " vdname " " baud " " device " " unit)
)

(complete 100)

(if (= completeInstall FALSE)
(
    (message (cat "\n\nThe " vdname " driver has been installed."))
    (exit (quiet))
))
