; ***********************************************
; *                                             *
; *      THC-Engine V?.x HD-Installer by        *
; *             Marinus Kuivenhoven             *
; *          (Anakin / tRS ^ Seasons)           *
; *                   V1.0                      *
; *                                             *
; ***********************************************

;------------------------------------------------ Put variables

; ***************** Assign-text

(set AsName	"THC:")

; ***************** Files

(set ProgFile	"THC.exe")
(set GuideFile	"THC.guide")

; ***************** Dest-directories

(set DestDirName	"THC")
(set Subcarts	  	"carts")

; ***************** Messages

(set IntroMsg
	(cat	"\nTHC-Engine Version 0.205a"
		"\n"
		"\nHi! Now you are going to install version 2.05a"
		"\nof this PC-Engine emulator on your harddrive."
		"\n"
		"\nThe whole program requires about 400 kBytes"
		"\nof free diskspace on your hardrive."
	)
)


(set EndMsg
	(cat	"\nEverything has gone correctly!"
		"\nNow start the program and have phun."
	)
)


(set AssignMsg
	(cat	"\nTo start-up THC-Engine properly,"
		"\nI have to make an Assign. Therefore"
                "\nI am going to change your User-startup."
	)
)

; ***************** Prompts

(set DestDirPrompt
	(cat	"Where do you want to install 'THC-Engine'?"
		"\nA new directory will be created."
	)
)

(set CopyMainPrompt
	"Copying main program..."
)

(set CopyGuidePrompt
	"Copying guidefile..."
)

(set CopyFontsPrompt
	"Copying Fonts..."
)

(set AsPrompt
        "Adding things to your user-startup..."
)

; ***************** Help

(set DestDirHelp
	(cat	"\nHello! I am asking you where you want"
		"\nto put the program on your harddisk."
	)
)


(set AsHelp
	(cat	"\nIf I don't make an assign, the program will"
		"\nNOT work, so..."
	)
)

;------------------------------------------------ The Installer

; ***************** Intro

(message IntroMsg)

; ***************** Ask for the destination directory

(set DestDir
	(askdir
	(prompt  DestDirPrompt)
	(help DestDirHelp)
	(default "Ram:")
	)
)

; ***************** Make the destination directory

(set DestDir
	(tackon DestDir DestDirName)
)

(makedir
	(DestDir)
	(infos)
)

(set @default-dest (DestDir))

; ***************** Copy the main program

(copyfiles
	(prompt CopyMainPrompt)
	(help @copyfiles-help)
	(source ProgFile)
	(dest DestDir)
        (infos)
)

; ***************** Copy the guidefile

(copyfiles
	(prompt CopyGuidePrompt)
	(help @copyfiles-help)
	(source GuideFile)
	(dest DestDir)
        (infos)
)

; ***************** Copy the Fonts

(set @Destdir "FONTS:")

(copyfiles
	(prompt "And the fonts...\nWhere do I put them?")
	(help @copyfiles-help)
	(source "fonts/")
	(dest @Destdir)
	(all)
	(confirm)
)

; ***************** Remember the Base-dir

(set BaseDir DestDir)

; ***************** Make Carts subdirectory

(set DestDir
	(tackon BaseDir Subcarts)
)

(makedir
	(DestDir)
)

(set @default-dest (DestDir))

; ***************** Reset the Base-dir

(set @default-dest (BaseDir))

; ***************** Add assign to user-startup

(message AssignMsg)

(startup AsName
	(prompt AsPrompt)
	(help AsHelp)
	(command
		"Assign THC: \"" @default-dest "\"\n"
	)
	(makeassign "THC" @default-dest (safe))
)

; ***************** End message

(message EndMsg)

; ***************** Finish!!
;------------------------------------------------ End
