home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 7840 / WD_Repack.7z / WD_XBT-ConvertDDS.bat < prev    next >
Encoding:
DOS Batch File  |  2014-09-18  |  4.2 KB  |  149 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 CRN to DDS                       *
  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. Set /a Count=!Count!+1
  98. Set /a mCount=!mCount!+1
  99.  
  100. rem *** show progress as this can take awhile...
  101. set /a CountDiv=!Count!/10
  102. set /a CountDiv1=!mCount!/10
  103. if !Count!==1 (<NUL set /p=* [%TotalFile% Alpha files] Compression in progress)
  104. if !CountDiv!==!CountDiv1! (<NUL set /p=.) ELSE (<NUL set /p=!Count!)
  105. rem echo [!CountDiv!]  ~  {!CountDiv1!}    ~   !Count!
  106.  
  107. if exist "%%~ni".crn (
  108.  
  109. rem *** CRN = Compress file...
  110. set WinTitle=Compressing DDS file [!Count!/%TotalFile%]...
  111. start "!WinTitle!" /WAIT /MIN WD_XBT-ConvertGraphicProc.bat %%i A8R8G8B8 DDS
  112.  
  113. )
  114. )
  115. echo.
  116.  
  117. set Count=0
  118. set mCount=-1
  119. set CountDiv=0
  120. set CountDiv1=0
  121.  
  122. For /F "delims=~" %%i in (%WD_FinalList%) do (
  123. Set /a Count=!Count!+1
  124. set TotalFile=!Count!
  125. )
  126.  
  127. set Count=0
  128. For /F "tokens=1,2 delims=~+~" %%i in (%WD_FinalList%) do (
  129. Set /a Count=!Count!+1
  130. Set /a mCount=!mCount!+1
  131.  
  132. rem *** show progress as this can take awhile...
  133. set /a CountDiv=!Count!/10
  134. set /a CountDiv1=!mCount!/10
  135. if !Count!==1 (<NUL set /p=* [%TotalFile% graphic files] Compression in progress)
  136. if !CountDiv!==!CountDiv1! (<NUL set /p=.) ELSE (<NUL set /p=!Count!)
  137.  
  138. if exist "%%~ni".crn (
  139.  
  140. set WinTitle=Compressing DDS file [!Count!/%TotalFile%]...
  141. start "!WinTitle!" /WAIT /MIN WD_XBT-ConvertGraphicProc.bat %%i %%j DDS
  142.  
  143. )
  144. )
  145.  
  146. :END
  147.  
  148. echo.
  149. pause