Advertisement
Guest User

Untitled

a guest
Jun 9th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Winbatch 11.21 KB | None | 0 0
  1. @echo off
  2.  
  3. SETLOCAL ENABLEEXTENSIONS
  4.  
  5. echo Mikero's Arma3 to "Pdrive" with Lappi scripts
  6. :chosedrv
  7. choice /C ABCDEFGHIJKLMNOPQRSTUVWXYZ /N /M "enter drive to extract to E..Z
  8. if not errorlevel 1 exit /b 0
  9. IF ERRORLEVEL 26 SET BOOTLETTER=Z
  10. IF ERRORLEVEL 25 SET BOOTLETTER=Y
  11. IF ERRORLEVEL 24 SET BOOTLETTER=X
  12. IF ERRORLEVEL 23 SET BOOTLETTER=W
  13. IF ERRORLEVEL 22 SET BOOTLETTER=V
  14. IF ERRORLEVEL 21 SET BOOTLETTER=U
  15. IF ERRORLEVEL 20 SET BOOTLETTER=T
  16. IF ERRORLEVEL 19 SET BOOTLETTER=S
  17. IF ERRORLEVEL 18 SET BOOTLETTER=R
  18. IF ERRORLEVEL 17 SET BOOTLETTER=Q
  19. IF ERRORLEVEL 16 SET BOOTLETTER=P
  20. IF ERRORLEVEL 15 SET BOOTLETTER=O
  21. IF ERRORLEVEL 14 SET BOOTLETTER=N
  22. IF ERRORLEVEL 13 SET BOOTLETTER=M
  23. IF ERRORLEVEL 12 SET BOOTLETTER=L
  24. IF ERRORLEVEL 11 SET BOOTLETTER=K
  25. IF ERRORLEVEL 10 SET BOOTLETTER=J
  26. IF ERRORLEVEL  9 SET BOOTLETTER=I
  27. IF ERRORLEVEL  8 SET BOOTLETTER=H
  28. IF ERRORLEVEL  7 SET BOOTLETTER=G
  29. IF ERRORLEVEL  6 SET BOOTLETTER=F
  30. IF ERRORLEVEL  5 SET BOOTLETTER=E
  31. IF ERRORLEVEL  1 goto chosedrv
  32.  
  33. set BOOTDRV=%BOOTLETTER%:
  34. if exist %BOOTDRV%\ (goto askp)
  35.  
  36. choice  /m "%BOOTDRV% does not exist. Do you wish to make one?"
  37. IF ERRORLEVEL 2 exit /b 1
  38. set Pdrive= c:\%BOOTLETTER%Drive
  39. mkdir %Pdrive%
  40. if exist %Pdrive% goto gooddir
  41. :baddir
  42. rem ^^ can't use errorlevl coz it may exist already
  43. echo cannot make %Pdrive%
  44. pause
  45. @exit /B 1
  46. :gooddir
  47. set setdrive=%Pdrive%\set%BOOTLETTER%drive.bat
  48. echo if exist %BOOTDRV% (subst %BOOTDRV% /d) > %setdrive%
  49. rem ^^ only needed for subsequent calls
  50. echo subst %BOOTDRV% %Pdrive% >>%setdrive%
  51. call %setdrive%
  52. if not exist %BOOTDRV% goto baddir
  53.  
  54. choice /c k /m "%setdrive% has been created for your subsequent use"
  55. goto yesp
  56.  
  57. :askp
  58. choice  /m "This will alter some content on the %BOOTDRV% drive. Are you sure?"
  59. if errorlevel 2 goto nop
  60. goto yesp
  61. rem set /P INPUT=This will alter some content on the %BOOTDRV% drive. Are you sure? (y/n): %=%
  62. rem If /I "%INPUT%"=="y" goto yesp
  63. rem If /I "%INPUT%"=="n" goto nop
  64. rem goto askp
  65. :nop
  66. @exit /B 1
  67. :yesp
  68.  
  69. set full=no
  70. choice  /m "full extraction including dubbing and missions?"
  71. IF ERRORLEVEL 2 goto fast
  72. set full=yes
  73. :fast
  74.  
  75.  
  76.  
  77.  
  78. rem ////////////////////////////////////////
  79. echo searching for mikero tools
  80. rem /////////////////////////////////////
  81. for /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKLM\SOFTWARE\Mikero\depbo" /v "path" 2^>nul') do (set _MIKEDLL=%%B)
  82. if defined _MIKEDLL goto mikefound
  83. for /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKCU\SOFTWARE\Mikero\depbo" /v "path" 2^>nul') do (set _MIKEDLL=%%B)
  84. if defined _MIKEDLL goto mikefound
  85. echo mikero tools is not set in registry
  86. set _MIKEDLL=C:\Program Files (x86)\Mikero\DePboTools
  87. :mikefound
  88.  
  89. set _MIKEDLL=%_MIKEDLL%\bin
  90. echo %_MIKEDLL%
  91. rem if not exist "%_MIKEDLL%\depbo.dll" (goto nofind)
  92. if exist "%_MIKEDLL%\extractpbodos.exe" goto foundextract
  93. echo extractpbo is not installed
  94. goto err
  95.  
  96.  
  97. :foundextract
  98. if exist "%_MIKEDLL%\derap.exe" goto foundDeRap
  99. echo derap.exe is not installed
  100. goto err
  101.  
  102.  
  103. :foundDeRap
  104. goto foundDeroad
  105. if exist "%_MIKEDLL%\deroad.exe" goto foundDeroad
  106. echo deroad.exe is not installed
  107. goto err
  108.  
  109. :foundderoad
  110.  
  111. rem ********************
  112. echo searching registry for the arma3 path
  113. rem ********************
  114.  
  115.  
  116. for /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKLM\SOFTWARE\Wow6432Node\Bohemia Interactive Studio\ArmA 3" /v "MAIN" 2^>nul') do (set _ARMA3PATH=%%B)
  117. if defined _ARMA3PATH goto found_A3
  118.  
  119. for /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKLM\SOFTWARE\Bohemia Interactive Studio\ArmA 3" /v "MAIN" 2^>nul') do (set _ARMA3PATH=%%B)
  120. if defined _ARMA3PATH goto found_A3
  121.  
  122. for /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKLM\SOFTWARE\Wow6432Node\Bohemia Interactive\ArmA 3" /v "MAIN" 2^>nul') do (set _ARMA3PATH=%%B)
  123. if defined _ARMA3PATH goto found_A3
  124.  
  125. for /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKLM\SOFTWARE\Bohemia Interactive\ArmA 3" /v "MAIN" 2^>nul') do (set _ARMA3PATH=%%B)
  126. if defined _ARMA3PATH goto found_A3
  127.  
  128. rem no regkeys are found so use steams generic folder if present
  129.  
  130. for /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKLM\SOFTWARE\Wow6432Node\Valve\Steam" /v "InstallPath" 2^>nul') do (set _ARMA3PATH=%%B\steamapps\common\Arma 3)
  131. if defined _ARMA3PATH goto found_A3
  132. for /F "Tokens=2* skip=2" %%A In ('REG QUERY "HKLM\SOFTWARE\Valve\Steam" /v "InstallPath" 2^>nul') do (set _ARMA3PATH=%%B\steamapps\common\Arma 3)
  133. if defined _ARMA3PATH goto found_A3
  134.  
  135. echo arma3 does not exist in the registry
  136. goto err
  137.  
  138.  
  139. :found_A3
  140. echo %_ARMA3PATH%
  141. rem goto cursor
  142. echo removing folders. Expect this to take some time......
  143.  
  144. rem //////////////////////
  145. echo removing a3...
  146. rem //////////////////////
  147. if exist %BOOTDRV%\a3 (rmdir /s/q %BOOTDRV%\a3)
  148. if ERRORLEVEL 1 goto err
  149.  
  150. rem //////////////////////////////////////
  151.  
  152. if %full%==yes echo extracting all addons ....
  153. if not %full%==yes echo extracting all addons except dubbing and missions....
  154.  
  155. rem ///////////////////////////////////////
  156.  
  157. dir /b/s "%_ARMA3PATH%\Addons\*.pbo" >%BOOTDRV%\a3.txt
  158. if not ERRORLEVEL 1 goto ok1
  159. echo failed to create %BOOTDRV%\a3.txt
  160. goto err
  161. :ok1
  162. if %full%==yes goto allpbo
  163. findstr  /vic:"dubbing" "%BOOTDRV%\a3.txt" >"%BOOTDRV%\pipe.txt"
  164. if not ERRORLEVEL 1 goto ok2
  165. echo failed to exclude dubbing pbos from "%BOOTDRV%\pipe.txt"
  166. goto err
  167. :ok2
  168.  
  169. findstr  /vic:"mission" "%BOOTDRV%\pipe.txt" >"%BOOTDRV%\a3.txt"
  170. if not ERRORLEVEL 1 goto ok3
  171. echo failed to exclude mission pbos from "%BOOTDRV%\a3.txt"
  172. goto err
  173. :ok3
  174.  
  175. :allpbo
  176. FOR /F "tokens=1* delims=," %%A in (%BOOTDRV%\a3.txt) do (
  177.  
  178. extractpbodos -p "%%A" %BOOTDRV%\
  179.  if ERRORLEVEL 1 goto err
  180. )
  181. del %BOOTDRV%\pipe.txt
  182.  
  183.  
  184. rem ////////////////////////////////////////////////
  185. echo extracting dlc's (if any)
  186. rem ////////////////////////////////////////////////
  187.  
  188. if not exist "%_ARMA3PATH%\argo" goto noargo
  189. echo extracting the argo folder....
  190. extractpbodos -p "%_ARMA3PATH%\argo\Addons" %BOOTDRV%\
  191. if ERRORLEVEL 1 goto err
  192. :noargo
  193.  
  194. if not exist "%_ARMA3PATH%\curator" goto nocurator
  195. echo extracting the curator folder....
  196. extractpbodos -p "%_ARMA3PATH%\curator\Addons" %BOOTDRV%\
  197. if ERRORLEVEL 1 goto err
  198. :nocurator
  199.  
  200. if not exist "%_ARMA3PATH%\expansion" goto noexp
  201. echo extracting expansions mod
  202. extractpbodos -p "%_ARMA3PATH%\expansion\Addons" %BOOTDRV%\
  203. if ERRORLEVEL 1 goto err
  204. :noexp
  205.  
  206. if not exist "%_ARMA3PATH%\heli" goto noheli
  207. echo extracting the heli folder....
  208. extractpbodos -p "%_ARMA3PATH%\heli\Addons" %BOOTDRV%\
  209. if ERRORLEVEL 1 goto err
  210. :noheli
  211.  
  212. if not exist "%_ARMA3PATH%\jets" goto nojets
  213. echo extracting the jets folder....
  214. extractpbodos -p "%_ARMA3PATH%\jets\Addons" %BOOTDRV%\
  215. if ERRORLEVEL 1 goto err
  216. :nojets
  217.  
  218. if not exist "%_ARMA3PATH%\kart" goto nokarts
  219. echo extracting the kart folder....
  220. extractpbodos -p "%_ARMA3PATH%\kart\Addons" %BOOTDRV%\
  221. if ERRORLEVEL 1 goto err
  222. :nokarts
  223.  
  224. if not exist "%_ARMA3PATH%\mark" goto nomark
  225. echo extracting marksman mod
  226. extractpbodos -p "%_ARMA3PATH%\mark\Addons" %BOOTDRV%\
  227. if ERRORLEVEL 1 goto err
  228. :nomark
  229.  
  230. if not exist "%_ARMA3PATH%\orange" goto nooran
  231. echo extracting orange mod
  232. extractpbodos -p "%_ARMA3PATH%\orange\Addons" %BOOTDRV%\
  233. if ERRORLEVEL 1 goto err
  234. :nooran
  235.  
  236. if not exist "%_ARMA3PATH%\tacops" goto notaco
  237. echo extracting tacops mod
  238. extractpbodos -p "%_ARMA3PATH%\tacops\Addons" %BOOTDRV%\
  239. if ERRORLEVEL 1 goto err
  240. :notaco
  241.  
  242. if not exist "%_ARMA3PATH%\tank" goto notank
  243. echo extracting tank mod
  244. extractpbodos -p "%_ARMA3PATH%\tank\Addons" %BOOTDRV%\
  245. if ERRORLEVEL 1 goto err
  246. :notank
  247.  
  248. rem echo removing deprecated a3_dta if it exists...
  249. if exist %BOOTDRV%\a3_dta (rmdir /s/q %BOOTDRV%\a3_dta)
  250. if ERRORLEVEL 1 goto err
  251.  
  252. echo removing bin...
  253. if exist %BOOTDRV%\bin (rmdir /s/q %BOOTDRV%\bin)
  254. if ERRORLEVEL 1 goto err
  255.  
  256. echo removing core...
  257. if exist %BOOTDRV%\core (rmdir /s/q %BOOTDRV%\core)
  258. if ERRORLEVEL 1 goto err
  259.  
  260. echo removing languages...
  261. if exist %BOOTDRV%\languagecore (rmdir /s/q %BOOTDRV%\languagecore)
  262. if ERRORLEVEL 1 goto err
  263. if exist %BOOTDRV%\languagecore_f (rmdir /s/q %BOOTDRV%\languagecore_f)
  264. if ERRORLEVEL 1 goto err
  265. if exist %BOOTDRV%\languagecore_h (rmdir /s/q %BOOTDRV%\languagecore_h)
  266. if ERRORLEVEL 1 goto err
  267.  
  268.  
  269. rem ////////////////////////////////
  270. echo extracting dta....
  271. rem ////////////////////////////////
  272.  
  273. extractpbodos -p "%_ARMA3PATH%\Dta" %BOOTDRV%\
  274. if ERRORLEVEL 1 goto err
  275.  
  276.  
  277.  
  278. rem ////////////////////////////
  279. echo unrapping bin extensions to dta
  280. rem ////////////////////////////
  281.  
  282. rem remove wrong locations from a previous install if any
  283. if exist %BOOTDRV%\languagelist.* (del /q %BOOTDRV%\languagelist.*)
  284. if exist %BOOTDRV%\product.* (del /q %BOOTDRV%\product.*)
  285. if exist %BOOTDRV%\splashwindow.* (del /q %BOOTDRV%\splashwindow.*)
  286.  
  287. rem arma3 has a collection of rapified bins : product, languagelist and blah
  288. rem one exception is texheaders.bin
  289. if exist %BOOTDRV%\dta (rmdir /s/q %BOOTDRV%\dta)
  290. if ERRORLEVEL 1 goto err
  291.  
  292. echo making dta folder
  293. mkdir %BOOTDRV%\dta
  294. if ERRORLEVEL 1 goto err
  295. set binfiles="%_ARMA3PATH%\Dta\*.bin"
  296.  
  297.  
  298. dir /b/s %binfiles% >%BOOTDRV%\a3.txt
  299. if ERRORLEVEL 1 goto err
  300.  
  301. rem missions_f_epa.pbo
  302. rem B_in.Altis\mission.sqm
  303. FOR /F "tokens=1* delims=," %%A in (%BOOTDRV%\a3.txt) do (
  304. rem always copy the bin
  305. xcopy /Q/y "%%A" %BOOTDRV%\dta >nul
  306. if ERRORLEVEL 1 goto err
  307.  
  308. rem derap -Q "%%A"
  309. rem if errorlevel 1 goto not_rap
  310. derap -p "%%A" %BOOTDRV%\dta
  311. if errorlevel 1 echo ignored
  312. rem echo "%%A"
  313.  
  314.  
  315.  
  316. )
  317. del %BOOTDRV%\a3.txt
  318.  
  319. goto skiproads
  320. echo debinarising roads....
  321. deroad.exe %BOOTDRV%\a3\roads_f >%BOOTDRV%\roads.lst
  322. echo done. output is in %BOOTDRV%\roads.lst
  323. echo creating binarised roads in temp
  324. if exist %BOOTDRV%\temp\a3\roads_f (rmdir /s/q %BOOTDRV%\temp\a3\roads_f)
  325. extractpbodos -p "%_ARMA3PATH%\addons\roads_f" %BOOTDRV%\temp
  326.  
  327. echo datestamping binary roads
  328. dir/b/s %BOOTDRV%\temp\a3\roads_f\*.p3d >touch.txt
  329. FOR /F "tokens=1* delims=," %%A in (touch.txt) do  copy/b/y nul>>"%%A"
  330. del/q touch.txt
  331. :skiproads
  332. :skip
  333. echo removing buldozer from p:
  334. if exist %BOOTDRV%\*.dll (del/q %BOOTDRV%\*.dll)
  335. if exist %BOOTDRV%\buldozer.exe (del /q %BOOTDRV%\buldozer.exe)
  336. if exist %BOOTDRV%\steam_appid.txt (del /q %BOOTDRV%\steam_appid.txt)
  337. goto nobul
  338.  
  339. echo installing buldozer and it's dlls
  340. echo    all dlls
  341. echo delete
  342. del %BOOTDRV%\*.dll
  343. rem if ERRORLEVEL 1 goto err
  344.  
  345. echo copying..
  346. xcopy /y "%_ARMA3PATH%\*.dll" %BOOTDRV%\
  347. if ERRORLEVEL 1 goto err
  348.  
  349. echo buldozer...
  350. copy /b/y "%_ARMA3PATH%\arma3.exe" %BOOTDRV%\buldozer.exe
  351. if ERRORLEVEL 1 goto err
  352. echo appid
  353. xcopy /q/y "%_ARMA3PATH%\steam_appid.txt" %BOOTDRV%\
  354. if ERRORLEVEL 1 goto err
  355. :nobul
  356. echo installing lappihuan buldozer scripts
  357. echo see https://forums.bistudio.com/topic/192622-buldozer-tools
  358. echo for latest updates
  359. if not exist %BOOTDRV%\scripts mkdir %BOOTDRV%\scripts
  360.  
  361. xcopy /sy "%_MIKEDLL%\scripts\*" %BOOTDRV%\scripts
  362. :cursor
  363. echo using opteryx's buldozer cursor fix because bis can't
  364. copy cursor.p3d %BOOTDRV%\core\cursor
  365.  
  366. :success
  367.  
  368. echo All tasks completed successfully
  369. echo ***warning warning warning***
  370. echo ***warning warning warning***
  371. echo ***warning warning warning***
  372. echo %BOOTDRV%\buldozer.exe has been removed
  373.  
  374. echo adjust Object Builder AND Terrain Builder to point to:
  375. choice /c k /m "%_ARMA3PATH%\arma3.exe"
  376.  
  377. @exit /B 0
  378.  
  379. :err
  380.  
  381. echo failed
  382. choice /c k /m "Steam/Mikero tools WILL NOT WORK until you fix this error!"
  383.  
  384. @exit /B 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement