Streamlined packaging script and updated README to mention it

This commit is contained in:
ALLEN-PC\acj30 2023-11-11 11:42:09 -06:00
parent 2a786cd655
commit 58b754d4a8
2 changed files with 157 additions and 92 deletions

View File

@ -6,6 +6,10 @@ This repository accepts pull requests for contributing scripts, assets, or other
--- ---
Please view `MAPBASE_CONTENT_USAGE.txt` for all information on attribution for this content (including content in the code and elsewhere). This repo includes an amateur shell script (`mapbase-build-packaging-script.sh`) which is used to assemble builds of Mapbase's mod folders. This script was originally created for personal use, but efforts have been made to try to allow it to be used by anyone. A more efficient and/or user-friendly solution may be introduced in the future.
---
Please refer to `MAPBASE_CONTENT_USAGE.txt` for all information on attribution for this content (including content in the code and elsewhere).
`README.txt` is distributed with builds. `README.txt` is distributed with builds.

View File

@ -8,7 +8,7 @@
# To set up this script on your machine, you must have certain folders for the script to draw files from. # To set up this script on your machine, you must have certain folders for the script to draw files from.
# For that, you can follow these steps: # For that, you can follow these steps:
# #
# 1. Extract the VMT (material) files from HL2, EP1, EP2, and Lost Coast. All of these can be found # 1. Gather the VMT (material) files from HL2, EP1, EP2, and Lost Coast. All of these can be found
# in Source SDK Base 2013 Singleplayer if you do not have the relevant games installed. # in Source SDK Base 2013 Singleplayer if you do not have the relevant games installed.
# #
# 2. Use the Mapbase Multi-Tool to convert those materials to the new shaders. Send them to new # 2. Use the Mapbase Multi-Tool to convert those materials to the new shaders. Send them to new
@ -16,12 +16,29 @@
# folders in this repository. For episodic_materials_source, make sure the EP2 materials are converted # folders in this repository. For episodic_materials_source, make sure the EP2 materials are converted
# after the EP1 materials so that the former group overwrites the latter. # after the EP1 materials so that the former group overwrites the latter.
# #
# 3. Have your own copies of Mapbase's source-sdk-2013 and source-fgds repositories on your computer. # 3. Find a previously released Mapbase build and extract the scenes from "mapbase_hl2/content/hl2_scenes"
# Preferably, you should use Git with them. # and "mapbase_episodic/content/episodic_scenes" to new "VPKs/hl2_scenes" and "VPKs/episodic_scenes"
# folders in this repository. (This does not apply if you are planning on using a local code repo)
# #
# 4. Tweak the directory variables below. # 4. Tweak the directory variables below.
# #
# With all of that done, you should be ready to create Mapbase builds. # With all of that done, you should be ready to create basic Mapbase builds using this script, although there are
# a few manual steps involved which are not automated by default:
#
# - For the code binaries, you will need to download artifacts from GitHub and insert them into the
# games' bin folders. (If you have a local copy, you can set USE_LOCAL_CODE below to true, but this
# usually does not contain everything needed for a build)
#
# - For the FGDs, you will need to download the latest version of the FGD repo. If you already have a
# local copy of this repo, set USE_LOCAL_FGDS below to 'true' and set the path. That will eliminate
# this manual step.
#
# - You will need to include the legacy pre-v7.0 shared_content VPK in mapbase_shared. This can be
# obtained from previously released builds.
#
# After generating a build, a to-do list showing any applicable manual steps will be given in the console.
#
# Once those manual steps are complete, you should have a fully functional Mapbase build.
# #
# ===================================================================================================== # =====================================================================================================
@ -31,17 +48,23 @@ BIN_DIR="C:/Program\ Files\ \(x86\)/Steam/SteamApps/common/Source\ SDK\ Base\ 20
# This repository's 'VPKs' folder (used by vpk.exe) # This repository's 'VPKs' folder (used by vpk.exe)
VPK_CONTENT_DIR="E:/Mapbase/mapbase-game-src/VPKs" VPK_CONTENT_DIR="E:/Mapbase/mapbase-game-src/VPKs"
# Where the DLLs and SDK tools are # Whether or not to use a local source code repository to automatically gather DLLs
USE_LOCAL_CODE=false
# USE_LOCAL_CODE only: Where the DLLs and SDK tools are
SOURCE_BIN_DIR="../mapbase-hl2-master/sp/game/bin" SOURCE_BIN_DIR="../mapbase-hl2-master/sp/game/bin"
SOURCE_MOD_EPISODIC_DIR="../mapbase-hl2-master/sp/game/mod_episodic" SOURCE_MOD_EPISODIC_DIR="../mapbase-hl2-master/sp/game/mod_episodic"
SOURCE_MOD_HL2_DIR="../mapbase-hl2-master/sp/game/mod_hl2" SOURCE_MOD_HL2_DIR="../mapbase-hl2-master/sp/game/mod_hl2"
# Where the original games' VCD files are (they come with the code repo by default) # USE_LOCAL_CODE only: Where the original games' VCD files are (they come with the code repo by default)
SOURCE_HL2_SCENES_DIR="../mapbase-hl2-master/sp/game/hl2/scenes" SOURCE_HL2_SCENES_DIR="../mapbase-hl2-master/sp/game/hl2/scenes"
SOURCE_EP1_SCENES_DIR="../mapbase-hl2-master/sp/game/episodic/scenes" SOURCE_EP1_SCENES_DIR="../mapbase-hl2-master/sp/game/episodic/scenes"
SOURCE_EP2_SCENES_DIR="../mapbase-hl2-master/sp/game/ep2/scenes" SOURCE_EP2_SCENES_DIR="../mapbase-hl2-master/sp/game/ep2/scenes"
# Where the FGDs are # Whether or not to use a local FGD repository
USE_LOCAL_FGDS=false
# USE_LOCAL_FGDS only: Where the FGDs are
SOURCE_FGDS_DIR="../source-fgds" SOURCE_FGDS_DIR="../source-fgds"
# "read VERSION" could've been used for this, but it doesn't change as frequently as builds # "read VERSION" could've been used for this, but it doesn't change as frequently as builds
@ -49,6 +72,8 @@ SOURCE_FGDS_DIR="../source-fgds"
VERSION="v7_1" VERSION="v7_1"
VERSION_VPK_NAME="v7_0" VERSION_VPK_NAME="v7_0"
# =====================================================================================================
echo "The currently selected version is \"${VERSION}\"" echo "The currently selected version is \"${VERSION}\""
echo "If this is correct, press enter to continue. If not, close this window and configure the version in the file." echo "If this is correct, press enter to continue. If not, close this window and configure the version in the file."
read read
@ -74,6 +99,8 @@ echo "mapbase_hl2 copied"
#cp mapbase_hl2mp ${BUILD_DIR} #cp mapbase_hl2mp ${BUILD_DIR}
#echo "mapbase_hl2mp copied" #echo "mapbase_hl2mp copied"
if [ "$USE_LOCAL_CODE" = true ] ;
then
echo "=====================" echo "====================="
echo "Copying binaries from SDK bin" echo "Copying binaries from SDK bin"
echo "=====================" echo "====================="
@ -89,10 +116,18 @@ cp ${SOURCE_MOD_EPISODIC_DIR}/bin/client.dll ${BUILD_DIR}/mapbase_episodic/bin
cp ${SOURCE_MOD_EPISODIC_DIR}/bin/server.dll ${BUILD_DIR}/mapbase_episodic/bin cp ${SOURCE_MOD_EPISODIC_DIR}/bin/server.dll ${BUILD_DIR}/mapbase_episodic/bin
cp ${SOURCE_MOD_EPISODIC_DIR}/bin/game_shader_dx9.dll ${BUILD_DIR}/mapbase_episodic/bin cp ${SOURCE_MOD_EPISODIC_DIR}/bin/game_shader_dx9.dll ${BUILD_DIR}/mapbase_episodic/bin
cp ${SOURCE_MOD_EPISODIC_DIR}/bin/client.so ${BUILD_DIR}/mapbase_episodic/bin
cp ${SOURCE_MOD_EPISODIC_DIR}/bin/server.so ${BUILD_DIR}/mapbase_episodic/bin
cp ${SOURCE_MOD_EPISODIC_DIR}/bin/game_shader_dx9.so ${BUILD_DIR}/mapbase_episodic/bin
cp ${SOURCE_MOD_HL2_DIR}/bin/client.dll ${BUILD_DIR}/mapbase_hl2/bin cp ${SOURCE_MOD_HL2_DIR}/bin/client.dll ${BUILD_DIR}/mapbase_hl2/bin
cp ${SOURCE_MOD_HL2_DIR}/bin/server.dll ${BUILD_DIR}/mapbase_hl2/bin cp ${SOURCE_MOD_HL2_DIR}/bin/server.dll ${BUILD_DIR}/mapbase_hl2/bin
cp ${SOURCE_MOD_HL2_DIR}/bin/game_shader_dx9.dll ${BUILD_DIR}/mapbase_hl2/bin cp ${SOURCE_MOD_HL2_DIR}/bin/game_shader_dx9.dll ${BUILD_DIR}/mapbase_hl2/bin
cp ${SOURCE_MOD_HL2_DIR}/bin/client.so ${BUILD_DIR}/mapbase_hl2/bin
cp ${SOURCE_MOD_HL2_DIR}/bin/server.so ${BUILD_DIR}/mapbase_hl2/bin
cp ${SOURCE_MOD_HL2_DIR}/bin/game_shader_dx9.so ${BUILD_DIR}/mapbase_hl2/bin
echo "=====================" echo "====================="
echo "Copying compile tools from SDK bin" echo "Copying compile tools from SDK bin"
echo "=====================" echo "====================="
@ -103,6 +138,7 @@ cp ${SOURCE_BIN_DIR}/vrad.exe ${BUILD_DIR}/mapbase_engine_bin
cp ${SOURCE_BIN_DIR}/vrad_dll.dll ${BUILD_DIR}/mapbase_engine_bin cp ${SOURCE_BIN_DIR}/vrad_dll.dll ${BUILD_DIR}/mapbase_engine_bin
cp ${SOURCE_BIN_DIR}/vvis.exe ${BUILD_DIR}/mapbase_engine_bin cp ${SOURCE_BIN_DIR}/vvis.exe ${BUILD_DIR}/mapbase_engine_bin
cp ${SOURCE_BIN_DIR}/vvis_dll.dll ${BUILD_DIR}/mapbase_engine_bin cp ${SOURCE_BIN_DIR}/vvis_dll.dll ${BUILD_DIR}/mapbase_engine_bin
fi
echo "=====================" echo "====================="
echo "Copying materials" echo "Copying materials"
@ -123,6 +159,8 @@ echo "lostcoast_materials_source copied"
cp -r VPKs/lostcoast_materials_overrides/materials VPKs/lostcoast_materials cp -r VPKs/lostcoast_materials_overrides/materials VPKs/lostcoast_materials
echo "lostcoast_materials_overrides copied" echo "lostcoast_materials_overrides copied"
if [ "$USE_LOCAL_CODE" = true ] ;
then
echo "=====================" echo "====================="
echo "Copying scenes" echo "Copying scenes"
echo "=====================" echo "====================="
@ -136,6 +174,7 @@ cp -r ${SOURCE_EP1_SCENES_DIR} VPKs/episodic_scenes
echo "EP1 scenes copied" echo "EP1 scenes copied"
cp -r ${SOURCE_EP2_SCENES_DIR} VPKs/episodic_scenes cp -r ${SOURCE_EP2_SCENES_DIR} VPKs/episodic_scenes
echo "EP2 scenes copied" echo "EP2 scenes copied"
fi
echo "=====================" echo "====================="
echo "Packing VPKs" echo "Packing VPKs"
@ -145,6 +184,7 @@ mkdir ${BUILD_DIR}/mapbase_shared
mkdir ${BUILD_DIR}/mapbase_episodic/content mkdir ${BUILD_DIR}/mapbase_episodic/content
mkdir ${BUILD_DIR}/mapbase_hl2/content mkdir ${BUILD_DIR}/mapbase_hl2/content
echo "Generating keypair for ${VERSION}"
eval "${BIN_DIR}/vpk.exe generate_keypair \"mapbase_${VERSION}\"" eval "${BIN_DIR}/vpk.exe generate_keypair \"mapbase_${VERSION}\""
eval "${BIN_DIR}/vpk.exe -M -P -c 50 -k mapbase_${VERSION}.publickey.vdf -K mapbase_${VERSION}.privatekey.vdf -vpk \"${VPK_CONTENT_DIR}/shared_content_${VERSION_VPK_NAME}\"" eval "${BIN_DIR}/vpk.exe -M -P -c 50 -k mapbase_${VERSION}.publickey.vdf -K mapbase_${VERSION}.privatekey.vdf -vpk \"${VPK_CONTENT_DIR}/shared_content_${VERSION_VPK_NAME}\""
@ -162,11 +202,6 @@ eval "${BIN_DIR}/vpk.exe rehash \"${VPK_CONTENT_DIR}/hl2_materials\""
echo "Moving hl2_materials" echo "Moving hl2_materials"
mv VPKs/*.vpk ${BUILD_DIR}/mapbase_hl2/content mv VPKs/*.vpk ${BUILD_DIR}/mapbase_hl2/content
eval "${BIN_DIR}/vpk.exe -M -P -c 50 -k mapbase_${VERSION}.publickey.vdf -K mapbase_${VERSION}.privatekey.vdf -vpk \"${VPK_CONTENT_DIR}/hl2_scenes\""
eval "${BIN_DIR}/vpk.exe rehash \"${VPK_CONTENT_DIR}/hl2_scenes\""
echo "Moving hl2_scenes"
mv VPKs/*.vpk ${BUILD_DIR}/mapbase_hl2/content
eval "${BIN_DIR}/vpk.exe -M -P -c 50 -k mapbase_${VERSION}.publickey.vdf -K mapbase_${VERSION}.privatekey.vdf -vpk \"${VPK_CONTENT_DIR}/lostcoast_materials\"" eval "${BIN_DIR}/vpk.exe -M -P -c 50 -k mapbase_${VERSION}.publickey.vdf -K mapbase_${VERSION}.privatekey.vdf -vpk \"${VPK_CONTENT_DIR}/lostcoast_materials\""
eval "${BIN_DIR}/vpk.exe rehash \"${VPK_CONTENT_DIR}/lostcoast_materials\"" eval "${BIN_DIR}/vpk.exe rehash \"${VPK_CONTENT_DIR}/lostcoast_materials\""
echo "Moving lostcoast_materials" echo "Moving lostcoast_materials"
@ -182,11 +217,21 @@ eval "${BIN_DIR}/vpk.exe rehash \"${VPK_CONTENT_DIR}/episodic_materials\""
echo "Moving episodic_materials" echo "Moving episodic_materials"
mv VPKs/*.vpk ${BUILD_DIR}/mapbase_episodic/content mv VPKs/*.vpk ${BUILD_DIR}/mapbase_episodic/content
if [ "$USE_LOCAL_CODE" = true ] || [ -d VPKs/hl2_scenes ] ;
then
eval "${BIN_DIR}/vpk.exe -M -P -c 50 -k mapbase_${VERSION}.publickey.vdf -K mapbase_${VERSION}.privatekey.vdf -vpk \"${VPK_CONTENT_DIR}/hl2_scenes\""
eval "${BIN_DIR}/vpk.exe rehash \"${VPK_CONTENT_DIR}/hl2_scenes\""
echo "Moving hl2_scenes"
mv VPKs/*.vpk ${BUILD_DIR}/mapbase_hl2/content
eval "${BIN_DIR}/vpk.exe -M -P -c 50 -k mapbase_${VERSION}.publickey.vdf -K mapbase_${VERSION}.privatekey.vdf -vpk \"${VPK_CONTENT_DIR}/episodic_scenes\"" eval "${BIN_DIR}/vpk.exe -M -P -c 50 -k mapbase_${VERSION}.publickey.vdf -K mapbase_${VERSION}.privatekey.vdf -vpk \"${VPK_CONTENT_DIR}/episodic_scenes\""
eval "${BIN_DIR}/vpk.exe rehash \"${VPK_CONTENT_DIR}/episodic_scenes\"" eval "${BIN_DIR}/vpk.exe rehash \"${VPK_CONTENT_DIR}/episodic_scenes\""
echo "Moving episodic_scenes" echo "Moving episodic_scenes"
mv VPKs/*.vpk ${BUILD_DIR}/mapbase_episodic/content mv VPKs/*.vpk ${BUILD_DIR}/mapbase_episodic/content
fi
if [ "$USE_LOCAL_FGDS" = true ] ;
then
echo "=====================" echo "====================="
echo "Copying FGDs" echo "Copying FGDs"
echo "=====================" echo "====================="
@ -198,6 +243,7 @@ cp ${SOURCE_FGDS_DIR}/base.fgd ${BUILD_DIR}/mapbase_shared/shared_misc/bin
echo "base.fgd copied" echo "base.fgd copied"
cp ${SOURCE_FGDS_DIR}/halflife2.fgd ${BUILD_DIR}/mapbase_shared/shared_misc/bin cp ${SOURCE_FGDS_DIR}/halflife2.fgd ${BUILD_DIR}/mapbase_shared/shared_misc/bin
echo "halflife2.fgd copied" echo "halflife2.fgd copied"
fi
echo "=====================" echo "====================="
echo "Copying READMEs" echo "Copying READMEs"
@ -218,14 +264,14 @@ rm -r VPKs/hl2_materials
echo "Loose hl2_materials removed" echo "Loose hl2_materials removed"
rm -r VPKs/lostcoast_materials rm -r VPKs/lostcoast_materials
echo "Loose lostcoast_materials removed" echo "Loose lostcoast_materials removed"
if [ "$USE_LOCAL_CODE" = true ] ;
then
rm -r VPKs/episodic_scenes rm -r VPKs/episodic_scenes
echo "Loose episodic_scenes removed" echo "Loose episodic_scenes removed"
rm -r VPKs/hl2_scenes rm -r VPKs/hl2_scenes
echo "Loose hl2_scenes removed" echo "Loose hl2_scenes removed"
fi
echo "====================="
echo "Verifying files"
echo "====================="
mkdir ${BUILD_DIR}/mapbase_episodic/custom mkdir ${BUILD_DIR}/mapbase_episodic/custom
mkdir ${BUILD_DIR}/mapbase_hl2/custom mkdir ${BUILD_DIR}/mapbase_hl2/custom
@ -233,28 +279,43 @@ mkdir ${BUILD_DIR}/mapbase_hl2/custom
mkdir ${BUILD_DIR}/mapbase_episodic/maps mkdir ${BUILD_DIR}/mapbase_episodic/maps
mkdir ${BUILD_DIR}/mapbase_hl2/maps mkdir ${BUILD_DIR}/mapbase_hl2/maps
if [ -e ${BUILD_DIR}/mapbase_episodic/bin/game_shader_dx9.dll ] echo "=========================================="
echo "Manual steps needed:"
echo "=========================================="
if [ "$USE_LOCAL_CODE" = false ] ;
then then
echo " Exists: mapbase_episodic/bin/game_shader_dx9.dll" echo " - ADD THE CODE"
echo " - Add binaries to mapbase_hl2 and mapbase_episodic"
echo " - If applicable, add compile tools"
if [ ! -e ${BUILD_DIR}/mapbase_hl2/content/hl2_scenes_dir.vpk ] && [ ! -e ${BUILD_DIR}/mapbase_episodic/content/episodic_scenes_dir.vpk ]
then
echo " - Add hl2_scenes and/or episodic_scenes VPKs to the respective games' content directories"
fi
else else
echo " *** WARNING: game_shader_dx9.dll missing from mapbase_episodic" if [ ! -e ${BUILD_DIR}/mapbase_episodic/bin/game_shader_dx9.dll ] || [ ! -e ${BUILD_DIR}/mapbase_hl2/bin/game_shader_dx9.dll ]
then
echo " - Add missing shader DLLs"
fi fi
if [ -e ${BUILD_DIR}/mapbase_hl2/bin/game_shader_dx9.dll ] if [ ! -e ${BUILD_DIR}/mapbase_hl2/bin/server.so ]
then then
echo " Exists: mapbase_hl2/bin/game_shader_dx9.dll" echo " - Add missing Linux SOs (if this build should support Linux)"
else fi
echo " *** WARNING: game_shader_dx9.dll missing from mapbase_hl2"
fi fi
if [ -e ${BUILD_DIR}/mapbase_shared/shared_content_dir.vpk ] if [ ! -e ${BUILD_DIR}/mapbase_shared/shared_misc/bin/base.fgd ]
then then
echo " Exists: Legacy pre-v7.0 shared_content_dir.vpk" echo " - Add the FGDs to mapbase_shared/shared_misc/bin"
else
echo " *** WARNING: Legacy pre-v7.0 shared_content_dir.vpk missing from mapbase_shared"
fi fi
echo "If any files are missing, you may just need to copy them from an existing version of the build." if [ ! -e ${BUILD_DIR}/mapbase_shared/shared_content_dir.vpk ]
then
echo " - Add legacy pre-v7.0 shared_content_dir.vpk to mapbase_shared (find from existing version of build)"
fi
echo "=========================================="
echo "Done! Press enter to continue" echo "Done! Press enter to continue"
read read