Build_AssetBundler_AuxiliaryContent_PC.bat 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. @echo off
  2. REM
  3. REM All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  4. REM its licensors.
  5. REM
  6. REM For complete copyright and license terms please see the LICENSE at the root of this
  7. REM distribution (the "License"). All use of this software is governed by the License,
  8. REM or, if provided, by the license below or the license accompanying this file. Do not
  9. REM remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  10. REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. REM
  12. setlocal enabledelayedexpansion
  13. set ORIGINALDIRECTORY=%cd%
  14. set MYBATCHFILEDIRECTORY=%~dp0
  15. cd "%MYBATCHFILEDIRECTORY%"
  16. REM Parse command line arguments for OPTIONAL parameters. Looking for --recompress or --use_fastest.
  17. set RECOMPRESS_NAME=--recompress
  18. set /A RECOMPRESS_VALUE=0
  19. set USE_FASTEST_NAME=--use_fastest
  20. set /A USE_FASTEST_VALUE=0
  21. set GAME_NAME_CMD=--game
  22. set "BINFOLDER_HINT_NAME=--binfolder-hint"
  23. set "BINFOLDER_HINT="
  24. :CmdLineArgumentsParseLoop
  25. if "%1"=="" goto CmdLineArgumentsParsingDone
  26. if "%1"=="%RECOMPRESS_NAME%" (
  27. set /A RECOMPRESS_VALUE=1
  28. goto GotValidArgument
  29. )
  30. if "%1"=="%USE_FASTEST_NAME%" (
  31. set /A USE_FASTEST_VALUE=1
  32. goto GotValidArgument
  33. )
  34. if "%1"=="%GAME_NAME_CMD%" (
  35. set GAME_NAME=%2
  36. shift
  37. set GAME_NAME
  38. CALL :lowercase GAME_NAME GAME_NAME_LOWER
  39. set GAME_NAME_LOWER
  40. goto GotValidArgument
  41. )
  42. if "%1"=="%BINFOLDER_HINT_NAME%" (
  43. REM The next parameter is the hint directory
  44. set BINFOLDER_HINT=%2%
  45. shift
  46. goto GotValidArgument
  47. )
  48. :InvalidCommandArgument
  49. REM If we are here, the user gave us an unexpected argument. Let them know and quit.
  50. echo "%1" is an invalid argument, "%GAME_NAME_CMD%" is required, optional arguments are "%RECOMPRESS_NAME%", "%USE_FASTEST_NAME%" or "%BINFOLDER_HINT_NAME%"
  51. echo --game: The name of the game to generate the auxiliary content for.
  52. echo --recompress: If present, the ResourceCompiler (RC.exe) will decompress and compress back each
  53. echo PAK file found as they are transferred from the cache folder to the game_pc_pak folder.
  54. echo --use_fastest: As each file is being added to its PAK file, they will be compressed across all
  55. echo available codecs (ZLIB, ZSTD and LZ4) and the one with the fastest decompression time
  56. echo will be chosen. The default is to always use ZLIB.
  57. echo %BINFOLDER_HINT_NAME%^=^<folder_name^>: A hint to indicate the folder name to use for finding the windows binaries i.e Bin64vc142
  58. exit /b 1
  59. :GotValidArgument
  60. shift
  61. goto CmdLineArgumentsParseLoop
  62. :CmdLineArgumentsParsingDone
  63. if "%GAME_NAME%"=="" goto InvalidCommandArgument
  64. REM Attempt to determine the best BinFolder for rc.exe and AssetProcessorBatch.exe
  65. call "%MYBATCHFILEDIRECTORY%\DetermineRCandAP.bat" SILENT %BINFOLDER_HINT%
  66. REM If a bin folder was registered, validate the presence of the binfolder/rc.exe
  67. IF ERRORLEVEL 1 (
  68. ECHO unable to determine the locations of AssetProcessor and rc.exe. Make sure that they are available or rebuild from source
  69. EXIT /b 1
  70. )
  71. ECHO Detected binary folder at %MYBATCHFILEDIRECTORY%%BINFOLDER%
  72. echo ----- Processing Assets Using Asset Processor Batch ----
  73. .\%BINFOLDER%\AssetProcessorBatch.exe /gamefolder=%GAME_NAME% /platforms=pc
  74. IF ERRORLEVEL 1 GOTO AssetProcessingFailed
  75. echo ----- Creating Packages ----
  76. rem lowercase is intentional, since cache folders are lowercase on some platforms
  77. .\%BINFOLDER%\rc.exe /job=%MYBATCHFILEDIRECTORY%Code\Tools\RC\Config\rc\RCJob_Generic_MakeAuxiliaryContent.xml /p=pc /game=%GAME_NAME_LOWER% /recompress=%RECOMPRESS_VALUE% /use_fastest=%USE_FASTEST_VALUE%
  78. IF ERRORLEVEL 1 GOTO RCFailed
  79. echo ----- Done -----
  80. cd "%ORIGINALDIRECTORY%"
  81. exit /b 0
  82. :RCFailed
  83. echo ---- RC PAK failed ----
  84. cd "%ORIGINALDIRECTORY%"
  85. exit /b 1
  86. :AssetProcessingFailed
  87. echo ---- ASSET PROCESSING FAILED ----
  88. cd "%ORIGINALDIRECTORY%"
  89. exit /b 1
  90. :lowercase
  91. SET _UCase=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  92. SET _LCase=a b c d e f g h i j k l m n o p q r s t u v w x y z
  93. SET _Lib_UCase_Tmp=!%1!
  94. SET _Abet=%_LCase%
  95. FOR %%Z IN (%_Abet%) DO SET _Lib_UCase_Tmp=!_Lib_UCase_Tmp:%%Z=%%Z!
  96. SET %2=%_Lib_UCase_Tmp%
  97. GOTO:EOF