installer.nsi 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460
  1. ; Panda3D installation script for the Nullsoft Installation System (NSIS).
  2. ; Jon Parise <[email protected]>
  3. ; with Ben Johnson <[email protected]>
  4. ; with Jason Pratt <[email protected]>
  5. ; mangled by Josh Yelon <[email protected]>
  6. ; Heavily restructured by rdb
  7. ; Caller needs to define these variables:
  8. ;
  9. ; COMPRESSOR - either zlib or lzma
  10. ; TITLE - title (eg. "Panda3D SDK 1.9.0")
  11. ; INSTALLDIR - default install location (eg. "C:\Panda3D-1.9.0-x64")
  12. ; OUTFILE - where to put the output file (eg. "..\nsis-output.exe")
  13. ;
  14. ; BUILT - location of panda install tree.
  15. ; SOURCE - location of the panda source-tree if available, OR location of panda install tree.
  16. ; INCLUDE_PYVER - version of Python that Panda was built with (eg. "2.7", "3.5-32")
  17. ; REGVIEW - either 32 or 64, depending on the build architecture.
  18. ;
  19. Name "${TITLE}"
  20. InstallDir "${INSTALLDIR}"
  21. OutFile "${OUTFILE}"
  22. RequestExecutionLevel user
  23. SetCompress auto
  24. SetCompressor ${COMPRESSOR}
  25. !include "MUI2.nsh"
  26. !include "Sections.nsh"
  27. !include "WinMessages.nsh"
  28. !include "WinVer.nsh"
  29. !include "WordFunc.nsh"
  30. !include "x64.nsh"
  31. !define MUI_WELCOMEFINISHPAGE_BITMAP "panda-install.bmp"
  32. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "panda-install.bmp"
  33. !define MUI_ABORTWARNING
  34. !define MUI_FINISHPAGE_NOREBOOTSUPPORT
  35. !define MUI_FINISHPAGE_RUN
  36. !define MUI_FINISHPAGE_RUN_FUNCTION runFunction
  37. !define MUI_FINISHPAGE_RUN_TEXT "Visit the Panda3D Manual"
  38. !insertmacro MUI_PAGE_WELCOME
  39. !insertmacro MUI_PAGE_LICENSE "${SOURCE}/doc/LICENSE"
  40. !insertmacro MUI_PAGE_DIRECTORY
  41. !ifdef INCLUDE_PYVER
  42. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE ConfirmPythonSelection
  43. !endif
  44. !insertmacro MUI_PAGE_COMPONENTS
  45. !insertmacro MUI_PAGE_INSTFILES
  46. !insertmacro MUI_PAGE_FINISH
  47. !insertmacro MUI_UNPAGE_WELCOME
  48. !insertmacro MUI_UNPAGE_CONFIRM
  49. !insertmacro MUI_UNPAGE_INSTFILES
  50. !insertmacro MUI_UNPAGE_FINISH
  51. !insertmacro MUI_LANGUAGE "English"
  52. ShowInstDetails hide
  53. ShowUninstDetails hide
  54. LicenseData "${SOURCE}/doc/LICENSE"
  55. InstType "Auto (Recommended)"
  56. InstType "Full"
  57. InstType "Light"
  58. LangString DESC_SecCore ${LANG_ENGLISH} "The Panda3D core libraries, configuration files and models/textures that are needed to use Panda3D."
  59. LangString DESC_SecOpenGL ${LANG_ENGLISH} "The OpenGL graphics back-end is the most well-supported renderer."
  60. LangString DESC_SecDirect3D9 ${LANG_ENGLISH} "The optional Direct3D 9 renderer."
  61. LangString DESC_SecOpenAL ${LANG_ENGLISH} "Support for playing audio via the OpenAL library. You need either OpenAL or FMOD to be able to play audio."
  62. LangString DESC_SecFMOD ${LANG_ENGLISH} "Support for decoding and playing audio via the FMOD Ex library. You need either OpenAL or FMOD to be able to play audio."
  63. LangString DESC_SecFFMpeg ${LANG_ENGLISH} "Support for decoding video and audio via the FFMpeg library. Without this option, Panda3D will only be able to play .wav and .ogg audio files."
  64. LangString DESC_SecBullet ${LANG_ENGLISH} "Support for the Bullet physics engine."
  65. LangString DESC_SecODE ${LANG_ENGLISH} "Support for the Open Dynamics Engine to implement physics."
  66. LangString DESC_SecPhysX ${LANG_ENGLISH} "Support for NVIDIA PhysX to implement physics."
  67. LangString DESC_SecRocket ${LANG_ENGLISH} "Support for the libRocket GUI library. This is an optional library that offers an HTML/CSS-like approach to creating user interfaces."
  68. LangString DESC_SecTools ${LANG_ENGLISH} "Useful tools and model converters to help with Panda3D development. Recommended."
  69. LangString DESC_SecGroupPython ${LANG_ENGLISH} "Contains modules that provide Python support for Panda3D."
  70. LangString DESC_SecPyShared ${LANG_ENGLISH} "Contains the common Python code used by the Panda3D Python bindings."
  71. LangString DESC_SecPython ${LANG_ENGLISH} "Contains a ${REGVIEW}-bit copy of Python ${INCLUDE_PYVER} preconfigured to make use of Panda3D."
  72. LangString DESC_SecEnsurePip ${LANG_ENGLISH} "Installs the pip package manager into the included Python installation."
  73. LangString DESC_SecHeadersLibs ${LANG_ENGLISH} "Headers and libraries needed for C++ development with Panda3D."
  74. LangString DESC_SecSamples ${LANG_ENGLISH} "The sample programs demonstrate how to make Python applications with Panda3D."
  75. LangString DESC_SecMaxPlugins ${LANG_ENGLISH} "Plug-ins for Autodesk 3ds Max (${REGVIEW}-bit) that can be used to export models to Panda3D."
  76. LangString DESC_SecMayaPlugins ${LANG_ENGLISH} "Plug-ins and scripts for Autodesk Maya (${REGVIEW}-bit) that can be used to export models to Panda3D."
  77. var READABLE
  78. ; See http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time for documentation
  79. !macro !defineifexist _VAR_NAME _FILE_NAME
  80. !tempfile _TEMPFILE
  81. !ifdef NSIS_WIN32_MAKENSIS
  82. ; Windows - cmd.exe
  83. !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} > "${_TEMPFILE}"'
  84. !else
  85. ; Posix - sh
  86. !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME}" > "${_TEMPFILE}"; fi'
  87. !endif
  88. !include '${_TEMPFILE}'
  89. !delfile '${_TEMPFILE}'
  90. !undef _TEMPFILE
  91. !macroend
  92. !insertmacro !defineifexist HAVE_GL "${BUILT}\bin\libpandagl.dll"
  93. !insertmacro !defineifexist HAVE_DX9 "${BUILT}\bin\libpandadx9.dll"
  94. !insertmacro !defineifexist HAVE_OPENAL "${BUILT}\bin\libp3openal_audio.dll"
  95. !insertmacro !defineifexist HAVE_FMOD "${BUILT}\bin\libp3fmod_audio.dll"
  96. !insertmacro !defineifexist HAVE_FFMPEG "${BUILT}\bin\libp3ffmpeg.dll"
  97. !insertmacro !defineifexist HAVE_BULLET "${BUILT}\bin\libpandabullet.dll"
  98. !insertmacro !defineifexist HAVE_ODE "${BUILT}\bin\libpandaode.dll"
  99. !insertmacro !defineifexist HAVE_PHYSX "${BUILT}\bin\libpandaphysx.dll"
  100. !insertmacro !defineifexist HAVE_ROCKET "${BUILT}\bin\libp3rocket.dll"
  101. !insertmacro !defineifexist HAVE_SAMPLES "${SOURCE}\samples"
  102. !insertmacro !defineifexist HAVE_MAX_PLUGINS "${BUILT}\plugins\*.dlo"
  103. !insertmacro !defineifexist HAVE_MAYA_PLUGINS "${BUILT}\plugins\*.mll"
  104. !macro RemovePythonPath PYVER
  105. ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D" ""
  106. StrCmp $0 "$INSTDIR" 0 +2
  107. DeleteRegKey HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D"
  108. !macroend
  109. !macro PyBindingSection PYVER EXT_SUFFIX
  110. LangString DESC_SecPyBindings${PYVER} ${LANG_ENGLISH} "Contains the Python modules that allow use of Panda3D using a ${REGVIEW}-bit version of Python ${PYVER}."
  111. !insertmacro !defineifexist _present "${BUILT}\panda3d\core${EXT_SUFFIX}"
  112. !ifdef _present
  113. Section "${PYVER} bindings" SecPyBindings${PYVER}
  114. !if "${PYVER}" == "${INCLUDE_PYVER}"
  115. SectionIn 1 2 3
  116. !else
  117. !if "${PYVER}" == "2.7"
  118. SectionIn 1 2
  119. !else
  120. ; See .onInit function where this is dynamically enabled.
  121. SectionIn 2
  122. !endif
  123. !endif
  124. SetDetailsPrint both
  125. DetailPrint "Installing Panda3D bindings for Python ${PYVER}..."
  126. SetDetailsPrint listonly
  127. SetOutPath $INSTDIR\panda3d
  128. File /nonfatal /r "${BUILT}\panda3d\core${EXT_SUFFIX}"
  129. File /nonfatal /r "${BUILT}\panda3d\ai${EXT_SUFFIX}"
  130. File /nonfatal /r "${BUILT}\panda3d\direct${EXT_SUFFIX}"
  131. File /nonfatal /r "${BUILT}\panda3d\egg${EXT_SUFFIX}"
  132. File /nonfatal /r "${BUILT}\panda3d\fx${EXT_SUFFIX}"
  133. File /nonfatal /r "${BUILT}\panda3d\interrogatedb${EXT_SUFFIX}"
  134. File /nonfatal /r "${BUILT}\panda3d\physics${EXT_SUFFIX}"
  135. File /nonfatal /r "${BUILT}\panda3d\_rplight${EXT_SUFFIX}"
  136. File /nonfatal /r "${BUILT}\panda3d\skel${EXT_SUFFIX}"
  137. File /nonfatal /r "${BUILT}\panda3d\vision${EXT_SUFFIX}"
  138. File /nonfatal /r "${BUILT}\panda3d\vrpn${EXT_SUFFIX}"
  139. !ifdef HAVE_BULLET
  140. SectionGetFlags ${SecBullet} $R0
  141. IntOp $R0 $R0 & ${SF_SELECTED}
  142. StrCmp $R0 ${SF_SELECTED} 0 SkipBulletPyd
  143. File /nonfatal /r "${BUILT}\panda3d\bullet${EXT_SUFFIX}"
  144. SkipBulletPyd:
  145. !endif
  146. !ifdef HAVE_ODE
  147. SectionGetFlags ${SecODE} $R0
  148. IntOp $R0 $R0 & ${SF_SELECTED}
  149. StrCmp $R0 ${SF_SELECTED} 0 SkipODEPyd
  150. File /nonfatal /r "${BUILT}\panda3d\ode${EXT_SUFFIX}"
  151. SkipODEPyd:
  152. !endif
  153. !ifdef HAVE_PHYSX
  154. SectionGetFlags ${SecPhysX} $R0
  155. IntOp $R0 $R0 & ${SF_SELECTED}
  156. StrCmp $R0 ${SF_SELECTED} 0 SkipPhysXPyd
  157. File /nonfatal /r "${BUILT}\panda3d\physx${EXT_SUFFIX}"
  158. SkipPhysXPyd:
  159. !endif
  160. !ifdef HAVE_ROCKET
  161. SectionGetFlags ${SecRocket} $R0
  162. IntOp $R0 $R0 & ${SF_SELECTED}
  163. StrCmp $R0 ${SF_SELECTED} 0 SkipRocketPyd
  164. File /nonfatal /r "${BUILT}\panda3d\rocket${EXT_SUFFIX}"
  165. SkipRocketPyd:
  166. !endif
  167. SetOutPath $INSTDIR\pandac\input
  168. File /r "${BUILT}\pandac\input\*"
  169. SetOutPath $INSTDIR\Pmw
  170. File /nonfatal /r /x CVS "${BUILT}\Pmw\*"
  171. SetOutPath $INSTDIR\panda3d.dist-info
  172. File /nonfatal /r "${BUILT}\panda3d.dist-info\*"
  173. !ifdef REGVIEW
  174. SetRegView ${REGVIEW}
  175. !endif
  176. ; Install a Panda3D path into the global PythonPath for this version
  177. ; of Python.
  178. WriteRegStr HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D" "" "$INSTDIR"
  179. SectionEnd
  180. !undef _present
  181. !endif
  182. !macroend
  183. Function runFunction
  184. ExecShell "open" "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk"
  185. FunctionEnd
  186. SectionGroup "Panda3D Libraries"
  187. Section "Core Libraries" SecCore
  188. SectionIn 1 2 3 RO
  189. SetShellVarContext current
  190. SetOverwrite try
  191. SetDetailsPrint both
  192. DetailPrint "Installing Panda3D libraries..."
  193. SetDetailsPrint listonly
  194. SetOutPath "$INSTDIR"
  195. File /nonfatal "${BUILT}\LICENSE"
  196. File /nonfatal "${BUILT}\ReleaseNotes"
  197. File /nonfatal "${BUILT}\pandaIcon.ico"
  198. SetOutPath $INSTDIR\etc
  199. File /r "${BUILT}\etc\*"
  200. SetOutPath $INSTDIR\bin
  201. File /r /x api-ms-win-*.dll /x ucrtbase.dll /x libpandagl.dll /x libpandadx9.dll /x cgD3D*.dll /x python*.dll /x libpandaode.dll /x libp3fmod_audio.dll /x fmodex*.dll /x libp3ffmpeg.dll /x av*.dll /x postproc*.dll /x swscale*.dll /x swresample*.dll /x NxCharacter*.dll /x cudart*.dll /x PhysX*.dll /x libpandaphysx.dll /x libp3rocket.dll /x boost_python*.dll /x Rocket*.dll /x _rocket*.pyd /x libpandabullet.dll /x OpenAL32.dll /x *_oal.dll /x libp3openal_audio.dll "${BUILT}\bin\*.dll"
  202. File /nonfatal /r "${BUILT}\bin\Microsoft.*.manifest"
  203. ; Before Windows 10, we need these stubs for the UCRT as well.
  204. ReadRegDWORD $0 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentMajorVersionNumber"
  205. ${If} $0 < 10
  206. ClearErrors
  207. File /nonfatal /r "${BUILT}\bin\api-ms-win-*.dll"
  208. File /nonfatal "${BUILT}\bin\ucrtbase.dll"
  209. ${Endif}
  210. SetDetailsPrint both
  211. DetailPrint "Installing models..."
  212. SetDetailsPrint listonly
  213. SetOutPath $INSTDIR\models
  214. File /nonfatal /r /x CVS "${BUILT}\models\*"
  215. SetDetailsPrint both
  216. DetailPrint "Installing optional components..."
  217. SetDetailsPrint listonly
  218. RMDir /r "$SMPROGRAMS\${TITLE}"
  219. CreateDirectory "$SMPROGRAMS\${TITLE}"
  220. SectionEnd
  221. !ifdef HAVE_GL
  222. Section "OpenGL" SecOpenGL
  223. SectionIn 1 2 3 RO
  224. SetOutPath "$INSTDIR\bin"
  225. File "${BUILT}\bin\libpandagl.dll"
  226. SectionEnd
  227. !endif
  228. !ifdef HAVE_DX9
  229. Section "Direct3D 9" SecDirect3D9
  230. SectionIn 1 2
  231. SetOutPath "$INSTDIR\bin"
  232. File "${BUILT}\bin\libpandadx9.dll"
  233. File /nonfatal /r "${BUILT}\bin\cgD3D9.dll"
  234. SectionEnd
  235. !endif
  236. !ifdef HAVE_OPENAL
  237. Section "OpenAL Audio" SecOpenAL
  238. SectionIn 1 2 3
  239. SetOutPath "$INSTDIR\bin"
  240. File "${BUILT}\bin\libp3openal_audio.dll"
  241. File /nonfatal /r "${BUILT}\bin\OpenAL32.dll"
  242. File /nonfatal /r "${BUILT}\bin\*_oal.dll"
  243. SectionEnd
  244. !endif
  245. !ifdef HAVE_FMOD
  246. Section "FMOD Audio" SecFMOD
  247. SectionIn 1 2
  248. SetOutPath "$INSTDIR\bin"
  249. File "${BUILT}\bin\libp3fmod_audio.dll"
  250. File /r "${BUILT}\bin\fmodex*.dll"
  251. SectionEnd
  252. !endif
  253. !ifdef HAVE_FFMPEG
  254. Section "FFMpeg" SecFFMpeg
  255. SectionIn 1 2
  256. SetOutPath "$INSTDIR\bin"
  257. File "${BUILT}\bin\libp3ffmpeg.dll"
  258. File /nonfatal /r "${BUILT}\bin\av*.dll"
  259. File /nonfatal /r "${BUILT}\bin\swscale*.dll"
  260. File /nonfatal /r "${BUILT}\bin\swresample*.dll"
  261. File /nonfatal /r "${BUILT}\bin\postproc*.dll"
  262. SectionEnd
  263. !endif
  264. !ifdef HAVE_BULLET
  265. Section "Bullet Physics" SecBullet
  266. SectionIn 1 2
  267. SetOutPath "$INSTDIR\bin"
  268. File "${BUILT}\bin\libpandabullet.dll"
  269. SectionEnd
  270. !endif
  271. !ifdef HAVE_ODE
  272. Section "ODE Physics" SecODE
  273. SectionIn 1 2
  274. SetOutPath "$INSTDIR\bin"
  275. File "${BUILT}\bin\libpandaode.dll"
  276. SectionEnd
  277. !endif
  278. !ifdef HAVE_PHYSX
  279. Section "NVIDIA PhysX" SecPhysX
  280. ; Only enable in "Full"
  281. SectionIn 2
  282. SetOutPath "$INSTDIR\bin"
  283. File "${BUILT}\bin\libpandaphysx.dll"
  284. File /nonfatal /r "${BUILT}\bin\PhysX*.dll"
  285. File /nonfatal /r "${BUILT}\bin\NxCharacter*.dll"
  286. File /nonfatal /r "${BUILT}\bin\cudart*.dll"
  287. SectionEnd
  288. !endif
  289. !ifdef HAVE_ROCKET
  290. Section "libRocket GUI" SecRocket
  291. SectionIn 1 2
  292. SetOutPath "$INSTDIR\bin"
  293. File "${BUILT}\bin\libp3rocket.dll"
  294. File /nonfatal /r "${BUILT}\bin\Rocket*.dll"
  295. File /nonfatal /r "${BUILT}\bin\_rocket*.pyd"
  296. File /nonfatal /r "${BUILT}\bin\boost_python*.dll"
  297. SectionEnd
  298. !endif
  299. SectionGroupEnd
  300. Section "Tools and utilities" SecTools
  301. SectionIn 1 2 3
  302. SetDetailsPrint both
  303. DetailPrint "Installing utilities..."
  304. SetDetailsPrint listonly
  305. SetOutPath "$INSTDIR\bin"
  306. File /r /x deploy-stub.exe /x deploy-stubw.exe "${BUILT}\bin\*.exe"
  307. File /nonfatal /r "${BUILT}\bin\*.p3d"
  308. SetOutPath "$INSTDIR\NSIS"
  309. File /r /x CVS "${NSISDIR}\*"
  310. WriteRegStr HKCU "Software\Classes\Panda3D.Model" "" "Panda3D model/animation"
  311. WriteRegStr HKCU "Software\Classes\Panda3D.Model\DefaultIcon" "" "$INSTDIR\bin\pview.exe"
  312. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell" "" "open"
  313. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\open\command" "" '"$INSTDIR\bin\pview.exe" -l "%1"'
  314. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\compress" "" "Compress to .pz"
  315. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\compress\command" "" '"$INSTDIR\bin\pzip.exe" "%1"'
  316. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed" "" "Compressed file"
  317. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" "" "$INSTDIR\bin\pzip.exe"
  318. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell" "" "open"
  319. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\open\command" "" '"$INSTDIR\bin\pview.exe" -l "%1"'
  320. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\decompress" "" "Decompress"
  321. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\decompress\command" "" '"$INSTDIR\bin\punzip.exe" "%1"'
  322. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile" "" "Panda3D Multifile"
  323. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" "" "$INSTDIR\bin\multify.exe"
  324. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell" "" "open"
  325. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell\extract" "" "Extract here"
  326. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell\extract\command" "" '"$INSTDIR\bin\multify.exe" -xf "%1"'
  327. SectionEnd
  328. SectionGroup "Python modules" SecGroupPython
  329. Section "Shared code" SecPyShared
  330. SectionIn 1 2 3
  331. SetDetailsPrint both
  332. DetailPrint "Installing Panda3D shared Python modules..."
  333. SetDetailsPrint listonly
  334. SetOutPath $INSTDIR\direct\directscripts
  335. File /r /x CVS /x Opt?-Win32 "${BUILT}\direct\directscripts\*"
  336. SetOutPath $INSTDIR\direct
  337. File /r /x CVS /x Opt?-Win32 "${BUILT}\direct\*.py"
  338. Delete "$INSTDIR\panda3d.py"
  339. Delete "$INSTDIR\panda3d.pyc"
  340. Delete "$INSTDIR\panda3d.pyo"
  341. SetOutPath $INSTDIR\pandac
  342. File /r "${BUILT}\pandac\*.py"
  343. SetOutPath $INSTDIR\panda3d
  344. File /r "${BUILT}\panda3d\*.py"
  345. SectionEnd
  346. !insertmacro PyBindingSection 2.7 .pyd
  347. !if "${REGVIEW}" == "32"
  348. !insertmacro PyBindingSection 3.5-32 .cp35-win32.pyd
  349. !insertmacro PyBindingSection 3.6-32 .cp36-win32.pyd
  350. !insertmacro PyBindingSection 3.7-32 .cp37-win32.pyd
  351. !insertmacro PyBindingSection 3.8-32 .cp38-win32.pyd
  352. !insertmacro PyBindingSection 3.9-32 .cp39-win32.pyd
  353. !insertmacro PyBindingSection 3.10-32 .cp310-win32.pyd
  354. !else
  355. !insertmacro PyBindingSection 3.5 .cp35-win_amd64.pyd
  356. !insertmacro PyBindingSection 3.6 .cp36-win_amd64.pyd
  357. !insertmacro PyBindingSection 3.7 .cp37-win_amd64.pyd
  358. !insertmacro PyBindingSection 3.8 .cp38-win_amd64.pyd
  359. !insertmacro PyBindingSection 3.9 .cp39-win_amd64.pyd
  360. !insertmacro PyBindingSection 3.10 .cp310-win_amd64.pyd
  361. !endif
  362. SectionGroupEnd
  363. !ifdef INCLUDE_PYVER
  364. Section "Python ${INCLUDE_PYVER}" SecPython
  365. SectionIn 1 2 3
  366. !ifdef REGVIEW
  367. SetRegView ${REGVIEW}
  368. !endif
  369. SetDetailsPrint both
  370. DetailPrint "Installing Python ${INCLUDE_PYVER} interpreter (${REGVIEW}-bit)..."
  371. SetDetailsPrint listonly
  372. SetOutPath "$INSTDIR\bin"
  373. File /nonfatal "${BUILT}\bin\python*.dll"
  374. SetOutPath "$INSTDIR\python"
  375. File /r /x *.pdb "${BUILT}\python\*"
  376. SetDetailsPrint both
  377. DetailPrint "Adding registry keys for Python..."
  378. SetDetailsPrint listonly
  379. ; Check if a copy of Python is installed for this user.
  380. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  381. StrCmp "$0" "$INSTDIR\python" RegPath 0
  382. StrCmp "$0" "" SkipFileCheck 0
  383. IfFileExists "$0\python.exe" AskRegPath 0
  384. SkipFileCheck:
  385. ; Check if a system-wide copy of Python is installed.
  386. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  387. StrCmp "$0" "$INSTDIR\python" RegPath 0
  388. StrCmp "$0" "" RegPath 0
  389. IfFileExists "$0\python.exe" AskRegPath RegPath
  390. AskRegPath:
  391. MessageBox MB_YESNO|MB_ICONQUESTION \
  392. "You already have a copy of Python ${INCLUDE_PYVER} installed in:$\r$\n$0$\r$\n$\r$\nPanda3D installs its own copy of Python ${INCLUDE_PYVER}, which will install alongside your existing copy. Would you like to make Panda's copy the default Python for your user account?" \
  393. IDNO SkipRegPath
  394. RegPath:
  395. WriteRegStr HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" "" "$INSTDIR\python"
  396. WriteRegStr HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" "ExecutablePath" "$INSTDIR\python\python.exe"
  397. SkipRegPath:
  398. SectionEnd
  399. Section "Install pip" SecEnsurePip
  400. SectionIn 1 2 3
  401. SetDetailsPrint both
  402. DetailPrint "Installing the pip package manager..."
  403. SetDetailsPrint listonly
  404. SetOutPath $INSTDIR
  405. nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m ensurepip --default-pip'
  406. Pop $0
  407. DetailPrint "Command returned exit status $0"
  408. SectionEnd
  409. !endif
  410. !macro MaybeEnablePyBindingSection PYVER
  411. !if "${INCLUDE_PYVER}" != "${PYVER}"
  412. !ifdef SecPyBindings${PYVER}
  413. ; Check if a copy of Python is installed for this user.
  414. Push $0
  415. ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\InstallPath" ""
  416. StrCmp "$0" "" +2 0
  417. IfFileExists "$0\python.exe" Py${PYVER}Exists 0
  418. ; Check if a system-wide copy of Python is installed.
  419. ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" ""
  420. StrCmp "$0" "" Py${PYVER}ExistsNot 0
  421. IfFileExists "$0\python.exe" Py${PYVER}Exists Py${PYVER}ExistsNot
  422. Py${PYVER}Exists:
  423. SectionSetFlags ${SecPyBindings${PYVER}} ${SF_SELECTED}
  424. SectionSetInstTypes ${SecPyBindings${PYVER}} 3
  425. Py${PYVER}ExistsNot:
  426. Pop $0
  427. !endif
  428. !endif
  429. !macroend
  430. Function .onInit
  431. ${If} ${REGVIEW} = 64
  432. ${AndIfNot} ${RunningX64}
  433. MessageBox MB_OK|MB_ICONEXCLAMATION "You are attempting to install the 64-bit version of Panda3D on a 32-bit version of Windows. Please download and install the 32-bit version of Panda3D instead."
  434. Abort
  435. ${EndIf}
  436. !ifdef REGVIEW
  437. SetRegView ${REGVIEW}
  438. !endif
  439. ; We never check for 2.7; it is always enabled in Auto mode
  440. !if "${REGVIEW}" == "32"
  441. !insertmacro MaybeEnablePyBindingSection 3.5-32
  442. !insertmacro MaybeEnablePyBindingSection 3.6-32
  443. !insertmacro MaybeEnablePyBindingSection 3.7-32
  444. !insertmacro MaybeEnablePyBindingSection 3.8-32
  445. ${If} ${AtLeastWin8}
  446. !insertmacro MaybeEnablePyBindingSection 3.9-32
  447. !insertmacro MaybeEnablePyBindingSection 3.10-32
  448. ${EndIf}
  449. !else
  450. !insertmacro MaybeEnablePyBindingSection 3.5
  451. !insertmacro MaybeEnablePyBindingSection 3.6
  452. !insertmacro MaybeEnablePyBindingSection 3.7
  453. !insertmacro MaybeEnablePyBindingSection 3.8
  454. ${If} ${AtLeastWin8}
  455. !insertmacro MaybeEnablePyBindingSection 3.9
  456. !insertmacro MaybeEnablePyBindingSection 3.10
  457. ${EndIf}
  458. !endif
  459. ; These versions of Python require Windows 8.1 or higher.
  460. ${Unless} ${AtLeastWin8}
  461. !ifdef SecPyBindings3.9
  462. SectionSetFlags ${SecPyBindings3.9} ${SF_RO}
  463. SectionSetInstTypes ${SecPyBindings3.9} 0
  464. !endif
  465. !ifdef SecPyBindings3.10
  466. SectionSetFlags ${SecPyBindings3.10} ${SF_RO}
  467. SectionSetInstTypes ${SecPyBindings3.10} 0
  468. !endif
  469. ${EndUnless}
  470. FunctionEnd
  471. Function .onSelChange
  472. ; If someone selects any Python version, the "shared modules" must be on.
  473. ${If} ${SectionIsPartiallySelected} ${SecGroupPython}
  474. SectionGetFlags ${SecPyShared} $R0
  475. IntOp $R0 $R0 | ${SF_SELECTED}
  476. SectionSetFlags ${SecPyShared} $R0
  477. ${EndIf}
  478. !ifdef INCLUDE_PYVER
  479. ${If} ${SectionIsSelected} ${SecPython}
  480. !insertmacro SectionFlagIsSet ${SecEnsurePip} ${SF_RO} 0 SkipSelectEnsurePip
  481. !insertmacro SelectSection ${SecEnsurePip}
  482. SkipSelectEnsurePip:
  483. !insertmacro ClearSectionFlag ${SecEnsurePip} ${SF_RO}
  484. ${Else}
  485. !insertmacro UnselectSection ${SecEnsurePip}
  486. !insertmacro SetSectionFlag ${SecEnsurePip} ${SF_RO}
  487. ${EndIf}
  488. !endif
  489. FunctionEnd
  490. !ifdef INCLUDE_PYVER
  491. Function ConfirmPythonSelection
  492. ; Check the current state of the "Python" section selection.
  493. SectionGetFlags ${SecPython} $R0
  494. IntOp $R1 $R0 & ${SF_SELECTED}
  495. ; Is the "Python" selection deselected?
  496. StrCmp $R1 ${SF_SELECTED} SkipCheck 0
  497. ; Maybe the user just doesn't want Python support at all?
  498. !insertmacro SectionFlagIsSet ${SecGroupPython} ${SF_PSELECTED} 0 SkipCheck
  499. !ifdef REGVIEW
  500. SetRegView ${REGVIEW}
  501. !endif
  502. ; Check for a user installation of Python.
  503. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  504. StrCmp $0 "$INSTDIR\python" CheckSystemWidePython 0
  505. StrCmp $0 "" CheckSystemWidePython 0
  506. IfFileExists "$0\ppython.exe" CheckSystemWidePython 0
  507. IfFileExists "$0\python.exe" SkipCheck CheckSystemWidePython
  508. ; Check for a system-wide Python installation.
  509. CheckSystemWidePython:
  510. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  511. StrCmp $0 "$INSTDIR\python" AskConfirmation 0
  512. StrCmp $0 "" AskConfirmation 0
  513. IfFileExists "$0\ppython.exe" AskConfirmation 0
  514. IfFileExists "$0\python.exe" SkipCheck AskConfirmation
  515. ; No compatible Python version found (that wasn't shipped as part
  516. ; of a different Panda3D build.) Ask the user if he's sure about this.
  517. AskConfirmation:
  518. MessageBox MB_YESNO|MB_ICONQUESTION \
  519. "You do not appear to have a ${REGVIEW}-bit version of Python ${INCLUDE_PYVER} installed. Are you sure you don't want Panda to install a compatible copy of Python?$\r$\n$\r$\nIf you choose Yes, you will not be able to do Python development with Panda3D until you install a ${REGVIEW}-bit version of Python and install the bindings for this version." \
  520. IDYES SkipCheck
  521. ; User clicked no, so re-enable the select box and abort.
  522. IntOp $R0 $R0 | ${SF_SELECTED}
  523. SectionSetFlags ${SecPython} $R0
  524. Abort
  525. SkipCheck:
  526. FunctionEnd
  527. !endif
  528. Section "C++ support" SecHeadersLibs
  529. SectionIn 1 2
  530. SetDetailsPrint both
  531. DetailPrint "Installing header files..."
  532. SetDetailsPrint listonly
  533. SetOutPath $INSTDIR\include
  534. File /r /x *.exp "${BUILT}\include\*"
  535. SetDetailsPrint both
  536. DetailPrint "Installing library archives..."
  537. SetDetailsPrint listonly
  538. SetOutPath $INSTDIR\lib
  539. File /r /x *.exp "${BUILT}\lib\*"
  540. SectionEnd
  541. !ifdef HAVE_SAMPLES
  542. Section "Sample programs" SecSamples
  543. SectionIn 1 2
  544. ; Necessary for proper start menu shortcut installation
  545. SetShellVarContext current
  546. SetDetailsPrint both
  547. DetailPrint "Installing sample programs..."
  548. SetDetailsPrint listonly
  549. SetOutPath $INSTDIR\samples
  550. File /nonfatal /r /x CVS "${SOURCE}\samples\*"
  551. SetDetailsPrint both
  552. DetailPrint "Creating shortcuts..."
  553. SetDetailsPrint listonly
  554. SetOutPath $INSTDIR
  555. WriteINIStr $INSTDIR\Website.url "InternetShortcut" "URL" "https://www.panda3d.org/"
  556. WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}"
  557. WriteINIStr $INSTDIR\Samples.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}/python/more-resources/samples/index"
  558. SetOutPath $INSTDIR
  559. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Manual"
  560. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Website"
  561. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Sample Program Manual"
  562. ${Unless} ${AtLeastWin8}
  563. FindFirst $0 $1 $INSTDIR\samples\*
  564. loop:
  565. StrCmp $1 "" done
  566. StrCmp $1 "." next
  567. StrCmp $1 ".." next
  568. FindFirst $2 $3 $INSTDIR\samples\$1\*.py
  569. StrCmp $3 "" next
  570. Push $1
  571. Push "-"
  572. Push " "
  573. Call StrRep
  574. Call Capitalize
  575. Pop $R0
  576. StrCpy $READABLE $R0
  577. DetailPrint "Creating shortcuts for sample program $READABLE"
  578. CreateDirectory "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE"
  579. SetOutPath $INSTDIR\samples\$1
  580. WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}/python/more-resources/samples/$1"
  581. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Manual Entry on this Sample Program"
  582. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\View Source Code.lnk" "$INSTDIR\samples\$1"
  583. iloop:
  584. StrCmp $3 "" idone
  585. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
  586. CreateShortCut "$INSTDIR\samples\$1\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
  587. FindNext $2 $3
  588. goto iloop
  589. idone:
  590. next:
  591. FindNext $0 $1
  592. Goto loop
  593. done:
  594. ${EndUnless}
  595. SectionEnd
  596. !endif
  597. !ifdef HAVE_MAX_PLUGINS
  598. Section "3ds Max plug-ins" SecMaxPlugins
  599. SectionIn 1 2
  600. SetDetailsPrint both
  601. DetailPrint "Installing Autodesk 3ds Max plug-ins..."
  602. SetDetailsPrint listonly
  603. SetOutPath $INSTDIR\plugins
  604. File /nonfatal /r "${BUILT}\plugins\*.dle"
  605. File /nonfatal /r "${BUILT}\plugins\*.dlo"
  606. File /nonfatal /r "${BUILT}\plugins\*.ms"
  607. SectionEnd
  608. !endif
  609. !ifdef HAVE_MAYA_PLUGINS
  610. Section "Maya plug-ins" SecMayaPlugins
  611. SectionIn 1 2
  612. SetDetailsPrint both
  613. DetailPrint "Installing Autodesk Maya plug-ins..."
  614. SetDetailsPrint listonly
  615. SetOutPath $INSTDIR\plugins
  616. File /nonfatal /r "${BUILT}\plugins\*.mll"
  617. File /nonfatal /r "${BUILT}\plugins\*.mel"
  618. SectionEnd
  619. !endif
  620. Section -post
  621. !ifdef REGVIEW
  622. SetRegView ${REGVIEW}
  623. !endif
  624. ; Run eggcacher. We can't do this in SecCore because we haven't
  625. ; installed eggcacher at that point yet.
  626. SetDetailsPrint both
  627. DetailPrint "Preloading .egg files into the model cache..."
  628. SetDetailsPrint listonly
  629. SetOutPath $INSTDIR
  630. nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m direct.directscripts.eggcacher --concise models samples'
  631. Pop $0
  632. DetailPrint "Command returned exit status $0"
  633. SetDetailsPrint both
  634. DetailPrint "Writing the uninstaller ..."
  635. SetDetailsPrint listonly
  636. Delete "$INSTDIR\uninst.exe"
  637. WriteUninstaller "$INSTDIR\uninst.exe"
  638. WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" "DisplayName" "${TITLE}"
  639. WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" "UninstallString" '"$INSTDIR\uninst.exe"'
  640. SetOutPath $INSTDIR
  641. CreateShortcut "$SMPROGRAMS\${TITLE}\Uninstall ${TITLE}.lnk" "$INSTDIR\uninst.exe" ""
  642. SetDetailsPrint both
  643. DetailPrint "Registering file type associations..."
  644. SetDetailsPrint listonly
  645. ; Even though we need the runtime to run these, we might as well tell
  646. ; Windows what this kind of file is.
  647. WriteRegStr HKCU "Software\Classes\.p3d" "" "Panda3D applet"
  648. WriteRegStr HKCU "Software\Classes\.p3d" "Content Type" "application/x-panda3d"
  649. WriteRegStr HKCU "Software\Classes\.p3d" "PerceivedType" "application"
  650. ; Register various model files
  651. WriteRegStr HKCU "Software\Classes\.egg" "" "Panda3D.Model"
  652. WriteRegStr HKCU "Software\Classes\.egg" "Content Type" "application/x-egg"
  653. WriteRegStr HKCU "Software\Classes\.egg" "PerceivedType" "gamemedia"
  654. WriteRegStr HKCU "Software\Classes\.bam" "" "Panda3D.Model"
  655. WriteRegStr HKCU "Software\Classes\.bam" "Content Type" "application/x-bam"
  656. WriteRegStr HKCU "Software\Classes\.bam" "PerceivedType" "gamemedia"
  657. WriteRegStr HKCU "Software\Classes\.pz" "" "Panda3D.Compressed"
  658. WriteRegStr HKCU "Software\Classes\.pz" "PerceivedType" "compressed"
  659. WriteRegStr HKCU "Software\Classes\.mf" "" "Panda3D.Multifile"
  660. WriteRegStr HKCU "Software\Classes\.mf" "PerceivedType" "compressed"
  661. WriteRegStr HKCU "Software\Classes\.prc" "" "inifile"
  662. WriteRegStr HKCU "Software\Classes\.prc" "Content Type" "text/plain"
  663. WriteRegStr HKCU "Software\Classes\.prc" "PerceivedType" "text"
  664. ; For convenience, if nobody registered .pyd, we will.
  665. ReadRegStr $0 HKCR "Software\Classes\.pyd" ""
  666. StrCmp $0 "" 0 +2
  667. WriteRegStr HKCU "Software\Classes\.pyd" "" "dllfile"
  668. SetDetailsPrint both
  669. DetailPrint "Adding directories to system PATH..."
  670. SetDetailsPrint listonly
  671. # Add the "bin" directory to the PATH.
  672. Push "$INSTDIR\python"
  673. Call RemoveFromPath
  674. Push "$INSTDIR\python\Scripts"
  675. Call RemoveFromPath
  676. Push "$INSTDIR\bin"
  677. Call RemoveFromPath
  678. Push "$INSTDIR\python;$INSTDIR\python\Scripts;$INSTDIR\bin"
  679. Call AddToPath
  680. # This is needed for the environment variable changes to take effect.
  681. DetailPrint "Broadcasting WM_WININICHANGE message..."
  682. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
  683. # Now dump the log to disk.
  684. StrCpy $0 "$INSTDIR\install.log"
  685. Push $0
  686. Call DumpLog
  687. SectionEnd
  688. Section Uninstall
  689. SetDetailsPrint listonly
  690. SetShellVarContext current
  691. !ifdef REGVIEW
  692. SetRegView ${REGVIEW}
  693. !endif
  694. SetDetailsPrint both
  695. DetailPrint "Removing registry entries..."
  696. SetDetailsPrint listonly
  697. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}"
  698. DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}"
  699. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Model\DefaultIcon" ""
  700. StrCmp $0 "$INSTDIR\bin\pview.exe" 0 +3
  701. DeleteRegKey HKCU "Software\Classes\Panda3D.Model\DefaultIcon"
  702. DeleteRegKey HKCU "Software\Classes\Panda3D.Model\shell"
  703. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" ""
  704. StrCmp $0 "$INSTDIR\bin\pzip.exe" 0 +3
  705. DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon"
  706. DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\shell"
  707. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" ""
  708. StrCmp $0 "$INSTDIR\bin\multify.exe" 0 +3
  709. DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon"
  710. DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\shell"
  711. !ifdef INCLUDE_PYVER
  712. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  713. StrCmp $0 "$INSTDIR\python" 0 +2
  714. DeleteRegKey HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}"
  715. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  716. StrCmp $0 "$INSTDIR\python" 0 +2
  717. DeleteRegKey HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}"
  718. !endif
  719. !insertmacro RemovePythonPath 2.7
  720. !if "${REGVIEW}" == "32"
  721. !insertmacro RemovePythonPath 3.5-32
  722. !insertmacro RemovePythonPath 3.6-32
  723. !insertmacro RemovePythonPath 3.7-32
  724. !insertmacro RemovePythonPath 3.8-32
  725. !insertmacro RemovePythonPath 3.9-32
  726. !insertmacro RemovePythonPath 3.10-32
  727. !else
  728. !insertmacro RemovePythonPath 3.5
  729. !insertmacro RemovePythonPath 3.6
  730. !insertmacro RemovePythonPath 3.7
  731. !insertmacro RemovePythonPath 3.8
  732. !insertmacro RemovePythonPath 3.9
  733. !insertmacro RemovePythonPath 3.10
  734. !endif
  735. SetDetailsPrint both
  736. DetailPrint "Deleting files..."
  737. SetDetailsPrint listonly
  738. Delete "$INSTDIR\uninst.exe"
  739. RMDir /r "$INSTDIR"
  740. SetDetailsPrint both
  741. DetailPrint "Removing Start Menu entries..."
  742. SetDetailsPrint listonly
  743. SetShellVarContext current
  744. RMDir /r "$SMPROGRAMS\${TITLE}"
  745. SetShellVarContext all
  746. RMDir /r "$SMPROGRAMS\${TITLE}"
  747. SetDetailsPrint both
  748. DetailPrint "Removing entries from PATH..."
  749. SetDetailsPrint listonly
  750. Push "$INSTDIR\python"
  751. Call un.RemoveFromPath
  752. Push "$INSTDIR\python\Scripts"
  753. Call un.RemoveFromPath
  754. Push "$INSTDIR\bin"
  755. Call un.RemoveFromPath
  756. # This is needed for the environment variable changes to take effect.
  757. DetailPrint "Broadcasting WM_WININICHANGE message..."
  758. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
  759. SectionEnd
  760. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  761. !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(DESC_SecCore)
  762. !ifdef HAVE_GL
  763. !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenGL} $(DESC_SecOpenGL)
  764. !endif
  765. !ifdef HAVE_DX9
  766. !insertmacro MUI_DESCRIPTION_TEXT ${SecDirect3D9} $(DESC_SecDirect3D9)
  767. !endif
  768. !ifdef HAVE_OPENAL
  769. !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenAL} $(DESC_SecOpenAL)
  770. !endif
  771. !ifdef HAVE_FMOD
  772. !insertmacro MUI_DESCRIPTION_TEXT ${SecFMOD} $(DESC_SecFMOD)
  773. !endif
  774. !ifdef HAVE_FFMPEG
  775. !insertmacro MUI_DESCRIPTION_TEXT ${SecFFMpeg} $(DESC_SecFFMpeg)
  776. !endif
  777. !ifdef HAVE_BULLET
  778. !insertmacro MUI_DESCRIPTION_TEXT ${SecBullet} $(DESC_SecBullet)
  779. !endif
  780. !ifdef HAVE_ODE
  781. !insertmacro MUI_DESCRIPTION_TEXT ${SecODE} $(DESC_SecODE)
  782. !endif
  783. !ifdef HAVE_PHYSX
  784. !insertmacro MUI_DESCRIPTION_TEXT ${SecPhysX} $(DESC_SecPhysX)
  785. !endif
  786. !ifdef HAVE_ROCKET
  787. !insertmacro MUI_DESCRIPTION_TEXT ${SecRocket} $(DESC_SecRocket)
  788. !endif
  789. !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} $(DESC_SecTools)
  790. !insertmacro MUI_DESCRIPTION_TEXT ${SecGroupPython} $(DESC_SecGroupPython)
  791. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyShared} $(DESC_SecPyShared)
  792. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings2.7} $(DESC_SecPyBindings2.7)
  793. !if "${REGVIEW}" == "32"
  794. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.5-32} $(DESC_SecPyBindings3.5-32)
  795. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.6-32} $(DESC_SecPyBindings3.6-32)
  796. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.7-32} $(DESC_SecPyBindings3.7-32)
  797. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.8-32} $(DESC_SecPyBindings3.8-32)
  798. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.9-32} $(DESC_SecPyBindings3.9-32)
  799. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.10-32} $(DESC_SecPyBindings3.10-32)
  800. !else
  801. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.5} $(DESC_SecPyBindings3.5)
  802. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.6} $(DESC_SecPyBindings3.6)
  803. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.7} $(DESC_SecPyBindings3.7)
  804. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.8} $(DESC_SecPyBindings3.8)
  805. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.9} $(DESC_SecPyBindings3.9)
  806. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.10} $(DESC_SecPyBindings3.10)
  807. !endif
  808. !ifdef INCLUDE_PYVER
  809. !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} $(DESC_SecPython)
  810. !insertmacro MUI_DESCRIPTION_TEXT ${SecEnsurePip} $(DESC_SecEnsurePip)
  811. !endif
  812. !insertmacro MUI_DESCRIPTION_TEXT ${SecHeadersLibs} $(DESC_SecHeadersLibs)
  813. !ifdef HAVE_SAMPLES
  814. !insertmacro MUI_DESCRIPTION_TEXT ${SecSamples} $(DESC_SecSamples)
  815. !endif
  816. !ifdef HAVE_MAX_PLUGINS
  817. !insertmacro MUI_DESCRIPTION_TEXT ${SecMaxPlugins} $(DESC_SecMaxPlugins)
  818. !endif
  819. !ifdef HAVE_MAYA_PLUGINS
  820. !insertmacro MUI_DESCRIPTION_TEXT ${SecMayaPlugins} $(DESC_SecMayaPlugins)
  821. !endif
  822. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  823. # --[ Utility Functions ]------------------------------------------------------
  824. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  825. Function IsNT
  826. Push $0
  827. ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  828. StrCmp $0 "" 0 IsNT_yes
  829. ; we are not NT.
  830. Pop $0
  831. Push 0
  832. Return
  833. IsNT_yes:
  834. ; NT!!!
  835. Pop $0
  836. Push 1
  837. FunctionEnd
  838. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  839. Function un.IsNT
  840. Push $0
  841. ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  842. StrCmp $0 "" 0 unIsNT_yes
  843. ; we are not NT.
  844. Pop $0
  845. Push 0
  846. Return
  847. unIsNT_yes:
  848. ; NT!!!
  849. Pop $0
  850. Push 1
  851. FunctionEnd
  852. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  853. Function StrStr
  854. Push $0
  855. Exch
  856. Pop $0 ; $0 now have the string to find
  857. Push $1
  858. Exch 2
  859. Pop $1 ; $1 now have the string to find in
  860. Exch
  861. Push $2
  862. Push $3
  863. Push $4
  864. Push $5
  865. StrCpy $2 -1
  866. StrLen $3 $0
  867. StrLen $4 $1
  868. IntOp $4 $4 - $3
  869. unStrStr_loop:
  870. IntOp $2 $2 + 1
  871. IntCmp $2 $4 0 0 unStrStrReturn_notFound
  872. StrCpy $5 $1 $3 $2
  873. StrCmp $5 $0 unStrStr_done unStrStr_loop
  874. unStrStrReturn_notFound:
  875. StrCpy $2 -1
  876. unStrStr_done:
  877. Pop $5
  878. Pop $4
  879. Pop $3
  880. Exch $2
  881. Exch 2
  882. Pop $0
  883. Pop $1
  884. FunctionEnd
  885. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  886. Function un.StrStr
  887. Push $0
  888. Exch
  889. Pop $0 ; $0 now have the string to find
  890. Push $1
  891. Exch 2
  892. Pop $1 ; $1 now have the string to find in
  893. Exch
  894. Push $2
  895. Push $3
  896. Push $4
  897. Push $5
  898. StrCpy $2 -1
  899. StrLen $3 $0
  900. StrLen $4 $1
  901. IntOp $4 $4 - $3
  902. unStrStr_loop:
  903. IntOp $2 $2 + 1
  904. IntCmp $2 $4 0 0 unStrStrReturn_notFound
  905. StrCpy $5 $1 $3 $2
  906. StrCmp $5 $0 unStrStr_done unStrStr_loop
  907. unStrStrReturn_notFound:
  908. StrCpy $2 -1
  909. unStrStr_done:
  910. Pop $5
  911. Pop $4
  912. Pop $3
  913. Exch $2
  914. Exch 2
  915. Pop $0
  916. Pop $1
  917. FunctionEnd
  918. ; Capitalizes the first letter of every word.
  919. Function Capitalize
  920. Exch $R0
  921. Push $0
  922. Push $1
  923. Push $2
  924. StrCpy $0 0
  925. capNext:
  926. ; Grab the next character.
  927. StrCpy $1 $R0 1 $0
  928. StrCmp $1 '' end
  929. ; Capitalize it.
  930. ${StrFilter} '$1' '+eng' '' '' $1
  931. ${StrFilter} '$1' '+rus' '' '' $1
  932. ; Splice it into the string.
  933. StrCpy $2 $R0 $0
  934. IntOp $0 $0 + 1
  935. StrCpy $R0 $R0 '' $0
  936. StrCpy $R0 '$2$1$R0'
  937. ; Keep looping through the characters until we find a
  938. ; delimiter or reach the end of the string.
  939. loop:
  940. StrCpy $1 $R0 1 $0
  941. IntOp $0 $0 + 1
  942. StrCmp $1 '' end
  943. StrCmp $1 ' ' capNext
  944. StrCmp $1 '_' capNext
  945. StrCmp $1 '-' capNext
  946. StrCmp $1 '(' capNext
  947. StrCmp $1 '[' capNext
  948. Goto loop
  949. end:
  950. Pop $2
  951. Pop $1
  952. Pop $0
  953. Exch $R0
  954. FunctionEnd
  955. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  956. ; Commentary and smarter ';' checking by Jon Parise <[email protected]>
  957. Function AddToPath
  958. Exch $0
  959. Push $1
  960. Push $2
  961. Push $3
  962. Call IsNT
  963. Pop $1
  964. DetailPrint "Adding to PATH: $0"
  965. StrCmp $1 1 AddToPath_NT
  966. ; We're not on NT, so modify the AUTOEXEC.BAT file.
  967. StrCpy $1 $WINDIR 2
  968. FileOpen $1 "$1\autoexec.bat" a
  969. FileSeek $1 0 END
  970. GetFullPathName /SHORT $0 $0
  971. FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
  972. FileClose $1
  973. Goto AddToPath_done
  974. AddToPath_NT:
  975. ClearErrors
  976. ReadRegStr $1 HKCU "Environment" "PATH"
  977. ; If we reached an error, WATCH OUT. Either this means that
  978. ; the registry key did not exist, or that it didn't fit in
  979. ; NSIS' string limit. If the latter, we have to be very
  980. ; careful not to overwrite the user's PATH.
  981. IfErrors AddToPath_Error
  982. DetailPrint "Current PATH value is set to $1"
  983. StrCmp $1 "" AddToPath_NTAddPath
  984. ; Pull off the last character of the PATH string. If it's a semicolon,
  985. ; we don't need to add another one, so jump to the section where we
  986. ; append the new PATH component(s).
  987. StrCpy $2 $1 1 -1
  988. StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi
  989. AddToPath_Error:
  990. DetailPrint "Encountered error reading PATH variable."
  991. ; Does the variable exist? If it doesn't, then the
  992. ; error happened because we need to create the
  993. ; variable. If it does, then we failed to read it
  994. ; because we reached NSIS' string limit.
  995. StrCpy $3 0
  996. AddToPath_loop:
  997. EnumRegValue $4 HKCU "Environment" $3
  998. StrCmp $4 "PATH" AddToPath_ExceedLimit
  999. StrCmp $4 "" AddToPath_NTAddPath
  1000. IntOp $3 $3 + 1
  1001. Goto AddToPath_loop
  1002. AddToPath_ExceedLimit:
  1003. MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "Your PATH environment variable is too long! Please remove extraneous entries before proceeding. Panda3D needs to add the following the PATH so that the Panda3D utilities and libraries can be located correctly.$\n$\n$0$\n$\nIf you wish to add Panda3D to the path yourself, choose Ignore." IDIGNORE AddToPath_done IDRETRY AddToPath_NT
  1004. SetDetailsPrint both
  1005. DetailPrint "Cannot append to PATH - variable is likely too long."
  1006. SetDetailsPrint listonly
  1007. Abort
  1008. AddToPath_NTAddSemi:
  1009. StrCpy $1 "$1;"
  1010. Goto AddToPath_NTAddPath
  1011. AddToPath_NTAddPath:
  1012. StrCpy $0 "$1$0"
  1013. WriteRegExpandStr HKCU "Environment" "PATH" $0
  1014. AddToPath_done:
  1015. Pop $3
  1016. Pop $2
  1017. Pop $1
  1018. Pop $0
  1019. FunctionEnd
  1020. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  1021. Function RemoveFromPath
  1022. Exch $0
  1023. Push $1
  1024. Push $2
  1025. Push $3
  1026. Push $4
  1027. Push $5
  1028. Call IsNT
  1029. Pop $1
  1030. DetailPrint "Removing from PATH: $0"
  1031. StrCmp $1 1 unRemoveFromPath_NT
  1032. ; Not on NT
  1033. StrCpy $1 $WINDIR 2
  1034. FileOpen $1 "$1\autoexec.bat" r
  1035. GetTempFileName $4
  1036. FileOpen $2 $4 w
  1037. GetFullPathName /SHORT $0 $0
  1038. StrCpy $0 "SET PATH=%PATH%;$0"
  1039. SetRebootFlag true
  1040. Goto unRemoveFromPath_dosLoop
  1041. unRemoveFromPath_dosLoop:
  1042. FileRead $1 $3
  1043. StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
  1044. StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
  1045. StrCmp $3 "$0" unRemoveFromPath_dosLoop
  1046. StrCmp $3 "" unRemoveFromPath_dosLoopEnd
  1047. FileWrite $2 $3
  1048. Goto unRemoveFromPath_dosLoop
  1049. unRemoveFromPath_dosLoopEnd:
  1050. FileClose $2
  1051. FileClose $1
  1052. StrCpy $1 $WINDIR 2
  1053. Delete "$1\autoexec.bat"
  1054. CopyFiles /SILENT $4 "$1\autoexec.bat"
  1055. Delete $4
  1056. Goto unRemoveFromPath_done
  1057. unRemoveFromPath_NT:
  1058. Push $0
  1059. StrLen $2 $0
  1060. ReadRegStr $1 HKCU "Environment" "PATH"
  1061. Push $1
  1062. Push $0
  1063. Call StrStr ; Find $0 in $1
  1064. Pop $0 ; pos of our dir
  1065. IntCmp $0 -1 unRemoveFromPath_NT_System
  1066. ; else, it is in path
  1067. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1068. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1069. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1070. StrLen $0 $1
  1071. StrCpy $1 $1 $0 $2
  1072. StrCpy $3 "$3$1"
  1073. WriteRegExpandStr HKCU "Environment" "PATH" $3
  1074. unRemoveFromPath_NT_System:
  1075. Pop $0
  1076. StrLen $2 $0
  1077. ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
  1078. Push $1
  1079. Push $0
  1080. Call StrStr ; Find $0 in $1
  1081. Pop $0 ; pos of our dir
  1082. IntCmp $0 -1 unRemoveFromPath_done
  1083. ; else, it is in path
  1084. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1085. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1086. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1087. StrLen $0 $1
  1088. StrCpy $1 $1 $0 $2
  1089. StrCpy $3 "$3$1"
  1090. WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
  1091. unRemoveFromPath_done:
  1092. Pop $5
  1093. Pop $4
  1094. Pop $3
  1095. Pop $2
  1096. Pop $1
  1097. Pop $0
  1098. FunctionEnd
  1099. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  1100. Function un.RemoveFromPath
  1101. Exch $0
  1102. Push $1
  1103. Push $2
  1104. Push $3
  1105. Push $4
  1106. Push $5
  1107. Call un.IsNT
  1108. Pop $1
  1109. StrCmp $1 1 unRemoveFromPath_NT
  1110. ; Not on NT
  1111. StrCpy $1 $WINDIR 2
  1112. FileOpen $1 "$1\autoexec.bat" r
  1113. GetTempFileName $4
  1114. FileOpen $2 $4 w
  1115. GetFullPathName /SHORT $0 $0
  1116. StrCpy $0 "SET PATH=%PATH%;$0"
  1117. SetRebootFlag true
  1118. Goto unRemoveFromPath_dosLoop
  1119. unRemoveFromPath_dosLoop:
  1120. FileRead $1 $3
  1121. StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
  1122. StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
  1123. StrCmp $3 "$0" unRemoveFromPath_dosLoop
  1124. StrCmp $3 "" unRemoveFromPath_dosLoopEnd
  1125. FileWrite $2 $3
  1126. Goto unRemoveFromPath_dosLoop
  1127. unRemoveFromPath_dosLoopEnd:
  1128. FileClose $2
  1129. FileClose $1
  1130. StrCpy $1 $WINDIR 2
  1131. Delete "$1\autoexec.bat"
  1132. CopyFiles /SILENT $4 "$1\autoexec.bat"
  1133. Delete $4
  1134. Goto unRemoveFromPath_done
  1135. unRemoveFromPath_NT:
  1136. Push $0
  1137. StrLen $2 $0
  1138. ReadRegStr $1 HKCU "Environment" "PATH"
  1139. Push $1
  1140. Push $0
  1141. Call un.StrStr ; Find $0 in $1
  1142. Pop $0 ; pos of our dir
  1143. IntCmp $0 -1 unRemoveFromPath_NT_System
  1144. ; else, it is in path
  1145. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1146. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1147. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1148. StrLen $0 $1
  1149. StrCpy $1 $1 $0 $2
  1150. StrCpy $3 "$3$1"
  1151. WriteRegExpandStr HKCU "Environment" "PATH" $3
  1152. unRemoveFromPath_NT_System:
  1153. Pop $0
  1154. StrLen $2 $0
  1155. ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
  1156. Push $1
  1157. Push $0
  1158. Call un.StrStr ; Find $0 in $1
  1159. Pop $0 ; pos of our dir
  1160. IntCmp $0 -1 unRemoveFromPath_done
  1161. ; else, it is in path
  1162. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1163. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1164. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1165. StrLen $0 $1
  1166. StrCpy $1 $1 $0 $2
  1167. StrCpy $3 "$3$1"
  1168. WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
  1169. unRemoveFromPath_done:
  1170. Pop $5
  1171. Pop $4
  1172. Pop $3
  1173. Pop $2
  1174. Pop $1
  1175. Pop $0
  1176. FunctionEnd
  1177. Function StrRep
  1178. ;Written by dirtydingus 2003-02-20 04:30:09
  1179. ; USAGE
  1180. ;Push String to do replacement in (haystack)
  1181. ;Push String to replace (needle)
  1182. ;Push Replacement
  1183. ;Call StrRep
  1184. ;Pop $R0 result
  1185. ;StrCpy $Result STR $R0
  1186. Exch $R4 ; $R4 = Replacement String
  1187. Exch
  1188. Exch $R3 ; $R3 = String to replace (needle)
  1189. Exch 2
  1190. Exch $R1 ; $R1 = String to do replacement in (haystack)
  1191. Push $R2 ; Replaced haystack
  1192. Push $R5 ; Len (needle)
  1193. Push $R6 ; len (haystack)
  1194. Push $R7 ; Scratch reg
  1195. StrCpy $R2 ""
  1196. StrLen $R5 $R3
  1197. StrLen $R6 $R1
  1198. loop:
  1199. StrCpy $R7 $R1 $R5
  1200. StrCmp $R7 $R3 found
  1201. StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1
  1202. StrCpy $R2 "$R2$R7"
  1203. StrCpy $R1 $R1 $R6 1
  1204. StrCmp $R1 "" done loop
  1205. found:
  1206. StrCpy $R2 "$R2$R4"
  1207. StrCpy $R1 $R1 $R6 $R5
  1208. StrCmp $R1 "" done loop
  1209. done:
  1210. StrCpy $R3 $R2
  1211. Pop $R7
  1212. Pop $R6
  1213. Pop $R5
  1214. Pop $R2
  1215. Pop $R1
  1216. Pop $R4
  1217. Exch $R3
  1218. FunctionEnd
  1219. !ifndef LVM_GETITEMCOUNT
  1220. !define LVM_GETITEMCOUNT 0x1004
  1221. !endif
  1222. !ifndef LVM_GETITEMTEXT
  1223. !define LVM_GETITEMTEXT 0x102D
  1224. !endif
  1225. Function DumpLog
  1226. Exch $5
  1227. Push $0
  1228. Push $1
  1229. Push $2
  1230. Push $3
  1231. Push $4
  1232. Push $6
  1233. FindWindow $0 "#32770" "" $HWNDPARENT
  1234. GetDlgItem $0 $0 1016
  1235. StrCmp $0 0 exit
  1236. FileOpen $5 $5 "w"
  1237. StrCmp $5 "" exit
  1238. SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
  1239. System::Alloc ${NSIS_MAX_STRLEN}
  1240. Pop $3
  1241. StrCpy $2 0
  1242. System::Call "*(i, i, i, i, i, i, i, i, i) i \
  1243. (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
  1244. loop: StrCmp $2 $6 done
  1245. System::Call "User32::SendMessageA(i, i, i, i) i \
  1246. ($0, ${LVM_GETITEMTEXT}, $2, r1)"
  1247. System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
  1248. FileWrite $5 "$4$\r$\n"
  1249. IntOp $2 $2 + 1
  1250. Goto loop
  1251. done:
  1252. FileClose $5
  1253. System::Free $1
  1254. System::Free $3
  1255. exit:
  1256. Pop $6
  1257. Pop $4
  1258. Pop $3
  1259. Pop $2
  1260. Pop $1
  1261. Pop $0
  1262. Exch $5
  1263. FunctionEnd