55!include " MUI2.nsh" ; Modern UI
66!include " LogicLib.nsh" ; Logical operators
77!include " Sections.nsh" ; Support for section selection
8+ !include nsDialogs.nsh ; Support custom pages with dialogs
89
910; Compile-time definitions
1011!define VC_REDIST32_EXE " vc_redist.x86.exe"
@@ -48,6 +49,9 @@ BrandingText "${APP_NAME} powers your online jam session"
4849; Installer page configuration
4950!define MUI_PAGE_CUSTOMFUNCTION_PRE AbortOnRunningApp
5051!insertmacro MUI_PAGE_WELCOME
52+
53+ Page Custom ASIOCheckInstalled ExitASIOInstalled
54+
5155!insertmacro MUI_PAGE_LICENSE " ${ROOT_PATH}\COPYING"
5256!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ValidateDestinationFolder
5357!insertmacro MUI_PAGE_DIRECTORY
@@ -89,7 +93,20 @@ LangString OLD_WRONG_VER_FOUND_CONFIRM ${LANG_ENGLISH} \
8993 " If you continue without removing it, your installation might be broken! Are you sure you don't want to remove the old version?"
9094LangString OLD_VER_REMOVE_FAILED ${LANG_ENGLISH} \
9195 " FATAL: THE UNINSTALLER FAILED. Once you click on OK the old version will remain on your PC and we will try to install the new version too. You can also press cancel and try to remove it on your own."
96+ LangString ASIO_DRIVER_HEADER ${LANG_ENGLISH} \
97+ " ASIO driver"
98+ LangString ASIO_DRIVER_SUB ${LANG_ENGLISH} \
99+ " To use Jamulus, you need an ASIO driver"
100+ LangString ASIO_DRIVER_EXPLAIN ${LANG_ENGLISH} \
101+ " Jamulus needs an ASIO driver to provide low latency audio. You should install one now:"
102+ LangString ASIO_DRIVER_MORE_INFO ${LANG_ENGLISH} \
103+ " More information on jamulus.io"
104+ LangString ASIO_DRIVER_MORE_INFO_URL ${LANG_ENGLISH} \
105+ " https://jamulus.io/wiki/Installation-for-Windows#setting-up-asio4all"
106+ LangString ASIO_EXIT_NO_DRIVER ${LANG_ENGLISH} \
107+ " We couldn't find an ASIO driver on your PC. Jamulus will not work without one. Do you still want to continue?"
92108; Abort the installer/uninstaller if Jamulus is running
109+
93110!macro _AbortOnRunningApp
94111
95112 nsProcess::_FindProcess " ${APP_EXE}"
@@ -102,6 +119,11 @@ LangString OLD_VER_REMOVE_FAILED ${LANG_ENGLISH} \
102119
103120!macroend
104121
122+ ; Define Dialog variables
123+
124+ Var Dialog
125+ Var Label
126+ Var Button
105127
106128; Installer
107129!macro InstallApplication buildArch
@@ -251,6 +273,43 @@ Function createdesktopshortcut
251273 CreateShortCut " $DESKTOP\${APP_NAME}.lnk" " $INSTDIR\${APP_EXE}"
252274FunctionEnd
253275
276+ Function ASIOCheckInstalled
277+
278+ ; insert ASIO install page if no ASIO driver was found
279+ ClearErrors
280+ EnumRegKey $0 HKLM " SOFTWARE\ASIO" 0
281+ IfErrors 0 ASIOExists
282+ !insertmacro MUI_HEADER_TEXT " $(ASIO_DRIVER_HEADER)" " $(ASIO_DRIVER_SUB)"
283+ nsDialogs::Create 1018
284+ Pop $Dialog
285+
286+ ${If} $Dialog == error
287+ Abort
288+ ${Endif}
289+
290+ ${NSD_CreateLabel} 0 0 100 % 12u " $(ASIO_DRIVER_EXPLAIN)"
291+ Pop $Label
292+ ${NSD_CreateButton} 0 13u 100 % 13u " $(ASIO_DRIVER_MORE_INFO)"
293+ Pop $Button
294+ ${NSD_OnClick} $Button OpenASIOHelpPage
295+
296+ nsDialogs::Show
297+ ASIOExists:
298+ FunctionEnd
299+
300+ Function OpenASIOHelpPage
301+ ExecShell " open" " $(ASIO_DRIVER_MORE_INFO_URL)"
302+ FunctionEnd
303+
304+ Function ExitASIOInstalled
305+ ClearErrors
306+ EnumRegKey $0 HKLM " SOFTWARE\ASIO" 0
307+ IfErrors 0 SkipMessage
308+ MessageBox MB_YESNO |MB_ICONEXCLAMATION " $(ASIO_EXIT_NO_DRIVER)" /sd IDNO IDYES SkipMessage
309+ Abort
310+ SkipMessage:
311+ FunctionEnd
312+
254313; Uninstaller
255314!macro un.InstallFiles buildArch
256315
0 commit comments