;******************************************************************************** 
;
;CyberGraphics EnvSettings ©1994-1995 by Robert C. Reiswig
;If you wish to use parts you MUST ask!!  (April-21-95)
;For use with PD and Registered CyberGraphics Only, not for Commercial use.
;For Frank Mariak ONLY : CyberGraphics!
;
;Installer suggestions or problems: rcr@netcom.com
;
;********************************************************************************
(set #cyberver "40.49")


;******************************************************************************** 
;
; Read All System information 
;
;********************************************************************************
(set #PAY 1) ; 0=NO 1=YES 
(set cpu (database "cpu"))
(set vblank (database "vblank"))
(set graphmem (database "graphics-mem"))
(set totmem (database "total-mem"))
(set osver (/ (getversion "LIBS:version.library") 65536))
(if (= vblank "60") ((set blank "NTSC")) ((set blank "PAL")))
(set fastmem (- totmem graphmem))

( if (= osver 37) ( (set workbench "2.0")) ( if (= osver 38) ( (set workbench "2.1"))
( if (= osver 39) ( (set workbench "3.0")) ( if (= osver 40) ( (set workbench "3.1"))
( if (= osver 41) ( (set workbench "4.0")) )))))

(run "type >RAM:lan EnvArc:sys/locale.prefs opt h")
(set runstring (cat "search" " RAM:lan "))

(set english "")  (set german  "")

(set runstring1 (cat runstring "\"deutschland\""))   (if (= (run runstring1) 0) (set german1 "Deutsch"))
(set runstring1 (cat runstring "\"english\""))   (if (= (run runstring1) 0) (set english1 "English"))	  

(set CyberDrawer "CyberVision:")
(set were "sys")

;******************************************************************************** 
;
;ASK DEFAULT LANG
;
;********************************************************************************
(set #langQuestion (cat "The following were found in Locale:\n\n" english1 "\n"german1"\n\nSelect one of the installers supported Languages."))

(set LAN  (askchoice (choices "German (Deutsch)" "English"
			 (prompt #langQuestion)
	                 (help "Select a Language")
          		 (default lang)
	             )
          )
)

;******************************************************************************** 
;
;English Information
;
;********************************************************************************
(set #ThankYou (cat "\nWelcome to the Registered version of the Cybergraphics "
                    "installer!\n\n\nTHANK YOU"
               )
)

(set #By (cat "Cybergraphics Release Version " #cyberver "\n"
              "Software by:\n\nFrank Mariak\nfmariak@chaosengine.ping.de"
              "\n\n&\n\nThomas G.Sontowski\nmarvin@sub.ph-cip.uni-koeln.de"
              "\n\n\nInstallers & Versions By:\n Robert Reiswig - rcr@netcom.com"
         )
)





(set #MinReqOS (cat "The following are the MINIMUM REQUIREMENTS!\n"
                    "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
                    "Kickstart 3.x, **You only have " workbench "**\n\n" 
                    "PicassoII in linear mode *not segmented*\n\n"
                    "68020 or higher\n\n"
                    "2 MB of fast memory"                       
               ) 
)


(set #MinReqCp (cat "The following are the MINIMUM REQUIREMENTS!\n"
                    "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
                    "68020 or higher, **You only have " cpu "**\n\n"
                    "PicassoII in linear mode *not segmented*\n\n"
                    "Kickstart 3.x\n\n"                     
                    "2 MB of fast memory" 
               )
)  


(set #SysInfo (cat "Basic System Check, This Machine Has\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                   " \"" workbench "\" Version of OS\n\n"
                   " \"" cpu "\" Processor\n\n "
                   " \"" blank "\" Machine\n\n"
                   " \"" graphmem  "\" Total Free Chip Memory\n\n"
                   " \"" fastmem  "\" Total Free Fast Memory\n\n  \"" totmem "\" Total Free Memory\n\n"
              )
)



(set #EnvAbort (cat "\n\nEnvSettings could not find one of the Environment Varibles."
                    "\n\nAre you an registered user?  If you are then you need to run "
                    "the \"CyberGfx_Install\" to install the Env Vars correctly."
               )
)

(set #currset "\n\nThis setting is currently set to:")




(set #cpup2c (cat "CPUP2C\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                  "By setting this variable, the planar-to-chunky conversion "
                  "will be done by the CPU (in contrast to the blitter conversion) "
                  "Therefore the ugly looking "planar" blitting effects are gone, "
                  "but the software conversion is slower. Do you wish to Enable this feature?"
             )
)
  

(set #hirescrsr (cat "HIRESCRSR\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                     "By setting this variable, the Lores-Sprites on non-AA-machines "
                     "become Hires-sprites (they are no longer doubled by "
                     "the cybergraphics-Software). "
                     "This variable is identical to the tooltype HIRESSPRITE "
                     "of older Picasso-monitor files."
                )
)
  

(set #WhereReadME "Please select where you wish to put the ReadMe.")


(set #hide15bit (cat "HIDE15BIT\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                     "By setting this variable, you can switch off 15bit modes to reduce "
                     "screenmode list length. The Modes are still available but hidden."
                )
)

(set #alertemu  (cat "ALERTEMU\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                     "By setting this variable, DisplayAlert(), (The Screens you get when the machine crashes.) " 
                     "will be placed on an CyberGraphics screens."
                )
)



;******************************************************************************** 
;
;German Information
;
;********************************************************************************
(if (= LAN 0)
(

(set #By (cat "Cybergraphics Software von:\n\nFrank Mariak\nfmariak@chaosengine.ping.de"
              "\n\n&\n\nThomas G.Sontowski\nmarvin@sub.ph-cip.uni-koeln.de"
              "\n\n\nInstallerskript von:\n Robert Reiswig - rcr@netcom.com"
         )
)

(set #MinReqOS (cat "Folgendes sind die Minimalanforderungen !\n"
	          "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
                  "Kickstart 3.x, **Sie haben nur " Workbench "**\n\n"
                  "PicassoII im linear Modus *nicht segmentiert*\n\n"
                  "68020 oder höher\n\n"
                  "2 MB FAST Ram"
             )
)

(set #MinReqCP  (cat "Folgendes sind die Minimalanforderungen!\n"
                   "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
                   "68020 oder höher, **Sie haben nur eine " cpu "**\n\n"
                   "PicassoII im linear Modus *nicht segmentiert*\n\n"
                   "Kickstart 3.x\n\n"
                   "2 MB FAST Ram"
              )
)


(set #SysInfo (cat "Minimaler System Check, Dieser Rechner hat\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                   " Version \"" Workbench "\" des OS\n\n"
                   " \"" cpu "\" Prozessor\n\n "
                   " \"" blank "\" Gerät\n\n"
                   " \"" graphmem  "\" freier Chip Speicher\n\n"
                   " \"" fastmem  "\" freies Fast RAM\n\n  \"" totmem "\" freies RAM gesamt\n\n"
              )
)



(set #cpup2c (cat "CPUP2C\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                  "Wenn Sie diese Variable setzen, wird die Planar-nach-Chunky Konvertierung "
                  "von der CPU erledigt (im Gegensatz zur Blitter-Konvertierung) "
                  "Damit sind die teilweise merkwürdig aussehenden "planar" Bliteffekte verschwunden, "
                  "aber die CPU-Konvertierung ist langsamer. Wollen Sie diese Möglichkeit aktivieren ?"
             )
)
  

(set #hirescrsr (cat "HIRESCRSR\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                     "Wenn diese Variable aktiviert ist, werden Lores-Sprites auf nicht-AGA-Geräten "
                     "zu Hires-sprites (Sie werden nicht mehr von der cybergraphics Software "
                     "verdoppelt). "
                     "(Diese Variable ist identisch mit dem Tooltype HIRESSPRITE "
                     "in der alten Picasso software)."
                )
)


(set #hide15bit (cat "HIDE15BIT\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                     "Wenn diese Variable aktiviert ist, werden die 15Bit Modi deaktiviert, um "
                     "die Screenmodeliste zu verkuerzen. Die Modes sind immer noch da, aber nicht sichtbar."
                )
)

(set #alertemu  (cat "ALERTEMU\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                     "Ist diese Variable aktiviert, wird DisplayAlert(), (Die Routine, die eine Guru-Box erzeugt.) " 
                     "auf einen cybergraphics Bildschirm umgeleitet."
                )
)
 


(set #WhereReadME "Please select where you wish to put the ReadMe.")


(set #EnvAbort (cat "\n\nEnvSettings konnte keine der Einstellungen finden."
                    "\n\nSind Sie ein registrierter User?  Insofern Sie es sind, müssen "
                    "Sie \"CyberGfx_Install\" aufrufen um die Variablen richtig zu setzen."
               )
)

(set #currset "\n\nDiese Einstellung ist momentan gesetzt auf:")



)

)



;******************************************************************************** 
;
; Main Part of the Installer (Main Loop) 
;
;********************************************************************************
;(message #by)
;(message #SysInfo)

;******************************************************************************** 
; Check CPU & OS for Right versions 
;********************************************************************************
(if (< osver 39)  (abort #MinReqOS) )
(if (< cpu 68020) (abort #MinReqCP) )

;******************************************************************************** 
; Check for ENV files... Not checking for now...
;********************************************************************************
;(if (< (exists ("ENV:cybergraphics/HIRESCRSR")) 1)
; (abort #EnvAbort)
;)
;
;(if (< (exists ("ENV:cybergraphics/CPUP2C")) 1)
; (abort #EnvAbort)
;)

;******************************************************************************** 
; Find out whats in the env vars...
;********************************************************************************
(set hires 0)  (set cpup2c 0)  (set hide15bit 0)

(set runstring (cat "search" " ENV:cybergraphics/HIRESCRSR"))
(set runstring1 (cat runstring " 0"))   (if (= (run runstring1) 0) (set hires 0))
(set runstring1 (cat runstring " 1"))   (if (= (run runstring1) 0) (set hires 1))	  

(set runstring (cat "search" " ENV:cybergraphics/CPUP2C"))
(set runstring1 (cat runstring " 0"))   (if (= (run runstring1) 0) (set cpup2c 0))
(set runstring1 (cat runstring " 1"))   (if (= (run runstring1) 0) (set cpup2c 1))

(set runstring (cat "search" " ENV:cybergraphics/HIDE15BIT"))
(set runstring1 (cat runstring " 0"))   (if (= (run runstring1) 0) (set hide15bit 0))
(set runstring1 (cat runstring " 1"))   (if (= (run runstring1) 0) (set hide15bit 1))	  

(set runstring (cat "search" " ENV:cybergraphics/ALERTEMU"))
(set runstring1 (cat runstring " 0"))   (if (= (run runstring1) 0) (set alertemu 0))
(set runstring1 (cat runstring " 1"))   (if (= (run runstring1) 0) (set alertemu 1))	  

;******************************************************************************** 
; CPUP2C
;********************************************************************************
(set cpup2c   (askchoice    (choices "No" "Yes")
	                       (prompt (cat #cpup2c " " #currset))
	                       (help   (cat #cpup2c " " #currset))
          		       (default cpup2c)
	      )
)

(if (= cpup2c 0) ( (run "setenv cybergraphics/CPUP2C 0")
     (copyfiles (source "ENV:cybergraphics/CPUP2C") (dest "ENVARC:cybergraphics") )  )
)

(if (= cpup2c 1) ( (run "setenv cybergraphics/CPUP2C 1")
     (copyfiles (source "ENV:cybergraphics/CPUP2C") (dest "ENVARC:cybergraphics") )  )
)

;******************************************************************************** 
; HIRESCRSR
;********************************************************************************
(set HIRESCRSR (askchoice    (choices "No" "Yes")
	                       (prompt (cat #hirescrsr " " #currset))
	                       (help   (cat #hirescrsr " " #currset))
          		       (default hires)
	       )
)

(if (= HIRESCRSR 0) ( (run "setenv cybergraphics/HIRESCRSR 0")
     (copyfiles (source "ENV:cybergraphics/HIRESCRSR") (dest "ENVARC:cybergraphics") ) )
)

(if (= HIRESCRSR 1) ( (run "setenv cybergraphics/HIRESCRSR 1")
     (copyfiles (source "ENV:cybergraphics/HIRESCRSR") (dest "ENVARC:cybergraphics") ) )
)


;******************************************************************************** 
; HIDE15BIT
;********************************************************************************
(set HIDE15BIT (askchoice    (choices "No" "Yes")
	                       (prompt (cat #hide15bit " " #currset))
	                       (help   (cat #hide15bit " " #currset))
          		       (default hide15bit)
	       )
)

(if (= HIDE15BIT 0) ( (run "setenv cybergraphics/HIDE15BIT 0")
     (copyfiles (source "ENV:cybergraphics/HIDE15BIT") (dest "ENVARC:cybergraphics") ) )
)

(if (= HIDE15BIT 1) ( (run "setenv cybergraphics/HIDE15BIT 1")
     (copyfiles (source "ENV:cybergraphics/HIDE15BIT") (dest "ENVARC:cybergraphics") ) )
)


;******************************************************************************** 
; ALERTEMU
;********************************************************************************
(set ALERTEMU  (askchoice    (choices "No" "Yes")
	                       (prompt (cat #alertemu " " #currset))
	                       (help   (cat #alertemu " " #currset))
          		       (default alertemu)
	       )
)

(if (= ALERTEMU 0) ( (run "setenv cybergraphics/ALERTEMU 0")
     (copyfiles (source "ENV:cybergraphics/ALERTEMU") (dest "ENVARC:cybergraphics") ) )
)

(if (= ALERTEMU 1) ( (run "setenv cybergraphics/ALERTEMU 1")
     (copyfiles (source "ENV:cybergraphics/ALERTEMU") (dest "ENVARC:cybergraphics") ) )
)

;******************************************************************************** 
; Fool the installer to skip the welcome and set the defdest
;********************************************************************************
(set @default-dest "ENV:cybergraphics")
(if (= FrankIsAKing 46) (welcome) )

