installer.nsi 54 KB

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