# EclipseNSIS スクリプト・ウィザードにより自動生成されました
# 2009/03/21 20:46:25

# General Symbol Definitions
!define /date NOW "%Y-%m-%d"
!define NAME "MabiAssist"
!define NSISLANGFILESVER 8

!define UMUI_VERSION "v3.5.6"
!define UMUI_VERBUILD "3.5.6_${NOW}"

!define /date VERIPV "356.%Y.%m.%d"

!define COMPANY Logue
!define URL http://logue.be/

VIProductVersion ${VERIPV}
VIAddVersionKey ProductName "Mabinogi Assist"
VIAddVersionKey ProductVersion "${UMUI_VERBUILD}"
VIAddVersionKey CompanyName "${COMPANY}"
VIAddVersionKey CompanyWebsite "${URL}"
VIAddVersionKey FileVersion "${UMUI_VERBUILD}"
VIAddVersionKey FileDescription "Mabinogi Assist Installer"
VIAddVersionKey InternalName "MabiAssist"
VIAddVersionKey LegalTrademarks "Copyright (c) 2009 Logue All rights reserved."
VIAddVersionKey LegalCopyright "Copyright (c) 2009 Logue All rights reserved."
VIAddVersionKey OriginalFilename "Setup MabiAssist.exe"

# インストーラー属性
Name "Mabinogi Assist"

OutFile "Setup MabiAssist.exe"

SetCompressor /FINAL /SOLID lzma

;Request application privileges for Windows Vista
RequestExecutionLevel admin

BrandingText "Mabinogi Assist Installer ver.${UMUI_VERBUILD}"

InstallDir "$PROGRAMFILES\Mabinogi Assist"

CRCCheck on
XPStyle on
ShowInstDetails show
ShowUninstDetails show
SetDateSave on
SetDatablockOptimize on

# インクルード・ファイル
!include UMUI.nsh
!include LogicLib.nsh
!include Sections.nsh
!include FileFunc.nsh
!include Library.nsh

# 追加インクルードファイル
!include "Resource\LangLoad.nsh"
!include "Resource\Check.nsh"
!include "Resource\skin.nsh"
!include "Resource\registerExtension.nsh"
!include "Resource\SearchFile.nsh"
!include "Resource\GetIEVersion.nsh"
!include "Resource\Download.nsh"

#インターフェース設定
!define UMUI_SKIN "NSISShield"
!define UMUI_USE_INSTALLOPTIONSEX

!define UMUI_PAGEBGIMAGE
!define UMUI_UNPAGEBGIMAGE

!define MUI_ICON Resource\install.ico
!define MUI_UNICON Resource\uninstall.ico
!define MUI_HEADERIMAGE
!define MUI_COMPONENTSPAGE_CHECKBITMAP Resource\checkbox.bmp
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN $INSTDIR\MabiAssist.hta
!define MUI_UNFINISHPAGE_NOAUTOCLOSE

!define UMUI_DEFAULT_SHELLVARCONTEXT all

!define UMUI_ENABLE_DESCRIPTION_TEXT

!define UMUI_USE_ALTERNATE_PAGE

!define DECRYPT_TOME_CODE "E619ECB089C78DA5B51C38391DCC67FC"

#レジストリ設定
!define UMUI_PARAMS_REGISTRY_ROOT HKLM
!define UMUI_PARAMS_REGISTRY_KEY "Software\MabiAssist"

;!define UMUI_LANGUAGE_REGISTRY_VALUENAME "Language"
!define UMUI_SHELLVARCONTEXT_REGISTRY_VALUENAME "ShellVarContext"

!define UMUI_UNINSTALLPATH_REGISTRY_VALUENAME "UninstallPath"
!define UMUI_UNINSTALL_FULLPATH "$INSTDIR\Uninstall MabiAssist.exe"
!define UMUI_INSTALLERFULLPATH_REGISTRY_VALUENAME "InstallPath"

!define UMUI_VERSION_REGISTRY_VALUENAME "Version"
!define UMUI_VERBUILD_REGISTRY_VALUENAME "VerBuild"


InstallDirRegKey ${UMUI_PARAMS_REGISTRY_ROOT} "${UMUI_PARAMS_REGISTRY_KEY}" ""


# 予約ファイル
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
!insertmacro MUI_RESERVEFILE_LANGDLL ;Language selection dialog
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "${NSISDIR}\Plugins\AdvSplash.dll"
ReserveFile "${NSISDIR}\Plugins\DcryptDll.dll"
ReserveFile "${NSISDIR}\Plugins\inetc.dll"
ReserveFile "${NSISDIR}\Plugins\nsis7z.dll"
ReserveFile "${NSISDIR}\Plugins\nsisunz.dll"


# インストーラー・ページ
Var STARTMENU_FOLDER

!insertmacro UMUI_PAGE_MULTILANGUAGE
    !define UMUI_WELCOMEPAGE_ALTERNATIVETEXT

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE $(License)
    !define UMUI_SETUPTYPEPAGE_MINIMAL "$(UMUI_TEXT_SETUPTYPE_MINIMAL_TITLE)"
    !define UMUI_SETUPTYPEPAGE_STANDARD "$(UMUI_TEXT_SETUPTYPE_STANDARD_TITLE)"
    !define UMUI_SETUPTYPEPAGE_COMPLETE "$(UMUI_TEXT_SETUPTYPE_COMPLETE_TITLE)"
    !define UMUI_SETUPTYPEPAGE_DEFAULTCHOICE ${UMUI_CUSTOM}
    !define UMUI_SETUPTYPEPAGE_REGISTRY_VALUENAME "SetupType"
!insertmacro UMUI_PAGE_SETUPTYPE
Page custom MA_PAGE_DIRECTORY MA_PAGE_DIRECTORY_LEAVE
!insertmacro MUI_PAGE_COMPONENTS
    !define UMUI_ALTERNATIVESTARTMENUPAGE_SETSHELLVARCONTEXT
    !define UMUI_ALTERNATIVESTARTMENUPAGE_USE_TREEVIEW
    !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartMenuFolder"
    !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Mabinogi Assist"
!insertmacro UMUI_PAGE_ALTERNATIVESTARTMENU Application $STARTMENU_FOLDER
	!define UMUI_CONFIRMPAGE_TEXTBOX confirm_function
!insertmacro UMUI_PAGE_CONFIRM
!insertmacro MUI_PAGE_INSTFILES
    !define MUI_FINISHPAGE_LINK "Mabinogi Assist Official Page"
    !define MUI_FINISHPAGE_LINK_LOCATION "http://logue.be/MabiAssist.html"
!insertmacro MUI_PAGE_FINISH
    !define UMUI_ABORTPAGE_LINK "Mabinogi Assist Official Page"
    !define UMUI_ABORTPAGE_LINK_LOCATION "http://logue.be/MabiAssist.html"
!insertmacro UMUI_PAGE_ABORT


!insertmacro UMUI_UNPAGE_MULTILANGUAGE
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

    !define MUI_FINISHPAGE_LINK "Mabinogi Assist Official Page"
    !define MUI_FINISHPAGE_LINK_LOCATION "http://logue.be/MabiAssist.html"
!insertmacro MUI_UNPAGE_FINISH

    !define UMUI_ABORTPAGE_LINK "Mabinogi Assist Official Page"
    !define UMUI_ABORTPAGE_LINK_LOCATION "http://logue.be/MabiAssist.html"
!insertmacro UMUI_UNPAGE_ABORT

# インストーラー言語
!insertmacro LANG_LOAD "English"
!insertmacro LANG_LOAD "Japanese"
!insertmacro LANG_LOAD "Korean"
!insertmacro LANG_LOAD "TradChinese"
!insertmacro LANG_LOAD "SimpChinese"

# カスタムページ
Var HWND
Var DLGITEM

# Mabinogiの設置ディレクトリを取得
var MABIDIR
!define MABIDIR $MABIDIR
var MABI_TYPE
!define MABI_TYPE $MABI_TYPE
!macro DETECT_MABIDIR
	Banner::show $(Detect_Mabinogi)
	${IF} ${FileExists} "$INSTDIR\MabiAssist.ini"
		ReadINIStr $MABIDIR "$INSTDIR\MabiAssist.ini" MabiAssist MabinogiDir
	${ELSE}
		; default
		ReadRegStr $MABIDIR HKCU "Software\Nexon\Mabinogi" ""
		${IfNot} $MABIDIR == ""
			StrCpy $MABI_TYPE 'Default'
			goto MABIDIR_OK
		${EndIf}

		; Hangame
		ReadRegStr $MABIDIR HKCU "Software\Nexon\Mabinogi_hangame" ""
		${IfNot} $MABIDIR == ""
			StrCpy $MABI_TYPE 'Hangame'
			goto MABIDIR_OK
		${EndIf}

		; Test
		ReadRegStr $MABIDIR HKCU "Software\Nexon\Mabinogi_test" ""
		${IfNot} $MABIDIR == ""
			StrCpy $MABI_TYPE 'Test'
			goto MABIDIR_OK
		${EndIf}
	${EndIf}
	
	${If} $MABIDIR == ""
		Push "Mabinogi.exe" ;File or folder to search. Wildcards are supported.
		Push "file" ;Path where to search for the file or folder.
		Push $0
		Exch $0
		Push "1" ;Include subfolders in search. (0 = false, 1 = true)
		Push "1" ;Enter subfolders with ".". This only works if "Include subfolders in search" is set to 1 (true). (0 = false, 1 = true)
		Call SearchFile
		
		${If} $R0 == "0"
			MessageBox MB_YESNO $(Error_Detect_Mabinogi) IDYES MABIDIR_OK IDNO +1
			Abort
		${Else}
			StrCpy $MABIDIR $R0
		${EndIf}
	${EndIf}
	MABIDIR_OK:
	Banner::destroy
!macroend

!macro SetTransparent HWND IDC
  GetDlgItem $R0 ${HWND} ${IDC}
  SetCtlColors $R0 0xFFFFFF transparent
!macroend

Function MA_PAGE_DIRECTORY
	!insertmacro MUI_HEADER_TEXT $(MabiAssist_Directory_title) $(MabiAssist_Directory_subtitle)

	!insertmacro INSTALLOPTIONS_WRITE "MA_DIRECTORY.ini" "Field 1" "Text" $(MabiAssist_Directory_MabiDir)
	!insertmacro INSTALLOPTIONS_WRITE "MA_DIRECTORY.ini" "Field 2" "Text" $(MabiAssist_Directory_MabiAssistDir)
	!insertmacro INSTALLOPTIONS_WRITE "MA_DIRECTORY.ini" "Field 3" "Text" $(MabiAssist_Directory_Notice)
	!insertmacro INSTALLOPTIONS_WRITE "MA_DIRECTORY.ini" "Field 4" "State" $INSTDIR
	!insertmacro INSTALLOPTIONS_WRITE "MA_DIRECTORY.ini" "Field 5" "State" $MABIDIR
	!insertmacro INSTALLOPTIONS_INITDIALOG "MA_DIRECTORY.ini"

	Pop $HWND ;get dialog HWND	
	; Set transparent backgrounds.
	SetCtlColors $HWND ${UMUI_TEXT_COLOR} transparent
	!insertmacro SetTransparent $HWND 1200
	!insertmacro SetTransparent $HWND 1201
	!insertmacro SetTransparent $HWND 1202

	GetDlgItem $DLGITEM $HWND 1200 ;1200 + Field number - 1

	!insertmacro INSTALLOPTIONS_SHOW
FunctionEnd

Function MA_PAGE_DIRECTORY_LEAVE
	!insertmacro INSTALLOPTIONS_READ $INSTDIR "MA_DIRECTORY.ini" "Field 4" "State"
	!insertmacro INSTALLOPTIONS_READ $MABIDIR "MA_DIRECTORY.ini" "Field 5" "State"

	${If} $MABIDIR == ""
		MessageBox MB_ICONEXCLAMATION|MB_OK $(MabiAssist_Directory_Error)
		Abort
	${EndIf}
FunctionEnd

;--------------------------------
;Confirm page function

!include "Sections.nsh"
  
!macro confirm_addline section
	SectionGetFlags ${Sec${section}} $1
	IntOp $1 $1 & ${SF_SELECTED}
	IntCmp $1 ${SF_SELECTED} 0 n${section} n${section}
	SectionGetText ${Sec${section}} $1
  !insertmacro UMUI_CONFIRMPAGE_TEXTBOX_ADDLINE "   - $1"
n${section}:
!macroend

Function confirm_function
	!insertmacro UMUI_CONFIRMPAGE_TEXTBOX_ADDLINE "$(UMUI_TEXT_INSTCONFIRM_TEXTBOX_DESTINATION_LOCATION)"
	!insertmacro UMUI_CONFIRMPAGE_TEXTBOX_ADDLINE "      $INSTDIR"
	!insertmacro UMUI_CONFIRMPAGE_TEXTBOX_ADDLINE ""

	;For the setuptype page
	!insertmacro UMUI_CONFIRMPAGE_TEXTBOX_ADDLINE "$(UMUI_TEXT_SETUPTYPE_TITLE):"
	!insertmacro UMUI_GET_CHOOSEN_SETUP_TYPE_TEXT
	Pop $R0
	!insertmacro UMUI_CONFIRMPAGE_TEXTBOX_ADDLINE "      $R0"
	
	!insertmacro UMUI_CONFIRMPAGE_TEXTBOX_ADDLINE ""
  !insertmacro UMUI_CONFIRMPAGE_TEXTBOX_ADDLINE "$(UMUI_TEXT_INSTCONFIRM_TEXTBOX_COMPNENTS)"

  !insertmacro confirm_addline S1
  !insertmacro confirm_addline S2
  !insertmacro confirm_addline S3
FunctionEnd

!macro SETUP_mmSeq
	SetOverwrite ifnewer
	SetOutPath "$INSTDIR\mmSeq"
	File "mmSeq\readme.txt"
	File "mmSeq\mmSeqHelp.chm"
	SetOutPath "$INSTDIR\mmSeq\skin"
	File "mmSeq\skin\5MLEe.skn"
	File "mmSeq\skin\mmsClassic.skn"
	File "mmSeq\skin\qsp.skn"
	SetOutPath "$INSTDIR\mmSeq\plugins"
	File "mmSeq\plugins\refExporter.dll"
	File "mmSeq\plugins\refSelection.dll"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "player" "resolution" "384"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "player" "dlsFile" "$MABIDIR\mp3\MSXsprit.dls"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div1" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div2" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div3" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div4" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div6" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div8" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div12" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div16" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div24" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div32" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div48" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "div64" "1"
	WriteIniStr "$INSTDIR\mmSeq\mmSeq.ini" "notePalette" "correctTriplet" "0"
	ExecWait 'icacls /grant USER:MODE /Q /T $INSTDIR\mmSeq\*.ini'
!macroend

# インストーラー関数 ------------------------------------------------------------------------------#

Function .onInit
	!insertmacro UMUI_MULTILANG_GET
	
	SetOutPath $TEMP
	File /oname=spltmp.bmp "Resource\splash.bmp"
	AdvSplash::show 1000 600 400 -1 $TEMP\spltmp

	!insertmacro DETECT_MABIDIR
;	!insertmacro PROCCESS_CHECK
	Call GetIEVersion
	Pop $R0
	${If} $R0 < 7
		MessageBox MB_OK $(IE_Version_error) IDYES IEOK IDNO +1
		Abort
	${EndIf}
	
	IEOK:
;	!insertmacro CHECK_DOTNET
	Pop $0

	!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "Resource\MA_DIRECTORY.ini" "MA_DIRECTORY.ini"
	CreateDirectory "$EXEDIR\Cache"
	
	${Switch} $LANGUAGE
		${Case} '1042' ; Korean
		${Case} '1033' ; English (1033)
			!insertmacro UnselectSection ${SEC_NaoTimer}
			!insertmacro UnselectSection ${SEC_MabinogiPlus2}
		${Break}
	${EndSwitch}

	Delete $TEMP\spltmp.bmp
FunctionEnd

;--------------------------------
;Installer Types

InstType "$(UMUI_TEXT_SETUPTYPE_MINIMAL_TITLE)"
InstType "$(UMUI_TEXT_SETUPTYPE_STANDARD_TITLE)"
InstType "$(UMUI_TEXT_SETUPTYPE_COMPLETE_TITLE)"

# セクション
SectionGroup $(Core) SEC_core
	Section "Mabinogi Assist"
		SectionIn 1 2 3 RO
		SetOverwrite ifdiff
		SetOutPath "$INSTDIR"
		File "MabiAssist\License.html"
		File "MabiAssist\MabiAssist.hta"
		File "MabiAssist\MabiAssist.ini"
		File "MabiAssist\MabiAssist.ico"
		SetOutPath "$INSTDIR\img"
		File "MabiAssist\img\loading.gif"
		File "MabiAssist\img\mabinogi.png"
		File "MabiAssist\img\KukuTimer.png"
		File "MabiAssist\img\KukuTimerFairy.png"
		File "MabiAssist\img\mmSeq.png"
		File "MabiAssist\img\3MLE.png"
		File "MabiAssist\img\kbd.png"
		File "MabiAssist\img\html.ico"
		File "MabiAssist\img\MabinogiColorHelper.png"
		File "MabiAssist\img\BMP2MabiPNG.png"
		File "MabiAssist\img\Noginogi.png"
		SetOutPath "$INSTDIR\img\icons"
		File "MabiAssist\img\icons\cancel.png"
		File "MabiAssist\img\icons\edit.png"
		File "MabiAssist\img\icons\execute.png"
		File "MabiAssist\img\icons\ok.png"
		File "MabiAssist\img\icons\print.png"
		File "MabiAssist\img\icons\file.png"
		SetOutPath "$INSTDIR\img\Weather"
		File "MabiAssist\img\Weather\0.png"
		File "MabiAssist\img\Weather\1.png"
		File "MabiAssist\img\Weather\2.png"
		File "MabiAssist\img\Weather\3.png"
		File "MabiAssist\img\Weather\4.png"
		File "MabiAssist\img\Weather\5.png"
		File "MabiAssist\img\Weather\6.png"
		File "MabiAssist\img\Weather\7.png"
		File "MabiAssist\img\Weather\8.png"
		File "MabiAssist\img\Weather\9.png"
		File "MabiAssist\img\Weather\10.png"
		File "MabiAssist\img\Weather\11.png"
		File "MabiAssist\img\Weather\12.png"
		File "MabiAssist\img\Weather\13.png"
		File "MabiAssist\img\Weather\14.png"
		File "MabiAssist\img\Weather\15.png"
		File "MabiAssist\img\Weather\16.png"
		File "MabiAssist\img\Weather\17.png"
		File "MabiAssist\img\Weather\18.png"
		File "MabiAssist\img\Weather\19.png"
		File "MabiAssist\img\Weather\20.png"
		File "MabiAssist\img\Weather\21.png"
		File "MabiAssist\img\Weather\22.png"
		SetOutPath "$INSTDIR\js"
		File "MabiAssist\js\MabiAssist.js"
		File "MabiAssist\js\MabiAssist.css"
		File "MabiAssist\js\io.js"
		File "MabiAssist\js\ini.js"
		SetOutPath "$INSTDIR\locale"
		File "MabiAssist\locale\Japan.ini"
		File "MabiAssist\locale\US.ini"
		File "MabiAssist\locale\Taiwan.ini"
		File "MabiAssist\locale\China.ini"
		File "MabiAssist\locale\Korea.ini"
		
		DetailPrint "Modify MabiAssist.ini..."
		${Switch} $LANGUAGE
			${Case} '1028' ; Chinese (Traditional)
				WriteIniStr "$INSTDIR\MabiAssist.ini" "MabiAssist" "locale" 'Taiwan'
			${Break}
			${Case} '1041' ; Japanese
				WriteIniStr "$INSTDIR\MabiAssist.ini" "MabiAssist" "locale" 'Japan'
			${Break}
			${Case} '1042' ; Korean
				WriteIniStr "$INSTDIR\MabiAssist.ini" "MabiAssist" "locale" 'Korea'
			${Break}
			${Case} '2052' ; Chinese (Simplified)
				WriteIniStr "$INSTDIR\MabiAssist.ini" "MabiAssist" "locale" 'China'
			${Break}
			${Case} '1033' ; English
				WriteIniStr "$INSTDIR\MabiAssist.ini" "MabiAssist" "locale" 'US'
			${Break}
		${EndSwitch}
		WriteRegStr HKLM "${REGKEY}\Components" MabiAssist MabiAssist
		WriteIniStr "$INSTDIR\MabiAssist.ini" "MabiAssist" "MabinogiDir" $MABIDIR
		WriteIniStr "$INSTDIR\MabiAssist.ini" "MabiAssist" "MabiAssistDir" $INSTDIR
	SectionEnd

	SubSection "Patch"
		Section $(MabinogiMemoryPatch) SEC_MabinogiMemoryPatch
			SectionIn 2 3
			SetOutPath "$MABIDIR"
			File "MultiPatch\ijl15.dat"
			${Switch} $LANGUAGE
				${Case} '1028' ; Chinese (Traditional)
				${Case} '2052' ; Chinese (Simplified)
					File "MultiPatch\chn\ijl15.dll"
;					${IfNot} ${FileExists} "$MABIDIR\Patch.ini"
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "UseDataFolder" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "ControlCPU" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "CharParam1000" 0
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "ShowItemPrice" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "ShowCombetPower" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "ShowChineseCombetScript" 0
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "NoEndAD" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "DigitalFoodQuality" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "NoCookNois" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "ShowTrueDuarbility" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "EnterRemoteShop" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "ModifyZoomWideLimit" 3500
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "DungeonMiniMapNofog" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "FixedNightLum" 0
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "EnableFSAA" 1
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "EnableCopyRight" 0
						WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "SnapshotQuality" 100
;					${EndIf}
					WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "MabinogiPatch" 'ijl15.dll|0|patch.ini|PATCH|patchlog.txt'
				${Break}
				${Default}
					File "MultiPatch\mamp\ijl15.dll"
;					${IfNot} ${FileExists} "$MABIDIR\ijl15.ini"
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "BlockEndingAds" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ClearDungeonFog" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "EnableFSAA" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "DisableNighttime" 0
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "EnterRemoteShop" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ModifyZoomLimit" 3500
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ScreenshotQuality" 90
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ShowCombatPower" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ShowItemPrice" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ShowTrueDurability" 0
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ShowTrueDurability_str" "Durability {1}/{3} ({0}/{2})"
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ShowItemColor" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ShowTrueFoodQuality" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "UseDataFolder" 1
						
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "EnableNameColoring" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "EnableSelfTrade" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "LargeClockText" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "MonsterLabel" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "MoveToSameChannel" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "MoveWhileTalking" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "NaoSoon" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "NegativeHP" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "RemoveLoginDelay" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "ShowExplorationPercent" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "TalkToUnequippedEgo" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "TargetProps" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "UnlimitedSign" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "UseBitmapFonts" 1
						
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "LogoutWhileTalking" 1
						
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "CPUReduction" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "CPUReduction_OnlyMinimized" 1
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "Debug" 0
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "DisableRegistryPatch" 0
						WriteIniStr "$MABIDIR\ijl15.ini" "PATCH" "DisableCRTPatch" 0
;					${EndIf}
					WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "MabinogiPatch" 'ijl15.dll|0|ijl15.ini|PATCH|mamp_log.txt'
				${Break}
			${EndSwitch}
		SectionEnd

		Section $(Noginogi) SEC_Noginogi
			SectionIn 2 3
			SetOutPath "$INSTDIR\Noginogi"
			File "Noginogi\ChangeLog.txt"
			File "Noginogi\jinsu_nnogi_lv180.exe"
			File "Noginogi\NogiNogi.ini"
			File "Noginogi\NogiReadme.txt"

			DetailPrint $(Nogi_AutoPatching)
			ExecWait 'icacls /grant USER:MODE /Q /T $INSTDIR\Noginogi\noginogi.ini'
			WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Noginogi" "DefaultPath" $MABIDIR
			WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Custom" "#custom_data_folder_read" "1"
			WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Custom" "#custom_user_cp" "0"
			WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Custom" "#custom_prop_targeting" "0"

			${IfNot} $LANGUAGE == '1042'	; If not Korean.
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Language" "Language" $(Noginogi_Language)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Language" "Author" ${COMPANY}
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Language" "Homepage" ${URL}
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Title" "Title1" $(Noginogi_Title1)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Title" "Title2" $(Noginogi_Title2)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Title" "Title3" $(Noginogi_Title3)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Browse" "Browse1" $(Noginogi_Browse1)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Browse" "Browse2" $(Noginogi_Browse2)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg1" $(Noginogi_Msg1)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg2" $(Noginogi_Msg2)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg3" $(Noginogi_Msg3)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg4" $(Noginogi_Msg4)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg5" $(Noginogi_Msg5)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg6" $(Noginogi_Msg6)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg7" $(Noginogi_Msg7)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg8" $(Noginogi_Msg8)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg9" $(Noginogi_Msg9)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg10" $(Noginogi_Msg10)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg11" $(Noginogi_Msg11)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg12" $(Noginogi_Msg12)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg13" $(Noginogi_Msg13)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg14" $(Noginogi_Msg14)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg15" $(Noginogi_Msg15)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg16" $(Noginogi_Msg16)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg17" $(Noginogi_Msg17)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg18" $(Noginogi_Msg18)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg19" $(Noginogi_Msg19)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg20" $(Noginogi_Msg20)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg21" $(Noginogi_Msg21)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg22" $(Noginogi_Msg22)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg23" $(Noginogi_Msg23)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Message" "Msg24" $(Noginogi_Msg24)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi1" $(Noginogi_Nogi1)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi2" $(Noginogi_Nogi2)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi3" $(Noginogi_Nogi3)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi4" $(Noginogi_Nogi4)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi5" $(Noginogi_Nogi5)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi6" $(Noginogi_Nogi6)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi7" $(Noginogi_Nogi7)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi7_1" $(Noginogi_Nogi7_1)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi7_2" $(Noginogi_Nogi7_2)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi8" $(Noginogi_Nogi8)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi8_1" $(Noginogi_Nogi8_1)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi8_2" $(Noginogi_Nogi8_2)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi8_3" $(Noginogi_Nogi8_3)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi8_4" $(Noginogi_Nogi8_4)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi10" $(Noginogi_Nogi10)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi11" $(Noginogi_Nogi11)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi12" $(Noginogi_Nogi12)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi13" $(Noginogi_Nogi13)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi14" $(Noginogi_Nogi14)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi15" $(Noginogi_Nogi15)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi16" $(Noginogi_Nogi16)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi18" $(Noginogi_Nogi18)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi7_3" $(Noginogi_Nogi7_3)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi19" $(Noginogi_Nogi19)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi20" $(Noginogi_Nogi20)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi9" $(Noginogi_Nogi9)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi21" $(Noginogi_Nogi21)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi22" $(Noginogi_Nogi22)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi23" $(Noginogi_Nogi23)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi24" $(Noginogi_Nogi24)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi25" $(Noginogi_Nogi25)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi26" $(Noginogi_Nogi26)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi27" $(Noginogi_Nogi27)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi28" $(Noginogi_Nogi28)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi29" $(Noginogi_Nogi29)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi30" $(Noginogi_Nogi30)
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi31" $(Noginogi_Nogi31)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi32" $(Noginogi_Nogi32)
				
				WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Patch" "Nogi33" $(Noginogi_Nogi33)
			${EndIf}
		SectionEnd
		
		Section /o "NabiPack" SEC_NabiPack
			SectionIn 1 3
			SetOutPath $INSTDIR
			File "NabiPack.exe"
		SectionEnd
	SubSectionEnd

	Section $(NaoTimer) SEC_NaoTimer
		SectionIn 2 3
		SetOutPath "$MABIDIR"
		${Switch} $LANGUAGE
			${Case} '1028' ; Chinese (Traditional)
				File "NaoTimer\twn\d3d9.dll"
				File "NaoTimer\twn\d3d9.ini"
			${Break}

			${Case} '1041' ; Japanese
				File "NaoTimer\jpn\d3d9.dll"
				File /oname=d3d9.ini "NaoTimer\jpn\d3d9_novoice.ini"
			${Break}
/*
			${Case} '1042' ; Korean
				File "NaoTimer\kor\d3d9.dll"
				File "NaoTimer\kor\d3d9.ini"
			${Break}
*/
			${Case} '2052' ; Chinese (Simplified)
				File "NaoTimer\chn\d3d9.dll"
				File "NaoTimer\chn\d3d9.ini"
				SetOutPath "C:\nao_wave"
				File "NaoTimer\chn\snd\BigBenClock.wav"
				File "NaoTimer\chn\snd\dragon_summon.wav"
				File "NaoTimer\chn\snd\hayaku.wav"
				File "NaoTimer\chn\snd\i am murloc-I Am Mur.wav"
				File "NaoTimer\chn\snd\night.wav"
				File "NaoTimer\chn\snd\pet_notify.wav"
			${Break}
			${Default}	; English (1033)
				File "NaoTimer\eng\d3d9.dll"
				File "NaoTimer\eng\d3d9.ini"
				File "NaoTimer\eng\Strongness.txt"
			${Break}
		${EndSwitch}
	SectionEnd

; Japanese Only
	Section $(NaoTimerVoice) SEC_NaoTimer_Voice
		SectionIn 2 3
		${If} $LANGUAGE == '1041'
			SetOutPath "C:\"
			!insertmacro DOWNLOAD "http://www.journey-k.com/~miu/v/dl_counter/lime.cgi?down=http://www.journey-k.com/~miu/v/material/nao_wave.zip&name=まびぼいす001" "nao_wave.zip"
			StrCpy $0 "C:\nao_wave\ご挨拶.wav"	; location of the wav file
			IntOp $1 "SND_ASYNC" || 1
			System::Call 'winmm::PlaySound(t r0, i 0, i r1) b'
			SetOverwrite ifdiff
			SetOutPath "$MABIDIR"
			File "NaoTimer\jpn\d3d9.ini"
		${EndIf}
	SectionEnd

	Section $(MabinogiPlus2) SEC_MabinogiPlus2
		SectionIn 2 3
;		!insertmacro CHECK_VCREDIST
		SetOutPath "$MABIDIR"
		File "MabinogiPlus2\Dinput8.dll"
		File "MabinogiPlus2\MabinogiPlus2.dll"
		File "MabinogiPlus2\MabinogiPlus2.dll.intermediate.manifest"
		File "MabinogiPlus2\MabinogiPlus2.lang.xml"
		${IfNot} ${FileExists} "$MABIDIR\MabinogiPlus2.ini"
			WriteIniStr "$MABIDIR\MabinogiPlus2.ini" "CustomDescription" "ShowItemColorCode" 1
			WriteIniStr "$MABIDIR\MabinogiPlus2.ini" "CustomDescription" "ShowItemDurability" 1
			WriteIniStr "$MABIDIR\MabinogiPlus2.ini" "CustomDescription" "ShowItemPrice" 1
			WriteIniStr "$MABIDIR\MabinogiPlus2.ini" "CustomDescription" "Debug" 0
			WriteIniStr "$MABIDIR\MabinogiPlus2.ini" "CustomDescription" "ShowItemQuality" 1
		${EndIf}
		
		${If} ${FileExists} "$MABIDIR\MabinogiPlus2.ini"
			WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "CharParam1000" 0
			WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "ShowItemPrice" 0
			WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "DigitalFoodQuality" 0
			WriteIniStr "$MABIDIR\Patch.ini" "PATCH" "ShowTrueDuarbility" 0
		${EndIf}
	SectionEnd

	Section $(mwfre) SEC_mwfre
		SectionIn 1 2 3
		SetOutPath "$INSTDIR"
		File "mwfre.dll"
		RegDLL "$INSTDIR\mwfre.dll"
	SectionEnd
/*
	Section "MabiMMLX" SEC_mabimmlx
		SectionIn 1 2 3
		SetOutPath "$INSTDIR"
		!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED MabiMMLX.ocx $SYSDIR\MabiMMLX.ocx $SYSDIR
	SectionEnd
*/
SectionGroupEnd

SectionGroup $(Tools) SEC_Tools
; Japanese and Chinese only
	Section $(mmSeq) SEC_mmSeq
		SectionIn 2 3
		${Switch} $LANGUAGE
			${Case} '1028' ; Chinese (Traditional)
			${Case} '2052' ; Chinese (Simplified)
				SetOutPath "$INSTDIR\mmSeq"
				File "mmSeq\mmSeqcht.exe"
				File "mmSeq\mmSeqcht.exe.manifest"
				File "mmSeq\aboutLocalize.txt"
				!insertmacro registerExtension "$INSTDIR\mmSeq\mmSeqcht.exe,4" ".mms" "mmSeq File"
				SetOutPath "$INSTDIR\mmSeq\plugins"
				File "mmSeq\plugins\refToolcht.dll"
				!insertmacro SETUP_mmSeq
			${Break}

			${Case} '1041' ; Japanese
				SetOutPath "$INSTDIR\mmSeq"
				File "mmSeq\mmSeq.exe"
				File "mmSeq\mmSeq.exe.manifest"
				!insertmacro registerExtension "$INSTDIR\mmSeq\mmSeq.exe,4" ".mms" "mmSeq File"
				SetOutPath "$INSTDIR\mmSeq\plugins"
				File "mmSeq\plugins\refTool.dll"
				!insertmacro SETUP_mmSeq
			${Break}
		${EndSwitch}
	SectionEnd

	Section $(3MLE) SEC_3MLE
		SectionIn 2 3
		SetOutPath "$INSTDIR\3MLE"
		File "3MLE\3MLE.exe"
		File "3MLE\ReadMe_jp.txt"
		File "3MLE\ReleaseNote_jp.txt"
		SetOutPath "$INSTDIR\3MLE\Presets"
		File "3MLE\Presets\MabinogiGM.def"
		File "3MLE\Presets\MSXspirit.def"
		SetOutPath "$INSTDIR\3MLE\Languages"
		${Switch} $LANGUAGE
			${Case} '1028' ; Chinese (Traditional)
				File "3MLE\Languages\TraditionalChinese.lng"
				WriteIniStr "$INSTDIR\3MLE\3MLE.ini" "Language Settings" "LanguageFile" ".\Languages\TraditionalChinese.lng"
			${Break}
			${Case} '1041' ; Japanese
				File "3MLE\Languages\Japanese.lng"
				WriteIniStr "$INSTDIR\3MLE\3MLE.ini" "Language Settings" "LanguageFile" ".\Languages\Japanese.lng"
			${Break}
			${Case} '1042' ; Korean
				File "3MLE\Languages\Korean.lng"
				WriteIniStr "$INSTDIR\3MLE\3MLE.ini" "Language Settings" "LanguageFile" ".\Languages\Korean.lng"
				SetOutPath "$INSTDIR\3MLE"
				File "3MLE\ReadMe_kr.txt"
				File "3MLE\ReleaseNote_kr.txt"
			${Break}
			${Case} '2052' ; Chinese (Simplified)
				File "3MLE\Languages\SimplifiedChinese.lng"
				WriteIniStr "$INSTDIR\3MLE\3MLE.ini" "Language Settings" "LanguageFile" ".\Languages\SimplifiedChinese.lng"
			${Break}
			${Case} '1033'	; English (1033)
				File "3MLE\Languages\English.lng"
				WriteIniStr "$INSTDIR\3MLE\3MLE.ini" "Language Settings" "LanguageFile" ".\Languages\English.lng"
			${Break}
		${EndSwitch}
		WriteIniStr "$INSTDIR\3MLE\3MLE.ini" "MML File Settings" "SpecificTPQN" "+96"
		ExecWait 'icacls /grant USER:MODE /Q /T $INSTDIR\3MLE\*.ini'
	SectionEnd

;Japanese only
	Section $(BMP2MabiPNG) SEC_BMP2MabiPNG
		SectionIn 1 2 3
		${If} $LANGUAGE == '1041'
			SetOutPath "$INSTDIR"
			File "BMP2MabiPNG\Bmp2MabiDrawPng.exe"
		${EndIf}
	SectionEnd

	Section /o "KukuTimer" SEC_KukuTimer
		SectionIn 3
		${If} $LANGUAGE == '1041'
			SetOutPath "$INSTDIR"
			!insertmacro DOWNLOAD "http://kuku.neko2.net/intl/KukuTimer.zip" "KukuTimer.zip"
			ExecWait 'icacls /grant USER:MODE /Q /T $INSTDIR\KukuTimer\*.*'
			ExecWait 'icacls /grant USER:MODE /Q /T $INSTDIR\KukuTimer\KukuTimerFairy\*.*'
			MessageBox MB_OK "KukuTimerはVistaに正式対応していません。$\nVista使用時は、初回起動時にスタートメニューから、KukuTimerを右クリックして、プロパティの互換性タブから「管理者として起動する」をチェックしてください。"
		${EndIf}
	SectionEnd

; Japanese and Chinese only
	Section /o $(MabinogiColorHelper) SEC_MabinogiColorHelper
		SectionIn 3
		${Switch} $LANGUAGE
			${Case} '1028' ; Chinese (Traditional)
			${Case} '2052' ; Chinese (Simplified)
				SetOutPath "$INSTDIR\MabinogiColorHelper"
				File "MabinogiColorHelper\MabinogiColorHelper.exe"
				File "MabinogiColorHelper\HotKeyHelper.dll"
			${Break}
			${Case} '1041' ; Japanese
				SetOutPath "$INSTDIR\MabinogiColorHelper"
				File /oname=MabinogiColorHelper.exe "MabinogiColorHelper\MabinogiColorHelper_j.exe"
				File "MabinogiColorHelper\HotKeyHelper.dll"
			${Break}
		${EndSwitch}
	SectionEnd

; Chinese only
	Section /o $(dyeAssistantAssistant) SEC_dyeAssistantAssistant
		SectionIn 3
		${Switch} $LANGUAGE
			${Case} '1028' ; Chinese (Traditional)
			${Case} '2052' ; Chinese (Simplified)
				SetOutPath "$INSTDIR\MabinogiColorHelper"
				File "MabinogiColorHelper\dyeAssistantAssistant.exe"
				File "MabinogiColorHelper\color.bin"
			${Break}
		${EndSwitch}
	SectionEnd

	Section /o $(MultiPatch) SEC_MultiPatch
		SectionIn 3
		SetOutPath "$MABIDIR"
		File "MultiPatch\MultiPatch.exe"
		ExecWait "$MABIDIR\MultiPatch.exe"
	SectionEnd
SectionGroupEnd

SectionGroup $(Mod) SEC_Mod
	Section $(PingBox) SEC_PingBox
		SectionIn 1 2 3
		SetOutPath "$MABIDIR\data\gfx\style"
		File "data\gfx\style\systemmenu.style.xml"
	SectionEnd

	Section $(CustomFont) SEC_Font
		SectionIn 1 2 3
		SetOutPath "$MABIDIR"
		${Switch} $LANGUAGE
			${Case} '2052' ; Chinese (Simplified)
				!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/custom_font_chn.tome" "custom_font_chn.tome"
			${Break}

			${Case} '1041' ; Japanese
				!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/custom_font_jpn.tome" "custom_font_jpn.tome"
			${Break}
			${Case} '1033'	; English (1033)
				!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/custom_font_eng.tome" "custom_font_eng.tome"
			${Break}
		${EndSwitch}
	SectionEnd

	Section $(CustomMap) SEC_CustomMap
		SectionIn 1 2 3
		SetOutPath "$MABIDIR"
		${Switch} $LANGUAGE
			${Case} '1028' ; Chinese (Traditional)
				!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/custom_map_twn.tome" "custom_map_twn.tome"
			${Break}
			${Case} '1041' ; Japanese
				!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/custom_map_jpn.tome" "custom_map_jpn.tome"
			${Break}
			${Case} '1042' ; Korean
				!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/custom_map_kor.tome" "custom_map_kor.tome"
			${Break}
			${Case} '2052' ; Chinese (Simplified)
				!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/custom_map_chn.tome" "custom_map_chn.tome"
			${Break}
			${Case} '1033'	; English
				!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/custom_map_eng.tome" "custom_map_eng.tome"
			${Break}
		${EndSwitch}
	SectionEnd
/*
	Section $(CutTransformScene) SEC_CutTransformScene
		SectionIn 1 2 3
		SetOutPath "$MABIDIR\data\db\cutscene"
		File "data\db\cutscene\cutscene_be_the_darkknight.xml"
		File "data\db\cutscene\cutscene_darknight_change.xml"
		File "data\db\cutscene\cutscene_elvenmissile_fire.xml"
		File "data\db\cutscene\cutscene_elvenmissile_ice.xml"
		File "data\db\cutscene\cutscene_elvenmissile_light.xml"
		File "data\db\cutscene\cutscene_giant_fullswing.xml"
		File "data\db\cutscene\cutscene_paladin_change.xml"
		SetOutPath "$MABIDIR\data\db\cutscene\c2"
		File "data\db\cutscene\c2\cutscene_elf_transform.xml"
		File "data\db\cutscene\c2\cutscene_giant_transform.xml"
	SectionEnd
*/
	Section $(CutItemDropAnime) SEC_CutItemDropAnime
		SectionIn 1 2 3
		SetOutPath "$MABIDIR\data\gfx\char\item\anim"
		File "data\gfx\char\item\anim\item_appear.ani"
		File "data\gfx\char\item\anim\item_appear02.ani"
		File "data\gfx\char\item\anim\item_appear02_from_prop.ani"
		File "data\gfx\char\item\anim\item_appear_from_prop.ani"
	SectionEnd
	
	Section $(BlockChat) SEC_BlockChat
		SectionIn 1 2 3
		${Switch} $LANGUAGE
			${Case} '1028' ; Chinese (Traditional)
				SetOutPath "$MABIDIR\data\locale\taiwan\filter"
			${Break}
			${Case} '1041' ; Japanese
				SetOutPath "$MABIDIR\data\locale\japan\filter"

			${Break}
			${Case} '1042' ; Korean
				SetOutPath "$MABIDIR\data\locale\korea\filter"

			${Break}
			${Case} '2052' ; Chinese (Simplified)
				SetOutPath "$MABIDIR\data\locale\china\filter"

			${Break}
			${Case} '1033'	; English (1033)
				SetOutPath "$MABIDIR\data\locale\english\filter"
				File "Resource\blockchat.txt"
				SetOutPath "$MABIDIR\data\locale\US\filter"
			${Break}
		${EndSwitch}
		File "Resource\blockchat.txt"
	SectionEnd

	Section /o $(HideDummy) SEC_HideDummy
		SectionIn 1 2 3
		SetOutPath "$MABIDIR\data\gfx\char\human\female\mantle"
		File "data\gfx\char\human\female\mantle\female_dummy_01.pmg"
		SetOutPath "$MABIDIR\data\gfx\char\human\female\mantle"
		File "data\gfx\char\human\male\mantle\male_dummy_01.pmg"
		SetOutPath "$MABIDIR\data\gfx\char\giant\female\mentle"
		File "data\gfx\char\giant\female\mentle\giant_female_dummy_01.pmg"
		SetOutPath "$MABIDIR\data\gfx\char\giant\female\mentle"
		File "data\gfx\char\giant\male\mentle\giant_male_dummy_01.pmg"
	SectionEnd
SectionGroupEnd

SectionGroup $(CutScene) SEC_CutScene
	Section /o $(CutBoss) SEC_CutBoss
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/cut_boss_scene.tome" "cut_boss_scene.tome"
	SectionEnd
	
	Section /o $(CutDiscovery) SEC_CutDiscovery
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/cut_discovery_effect.tome" "cut_discovery_effect.tome"
	SectionEnd
	
	Section /o $(CutRenes) SEC_CutRenes
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/cut_renes_egg_event_scene.tome" "cut_renes_egg_event_scene.tome"
	SectionEnd
	
	Section /o $(CutBroom) SEC_CutBroom
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/cut_riding_broom_animation.tome" "cut_riding_broom_animation.tome"
	SectionEnd
SectionGroupEnd

SectionGroup $(Modding) SEC_Modding
	Section /o $(UI) SEC_UI
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/mod_interface.tome" "mod_interface.tome"
	SectionEnd
	
	SubSection $(Blacksmith) SEC_Blacksmith
		Section $(Blacksmith_0) SEC_blacksmith_0
			SectionIn 1
			Delete $MABIDIR\data\gfx\gui\blacksmith.dds
			Delete $MABIDIR\data\gfx\gui\tailoring.dds
		SectionEnd
		Section /o $(Blacksmith_1) SEC_Blacksmith_1
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_blacksmith_1.tome" "extend_blacksmith_1.tome"
		SectionEnd
		Section /o $(Blacksmith_2) SEC_Blacksmith_2
			SectionIn 3
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_blacksmith_2.tome" "extend_blacksmith_2.tome"
		SectionEnd
	SubSectionEnd

	SubSection $(Lload) SEC_Lload
		Section $(Lload_0) SEC_Lload_0
			SectionIn 1
			Delete $MABIDIR\data\gfx\char\human\tool\tool_lroad_01.xml
			Delete $MABIDIR\data\gfx\char\human\tool\tool_lroad_02.xml
			Delete $MABIDIR\data\gfx\char\human\tool\tool_lroad_03.xml
			RMDir $MABIDIR\data\gfx\char\human\tool
			RMDir $MABIDIR\data\gfx\char\human
		SectionEnd
		Section /o $(Lload_1) SEC_Lload_1
			SectionIn 2 3
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_lroad_1.tome" "extend_lroad_1.tome"
		SectionEnd
		Section /o $(Lload_2) SEC_Lload_2
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_lroad_2.tome" "extend_lroad_2.tome"
		SectionEnd
	SubSectionEnd

	SubSection $(Target) SEC_Target
		Section $(Target_0) SEC_target_0
			SectionIn 1
			Delete $MABIDIR\data\gfx\image\gui_control_line.dds
			Delete $MABIDIR\data\gfx\image\gui_control_target.dds
			Delete $MABIDIR\data\gfx\image\gui_lastclick_target.dds
			RMDir $MABIDIR\data\gfx\image
		SectionEnd
		Section /o $(Target_1) SEC_Target_1
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_target_1.tome" "extend_target_1.tome"
		SectionEnd
		Section /o $(Target_2) SEC_Target_2
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_target_2.tome" "extend_target_2.tome"
		SectionEnd
		Section /o $(Target_3) SEC_Target_3
			SectionIn 2 3
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_target_3.tome" "extend_target_3.tome"
		SectionEnd
		Section /o $(Target_4) SEC_Target_4
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_target_4.tome" "extend_target_4.tome"
		SectionEnd
		Section /o $(Target_5) SEC_Target_5
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/extend_target_5.tome" "extend_target_5.tome"
		SectionEnd
	SubSectionEnd
	
	Section /o $(Mimic) SEC_Mimic
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/mod_mimic.tome" "mod_mimic.tome"
	SectionEnd
	
;	Section /o "Disabled Sulfur Golem Sleep State" SEC_golem
;		SetOutPath "$MABIDIR"
;		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/mod_golem.tome" "mod_golem.tome"
;	SectionEnd
	
	Section /o $(Key) SEC_Key
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/mod_key.tome" "mod_key.tome"
	SectionEnd
	
	Section /o $(Sheep) SEC_Sheep
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/mod_sheep.tome" "mod_sheep.tome"
	SectionEnd
SectionGroupEnd

SectionGroup $(Simplify) SEC_Simplify
	Section /o $(Blur) SEC_Blur
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_blur_effects.tome" "reduce_blur_effects.tome"
	SectionEnd

	Section /o $(Magic) SEC_Magic
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_magic_effects.tome" "reduce_magic_effects.tome"
	SectionEnd

	Section /o $(Terrain) SEC_Terrain
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_terrain_textures.tome" "reduce_terrain_textures.tome"
	SectionEnd

	SubSection $(Dungeon) SEC_Dungeon
		Section /o $(Barri)  SEC_Barri
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_barri_dungeon_objects.tome" "reduce_barri_dungeon_objects.tome"
		SectionEnd
		Section /o $(Runda) SEC_Runda
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_runda_dungeon_objects.tome" "reduce_runda_dungeon_objects.tome"
		SectionEnd
		Section /o $(WoodsRuins) SEC_WoodsRuins
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_woodsruins_dungeon_objects.tome" "reduce_woodsruins_dungeon_objects.tome"
		SectionEnd
	SubSectionEnd
	
	Section /o $(Critical) SEC_Critical
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_critical_effect.tome" "reduce_critical_effect.tome"
	SectionEnd

	Section /o $(Iria) SEC_Iria
		SetOutPath "$MABIDIR"
		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_iria_objects.tome" "reduce_iria_objects.tome"
	SectionEnd

	SubSection $(Field) SEC_Field
		Section /o $(Grass) SEC_Grass
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_tirchonaill_grass.tome" "reduce_tirchonaill_grass.tome"
		SectionEnd
		
		Section /o $(Desert) SEC_Desert
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_sand_field_effect.tome" "reduce_sand_field_effect.tome"
		SectionEnd
		Section /o $(Sand) SEC_Sand
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_sand_stream.tome" "reduce_sand_stream.tome"
		SectionEnd
		Section /o $(Snow) SEC_Snow
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_snow_field_effect.tome" "reduce_snow_field_effect.tome"
		SectionEnd
	SubSectionEnd
	
	SubSection $(G9) SEC_G9
		Section /o $(G9Objects) SEC_G9Objects
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_taillteann_objects.tome" "reduce_taillteann_objects.tome"
		SectionEnd
		Section /o $(G9Textures) SEC_G9Texture
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_taillteann_textures.tome" "reduce_taillteann_textures.tome"
		SectionEnd
	SubSectionEnd
	
	SubSection $(G10) SEC_G10
		Section /o $(G10Textures) SEC_G10Texture
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_tara_textures.tome" "reduce_tara_textures.tome"
		SectionEnd
		
		Section /o $(G10Objects) SEC_G10Objects
			SetOutPath "$MABIDIR"
			!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/reduce_tara_objects.tome" "reduce_tara_objects.tome"
		SectionEnd
	SubSectionEnd
SectionGroupEnd

Section -post
	DetailPrint "Final Proccess."
	WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
	CreateShortcut "$DESKTOP\MabiAssist.lnk" "$INSTDIR\MabiAssist.hta" "" "$INSTDIR\MabiAssist.ico"
	
	WriteUninstaller "$INSTDIR\Uninstall MabiAssist.exe"
	WriteIniStr "$INSTDIR\Website.url" "InternetShortcut" "URL" "${URL}"

	DetailPrint "Create Start Menu..."
	!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
		SetOutPath $SMPROGRAMS\$STARTMENU_FOLDER
		CreateShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\$(^UninstallLink).lnk" "$INSTDIR\Uninstall MabiAssist.exe"
		CreateShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\MabiAssist.lnk" "$INSTDIR\MabiAssist.hta" "" "$INSTDIR\MabiAssist.ico"
		CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(DistributerLink).lnk" "$INSTDIR\Website.url" "" "$INSTDIR\img\html.ico"
		
		SetOutPath $SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)
		${If} ${FileExists} "$INSTDIR\NabiPack.exe"
			CreateShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\$(NabiPack).lnk" "$INSTDIR\NabiPack.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "NabiPack" 'NabiPack.exe|1'
		${EndIf}
		${If} ${FileExists} "$INSTDIR\mmSeq\mmSeq.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(mmSeq).lnk" "$INSTDIR\mmSeq\mmSeq.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "mmSeq" 'mmSeq\mmSeq.exe|1'
		${EndIf}
		${If} ${FileExists} "$INSTDIR\mmSeq\mmSeqcht.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(mmSeq).lnk" "$INSTDIR\mmSeq\mmSeqcht.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "mmSeq" 'mmSeq\mmSeqcht.exe|1'
		${EndIf}
		${If} ${FileExists} "$INSTDIR\3MLE\3MLE.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(3MLE).lnk" "$INSTDIR\3MLE\3MLE.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "3MLE" '3MLE\3MLE.exe|1'
		${EndIf}
		${If} ${FileExists} "$INSTDIR\Bmp2MabiDrawPng.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(BMP2MabiPNG).lnk" "$INSTDIR\Bmp2MabiDrawPng.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "BMP2MabiPNG" 'Bmp2MabiDrawPng.exe|1'
		${EndIf}
		${If} ${FileExists} "$INSTDIR\KukuTimer\KukuTimer.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\KukuTimer.lnk" "$INSTDIR\KukuTimer\KukuTimer.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "KukuTimer" 'KukuTimer\KukuTimer.exe|1'
		${EndIf}
		${If} ${FileExists} "$INSTDIR\MabinogiColorHelper\MabinogiColorHelper.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(MabinogiColorHelper).lnk" "$INSTDIR\MabinogiColorHelper\MabinogiColorHelper.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "MabinogiColorHelper" 'MabinogiColorHelper\MabinogiColorHelper.exe|1'
		${EndIf}
		${If} ${FileExists} "$INSTDIR\MabinogiColorHelper\dyeAssistantAssistant.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(dyeAssistantAssistant).lnk" "$INSTDIR\MabinogiColorHelper\dyeAssistantAssistant.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "dyeAssistantAssistant" 'MabinogiColorHelper\dyeAssistantAssistant.exe|1'
		${EndIf}
		${If} ${FileExists} "$INSTDIR\Noginogi\jinsu_nnogi_lv180.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\Noginogi.lnk" "$INSTDIR\Noginogi\jinsu_nnogi_lv180.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "Noginogi" 'Noginogi\jinsu_nnogi_lv180.exe|1'

			DetailPrint "Launch Noginogi..."
			MessageBox MB_YESNO $(Noginogi_info) IDNO +2
			WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Custom" "@IsAutoPatch" "1"
			ExecWait $INSTDIR\Noginogi\jinsu_nnogi_lv$180.exe
			WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Custom" "@IsAutoPatch" "0"
		${EndIf}
		${If} ${FileExists} "$INSTDIR\NabiPack.exe"
			CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\NabiPack.lnk" "$INSTDIR\Noginogi\NabiPack.exe"
			WriteIniStr "$INSTDIR\MabiAssist.ini" "Packages" "NabiPack" 'Noginogi\NabiPack.exe|1'
			DetailPrint "Launch NabiPack..."
			MessageBox MB_OK $(NabiPack_1)
			ExecWait "$INSTDIR\NabiPack.exe"
		${EndIf}
	!insertmacro MUI_STARTMENU_WRITE_END
	
	DetailPrint "Write Registory..."
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon "$INSTDIR\MabiAssist.ico"
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString "$INSTDIR\Uninstall MabiAssist.exe"
	WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
	WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 0
	
	DetailPrint "Finish"
SectionEnd

; セクションの説明
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
	!insertmacro MUI_DESCRIPTION_TEXT ${SEC_core} $(Core_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MabinogiMemoryPatch} $(MabinogiMemoryPatch_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_NaoTimer} $(NaoTimer_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_NaoTimer_Voice} $(NaoTimer_Voice_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MabinogiPlus2} $(MabinogiPlus2_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MultiPatch} $(MultiPatch_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_mwfre} $(mwfre_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MabiMMLX} $(MabiMMLX_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Noginogi} $(Noginogi_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_NabiPack} $(NabiPack_desc)
	!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Tools} ""
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_mmSeq} $(mmSeq_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_3MLE} $(3MLE_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_BMP2MabiPNG} $(BMP2MabiPNG_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_KukuTimer} $(KukuTimer_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MabinogiColorHelper} $(MabinogiColorHelper_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_dyeAssistantAssistant} $(dyeAssistantAssistant_desc)
	!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Mod} $(Mod_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_PingBox} $(PingBox_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CustomFont} $(CustomFont_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CustomMap} $(CustomMap_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CutTransformScene} $(CutTransformScene_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CutItemDropAnime} $(CutItemDropAnime_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_BlockChat} $(BlockChat)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_HideDummy} $(HideDummy_desc)
	!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CutScene} $(CutScene_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CutBoss} $(CutBoss_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CutDiscovery} $(CutDiscovery_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CutRenes} $(CutRenes_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CutBroom} $(CutBroom_desc)
	!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Modding} $(Modding_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_UI} $(UI_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Blacksmith} $(Blacksmith_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Blacksmith_0} $(Blacksmith_0_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Blacksmith_1} $(Blacksmith_1_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Blacksmith_2} $(Blacksmith_2_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Lload} $(Lload_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Lload_0} $(Lload_0_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Lload_1} $(Lload_1_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Lload_2} $(Lload_2_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Target} $(Target_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Target_0} $(Target_0_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Target_1} $(Target_1_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Target_2} $(Target_2_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Target_3} $(Target_3_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Target_4} $(Target_4_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Target_5} $(Target_5_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Mimic} $(Mimic_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Key} $(Key_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Sheep} $(Sheep_desc)
	!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Simplify} $(Simplify_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Blur} $(Blur_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Magic} $(Magic_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Terrain} $(Terrain_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Dungeon} $(Dungeon_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Barri} $(Barri_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Runda} $(Runda_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_WoodsRuins} $(WoodsRuins_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Critical} $(Critical_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Iria} $(Iria_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Grass} $(Grass_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_G9} $(G9_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_G9Objects} $(G9Objects_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_G9Textures} $(G9Textures_desc)
		!insertmacro MUI_DESCRIPTION_TEXT ${SEC_G10} $(G10_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_G10Objects} $(G10Objects_desc)
			!insertmacro MUI_DESCRIPTION_TEXT ${SEC_G10Textures} $(G10Textures_desc)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

# ラジオボタン設定 --------------------------------------------------------------------------------#
Function .onSelChange
	${If} ${SectionIsSelected} ${SEC_Patch}
		!insertmacro UnSelectSection ${SEC_Patch}
		!insertmacro SelectSection $1
	${Else}
		!insertmacro StartRadioButtons $1
			!insertmacro RadioButton ${SEC_MabinogiMemoryPatch}
			!insertmacro RadioButton ${SEC_FantasistaPatch}
		!insertmacro EndRadioButtons
	${EndIf}
	
	${If} ${SectionIsSelected} ${SEC_blacksmith}
		!insertmacro UnSelectSection ${SEC_blacksmith}
		!insertmacro SelectSection $2
	${Else}
		!insertmacro StartRadioButtons $2
			!insertmacro RadioButton ${SEC_blacksmith_0}
			!insertmacro RadioButton ${SEC_blacksmith_1}
			!insertmacro RadioButton ${SEC_blacksmith_2}
		!insertmacro EndRadioButtons
	${EndIf}

	${If} ${SectionIsSelected} ${SEC_Lload}
		!insertmacro UnSelectSection ${SEC_Lload}
		!insertmacro SelectSection $3
	${Else}
		!insertmacro StartRadioButtons $3
			!insertmacro RadioButton ${SEC_Lload_0}
			!insertmacro RadioButton ${SEC_Lload_1}
			!insertmacro RadioButton ${SEC_Lload_2}
		!insertmacro EndRadioButtons
	${EndIf}


	${If} ${SectionIsSelected} ${SEC_target}
		!insertmacro UnSelectSection ${SEC_target}
		!insertmacro SelectSection $4
	${Else}
		!insertmacro StartRadioButtons $4
			!insertmacro RadioButton ${SEC_target_0}
			!insertmacro RadioButton ${SEC_target_1}
			!insertmacro RadioButton ${SEC_target_2}
			!insertmacro RadioButton ${SEC_target_3}
			!insertmacro RadioButton ${SEC_target_4}
			!insertmacro RadioButton ${SEC_target_5}
		!insertmacro EndRadioButtons
	${EndIf}
FunctionEnd

# 選択アンインストーラー・セクションのマクロ
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
	Push $R0
	ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
	StrCmp $R0 1 0 next${UNSECTION_ID}
	!insertmacro SelectSection "${UNSECTION_ID}"
	GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
	!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
	Pop $R0
!macroend


!insertmacro UMUI_DECLARECOMPONENTS_BEGIN
	!insertmacro UMUI_COMPONENT SEC_MabinogiMemoryPatch
	!insertmacro UMUI_COMPONENT SEC_NaoTimer
	!insertmacro UMUI_COMPONENT SEC_NaoTimer_Voice
	!insertmacro UMUI_COMPONENT SEC_MabinogiPlus2
	!insertmacro UMUI_COMPONENT SEC_MultiPatch
	!insertmacro UMUI_COMPONENT SEC_mwfre
	!insertmacro UMUI_COMPONENT SEC_MabiMMLX
	!insertmacro UMUI_COMPONENT SEC_Noginogi
	!insertmacro UMUI_COMPONENT SEC_NabiPack
	!insertmacro UMUI_COMPONENT SEC_mmSeq
	!insertmacro UMUI_COMPONENT SEC_3MLE
	!insertmacro UMUI_COMPONENT SEC_BMP2MabiPNG
	!insertmacro UMUI_COMPONENT SEC_KukuTimer
	!insertmacro UMUI_COMPONENT SEC_MabinogiColorHelper
	!insertmacro UMUI_COMPONENT SEC_dyeAssistantAssistant
	!insertmacro UMUI_COMPONENT SEC_PingBox
	!insertmacro UMUI_COMPONENT SEC_CustomFont
	!insertmacro UMUI_COMPONENT SEC_CustomMap
	!insertmacro UMUI_COMPONENT SEC_CutTransformScene
	!insertmacro UMUI_COMPONENT SEC_CutItemDropAnime
	!insertmacro UMUI_COMPONENT SEC_BlockChat
	!insertmacro UMUI_COMPONENT SEC_HideDummy
	!insertmacro UMUI_COMPONENT SEC_CutBoss
	!insertmacro UMUI_COMPONENT SEC_CutDiscovery
	!insertmacro UMUI_COMPONENT SEC_CutRenes
	!insertmacro UMUI_COMPONENT SEC_CutBroom
	!insertmacro UMUI_COMPONENT SEC_UI
	!insertmacro UMUI_COMPONENT SEC_Blacksmith_1
	!insertmacro UMUI_COMPONENT SEC_Blacksmith_2
	!insertmacro UMUI_COMPONENT SEC_Lload_1
	!insertmacro UMUI_COMPONENT SEC_Lload_2
	!insertmacro UMUI_COMPONENT SEC_Target_1
	!insertmacro UMUI_COMPONENT SEC_Target_2
	!insertmacro UMUI_COMPONENT SEC_Target_3
	!insertmacro UMUI_COMPONENT SEC_Target_4
	!insertmacro UMUI_COMPONENT SEC_Target_5
	!insertmacro UMUI_COMPONENT SEC_Mimic
	!insertmacro UMUI_COMPONENT SEC_Key
	!insertmacro UMUI_COMPONENT SEC_Sheep
	!insertmacro UMUI_COMPONENT SEC_Blur
	!insertmacro UMUI_COMPONENT SEC_Magic
	!insertmacro UMUI_COMPONENT SEC_Terrain
	!insertmacro UMUI_COMPONENT SEC_Barri
	!insertmacro UMUI_COMPONENT SEC_Runda
	!insertmacro UMUI_COMPONENT SEC_WoodsRuins
	!insertmacro UMUI_COMPONENT SEC_Critical
	!insertmacro UMUI_COMPONENT SEC_Iria
	!insertmacro UMUI_COMPONENT SEC_Grass
	!insertmacro UMUI_COMPONENT SEC_G9Objects
	!insertmacro UMUI_COMPONENT SEC_G9Textures
	!insertmacro UMUI_COMPONENT SEC_G10Objects
	!insertmacro UMUI_COMPONENT SEC_G10Textures
!insertmacro UMUI_DECLARECOMPONENTS_END

# アンインストーラー・セクション
SubSection un.$(Core)
	Section -un."Mabinogi Assist"
		Delete "$INSTDIR\uninst.exe"
		Delete "$INSTDIR\MabiAssist.hta"
		Delete "$INSTDIR\MabiAssist.ico"
		Delete "$INSTDIR\MabiAssist.ini"
		Delete "$INSTDIR\License.html"
		Delete "$INSTDIR\js\*.*"
		RMDir "$INSTDIR\js"
		Delete "$INSTDIR\img\weather\*.*"
		RMDir "$INSTDIR\img\weather"
		Delete "$INSTDIR\img\icons\*.*"
		RMDir "$INSTDIR\img\icons"
		Delete "$INSTDIR\img\*.*"
		RMDir "$INSTDIR\img"
		Delete "$INSTDIR\locale\*.*"
		RMDir "$INSTDIR\locale"
		DeleteRegValue HKLM "${REGKEY}\Components" MabiAssist
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\$(DistributerLink).lnk"
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\MabiAssist.lnk"
	SectionEnd

	Section un.$(MabinogiMemoryPatch)
		Delete "$MABIDIR\patch.ini"
		Delete "$MABIDIR\patchlog.txt"
		Delete "$MABIDIR\mamp_log.txt"
		${If} ${FileExists} "$MABIDIR\ijl15.dat"
			Delete "$MABIDIR\ijl15.dll"
			Rename "$MABIDIR\ijl15.dat" "$MABIDIR\ijl15.dll"
		${EndIf}
	SectionEnd

	Section un.$(NaoTimerVoice)
		Delete "C:\nao_wave\*.*"
		RMDir "C:\nao_wave"
	SectionEnd

	Section un.$(NaoTimer)
		Delete "$MABIDIR\d3d9.dll"
		Delete "$MABIDIR\d3d9.ini"
		Delete "$MABIDIR\Notify.wav"
	SectionEnd

	Section un.$(MabinogiPlus2)
		Delete "$MABIDIR\MabinogiPlus2.lang.xml"
		Delete "$MABIDIR\MabinogiPlus2.ini"
		Delete "$MABIDIR\MabinogiPlus2.dll.intermediate.manifest"
		Delete "$MABIDIR\MabinogiPlus2.dll"
		Delete "$MABIDIR\DInput8.dll"
	SectionEnd

	Section un.$(Noginogi)
		MessageBox MB_OK $(Noginogi_uninst)
		WriteIniStr "$INSTDIR\Noginogi\noginogi.ini" "Custom" "@IsAutoPatch" "0"
		ExecWait $INSTDIR\Noginogi\jinsu_nnogi_lv180.exe
		Delete "$INSTDIR\Noginogi\*.*"
		RMDir "$INSTDIR\Noginogi"
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(Noginogi).lnk"
	SectionEnd

	Section un.$(MultiPatch)
		Delete "$MABIDIR\MultiPatch.exe"
		${If} ${FileExists} "$MABIDIR\client.exe.bak"
			Delete "$MABIDIR\client.exe"
			Rename "$MABIDIR\client.exe.bak" "$MABIDIR\client.exe"
		${EndIf}

		${If} ${FileExists} "$MABIDIR\Mabinogi.exe.bak"
			Delete "$MABIDIR\Mabinogi.exe"
			Rename "$MABIDIR\Mabinogi.exe.bak" "$MABIDIR\Mabinogi.exe"
		${EndIf}
	SectionEnd

	Section un.$(mwfre)
		UnRegDLL "$INSTDIR\mwfre.dll"
		Delete "$INSTDIR\mwfre.dll"
	SectionEnd

	Section un.MabiMMLX
		!insertmacro UnInstallLib REGDLL SHARED REBOOT_NOTPROTECTED $SYSDIR\MabiMMLX.ocx
		Delete "$INSTDIR\MabiMMLX.ocx"
	SectionEnd
SubSectionEnd

SubSection un.$(Tools)
	Section un.$(mmSeq)
		Delete "$INSTDIR\mmSeq\plugins\*.*"
		RMDir "$INSTDIR\mmSeq\plugins"
		Delete "$INSTDIR\mmSeq\skin\*.*"
		RMDir "$INSTDIR\mmSeq\skin"
		Delete "$INSTDIR\mmSeq\*.*"
		RMDir "$INSTDIR\mmSeq"
;		!insertmacro unregisterExtension ".mms" "mmSeq File"
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(mmSeq).lnk"
	SectionEnd

	Section un.$(3MLE)
		Delete "$INSTDIR\3MLE\Languages\*.*"
		RMDir "$INSTDIR\3MLE\Languages"
		Delete "$INSTDIR\3MLE\Presets\*.*"
		RMDir "$INSTDIR\3MLE\Presets"
		Delete "$INSTDIR\3MLE\*.*"
		RMDir "$INSTDIR\3MLE"
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(3MLE).lnk"
	SectionEnd

	Section un.$(BMP2MabiPNG)
		Delete "$INSTDIR\Bmp2MabiDrawPng.exe"
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\$(BMP2MabiPNG).lnk"
	SectionEnd

	Section un.$(KukuTimer)
		Delete "$INSTDIR\KukuTimer\KukuTimerFairy\*.*"
		RMDir "$INSTDIR\KukuTimer\KukuTimerFairy"
		Delete "$INSTDIR\KukuTimer\Voicehana\*.*"
		RMDir "$INSTDIR\KukuTimer\Voicehana"
		Delete "$INSTDIR\KukuTimer\*.*"
		RMDir "$INSTDIR\KukuTimer"
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(KukuTimer).lnk"
	SectionEnd
	
	Section un.$(MabinogiColorHelper)
		Delete "$INSTDIR\MabinogiColorHelper\MabinogiColorHelper.exe"
		Delete "$INSTDIR\MabinogiColorHelper\HotKeyHook.dll"
		RMDir "$INSTDIR\MabinogiColorHelper"
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(MabinogiColorHelper).lnk"
	SectionEnd

	Section un.$(dyeAssistantAssistant)
		Delete "$INSTDIR\MabinogiColorHelper\dyeAssistantAssistant.exe"
		Delete "$INSTDIR\MabinogiColorHelper\color.bin"
		RMDir "$INSTDIR\MabinogiColorHelper"
		Delete "$SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)\$(dyeAssistantAssistant).lnk"
	SectionEnd
SubSectionEnd

SectionGroup un.$(Modding)
	Section un.$(UI)
;		!insertmacro DOWNLOAD "http://logue.be/mabinogi/assist/mod_interface.tome" "mod_interface.tome"
	SectionEnd
	
	Section un.$(Blacksmith)
		Delete $MABIDIR\data\gfx\gui\blacksmith.dds
		Delete $MABIDIR\data\gfx\gui\tailoring.dds
	SectionEnd

	Section un.$(Lload)
		Delete $MABIDIR\data\gfx\char\human\tool\tool_lroad_01.xml
		Delete $MABIDIR\data\gfx\char\human\tool\tool_lroad_02.xml
		Delete $MABIDIR\data\gfx\char\human\tool\tool_lroad_03.xml
		RMDir $MABIDIR\data\gfx\char\human\tool
		RMDir $MABIDIR\data\gfx\char\human
	SectionEnd

	Section un.$(Target)
		Delete $MABIDIR\data\gfx\image\gui_control_line.dds
		Delete $MABIDIR\data\gfx\image\gui_control_target.dds
		Delete $MABIDIR\data\gfx\image\gui_lastclick_target.dds
		RMDir $MABIDIR\data\gfx\image
	SectionEnd
	
	Section un.$(Mimic)
		Delete $MABIDIR\data\gfx\char\monster\mesh\mimic\mimic01_mesh.pmg
		Delete $MABIDIR\data\gfx\char\monster\mesh\mimic\mimic02_mesh.pmg
		Delete $MABIDIR\data\gfx\char\monster\mesh\mimic\mimic03_mesh.pmg
		RMDir $MABIDIR\data\gfx\char\monster\mesh\mimic
		RMDir $MABIDIR\data\gfx\char\monster\mesh
		RMDir $MABIDIR\data\gfx\char\monster
		RMDir $MABIDIR\data\gfx\char
	SectionEnd

	Section un.$(Key)
		Delete $MABIDIRdata\gfx\char\item\mesh\item_bosskey_001.pmg
		Delete $MABIDIRdata\gfx\char\item\mesh\item_bosskey_002.pmg
		Delete $MABIDIRdata\gfx\char\item\mesh\item_boxkey_001.pmg
		Delete $MABIDIRdata\gfx\char\item\mesh\item_roomkey_001.pmg
		RMDir $MABIDIRdata\gfx\char\item\mesh
		RMDir $MABIDIRdata\gfx\char\item
		RMDir $MABIDIRdata\gfx\char
	SectionEnd
	
	Section un.$(Sheep)
		Delete $MABIDIR\data\gfx\char\monster\mesh\sheep\sheep01_mesh.pmg
		RMDir $MABIDIR\data\gfx\char\monster\mesh\sheep
		RMDir $MABIDIR\data\gfx\char\monster\mesh
		RMDir $MABIDIR\data\gfx\char\monster
		RMDir $MABIDIR\data\gfx\char
	SectionEnd
SectionGroupEnd

SectionGroup un.$(Simplify)
	Section un.$(Blur)
		Delete $MABIDIR\data\gfx\fx\posteffect\blur.xml
		RMDir $MABIDIR\data\gfx\fx\posteffect
	SectionEnd

	Section un.$(Magic)
		Delete $MABIDIR\data\gfx\fx\effect\icespear.xml
		Delete $MABIDIR\data\gfx\fx\effect\lightningbolt.xml
		Delete $MABIDIR\data\gfx\fx\effect\particles2.xml
		Delete $MABIDIR\data\gfx\fx\effect\particles5_ver8.xml
		RMDir $MABIDIR\data\gfx\fx\effect
	SectionEnd

	Section un.$(Terrain)
		Delete $MABIDIR\data\material\terrain\*.dds
		RMDir $MABIDIR\data\material\terrain
	SectionEnd

	SubSection un.$(Dungeon)
		Section un.$(Barri)
			Delete $MABIDIR\data\gfx\scene\bangor\dungeon\*.pmg
			RMDir $MABIDIR\data\gfx\scene\bangor\dungeon
			RMDir $MABIDIR\data\gfx\scene\bangor
		SectionEnd
		Section  un.$(Runda)
			Delete $MABIDIR\data\gfx\scene\emainmacha\dungeon\alley\*.pmg
			RMDir $MABIDIR\data\gfx\scene\emainmacha\dungeon\alley
			Delete $MABIDIR\data\gfx\scene\emainmacha\dungeon\room\*.pmg
			RMDir $MABIDIR\data\gfx\scene\emainmacha\dungeon\room
			RMDir $MABIDIR\data\gfx\scene\emainmacha\dungeon
			RMDir $MABIDIR\data\gfx\scene\emainmacha
		SectionEnd
		Section un.$(WoodsRuins)
			Delete $MABIDIR\data\gfx\scene\dungeon\woodsruins\*.pmg
			RMDir $MABIDIR\data\gfx\scene\dungeon\woodsruins
		SectionEnd
	SubSectionEnd
	
	Section un.$(Critical)
		Delete $MABIDIR\data\material\fx\effect\common_effect.dds
		RMDir $MABIDIR\data\material\fx\effect
	SectionEnd

	Section un.$(Iria)
		Delete $MABIDIR\data\gfx\scene\iria\iria_sw\prop\*.pmg
		RMDir $MABIDIR\data\gfx\scene\iria\iria_sw\prop
		RMDir $MABIDIR\data\gfx\scene\iria\iria_sw
		RMDir $MABIDIR\data\gfx\scene\iria
	SectionEnd

	SubSection un.$(Field)
		Section un.$(Grass)
			Delete $MABIDIR\data\material\fx\grass\bbd_grass1.dds
			RMDir $MABIDIR\data\material\fx\grass
		SectionEnd
		
		Section un.$(Desert)
			Delete $MABIDIR\data\gfx\fx\effect\fx_g5_fieldeffect.xml
		SectionEnd
		Section un.$(Sand)
			Delete $MABIDIR\data\material\fx\sand\sand_stream1.dds
			RMDir $MABIDIR\data\material\fx\sand
		SectionEnd
		Section un.$(Snow)
			Delete $MABIDIR\data\gfx\fx\effect\c2_g6_s1_snowfield.xml
		SectionEnd
	SubSectionEnd
	SubSection un.$(G9)
		Section un.$(G9Objects)
			Delete $MABIDIR\data\material\fx\grass\bbd_grass1.dds
			RMDir $MABIDIR\data\material\fx\grass
		SectionEnd
		Section un.$(G9Textures)
			Delete $MABIDIR\data\material\fx\grass\bbd_grass1.dds
			RMDir $MABIDIR\data\material\fx\grass
		SectionEnd
	SubSectionEnd
	
	SubSection un.$(G10)
		Section un.$(G10Textures)
			Delete $MABIDIR\data\material\fx\grass\bbd_grass1.dds
			RMDir $MABIDIR\data\material\fx\grass
		SectionEnd
		
		Section un.$(G10Objects)
			Delete $MABIDIR\data\material\fx\grass\bbd_grass1.dds
			RMDir $MABIDIR\data\material\fx\grass
		SectionEnd
	SubSectionEnd
SectionGroupEnd

Section -un.post
	DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
	Delete "$SMPROGRAMS\$STARTMENU_FOLDER\*.*"
	Delete "$INSTDIR\*.*"
	DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
	DeleteRegValue HKLM "${REGKEY}" Path
	DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
	DeleteRegKey /IfEmpty HKLM "${REGKEY}"
	Delete "$DESKTOP\MabiAssist.lnk"
	Delete "$INSTDIR\Website.url"
	RmDir $SMPROGRAMS\$STARTMENU_FOLDER\$(Tools)
	RmDir $SMPROGRAMS\$STARTMENU_FOLDER
	RmDir $INSTDIR
SectionEnd

# アンインストーラー関数
Function un.onInit
	!insertmacro UMUI_MULTILANG_GET
;	!insertmacro PROCCESS_CHECK
FunctionEnd

Function un.onSelChange
	${If} ${SectionIsSelected} ${SEC_Patch}
		!insertmacro UnSelectSection ${SEC_Patch}
		!insertmacro SelectSection $1
	${Else}
		!insertmacro StartRadioButtons $1
			!insertmacro RadioButton ${SEC_MabinogiMemoryPatch}
			!insertmacro RadioButton ${SEC_FantasistaPatch}
		!insertmacro EndRadioButtons
	${EndIf}
	
	${If} ${SectionIsSelected} ${SEC_blacksmith}
		!insertmacro UnSelectSection ${SEC_blacksmith}
		!insertmacro SelectSection $2
	${Else}
		!insertmacro StartRadioButtons $2
			!insertmacro RadioButton ${SEC_blacksmith_0}
			!insertmacro RadioButton ${SEC_blacksmith_1}
			!insertmacro RadioButton ${SEC_blacksmith_2}
		!insertmacro EndRadioButtons
	${EndIf}

	${If} ${SectionIsSelected} ${SEC_Lload}
		!insertmacro UnSelectSection ${SEC_Lload}
		!insertmacro SelectSection $3
	${Else}
		!insertmacro StartRadioButtons $3
			!insertmacro RadioButton ${SEC_Lload_0}
			!insertmacro RadioButton ${SEC_Lload_1}
			!insertmacro RadioButton ${SEC_Lload_2}
		!insertmacro EndRadioButtons
	${EndIf}


	${If} ${SectionIsSelected} ${SEC_target}
		!insertmacro UnSelectSection ${SEC_target}
		!insertmacro SelectSection $4
	${Else}
		!insertmacro StartRadioButtons $4
			!insertmacro RadioButton ${SEC_target_0}
			!insertmacro RadioButton ${SEC_target_1}
			!insertmacro RadioButton ${SEC_target_2}
			!insertmacro RadioButton ${SEC_target_3}
			!insertmacro RadioButton ${SEC_target_4}
			!insertmacro RadioButton ${SEC_target_5}
		!insertmacro EndRadioButtons
	${EndIf}
FunctionEnd