home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 7840 / WD_Repack.7z / WD_XBT-ConvertCRN.bat < prev    next >
Encoding:
DOS Batch File  |  2014-09-17  |  4.2 KB  |  154 lines

  1. @echo off
  2.  
  3. set CRNfilename=crunch_x64.exe
  4. set CGPfilename=WD_XBT-ConvertGraphicProc.bat
  5.  
  6. set WD_Alist=WD_AlphaList.txt
  7. set WD_FinalList=WD_FinalList.txt
  8.  
  9. if NOT exist %CRNfilename% (
  10. echo.
  11. echo [%CRNfilename%] is not located in this folder...
  12. echo.
  13. goto :End
  14. )
  15.  
  16. if NOT exist %CGPfilename% (
  17. echo.
  18. echo [%CGPfilename%] is not located in this folder...
  19. echo.
  20. goto :End
  21. )
  22.  
  23. if NOT exist %WD_Alist% (
  24. echo.
  25. echo [%WD_Alist%] is not located in this folder...
  26. echo.
  27. goto :End
  28. )
  29.  
  30. if NOT exist %WD_FinalList% (
  31. echo.
  32. echo [%WD_FinalList%] is not located in this folder...
  33. echo.
  34. goto :End
  35. )
  36.  
  37.  
  38. :choice
  39. cls
  40. echo.
  41. echo *******************************************************************************
  42. echo *                                                                             *
  43. echo *                 Watch Dogs    ~    Convert DDS to CRN                       *
  44. echo *                                                                             *
  45. echo *                                                                             *
  46. echo *       Step 01: Convert all Alpha graphic files                              *
  47. echo *       Step 02: Convert all other graphic files                              *
  48. echo *                                                                             *
  49. echo *       Press [1] to start the conversion procedure...                        *
  50. echo *                                                                             *
  51. echo *                                                                             *
  52. echo *       Remark:                                                               *
  53. echo *       [WD_AlphaList.txt] and [WD_FinalList.txt] must exist in the           *
  54. echo *       current folder!                                                       *
  55. echo *       Created by [WD_XBT-ConvertList_DDS.bat]                               *
  56. echo *                                                                             *
  57. echo *                                                                             *
  58. echo *  Current Folder:                                                            *
  59. echo *  [%~dp0]
  60. echo *                                                                             *
  61. echo *                                                                             *
  62. echo *******************************************************************************
  63. echo.
  64. set /p userinp=Type a number (0,1): 
  65. set userinp=%userinp:~0,1%
  66. echo.
  67. echo.
  68. if "%userinp%"=="0" (
  69. echo Quiting...
  70. goto :END
  71. )
  72. if "%userinp%"=="1" goto Start
  73. echo invalid choice
  74. goto choice
  75.  
  76.  
  77.  
  78. :Start
  79. set TotalFile=0
  80.  
  81. %~d0
  82. cd %~dp0
  83.  
  84. setlocal EnableDelayedExpansion
  85. set Count=0
  86. set mCount=-1
  87. set CountDiv=0
  88. set CountDiv1=0
  89.  
  90. For /F "delims=~" %%i in (%WD_Alist%) do (
  91. Set /a Count=!Count!+1
  92. set TotalFile=!Count!
  93. )
  94.  
  95. set Count=0
  96. for /F "delims=~+~" %%i in (%WD_Alist%) do (
  97.  
  98. Set /a Count=!Count!+1
  99. Set /a mCount=!mCount!+1
  100.  
  101. rem *** show progress as this can take awhile...
  102. set /a CountDiv=!Count!/10
  103. set /a CountDiv1=!mCount!/10
  104. if !Count!==1 (<NUL set /p=* [%TotalFile% Alpha files] Compression in progress)
  105. if !CountDiv!==!CountDiv1! (<NUL set /p=.) ELSE (<NUL set /p=!Count!)
  106. rem echo [!CountDiv!]  ~  {!CountDiv1!}    ~   !Count!
  107.  
  108. if exist %%i (
  109.  
  110. rem *** CRN = Compress file...
  111. set WinTitle=Compressing DDS file [!Count!/%TotalFile%]...
  112. start "!WinTitle!" /WAIT /MIN WD_XBT-ConvertGraphicProc.bat %%i DXT5A CRN
  113.  
  114. )
  115. )
  116. echo.
  117.  
  118. set Count=0
  119. set mCount=-1
  120. set CountDiv=0
  121. set CountDiv1=0
  122.  
  123. For /F "delims=~" %%i in (%WD_FinalList%) do (
  124. Set /a Count=!Count!+1
  125. set TotalFile=!Count!
  126. )
  127.  
  128. set Count=0
  129. For /F "tokens=1,2 delims=~+~" %%i in (%WD_FinalList%) do (
  130.  
  131. Set /a Count=!Count!+1
  132. Set /a mCount=!mCount!+1
  133.  
  134. rem *** show progress as this can take awhile...
  135. set /a CountDiv=!Count!/10
  136. set /a CountDiv1=!mCount!/10
  137. if !Count!==1 (<NUL set /p=* [%TotalFile% graphic files] Compression in progress)
  138. if !CountDiv!==!CountDiv1! (<NUL set /p=.) ELSE (<NUL set /p=!Count!)
  139.  
  140. if exist %%i (
  141.  
  142. set WinTitle=Compressing DDS file [!Count!/%TotalFile%]...
  143. start "!WinTitle!" /WAIT /MIN WD_XBT-ConvertGraphicProc.bat %%i %%j CRN
  144.  
  145. )
  146. )
  147.  
  148.  
  149. goto END
  150.  
  151. :END
  152.  
  153. echo.
  154. pause