;
; GMPlay install script
; ---------------------
; © 1996 by Christian Buchner
;
; $VER: GMPlayInstall (19.06.96)
;

(set @app-name "GMPlay V1.1a")

; Do not allow Novice User (when running from Shell)

(if (= @user-level 0)
    (set @user-level 1)
)


;=============================================================================
; English strings

(set default_lang 4)

(set #welcomestring "GMPlay V1.1a\n--------------\n©1995,96 by Christian Buchner & Alessandro de Luca\nGiftware, any donations welcome!\nPlease support the development of a fine program!\n")
(set #whereprogram "Where shall I install GMPlay?\n A drawer called \"GMPlay\" will be created there.")
(set #installwhat "Please select what parts of the\npackage you want to install.")
(set #install0 "Install documentation (recommended)")
(set #install1 "Install XPK libraries (recommended)")
(set #install2 "Install the 14 bit driver (recommended)")
(set #install3 "Install the IFF sound samples (recommended)")
(set #install4 "Install the 14 bit calibration utility")
(set #install5 "Install the example MIDI files")
(set #install6 "Add GM: Assign to S:User-Startup (recommended)")
(set #copyprogram "Copying GMPlay executable")
(set #wheredocs "Where shall I place the documentation guide?\nPerhaps you prefer the HELP: directory?")
(set #copydocs "Copying documentation guide.")
(set #wherelibs "Where do you want the libraries installed?\nMake sure that there is a LIBS: assign to that directory.")
(set #copyxpk "Copying xpkmaster.library.")
(set #copyshri "Copying xpk SHRI sublibrary.")
(set #copysqsh "Copying xpk SQSH sublibrary.")
(set #copy14bit "Copying 14 bit sound driver.")
(set #copytones "Copying tone samples (XPK SQSH packed!).")
(set #copydrums "Copying drum samples (XPK SQSH packed!).")
(set #copytonemap "Copying tone map file.")
(set #copydrummap "Copying drum map file.")
(set #copycalib "Copying 14 bit calibration utility.")
(set #copymidi "Copying example MIDI files (XPK SHRI packed!).")
(set #addassign "Adding Assign for \"GM:\" to your User-Startup.")
(set #endmessage "GMPlay has been successfully installed.\nNote that GMPlay is a CLI-based program.\nPlease read the documentation.\nThen try playing the example songs.\n")

(complete 0)

(welcome #welcomestring)

(set #TargetDir
	(askdir
		(prompt #whereprogram)
		(help @askdir-help)
		(default
			(expandpath
				(if (exists "GM:" (noreq))
					"GM:/"
				(if (exists "Music:" (noreq))
					"Music:"
				(if (exists "Sound:" (noreq))
					  "Sound:"
				(if (exists "Work:Music" (noreq))
					  "Work:Music"
				(if (exists "Work:Sound" (noreq))
					  "Work:Sound"
				(if (exists "Work:" (noreq))
					  "Work:" "SYS:"
				)))))))
		)
		(newpath)
	)
)

(set #DestDir (tackon #TargetDir "GMPlay"))
(makedir #DestDir (infos))

(complete 10)

(set #InstFlags
	(askoptions
		(prompt #installwhat)
		(help @askoptions-help)
		(choices #install0
			 #install1
			 #install2
			 #install3
			 #install4
			 #install5
			 #install6
		)
	)
)

(complete 20)

(copyfiles
	(prompt #copyprogram)
	(help @copyfiles-help)
	(source "GMPlay")
	(dest #DestDir)
	(infos)
	(confirm)
)

(complete 30)

(if (BITAND #InstFlags 1)
	(
		(set #DocsDir
			(askdir
				(prompt #wheredocs)
				(help @askdir-help)
				(default #DestDir)
				(newpath)
			)
		)
		
		(makedir #DocsDir)
		
		(copyfiles
			(prompt #copydocs)
			(help @copyfiles-help)
			(source "GMPlay.guide")
			(dest #DocsDir)
			(infos)
			(confirm)
		)
	)
)

(complete 40)

(if (BITAND #InstFlags 2)
	(
		(set #LibsDir
			(askdir
				(prompt #wherelibs)
				(help @askdir-help)
				(default "LIBS:")
				(newpath)
			)
		)
		
		(set #CompDir (tackon #LibsDir "compressors"))
		(makedir #LibsDir)
		(makedir #CompDir)
		
		(copylib
			(prompt #copyxpk)
			(help @copylib-help)
			(source "Libs/xpkmaster.library")
			(dest #LibsDir)
			(confirm)
		)
		
		(copylib
			(prompt #copyshri)
			(help @copylib-help)
			(source "Libs/compressors/xpkSHRI.library")
			(dest #CompDir)
			(confirm)
		)
		
		(copylib
			(prompt #copysqsh)
			(help @copylib-help)
			(source "Libs/compressors/xpkSQSH.library")
			(dest #CompDir)
			(confirm)
		)
	)
)


(complete 50)

(if (BITAND #InstFlags 4)
	(
		(set #DriverDir (tackon #DestDir "SoundDrivers"))
		(makedir #DriverDir)
		
		(copyfiles
			(prompt #copy14bit)
			(help @copyfiles-help)
			(source "SoundDrivers")
			(pattern "14bit#?")
			(dest #DriverDir)
			(confirm)
		)
	)
)

(complete 60)

(if (BITAND #InstFlags 8)
	(
		(copyfiles
			(prompt #copytones)
			(help @copyfiles-help)
			(source "")
			(pattern "Tones")
			(dest #DestDir)
			(confirm)
		)
		
		(copyfiles
			(prompt #copydrums)
			(help @copyfiles-help)
			(source "")
			(pattern "Drums")
			(dest #DestDir)
			(confirm)
		)
		
		(copyfiles
			(prompt #copytonemap)
			(help @copyfiles-help)
			(source "ToneMap")
			(dest #DestDir)
			(confirm)
		)
		
		(copyfiles
			(prompt #copydrummap)
			(help @copyfiles-help)
			(source "DrumMap")
			(dest #DestDir)
			(confirm)
		)
	)
)

(complete 70)

(if (BITAND #InstFlags 16)
	(
		(copyfiles
			(prompt #copycalib)
			(help @copyfiles-help)
			(source "14Bit_Calibration")
			(dest #DestDir)
			(infos)
			(confirm)
		)
	)
)

(complete 80)

(if (BITAND #InstFlags 32)
	(
		(copyfiles
			(prompt #copymidi)
			(help @copyfiles-help)
			(source "")
			(pattern "MIDI-Files")
			(dest #DestDir)
			(infos)
			(confirm)
		)
	)
)

(complete 90)

(if (BITAND #InstFlags 32)
	(
		(startup "GMPlay"
			(prompt #addassign)
			(help @startup-help)
			(command (cat "Assign GM: \"" #DestDir "\""))
		)
	)
)

(makeassign "GM" #DestDir)

(complete 100)

(message #endmessage)
(exit (quiet))

; End of File
