# Extract the retail assets into OUT using the ra3tools scripts. Driven by the # openra3_assets target and run with `cmake -P`, so it needs only Python and the # game install - no target executable, and therefore works for a cross-build too # (mount the install into the container and pass RA3_GAME_DIR). # # Variables (all required unless noted): # GAME_DIR Red Alert 3 install root # OUT destination folder (next to the executable) # PYTHON python interpreter # RA3TOOLS path to ra3-headless/ra3tools # EXTRACT_ALL ON to also dump every asset (models/textures/audio/movies) # STAMP stamp file to write on completion function(run) execute_process(COMMAND ${ARGN} RESULT_VARIABLE _rc) if(NOT _rc EQUAL 0) message(WARNING "extract step failed (${_rc}): ${ARGN}") endif() endfunction() file(MAKE_DIRECTORY "${OUT}") if(NOT EXISTS "${RA3TOOLS}/ra3_big.py") message(WARNING "ra3tools not found at '${RA3TOOLS}'; skipping asset extraction") else() # Maps + overview art: raw .big payloads; the engine unwraps EAR/RefPack. run("${PYTHON}" "${RA3TOOLS}/ra3_big.py" extract "${GAME_DIR}/Data/MapsMultiplayer.big" --match "*.map" --out "${OUT}/maps") run("${PYTHON}" "${RA3TOOLS}/ra3_big.py" extract "${GAME_DIR}/Data/MapsMultiplayer.big" --match "*_art.tga" --out "${OUT}/maps") # Terrain tile textures (the engine samples these for the map). foreach(archive Terrain.big Core11.big) if(EXISTS "${GAME_DIR}/Data/${archive}") run("${PYTHON}" "${RA3TOOLS}/ra3_big.py" extract "${GAME_DIR}/Data/${archive}" --match "*.tga" --out "${OUT}/terrain") endif() endforeach() if(EXTRACT_ALL) message(STATUS "extracting every .big entry to ${OUT}/raw") run("${PYTHON}" "${RA3TOOLS}/ra3_big.py" extract-all --game-dir "${GAME_DIR}" --out "${OUT}/raw" --match "*") if(EXISTS "${RA3TOOLS}/ra3_binary.py") message(STATUS "extracting models + textures (static stream)") run("${PYTHON}" "${RA3TOOLS}/ra3_binary.py" export "${GAME_DIR}/Data/StaticStream.big" --models --textures --png --by-source --out "${OUT}/art") message(STATUS "extracting audio (sound effects + voice)") run("${PYTHON}" "${RA3TOOLS}/ra3_binary.py" export "${GAME_DIR}/Data/EnglishAudio.big" --stream audio --audio --out "${OUT}/audio") message(STATUS "extracting movie audio") run("${PYTHON}" "${RA3TOOLS}/ra3_big.py" extract "${GAME_DIR}/Data/EnglishMovieAudio.big" --match "*.snd" --out "${OUT}/movies") endif() endif() endif() file(TOUCH "${STAMP}")