Skip to content

Instantly share code, notes, and snippets.

@NekoiNemo
Created August 14, 2024 13:11
Show Gist options
  • Save NekoiNemo/1fd7aa6dd4cfaf6e411423464a0eabcd to your computer and use it in GitHub Desktop.
Save NekoiNemo/1fd7aa6dd4cfaf6e411423464a0eabcd to your computer and use it in GitHub Desktop.
#! /bin/bash
if [ "$#" -lt 2 ]; then
cat <<EOF
For use in Steam. Change Hitman's launch options in Steam to "./peacock_steam.sh HOST:PORT %command%"
Where HOST:PORT is the address of your Peacock server (you can omit "HOST:" if it's running locally), e.g.:
./peacock_steam.sh 4747 %command%
./peacock_steam.sh 192.168.0.10:5000 %command%
EOF
exit 1
fi
# ================ Get server address ================
if [[ $1 != *:* ]]; then
address="127.0.0.1:$1"
else
address="$1"
fi
shift 1
# ================ Create launcher ================
cat <<EOF >PeacockPatched.bat
@echo off
start Launcher.exe %* -skip_launcher
start PeacockPatcher.exe --headless --domain "$address"
EOF
# Alternatively comment out the block above and uncomment one below
# This will launch the PeacockPatcher GUI and won't skip the Hitman Launcher
# cat <<EOF >PeacockPatched.bat
# @echo off
# start Launcher.exe %*
# start PeacockPatcher.exe
# EOF
# ================ Start the game ================
#======== Before game starts ========
# Any command executed here must exit for game to get launched!
# Examples:
# docker start peacock_server
# systemctl --user start peacock.service
#======== Start Game ========
"${@/Launcher.exe/PeacockPatched.bat}"
#======== After game exits ========
# Any command executed here will keep the game still running in the eyes of Steam, until it exits
# Examples:
# docker stop peacock_server
# systemctl --user stop peacock.service
# ================ Cleanup ================
rm PeacockPatched.bat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment