;$VER: WildSMEG Install Script v1.05 (01 Nov 1993) by JC
;      For use in C='s Installer program.

;*****************************************
;  Setup some text to be displayed later
;*****************************************

(set Select_Wildcard_Version
  (cat "\nWildSMEG currently supports the following versions of "
       "the Super Wild Card.  If your SWC has an older "
       "ROM version, contact JFM Consoles "
       "for an upgrade.\n\nWhich version of the Wild Card "
       "do you have ? \n")
)

(set Selected_2.2_ROM
  (cat "\nYou have a Wild Card v2.2CC!\n\nThere were actually "
       "two different versions of this ROM.  If WildSMEG! fails "
       "to control your Wild Card, follow these simple instructions:\n\n"
       "1] Quit WildSMEG!                       \n"
       "2] Rename the WildSMEG:WildSMEG.22N file\n"
       "to WildSMEG.ROM                   \n\n"
       "If it still fails to work, get a new ROM upgrade from JFM Consoles.\n") 
)

(set Final_Text
  (cat "\nInstallation successful!\n\nNow that you've installed "
       "WildSMEG!,\nP L E A S E  take a few minutes to read "
       "the\ncomplete docs.  They contain some important "
       "information you should know about when running WildSMEG!\n"
       "\n-*The WildSMEG! Development Team*-\n"
       "1st November 1993\n")
)

(set KS13_Text
  (cat "\nWildSMEG! was intended to be used on an Amiga with KS2.04 "
       "or Higher.  Although it _should_ work on KS1.3, it has not "
       "been tested, and so is _not_ guaranteed to work.  If you do have "
       "problems, go out and buy a new KS ROM immediately!\n\n"
       "Note: We have tried to use KS1.3 compatible files in this "
       "archive.  The only non-compatible program is Utilities/PPShow, so "
       "you will need to use your own program to view the SMEGCable Pic.\n")
)

(set KS_Version
  (getversion)
)

(if (< KS_Version 36)
  (message KS13_Text)
)


;**********************************
;  ask where to install Wild Smeg
;**********************************

(set @default-dest
  (askdir
    (prompt "Select the directory you would like WildSMEG installed.")
    (help @askdir-help)
    (default "WildSMEG:")
  )
)

(makeassign "WildSMEG" @default-dest)


;****************************************
;  Install Main Program and GameBoy DOS
;****************************************

(copyfiles
  (prompt "")
  (help @copyfiles-help)
  (source "")
  (dest "WildSMEG:")
  (pattern (cat "(Install_Me_First|GameBoy.DOS|SRAM2SMC)"))
  (infos)
  (noposition)
)
(protect "WildSMEG:WildSMEG" "+D +W")
(delete "WildSMEG:WildSMEG")
(rename (cat "WildSMEG:Install_Me_First") (cat "WildSMEG:WildSMEG"))
(rename (cat "WildSMEG:Install_Me_First.info") (cat "WildSMEG:WildSMEG.info"))
(delete "WildSMEG:Install_Me_First.info")

;**************************************************************
;  Copy AmigaGuide.library and Font if Required
;**************************************************************

(set Font_Exist
  (exists "Fonts:cedfont/8" (noreq))
)

(if (= Font_Exist 0)
  (copyfiles
    (source "Fonts")
    (dest "Fonts:")
    (all)
  )
)

(copylib
  (prompt "\nThe documentation is now in AmigaGuideŠ Format.")
  (help @copylib-help)
  (source "Libs/amigaguide.library")
  (dest "Libs:")
  (confirm)
)

;******************************
;  Install Docs ?
;******************************

(if (askbool
      (prompt "\nWould you like to install the documentation for WildSMEG ?")
      (help @copyfiles-help)
      (choices "Yes" "No")
      (default 1)
    )
    (
      (copyfiles
        (source "")
        (dest "WildSMEG:")
        (pattern (cat "(DSP_Docs|Cable_Docs|WildSMEG.guide|SRCodes.txt)"))
        (infos)
        (noposition)
      )
    )
)

;************************************
;  Install the right ROM
;************************************

(set Wildcard_Version
  (askchoice 
    (prompt Select_Wildcard_Version)
    (help @askchoice-help)  
      (choices 
         "2.2CC"
         "2.6CC"
         "2.6F"
      )
    (default 2)
  )
)

(if (= Wildcard_Version 0)
      (
        (copyfiles
          (source "")
          (dest "WildSMEG:")
          (pattern "WildSMEG.22?")
        )
      (rename (cat "WildSMEG:WildSMEG.22C") (cat "WildSMEG:WildSMEG.ROM"))
      )
      (if (= Wildcard_Version 1)
            (copyfiles
              (source "WildSMEG.26C")
              (dest "WildSMEG:")
              (newname "WildSMEG.ROM")
          )
          (if (= Wildcard_Version 2)
                (copyfiles
                  (source "WildSMEG.26F")
                  (dest "WildSMEG:")
                  (newname "WildSMEG.ROM")
                )
          )
      )
)

(if (= Wildcard_Version 0)
      (message (Selected_2.2_ROM))
)

;*****************************************************
;  Do the Assignment
;*****************************************************

(protect "s:startup-sequence" "+R +W +D")

(startup @app-name
  (prompt "\nThe WildSMEG: assignment is required for correct operation."
          "  Shall I insert the assignment into your s:User-Startup ?")
  (help @startup-help)
  (command "Assign WildSMEG: "@default-dest)
)

;****************************************
;  Quit
;****************************************

(message (Final_Text))
(run ("run Utilities/AmigaGuide WildSMEG.guide"))
(exit)
