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

  1. @echo off
  2.  
  3. set CRNfilename=crunch_x64.exe
  4.  
  5. if NOT exist %CRNfilename% (
  6. echo.
  7. echo [%CRNfilename%] is not located in this folder...
  8. echo.
  9. goto :End
  10. )
  11.  
  12.  
  13. :choice
  14. cls
  15. echo.
  16. echo *******************************************************************************
  17. echo *                                                                             *
  18. echo *                 Watch Dogs    ~    Build DDS FileLists                      *
  19. echo *                                                                             *
  20. echo *       Creates 2 listfiles containing Alpha graphic files and any            *
  21. echo *       other graphic files (DXTx)                                            *
  22. echo *       Resp. [WD_AlphaList.txt] and [WD_FinalList.txt]                       *
  23. echo *                                                                             *
  24. echo *                                                                             *
  25. echo *       Press [1] to start the building procedure...                          *
  26. echo *                                                                             *
  27. echo *                                                                             *
  28. echo *       Remark:                                                               *
  29. echo *       Do NOT delete these 2 files as they are used                          *
  30. echo *       for the other procedures!                                             *
  31. echo *                                                                             *
  32. echo *                                                                             *
  33. echo *  Current Folder:                                                            *
  34. echo *  [%~dp0]
  35. echo *                                                                             *
  36. echo *                                                                             *
  37. echo *******************************************************************************
  38. echo.
  39. set /p userinp=Type a number (0,1): 
  40. set userinp=%userinp:~0,1%
  41. echo.
  42. echo.
  43. if "%userinp%"=="0" (
  44. echo Quiting...
  45. goto :END
  46. )
  47. if "%userinp%"=="1" goto Start
  48. echo invalid choice
  49. goto choice
  50.  
  51.  
  52.  
  53. :Start
  54. set WD_FList=WD_FListGraph.txt
  55. set WD_Alist=WD_AlphaList.txt
  56. set WD_FinalList=WD_FinalList.txt
  57. set WD_Tinfo=WD_tempFileInfo.txt
  58. set WD_Temp2=WD_tempfile2.txt
  59. set WD_EList1=WD_ErrorList1.txt
  60.  
  61. dir *.dds /b>WD_FListGraph.txt 2>nul
  62.  
  63. type nul > %WD_EList1%
  64.  
  65. %~d0
  66. cd %~dp0
  67.  
  68. setlocal EnableDelayedExpansion
  69. Set Count=0
  70. set FourCode=UNDF
  71. for /F "delims=~" %%i in (%WD_FList%) do (
  72. set /a count=!count!+1
  73.  
  74.  
  75. crunch_x64 /info -file "%%i"> %WD_Tinfo%
  76.  
  77. rem *** check if not a DDS file...
  78. if not !ErrorLevel! equ 0 ( 
  79.     type %WD_Tinfo% >> %WD_EList1%
  80.     del "%%i" "%%~ni.hdr"
  81. ) ELSE ( call :Proc_Fourcc "%%i")
  82.  
  83. rem type %WD_Temp3% >> %WD_Finallist%
  84.  
  85.  
  86. )
  87.  
  88. goto END
  89.  
  90.  
  91.  
  92. REM ********************************************
  93. REM *** Extracting Fourcc code   # Proc_Fourcc #
  94. REM ********************************************
  95. rem *** %1= "Filename"
  96. :Proc_Fourcc
  97.  
  98. rem *** get~add Fourcc codes  ~ info seperated by comma...
  99. findstr /L /C:"Source texture dimensions:" %WD_Tinfo%> %WD_Temp2%
  100. for /F "tokens=1-4 delims=," %%a in (%WD_Temp2%) do (set FourCode=%%d)
  101.  
  102. rem *** code length can be between 2-9  ~  use one space as seperator...
  103. set FourCode=xxxxx!FourCode:~1!
  104. set FourCode=!FourCode:~-15!
  105. echo !FourCode!> %WD_Temp2%
  106. for /F "tokens=1-2 delims= " %%a in (%WD_Temp2%) do (set FourCode=%%b)
  107.  
  108. rem echo [!FourCode!]
  109.  
  110. rem *** DXT1A not supported by crunch
  111. if !FourCode!==DXT1A (
  112. echo Not Supported: %1~+~XXXX~+~!FourCode! >> %WD_EList1%
  113. )
  114.  
  115. if not "!FourCode!"=="!FourCode:A=!" (
  116.       >>%WD_Alist% echo %1~+~!FourCode!
  117. ) ELSE (
  118.       >>%WD_FinalList% echo %1~+~!FourCode!)
  119.  
  120. echo !count!   ~  [!FourCode!]
  121.  
  122. goto :EOF
  123. rem *** End of :Proc_Fourcc procedure...
  124.  
  125. :END
  126.  
  127. del %WD_FList% >nul 2>nul
  128. del %WD_Tinfo% >nul 2>nul
  129. del %WD_Temp2% >nul 2>nul
  130.  
  131. pause