Merge branch 'master' from Windows

This commit is contained in:
2015-06-08 23:45:41 -04:00
6 changed files with 161 additions and 10 deletions

View File

@@ -32,6 +32,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_BLADESOFEXILE ICON "../../../rsrc/icons/win/BOE Icon.ico"
IDI_BOESAVE ICON "../../../rsrc/icons/win/BoE Save.ico"
/////////////////////////////////////////////////////////////////////////////
//

View File

@@ -158,6 +158,7 @@
</ItemGroup>
<ItemGroup>
<Image Include="..\..\..\rsrc\icons\win\BOE Icon.ico" />
<Image Include="..\..\..\rsrc\icons\win\BOE Save.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@@ -165,5 +165,8 @@
<Image Include="..\..\..\rsrc\icons\win\BOE Icon.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\..\rsrc\icons\win\BOE Save.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -39,15 +39,16 @@
#define IDM_HELP_ABOUT 142
#define IDM_HELP_TOWN 143
#define IDM_OPTIONS_JOURNAL 144
#define IDI_BOESAVE 145
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32774
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 145
#define _APS_NEXT_SYMED_VALUE 146
#endif
#endif

View File

@@ -0,0 +1,119 @@
; fileassoc.nsh
; File association helper macros
; Written by Saivert
;
; Features automatic backup system and UPDATEFILEASSOC macro for
; shell change notification.
;
; |> How to use <|
; To associate a file with an application so you can double-click it in explorer, use
; the APP_ASSOCIATE macro like this:
;
; Example:
; !insertmacro APP_ASSOCIATE "txt" "myapp.textfile" "Description of txt files" \
; "$INSTDIR\myapp.exe,0" "Open with myapp" "$INSTDIR\myapp.exe $\"%1$\""
;
; Never insert the APP_ASSOCIATE macro multiple times, it is only ment
; to associate an application with a single file and using the
; the "open" verb as default. To add more verbs (actions) to a file
; use the APP_ASSOCIATE_ADDVERB macro.
;
; Example:
; !insertmacro APP_ASSOCIATE_ADDVERB "myapp.textfile" "edit" "Edit with myapp" \
; "$INSTDIR\myapp.exe /edit $\"%1$\""
;
; To have access to more options when registering the file association use the
; APP_ASSOCIATE_EX macro. Here you can specify the verb and what verb is to be the
; standard action (default verb).
;
; And finally: To remove the association from the registry use the APP_UNASSOCIATE
; macro. Here is another example just to wrap it up:
; !insertmacro APP_UNASSOCIATE "txt" "myapp.textfile"
;
; |> Note <|
; When defining your file class string always use the short form of your application title
; then a period (dot) and the type of file. This keeps the file class sort of unique.
; Examples:
; Winamp.Playlist
; NSIS.Script
; Photoshop.JPEGFile
;
; |> Tech info <|
; The registry key layout for a file association is:
; HKEY_CLASSES_ROOT
; <applicationID> = <"description">
; shell
; <verb> = <"menu-item text">
; command = <"command string">
;
!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
; Backup the previously associated file class
ReadRegStr $R0 HKCR ".${EXT}" ""
WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"
WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"
WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`
WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`
WriteRegStr HKCR "${FILECLASS}\shell" "" "open"
WriteRegStr HKCR "${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
WriteRegStr HKCR "${FILECLASS}\shell\open\command" "" `${COMMAND}`
!macroend
!macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND
; Backup the previously associated file class
ReadRegStr $R0 HKCR ".${EXT}" ""
WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"
WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"
StrCmp "${SHELLNEW}" "0" +2
WriteRegStr HKCR ".${EXT}\ShellNew" "NullFile" ""
WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`
WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`
WriteRegStr HKCR "${FILECLASS}\shell" "" `${DEFAULTVERB}`
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
!macroend
!macro APP_ASSOCIATE_ADDVERB FILECLASS VERB COMMANDTEXT COMMAND
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
!macroend
!macro APP_ASSOCIATE_REMOVEVERB FILECLASS VERB
DeleteRegKey HKCR `${FILECLASS}\shell\${VERB}`
!macroend
!macro APP_UNASSOCIATE EXT FILECLASS
; Backup the previously associated file class
ReadRegStr $R0 HKCR ".${EXT}" `${FILECLASS}_backup`
WriteRegStr HKCR ".${EXT}" "" "$R0"
DeleteRegKey HKCR `${FILECLASS}`
!macroend
!macro APP_ASSOCIATE_GETFILECLASS OUTPUT EXT
ReadRegStr ${OUTPUT} HKCR ".${EXT}" ""
!macroend
; !defines for use with SHChangeNotify
!ifdef SHCNE_ASSOCCHANGED
!undef SHCNE_ASSOCCHANGED
!endif
!define SHCNE_ASSOCCHANGED 0x08000000
!ifdef SHCNF_FLUSH
!undef SHCNF_FLUSH
!endif
!define SHCNF_FLUSH 0x1000
!macro UPDATEFILEASSOC
; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we
; can update the shell.
System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)"
!macroend
;EOF

View File

@@ -10,6 +10,9 @@ InstallDir "$PROGRAMFILES\Blades of Exile"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "Release\Install-OBoE.exe"
; File association helpers
!include "fileassoc.nsh"
; Modern interface settings
!include "MUI.nsh"
@@ -69,6 +72,7 @@ Section "Blades of Exile" Section1
File "..\Release\Blades of Exile Scenarios\ZAKHAZI.BMP"
File "..\Release\Blades of Exile Scenarios\zakhazi.exs"
!include data.nsi
SetShellVarContext all
CreateShortCut "$DESKTOP\Blades of Exile.lnk" "$INSTDIR\Blades of Exile.exe"
CreateDirectory "$SMPROGRAMS\Blades of Exile"
CreateShortCut "$SMPROGRAMS\Blades of Exile\Blades of Exile.lnk" "$INSTDIR\Blades of Exile.exe"
@@ -83,6 +87,7 @@ Section "Character Editor" Section2
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
File "..\Release\Char Editor.exe"
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\Blades of Exile\Character Editor.lnk" "$INSTDIR\Char Editor.exe"
SectionEnd
@@ -97,6 +102,7 @@ Section "Scenario Editor" Section3
File "..\Release\Scen Editor.exe"
SetOutPath "$INSTDIR\Scenario Editor\Blades of Exile Base\"
File "..\Release\Scenario Editor\Blades of Exile Base\bladbase.exs"
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\Blades of Exile\Scenario Editor.lnk" "$INSTDIR\Scen Editor.exe"
SectionEnd
@@ -108,6 +114,20 @@ Section -FinishSection
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
!insertmacro APP_ASSOCIATE "exg" "BladesofExile.SaveGame" "Blades of Exile saved game" "$INSTDIR\Blades of Exile.exe,1" "" '$INSTDIR\myapp.exe "%1"'
!insertmacro APP_ASSOCIATE_ADDVERB "BladesOfExile.SaveGame" "edit" "" '$INSTDIR\Character Editor.exe "%1"'
!insertmacro APP_ASSOCIATE "boes" "BladesofExile.Scenario" "Blades of Exile scenario" "$INSTDIR\Blades of Exile.exe,2" "" '$INSTDIR\Scenario Editor.exe "%1"'
!insertmacro UPDATEFILEASSOC
; WriteRegStr HKCR ".exg" "" "BladesOfExile.SaveGame"
; WriteRegStr HKCR ".boes" "" "BladesOfExile.Scenario"
; WriteRegStr HKCR "MPC.avi" "" "AVI File"
; WriteRegStr HKCR "MPC.avi\shell" "" "Open"
; WriteRegStr HKCR "MPC.avi\shell\open\command" "" '"$INSTDIR\Blades of Exile.exe" "%1"'
; WriteRegStr HKCR "MPC.avi\DefaultIcon" "" "$INSTDIR\Blades of Exile.exe,1"
SectionEnd
; Modern install component descriptions
@@ -124,16 +144,13 @@ Section Uninstall
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\${APPNAME}"
!insertmacro APP_UNASSOCIATE "exg" "BladesOfExile.SaveGame"
!insertmacro APP_UNASSOCIATE "boes" "BladesOfExile.Scenario"
!insertmacro UPDATEFILEASSOC
; Delete self
Delete "$INSTDIR\uninstall.exe"
; Delete Shortcuts
Delete "$DESKTOP\Blades of Exile.lnk"
Delete "$SMPROGRAMS\Blades of Exile\Blades of Exile.lnk"
Delete "$SMPROGRAMS\Blades of Exile\Uninstall.lnk"
Delete "$SMPROGRAMS\Blades of Exile\Character Editor.lnk"
Delete "$SMPROGRAMS\Blades of Exile\Scenario Editor.lnk"
; Clean up Blades of Exile
Delete "$INSTDIR\Blades of Exile.exe"
Delete "$INSTDIR\Blades of Exile Scenarios\busywork.exs"
@@ -150,6 +167,7 @@ Section Uninstall
Delete "$INSTDIR\sfml-system-2.dll"
Delete "$INSTDIR\sfml-window-2.dll"
Delete "$INSTDIR\zlib1.dll"
Delete "$INSTDIR\openal.dll"
RMDir /r "$INSTDIR\data"
RMDir /r "$INSTDIR\Scenario Editor\graphics.exd"
RMDir /r "$INSTDIR\Scenario Editor\sounds.exa"
@@ -162,12 +180,20 @@ Section Uninstall
Delete "$INSTDIR\Scenario Editor\Blades of Exile Base\bladbase.exs"
; Remove remaining directories
RMDir "$SMPROGRAMS\Blades of Exile\"
RMDir "$INSTDIR\Blades of Exile Scenarios\"
RMDir "$INSTDIR\Scenario Editor\Blades of Exile Base\"
RMDir "$INSTDIR\Scenario Editor\"
RMDir "$INSTDIR\"
; Delete Shortcuts
SetShellVarContext all
Delete "$DESKTOP\Blades of Exile.lnk"
Delete "$SMPROGRAMS\Blades of Exile\Blades of Exile.lnk"
Delete "$SMPROGRAMS\Blades of Exile\Uninstall.lnk"
Delete "$SMPROGRAMS\Blades of Exile\Character Editor.lnk"
Delete "$SMPROGRAMS\Blades of Exile\Scenario Editor.lnk"
RMDir "$SMPROGRAMS\Blades of Exile\"
SectionEnd
; eof