1
0

Merge pull request #8 from GenZmeY/dev

Add support for any steam library folders (v1.8.0)
This commit is contained in:
GenZmeY 2023-04-03 05:40:45 +03:00 committed by GitHub
commit 2cc9940461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 20 deletions

View File

@ -9,7 +9,7 @@ jobs:
update-docs: update-docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Update docs - name: Update docs

View File

@ -11,7 +11,7 @@ jobs:
name: shellcheck name: shellcheck
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Run ShellCheck - name: Run ShellCheck
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master
env: env:

View File

@ -10,7 +10,7 @@ jobs:
name: shellcheck name: shellcheck
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Run ShellCheck - name: Run ShellCheck
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master
env: env:

View File

@ -15,11 +15,6 @@
- Killing Floor 2 - SDK; - Killing Floor 2 - SDK;
- [git-bash](https://git-scm.com/download/win). - [git-bash](https://git-scm.com/download/win).
# Limits
You can keep mod sources anywhere, but `Killing Floor 2` and `Killing Floor 2 - SDK` must be installed on the system drive (C:\ in most cases).
(I plan to fix this limitation in the future)
# Add to your project # Add to your project
Make sure that the location of folders and files in your project as follows (Correct it if it's not): Make sure that the location of folders and files in your project as follows (Correct it if it's not):
`/<PackageName>/Classes/*.uc` `/<PackageName>/Classes/*.uc`
@ -117,8 +112,5 @@ By the way, this allows you to use a script to upload maps (although this was no
**two mutators are uploaded to the steam workshop:** **two mutators are uploaded to the steam workshop:**
- [UnofficialMod](https://github.com/GenZmeY/UnofficialMod) - [UnofficialMod](https://github.com/GenZmeY/UnofficialMod)
# Other
[TODO List](TODO.md)
# License # License
[GNU GPLv3](LICENSE) [GNU GPLv3](LICENSE)

View File

@ -1,6 +1,2 @@
# TODO: # TODO:
- [ ] add kf2 support in another steam library (`Steam\steamapps\libraryfolders.vdf` may help)
- [ ] hooks (precompile, postcompile, prebrew, etc...)
- [ ] improve error parser (class vs name mismatch, etc...) - [ ] improve error parser (class vs name mismatch, etc...)
- [ ] server testing
- [ ] check description for quotes and warn about it (or add quotes support somehow)

61
builder
View File

@ -34,6 +34,32 @@ function reg_readkey () # $1: path, $2: key
fi fi
} }
function steamlib_by_steamid () # $1: SteamID
{
local Path
if ! [[ -f "$SteamLibFoldersVdf" ]]; then
return
fi
while read -r Line
do
if echo "$Line" | grep -Foq '"path"'; then
Path="$(echo "$Line" | sed -r 's|^\s*\"path\"\s*||' | sed 's|"||g')"
fi
if echo "$Line" | grep -Poq "^\s*\"${1}\"\s*\"\d+\"$"; then
wrapped_cygpath --unix "$Path"
fi
done < "$SteamLibFoldersVdf"
}
function wrapped_cygpath () # $@: Params
{
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
cygpath "$@"
fi
}
# Whoami # Whoami
ScriptFullname="$(readlink -e "$0")" ScriptFullname="$(readlink -e "$0")"
ScriptName="$(basename "$0")" ScriptName="$(basename "$0")"
@ -41,19 +67,23 @@ ScriptDir="$(dirname "$ScriptFullname")"
# Common # Common
SteamPath="$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")" SteamPath="$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")"
DocumentsPath="$(reg_readkey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal")" DocumentsPath="$(wrapped_cygpath --mydocs)"
ThirdPartyBin="$ScriptDir/3rd-party-bin" ThirdPartyBin="$ScriptDir/3rd-party-bin"
DummyPreview="$ScriptDir/dummy_preview.png" DummyPreview="$ScriptDir/dummy_preview.png"
SteamLibFoldersVdf="$SteamPath/steamapps/libraryfolders.vdf"
# Usefull KF2 executables / Paths / Configs # Usefull KF2 executables / Paths / Configs
KFDoc="$DocumentsPath/My Games/KillingFloor2" KFDoc="$DocumentsPath/My Games/KillingFloor2"
KFPath="$SteamPath/steamapps/common/killingfloor2" KFSteamLibraryFolder="$(steamlib_by_steamid "232090")"
KFDev="$KFPath/Development/Src" KFSDKSteamLibraryFolder="$(steamlib_by_steamid "232150")"
KFWin64="$KFPath/Binaries/Win64" KFPath="$KFSteamLibraryFolder/steamapps/common/killingfloor2"
KFSDKPath="$KFSDKSteamLibraryFolder/steamapps/common/killingfloor2"
KFDev="$KFSDKPath/Development/Src"
KFWin64="$KFSDKPath/Binaries/Win64"
KFEditor="$KFWin64/KFEditor.exe" KFEditor="$KFWin64/KFEditor.exe"
KFEditorPatcher="$KFWin64/kfeditor_patcher.exe" KFEditorPatcher="$KFWin64/kfeditor_patcher.exe"
KFEditorMergePackages="$KFWin64/KFEditor_mergepackages.exe" KFEditorMergePackages="$KFWin64/KFEditor_mergepackages.exe"
KFGame="$KFWin64/KFGame.exe" KFGame="$KFPath/Binaries/Win64/KFGame.exe"
KFWorkshop="$KFPath/Binaries/WorkshopUserTool.exe" KFWorkshop="$KFPath/Binaries/WorkshopUserTool.exe"
KFUnpublish="$KFDoc/KFGame/Unpublished" KFUnpublish="$KFDoc/KFGame/Unpublished"
KFPublish="$KFDoc/KFGame/Published" KFPublish="$KFDoc/KFGame/Published"
@ -931,6 +961,11 @@ function upload ()
warn "The size of $(basename "$Preview") is greater than 1mb. Steam may prevent you from loading content with this image. if you get an error while loading - try using a smaller preview." warn "The size of $(basename "$Preview") is greater than 1mb. Steam may prevent you from loading content with this image. if you get an error while loading - try using a smaller preview."
fi fi
if grep -Fq '"' "$MutPubContentDescription"; then
warn "Double quotes (\") found in $(basename "$MutPubContentDescription"), this may prevent the item from being uploaded to the workshop"
warn "Remove double quotes if there are problems uploading to the workshop"
fi
find "$KFPublish" -type d -empty -delete find "$KFPublish" -type d -empty -delete
# it's a bad idea to use the $KFPublish folder for upload # it's a bad idea to use the $KFPublish folder for upload
@ -1057,6 +1092,22 @@ function main ()
if is_true "$ArgVersion"; then version; die "" 0; fi if is_true "$ArgVersion"; then version; die "" 0; fi
if is_true "$ArgHelp"; then usage; die "" 0; fi if is_true "$ArgHelp"; then usage; die "" 0; fi
# Checks
if [[ -z "$KFSteamLibraryFolder" ]]; then
err "\"Killing Floor 2\" not found"
fi
if [[ -z "$KFSDKSteamLibraryFolder" ]]; then
err "\"Killing Floor 2 - SDK\" not found"
fi
if [[ -z "$KFSteamLibraryFolder" ]] || [[ -z "$KFSDKSteamLibraryFolder" ]]; then
die "" 1
elif [[ "$KFPath" != "$KFSDKPath" ]]; then
warn "\"Killing Floor 2\" and \"Killing Floor 2 - SDK\" installed in different steam library folders."
warn "If you get errors, install them in the same steam library folder."
fi
# Backup # Backup
if is_true "$ArgCompile" || is_true "$ArgBrew"; then backup_kfeditorconf; fi if is_true "$ArgCompile" || is_true "$ArgBrew"; then backup_kfeditorconf; fi