脚本:Winamp5音效增强绿色版

优质
小牛编辑
114浏览
2023-12-01
引用winamp.nsi的内容:

#######################################################################################
# 编译: 必须使用 NSIS 2.01 或以上版本
# 脚本编写: 蓝色网际

# 自定义设置,版本号等等
!define VER_MAJOR "5"
!define VER_MINOR "094"

# 是否添加到控制面板卸载程序
;!define ADDUNINSTREG

#######################################################################################


;----------------------------------安装程序属性
Name                 "Winamp"
OutFile              "Winamp\setup.exe"
Caption              "Nullsoft Winamp ${VER_MAJOR}.${VER_MINOR} 音效增强绿色版"
SetCompressor        /SOLID lzma
BrandingText         "绿色软件"
InstallDir           "$PROGRAMFILES\Winamp"
!ifdef ADDUNINSTREG
InstallDirRegKey     HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp${VER_MAJOR}" "InstallDir"
!endif
ShowInstDetails      show
ShowUninstDetails    show
AutoCloseWindow      true
SpaceTexts           none

;Var HWND
Var hFile

!include             "UsefulLib.nsh"
${GetChild}
${ForEachFile}
${un.DelFileByLog}
${un.RMDir}

!include             "MUI.nsh"

;----------------------------------页面界面设置
	!define MUI_ICON ".\resource\inst.ico"
	!define MUI_UNICON ".\resource\uninst.ico"
	!define MUI_HEADERIMAGE
	!define MUI_HEADERIMAGE_BITMAP ".\resource\modern-header.bmp"
	!define MUI_COMPONENTSPAGE_NODESC


;----------------------------------页面文本设置
	!define MUI_LICENSEPAGE_TEXT_TOP "请在安装前阅读并同意下面的许可条款"
	!define MUI_ABORTWARNING

;----------------------------------插入页面
	!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow
	!insertmacro MUI_PAGE_LICENSE ".\resource\License.txt"
	!insertmacro MUI_PAGE_COMPONENTS
	!insertmacro MUI_PAGE_DIRECTORY
	!insertmacro MUI_PAGE_INSTFILES

	!insertmacro MUI_UNPAGE_CONFIRM
	!insertmacro MUI_UNPAGE_INSTFILES
;----------------------------------插入语言
	!insertmacro MUI_LANGUAGE SimpChinese

!define InstFile `!insertmacro InstFile`
!macro InstFile FILE
	Push `${FILE}`
	Call InstFile
!macroend
Function InstFile
	Exch $R0
	Push $R1
	
	${if} ${fileexists} `$EXEDIR\$R0`
		SetDetailsPrint none
		ClearErrors
		CopyFiles /SILENT /FILESONLY `$EXEDIR\$R0` $OUTDIR
		SetDetailsPrint both
		${GetChild} $R1 `$R0`
		${unless} ${errors}
		    FileWrite $hFile `File: wrote to "$OUTDIR\$R1"$\r$\n`
		    ${CompactPathEx} $R1 `安装: $OUTDIR\$R1` 70
		${else}
		    ${CompactPathEx} $R1 `安装失败: $OUTDIR\$R1` 70
		${endunless}
		DetailPrint $R1
	${else}
	    FileWrite $hFile `File: missing "$EXEDIR\$R0"$\r$\n`
		${CompactPathEx} $R1 `文件丢失: $EXEDIR\$R0` 70
		DetailPrint $R1
	${endif}
	
	Pop $R1
	Pop $R0
FunctionEnd

!define InstDir `!insertmacro InstDir`
!macro InstDir FILE_SPEC
	Push `${FILE_SPEC}`
	Call InstDir
!macroend
Function InstDir
	Exch $R0
	Push $R1

	${if} ${fileexists} `$EXEDIR\$R0\*`
		GetFunctionAddress $R1 CallBackProc
		${ForEachFile} `$EXEDIR\$R0` $R1
	${endif}

	Pop $R1
	Pop $R0
FunctionEnd

Function CallBackProc
	Exch $R0
	Push $R1
		ClearErrors
		SetDetailsPrint none
		CopyFiles /SILENT /FILESONLY $R0 $OUTDIR
		SetDetailsPrint both
		${GetChild} $R1 `$R0`
		${unless} ${errors}
		    FileWrite $hFile `File: wrote to "$OUTDIR\$R1"$\r$\n`
		    ${CompactPathEx} $R1 `安装: $OUTDIR\$R1` 70
		${else}
		    ${CompactPathEx} $R1 `安装失败: $OUTDIR\$R1` 70
		${endunless}
		DetailPrint $R1
    Pop $R1
	Pop $R0
FunctionEnd

!define WriteINIStr `!insertmacro WriteINIStr`
!macro WriteINIStr INI_FILE_NAME SECTION VALUE DATA
	Push $R9
		ReadINIStr $R9 "${INI_FILE_NAME}" "${SECTION}" "${VALUE}"
		StrCmp $R9 "" 0 +2
		WriteINIStr "${INI_FILE_NAME}" "${SECTION}" "${VALUE}" "${DATA}"
	Pop $R9
!macroend

InstType "默认"
InstType "完全"

Section "主程序" SEC_MAIN 
	SectionIn 1 2 RO
	FileOpen $hFile `$INSTDIR\install.log` a
	SetOutPath `$INSTDIR`
	${InstFile} `Winamp.exe`
	${InstFile} `demo.mp3`
	${InstFile} `WhatsNew.txt`
	${InstFile} `Winamp.q1`
	${InstFile} `汉化说明.txt`
	${InstFile} `winampmb.htm`
	${InstFile} `简体中文.lng`
	SetOutPath `$INSTDIR\Windows 98、Me备用文件`
	${InstDir} `Windows 98、Me备用文件`
	SetOutPath `$INSTDIR\Skins`
	${InstFile} `Skins\30FormChineseSkinBlue_1.1.wsz`
	${InstFile} `Skins\30FormChineseSkin_1.5.wsz`
	ReadINIStr $0 `$INSTDIR\Winamp.ini` Winamp skin
	${if} $0 == ``
	${andif} ${fileexists} `$INSTDIR\Skins\30FormChineseSkin_1.5.wsz`
	    WriteINIStr `$INSTDIR\Winamp.ini` Winamp skin `30FormChineseSkin_1.5.wsz`
	${endif}
	SetOutPath `$INSTDIR\Plugins`
	${InstFile} `Plugins\in_wave.dll`
	${InstFile} `Plugins\out_wave.dll`
	
	WriteINIStr `$INSTDIR\Winamp.ini` Winamp inet_mode 2
	WriteINIStr `$INSTDIR\Winamp.ini` Winamp newverchk 0
	WriteINIStr `$INSTDIR\Winamp.ini` Winamp newverchk2 0
	${WriteINIStr} `$INSTDIR\Winamp.ini` Winamp mb_open 0
	${WriteINIStr} `$INSTDIR\Winamp.ini` Winamp pe_fontsize 12
	WriteINIStr `$INSTDIR\Winamp.ini` Winamp langpack `简体中文.lng`
	${WriteINIStr} `$INSTDIR\Winamp.ini` Winamp check_ft_startup 0
SectionEnd

SectionGroup "输入插件" SEC_INPUT

Section "MPEG 解码插件" SEC_MPEG 
	SectionIn 1 2
	;${InstFile} `Plugins\!in_mp3.dll`
	${InstFile} `Plugins\in_mpg123.dll`
SectionEnd

Section "CDDA 输入插件" SEC_CDDA 
	SectionIn 1 2
	${InstFile} `Plugins\in_cdda.dll`
SectionEnd

Section "MPC 解码插件" SEC_MPC 
	SectionIn 1 2
	${InstFile} `Plugins\in_mpc.dll`
SectionEnd

Section "MP4 解码插件" SEC_MP4
	SectionIn 1 2
	${InstFile} `Plugins\in_mp4.dll`
SectionEnd

Section "APE 解码插件" SEC_APE 
	SectionIn 1 2
	${InstFile} `Plugins\in_APE.dll`
SectionEnd

Section "FLAC 解码插件" SEC_FLAC 
	SectionIn 1 2
	${InstFile} `Plugins\in_flac.dll`
SectionEnd

Section "CUE Sheet 读取插件" SEC_CUE 
	SectionIn 1 2
	${InstFile} `Plugins\in_cue.dll`
SectionEnd

Section "MIDI 输入插件" SEC_MIDI 
	SectionIn 1 2
	${InstFile} `Plugins\in_midi.dll`
SectionEnd

Section "模块解码插件" SEC_MOD 
	SectionIn 1 2
	${InstFile} `Plugins\in_mod.dll`
SectionEnd

Section "OGG 解码插件" SEC_OGG 
	SectionIn 1 2
	${InstFile} `Plugins\in_vorbis.dll`
SectionEnd

Section "WMA 解码插件" SEC_WMA 
	SectionIn 1 2
	${InstFile} `Plugins\in_wm.dll`
	;如果已安装则跳过
;	ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" "msacm.msaudio1"
;	ReadRegStr $1 HKLM "System\CurrentControlSet\Control\MediaResources\ACM\msacm.msaudio1" "Driver"
;	${if} $0 != "msaud32.acm"
;	${andif} $1 != "msaud32.acm"
;	${andif} ${fileexists} "$EXEDIR\wmaudioredist.exe"
;		ExecWait '"$EXEDIR\wmaudioredist.exe" /Q /R:N'
;	${endif}
SectionEnd

Section "Real 音频输入插件" SEC_REAL 
	SectionIn 1 2
	${InstFile} `Plugins\in_tara.dll`
	SetOutPath $INSTDIR
	${InstFile} `tara.ini`
	SetOutPath `$INSTDIR\Plugins`
SectionEnd

SectionGroupEnd
 
SectionGroup "输出插件" SEC_OUTPUT

Section "DirectSound 输出插件" SEC_DS 
	SectionIn 1 2
	${InstFile} `Plugins\out_ds.dll`
SectionEnd

Section "磁盘输出插件" SEC_DISK 
	SectionIn 2
	${InstFile} `Plugins\out_disk.dll`
SectionEnd

Section "LAME 编码器输出插件" SEC_LAME 
	SectionIn 2
	${InstFile} `Plugins\out_lame.dll`
	${InstFile} `Plugins\lame_enc.dll`
	${unless} ${fileexists} `$INSTDIR\Plugins\out_lame.xml`
    	${InstFile} `Plugins\out_lame.xml`
    ${endunless}
	${unless} ${fileexists} `$INSTDIR\Plugins\out_lame.xsd`
    	${InstFile} `Plugins\out_lame.xsd`
    ${endunless}
SectionEnd

Section "5.1 声道输出插件" SEC_KB51
	SectionIn 2
	${InstFile} `Plugins\out_KB51chn.dll`
SectionEnd

SectionGroupEnd
 
SectionGroup "常规插件" SEC_GEN 

Section "热键控制" SEC_HOTKEY 
	SectionIn 1 2
	${InstFile} `Plugins\gen_hotkeys.dll`
SectionEnd

Section "恢复播放" SEC_RESTORE
	SectionIn 1 2
	${InstFile} `Plugins\gen_timerestore.dll`
	SetOutPath `$INSTDIR\Plugins\trap`
	${InstFile} `Plugins\trap\trap_简体中文.ini`
	${InstFile} `Plugins\trap\trap_happy.ini`
	SetOutPath `$INSTDIR\Plugins`
	${WriteINIStr} `$INSTDIR\Winamp.ini` `时间恢复和自动播放` lang `简体中文`
	${WriteINIStr} `$INSTDIR\Winamp.ini` `时间恢复和自动播放` options 3
SectionEnd

Section "曲目跳转" SEC_JUMP
	SectionIn 1 2
	${InstFile} `Plugins\gen_jumpex.dll`
SectionEnd

Section "托盘控制器" SEC_TRAY
	SectionIn 2
	${InstFile} `Plugins\gen_tray.dll`
SectionEnd

Section "标题字体设置" SEC_FONT
	SectionIn 2
	${InstFile} `Plugins\gen_tfp2_CN.dll`
	${InstFile} `Plugins\FontColor.the`
	SetOutPath `$INSTDIR\Plugins\Font Plug II`
	${InstDir} `Plugins\Font Plug II`
	SetOutPath `$INSTDIR\Plugins`
SectionEnd

SectionGroupEnd
 
SectionGroup 'DSP' SEC_DSP

Section "DFX" SEC_DFX
	SectionIn 2
	${InstFile} `Plugins\dsp_dfx.dll`
	SetOutPath `$INSTDIR\Plugins\Dfx`
	${InstFile} `Plugins\Dfx\dfx_skin.txt`
	SetOutPath `$INSTDIR\Plugins\Dfx\Presets\Factsoft`
	${InstDir} `Plugins\Dfx\Presets\Factsoft`
	SetOutPath `$INSTDIR\Plugins\Dfx\Presets\User`
	${InstDir} `Plugins\Dfx\Presets\User`
	SetOutPath `$INSTDIR\Plugins\Dfx\Shared\Skins\default_Winamp`
	${InstDir} `Plugins\Dfx\Shared\Skins\default_Winamp`
	SetOutPath `$INSTDIR\Plugins\Dfx\Shared\Skins\default_Winamp_minip`
	${InstDir} `Plugins\Dfx\Shared\Skins\default_Winamp_mini`
	SetOutPath `$INSTDIR`
	${InstFile} `dfxg11.dll`
	SetOutPath `$INSTDIR\Plugins`
	WriteRegStr HKLM "SOFTWARE\DFX\11\host_plugin_folder" "" "$INSTDIR\Plugins"
	WriteRegStr HKLM "SOFTWARE\DFX\11\top_folder" "" "$INSTDIR\Plugins\Dfx"
	WriteRegStr HKLM "SOFTWARE\DFX\11\top_host_folder" "" "$INSTDIR"
	WriteRegStr HKLM "SOFTWARE\DFX\11\REGISTRATION\stat" "" "3"
	WriteRegStr HKLM "SOFTWARE\DFX\11\top_shared_folder" "" "$INSTDIR\Plugins\Dfx\Shared"
SectionEnd

Section "Dee" SEC_DEE
	SectionIn 2
	${InstFile} `Plugins\dsp_dee.dll`
	SetOutPath `$INSTDIR\Plugins\dee_presets`
	${InstDir} `Plugins\dee_presets`
	SetOutPath `$INSTDIR\Plugins`
SectionEnd

Section "Enhancer" SEC_ENH
	SectionIn 2
	${InstFile} `Plugins\dsp_enh.dll`
	SetOutPath `$INSTDIR\Plugins\Enhancer\017`
	${InstDir} `Plugins\Enhancer\017`
	SetOutPath `$INSTDIR\Plugins`
SectionEnd

Section "iZotope Ozone" SEC_IZOZONE
	SectionIn 2
	${InstFile} `Plugins\dsp_izOzone.dll`
	SetOutPath `$INSTDIR\Plugins\Ozone`
	${InstDir} `Plugins\Ozone`
	SetOutPath `$INSTDIR\Plugins\Ozone\Readme`
	${InstDir} `Plugins\Ozone\Readme`
	SetOutPath `$INSTDIR\Plugins`
	WriteRegStr HKCU "Software\iZotope\Ozone\Winamp2" "EmailAddress" "dgyf44@sohu.com"
	WriteRegStr HKCU "Software\iZotope\Ozone\Winamp2" "RegName" "dgyf44"
	WriteRegStr HKCU "Software\iZotope\Ozone\Winamp2" "RegCode" "459212"
SectionEnd

Section "均衡器(替换者)" SEC_NEQ
	SectionIn 2
	${InstFile} `Plugins\dsp_neq.dll`
	${InstFile} `Plugins\preset.neq`
SectionEnd

Section "OctiMax" SEC_OCTIMAX
	SectionIn 2
	${InstFile} `Plugins\dsp_omx.dll`
	${InstFile} `Plugins\octimax winamp.ini`
SectionEnd

Section "DSP 管理器" SEC_DSPMRG
	SectionIn 2
	${InstFile} `Plugins\dsp_multiple.dll`
SectionEnd

SectionGroupEnd

Section "-post" SEC_POST
	FileClose $hFile
!ifdef ADDUNINSTREG
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp2" "DisplayName" "Winamp ${VER_MAJOR}.${VER_MINOR} 简体中文经典版"
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp2" "UninstallString" "$\"$INSTDIR\UninstWA.exe$\""
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp2" "Installer Language" "$LANGUAGE"
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp2" "InstallDir" "$INSTDIR"
!endif
	WriteUninstaller "$INSTDIR\UninstWA.exe"
	Exec `"$INSTDIR\Winamp.exe" /NEW`
SectionEnd

!macro VerifyFile FILE
	${unless} ${fileexists} `$EXEDIR\${FILE}`
	    MessageBox MB_OK|MB_ICONSTOP `找不到文件: "$EXEDIR\${FILE}"`
	    Quit
	${endunless}
!macroend

Function .onInit
	!insertmacro VerifyFile `Winamp.exe`
	!insertmacro VerifyFile `Plugins\in_wave.dll`
	!insertmacro VerifyFile `Plugins\out_wave.dll`
FunctionEnd

Function LicenseShow
	FindWindow $0 "#32770" "" $HWNDPARENT
	GetDlgItem $0 $0 1000
	;同时还可以换一个艺术的字体
	CreateFont $1 "Comic Sans Ms" "8"
	SendMessage $0 ${WM_SETFONT} $1 0
FunctionEnd

Section Uninstall
    ExecWait `"$INSTDIR\Winamp.exe" /UNREG`
!ifdef ADDUNINSTREG
	DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp${VER_MAJOR}"
!endif
	${if} ${fileexists} `$INSTDIR\Plugins\out_lame.dll`
	    Delete `$INSTDIR\Plugins\out_lame.xml`
	    Delete `$INSTDIR\Plugins\out_lame.xsd`
	${endif}
	${un.DelFileByLog} `$INSTDIR\install.log`
	Delete `$INSTDIR\install.log`
	Delete `$INSTDIR\Winamp.ini`
	Delete `$INSTDIR\Winamp.m3u`
	Delete `$INSTDIR\Plugins\musepack.ini`
	Delete `$INSTDIR\Plugins\plugin.ini`
	Delete `$INSTDIR\UninstWA.exe`
	${un.RMDir} $INSTDIR
SectionEnd

资源文件点击另存