installer.nsi 53 KB

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