installer.nsi 53 KB

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