From c05a5b4a8369fea9078bd4760571ea14b8d82c3b Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 03:31:44 +0300 Subject: [PATCH 1/9] use cygpath instead of reg query to find mydocs --- builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder b/builder index 6fd4c0c..312c627 100644 --- a/builder +++ b/builder @@ -41,7 +41,7 @@ ScriptDir="$(dirname "$ScriptFullname")" # Common SteamPath="$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")" -DocumentsPath="$(reg_readkey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal")" +DocumentsPath="$(cygpath --mydocs)" ThirdPartyBin="$ScriptDir/3rd-party-bin" DummyPreview="$ScriptDir/dummy_preview.png" From fbd47e013d0656e52b9b19cdc100d425bf9a030b Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 04:41:12 +0300 Subject: [PATCH 2/9] add support for any steam library folders --- builder | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/builder b/builder index 312c627..1e476eb 100644 --- a/builder +++ b/builder @@ -34,6 +34,21 @@ function reg_readkey () # $1: path, $2: key fi } +function steamlib_by_steamid () # $1: SteamID +{ + local Path + + 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 + cygpath --unix "$Path" + fi + done < "$SteamLibFoldersVdf" +} + # Whoami ScriptFullname="$(readlink -e "$0")" ScriptName="$(basename "$0")" @@ -44,16 +59,18 @@ SteamPath="$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")" DocumentsPath="$(cygpath --mydocs)" ThirdPartyBin="$ScriptDir/3rd-party-bin" DummyPreview="$ScriptDir/dummy_preview.png" +SteamLibFoldersVdf="$SteamPath/steamapps/libraryfolders.vdf" # Usefull KF2 executables / Paths / Configs KFDoc="$DocumentsPath/My Games/KillingFloor2" -KFPath="$SteamPath/steamapps/common/killingfloor2" -KFDev="$KFPath/Development/Src" -KFWin64="$KFPath/Binaries/Win64" +KFPath="$(steamlib_by_steamid "232090")/steamapps/common/killingfloor2" +KFSDKPath="$(steamlib_by_steamid "232150")/steamapps/common/killingfloor2" +KFDev="$KFSDKPath/Development/Src" +KFWin64="$KFSDKPath/Binaries/Win64" KFEditor="$KFWin64/KFEditor.exe" KFEditorPatcher="$KFWin64/kfeditor_patcher.exe" KFEditorMergePackages="$KFWin64/KFEditor_mergepackages.exe" -KFGame="$KFWin64/KFGame.exe" +KFGame="$KFPath/Binaries/Win64/KFGame.exe" KFWorkshop="$KFPath/Binaries/WorkshopUserTool.exe" KFUnpublish="$KFDoc/KFGame/Unpublished" KFPublish="$KFDoc/KFGame/Published" @@ -1049,6 +1066,12 @@ function main () setup_colors export PATH="$PATH:$ThirdPartyBin" + # Checks + if [[ "$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 + # Modifiers if is_true "$ArgDebug"; then set -o xtrace; fi From afd68517f97e311db9337d9d8d837e38db7e9414 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 05:08:57 +0300 Subject: [PATCH 3/9] add checks for build dependencies --- builder | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/builder b/builder index 1e476eb..f2943f8 100644 --- a/builder +++ b/builder @@ -63,8 +63,10 @@ SteamLibFoldersVdf="$SteamPath/steamapps/libraryfolders.vdf" # Usefull KF2 executables / Paths / Configs KFDoc="$DocumentsPath/My Games/KillingFloor2" -KFPath="$(steamlib_by_steamid "232090")/steamapps/common/killingfloor2" -KFSDKPath="$(steamlib_by_steamid "232150")/steamapps/common/killingfloor2" +KFSteamLibraryFolder="$(steamlib_by_steamid "232090")" +KFSDKSteamLibraryFolder="$(steamlib_by_steamid "232150")" +KFPath="$KFSteamLibraryFolder/steamapps/common/killingfloor2" +KFSDKPath="$KFSDKSteamLibraryFolder/steamapps/common/killingfloor2" KFDev="$KFSDKPath/Development/Src" KFWin64="$KFSDKPath/Binaries/Win64" KFEditor="$KFWin64/KFEditor.exe" @@ -1067,7 +1069,17 @@ function main () export PATH="$PATH:$ThirdPartyBin" # Checks - if [[ "$KFPath" != "$KFSDKPath" ]]; then + 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 From cb4f8730ecd0eb278929cb698dc226f356ff1d9c Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 05:10:24 +0300 Subject: [PATCH 4/9] add a check for quotes in the description --- builder | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builder b/builder index f2943f8..21a7889 100644 --- a/builder +++ b/builder @@ -950,6 +950,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." 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 # it's a bad idea to use the $KFPublish folder for upload From c34ffcbe76c7011337f5167736adffee05fcf192 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 05:21:55 +0300 Subject: [PATCH 5/9] hide cygpath from unix systems --- builder | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/builder b/builder index 21a7889..987ca31 100644 --- a/builder +++ b/builder @@ -38,17 +38,28 @@ 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 - cygpath --unix "$Path" + wrapped_cygpath --unix "$Path" fi done < "$SteamLibFoldersVdf" } +function wrapped_cygpath () # $@: Params +{ + if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then + cygpath "$@" + fi +} + # Whoami ScriptFullname="$(readlink -e "$0")" ScriptName="$(basename "$0")" @@ -56,7 +67,7 @@ ScriptDir="$(dirname "$ScriptFullname")" # Common SteamPath="$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")" -DocumentsPath="$(cygpath --mydocs)" +DocumentsPath="$(wrapped_cygpath --mydocs)" ThirdPartyBin="$ScriptDir/3rd-party-bin" DummyPreview="$ScriptDir/dummy_preview.png" SteamLibFoldersVdf="$SteamPath/steamapps/libraryfolders.vdf" From 7c00500bf2937a79e6fbcac359f0f9cd0b5bcf61 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 05:24:52 +0300 Subject: [PATCH 6/9] move the checks so they do not interfere with calling help page --- builder | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/builder b/builder index 987ca31..d49a495 100644 --- a/builder +++ b/builder @@ -1084,6 +1084,14 @@ function main () setup_colors export PATH="$PATH:$ThirdPartyBin" + # Modifiers + if is_true "$ArgDebug"; then set -o xtrace; fi + + # Help + if is_true "$ArgVersion" && is_true "$ArgHelp"; then version; usage; die "" 0; fi + if is_true "$ArgVersion"; then version; die "" 0; fi + if is_true "$ArgHelp"; then usage; die "" 0; fi + # Checks if [[ -z "$KFSteamLibraryFolder" ]]; then err "\"Killing Floor 2\" not found" @@ -1100,14 +1108,6 @@ function main () warn "If you get errors, install them in the same steam library folder." fi - # Modifiers - if is_true "$ArgDebug"; then set -o xtrace; fi - - # Help - if is_true "$ArgVersion" && is_true "$ArgHelp"; then version; usage; die "" 0; fi - if is_true "$ArgVersion"; then version; die "" 0; fi - if is_true "$ArgHelp"; then usage; die "" 0; fi - # Backup if is_true "$ArgCompile" || is_true "$ArgBrew"; then backup_kfeditorconf; fi From d1945c16989daa240296d46bdfcf439b55cac63f Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 05:26:01 +0300 Subject: [PATCH 7/9] update CI/CD --- .github/workflows/docs-autoupdate.yml | 2 +- .github/workflows/shellcheck-dev.yml | 2 +- .github/workflows/shellcheck-master.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-autoupdate.yml b/.github/workflows/docs-autoupdate.yml index 6485968..21e1d6f 100644 --- a/.github/workflows/docs-autoupdate.yml +++ b/.github/workflows/docs-autoupdate.yml @@ -9,7 +9,7 @@ jobs: update-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Update docs diff --git a/.github/workflows/shellcheck-dev.yml b/.github/workflows/shellcheck-dev.yml index 3af277f..45d88ee 100644 --- a/.github/workflows/shellcheck-dev.yml +++ b/.github/workflows/shellcheck-dev.yml @@ -11,7 +11,7 @@ jobs: name: shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master env: diff --git a/.github/workflows/shellcheck-master.yml b/.github/workflows/shellcheck-master.yml index 6c381aa..130bad2 100644 --- a/.github/workflows/shellcheck-master.yml +++ b/.github/workflows/shellcheck-master.yml @@ -10,7 +10,7 @@ jobs: name: shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master env: From 04f6b6313ece4d6b7f94f04326f30118184fecfc Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 05:28:24 +0300 Subject: [PATCH 8/9] Update TODO.md --- TODO.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/TODO.md b/TODO.md index 0cd03d5..62e4250 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,2 @@ # 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...) -- [ ] server testing -- [ ] check description for quotes and warn about it (or add quotes support somehow) From 0ba5b7c8d351f11480e1d5db77871b5411df6eab Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 Apr 2023 05:29:09 +0300 Subject: [PATCH 9/9] Update README.md --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index 143ad28..9fc01e8 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,6 @@ - Killing Floor 2 - SDK; - [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 Make sure that the location of folders and files in your project as follows (Correct it if it's not): `//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:** - [UnofficialMod](https://github.com/GenZmeY/UnofficialMod) -# Other -[TODO List](TODO.md) - # License [GNU GPLv3](LICENSE)