Name "Jheriko - J7"
Icon "J7.ico"
OutFile "J7.exe"

Function .onInit

SetOutPath $TEMP
File /oname=spltmp.bmp "j7_splash.bmp"

advsplash::show 1000 500 500 -1 $TEMP\spltmp

Pop $0 ;

Delete $TEMP\spltmp.bmp


StrCpy $9 0
FunctionEnd

Function .onNextPage

IntOp $9 $9 + 1

IntCmp $9 2 nothing

Goto jump

nothing:

SectionGetFlags 2 $1
SectionGetFlags 3 $2

IntOp $1 $1 + $2

IntCmp $1 1 getwa2path getwa3path getwa2path

getwa2path:
ReadRegStr $INSTDIR HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "UninstallString" 
StrCpy $INSTDIR $INSTDIR "" 1 
Goto skippy

getwa3path:
ReadRegStr $INSTDIR HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" "UninstallString"

skippy:

StrCpy $1 $INSTDIR
loopy:
StrCpy $2 $INSTDIR 1 $1
StrCmp $2 "" lpdone
StrCmp $2 "\" lpdone
IntOp $1 $1 - 1
Goto loopy
lpdone:
StrCpy $INSTDIR $INSTDIR $1

jump:

FunctionEnd

Function .onPrevPage

IntOp $9 $9 - 1

FunctionEnd

DirText "Please enter your full Winamp path below."

ComponentText "Please choose the version of Winamp that you wish to install to. Make sure that if you choose custom you only select components for ONE version of Winamp."

InstType "Winamp 2"
InstType "Winamp 3"

AutoCloseWindow false
ShowInstDetails show

Section "-"
SectionIn 1 2
SectionEnd

SubSection /e "Winamp 2.x"

Section "J7"
SectionIn 1
	SetOutPath "$INSTDIR\Plugins\AVS"

 	File "D:\winamp\plugins\avs\PAK9_1.bmp"

	IfFileExists "$INSTDIR\Plugins\AVS\multiplier.ape" j1
 	File "D:\winamp\plugins\avs\multiplier.ape"
j1:
	IfFileExists "$INSTDIR\Plugins\AVS\convolution.ape" j2
 	File "D:\winamp\plugins\avs\convolution.ape"
j2:
	IfFileExists "$INSTDIR\Plugins\AVS\channelshift.ape" j3
 	File "D:\winamp\plugins\avs\channelshift.ape"	
j3:	

	SetOutPath "$INSTDIR\Plugins\AVS\Jheriko - J7"

	File "D:\winamp\plugins\avs\Jheriko - J7\*.avs"
SectionEnd

Section "HiRes Bonus Pack"
SectionIn 1
	SetOutPath "$INSTDIR\Plugins\AVS\Jheriko - HiRes"

	File "D:\winamp\plugins\avs\Jheriko - HiRes\*.avs"	
SectionEnd

SubSectionEnd

SubSection "Winamp 3.x"

Section "J7"
SectionIn 2
	SetOutPath "$INSTDIR\wacs\data\AVS\"

 	File "D:\winamp\plugins\avs\PAK9_1.bmp"

	IfFileExists "$INSTDIR\wacs\data\AVS\multiplier.ape" j4
 	File "D:\winamp\plugins\avs\multiplier.ape"
j4:
	IfFileExists "$INSTDIR\wacs\data\AVS\convolution.ape" j5
 	File "D:\winamp\plugins\avs\convolution.ape"
j5:
	IfFileExists "$INSTDIR\wacs\data\AVS\channelshift.ape" j6
 	File "D:\winamp\plugins\avs\channelshift.ape"	
j6:

	SetOutPath "$INSTDIR\wacs\data\AVS\Jheriko - J7"

	File "D:\winamp\plugins\avs\Jheriko - J7\*.avs"
SectionEnd

Section "HiRes Bonus Pack"
SectionIn 2
	SetOutPath "$INSTDIR\wacs\data\AVS\Jheriko - HiRes"

	File "D:\winamp\plugins\avs\Jheriko - HiRes\*.avs"	
SectionEnd

SubSectionEnd

Section "AVS Preset Icon"
SectionIn 1 2
	SetOutPath $WINDIR
	
	IfFileExists "$WINDIR\avspreset.ico" alreadyiconed

	File "D:\avspreset.ico"

alreadyiconed:

	WriteRegStr HKCR ".avs" "" "AVSPreset"
	WriteRegStr HKCR "AVSPreset" "" "AVS Preset"
	WriteRegStr HKCR "AVSPreset\DefaultIcon" "" "$WINDIR\avspreset.ico"
SectionEnd