From 43abc56a41c94b7f83092f896ea1060309de0c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Sat, 26 Nov 2022 13:54:20 +0100 Subject: [PATCH] Improve build scripts and move them to `scripts/` --- .gitignore | 3 ++- README.md | 12 +++++++++--- RELEASE.md | 1 + build.sh | 24 ------------------------ scripts/build.bat | 2 ++ scripts/build.ps1 | 31 +++++++++++++++++++++++++++++++ scripts/run_loop.bat | 15 +++++++++++++++ scripts/test_debug.bat | 20 ++++++++++++++++++++ scripts/test_release.bat | 20 ++++++++++++++++++++ 9 files changed, 100 insertions(+), 28 deletions(-) delete mode 100644 build.sh create mode 100644 scripts/build.bat create mode 100644 scripts/build.ps1 create mode 100644 scripts/run_loop.bat create mode 100644 scripts/test_debug.bat create mode 100644 scripts/test_release.bat diff --git a/.gitignore b/.gitignore index 9a9bd73..1bc698b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ bin/ obj/ /.vs/ *.user -build-release/ +build-Release/ +build-Debug/ .vscode/ diff --git a/README.md b/README.md index 2257a03..cf11557 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ to make `SteamController.exe` the one mapping those. 1. In a new window click `DELETE`. 1. Now click `B` or `DONE`. -## 4. Risks +## 5. Risks **This software is provided on best-effort basis and can break your SteamDeck.** It does a direct manipulation of kernel memory to control usage the EC (Embedded Controller) and setting desired fan RPM via VLV0100 @@ -231,7 +231,7 @@ The memory addresses used are hardcoded and can be changed any moment by the Bio Fortunately quite amount of people are using it with a success and no problems observed. However, you should be aware of the consequences. -### 4.1. Risk of CPU and GPU frequency change +### 5.1. Risk of CPU and GPU frequency change The APU manipulation of CPU and GPU frequency uses a ported implementation from Linux kernel. It is more unstable than Fan Control (since the Fan Control is controller managing EC on Windows). @@ -242,7 +242,7 @@ power shutdown the device. Disconnect from charging, and hold power button for a Power device normally afterwards. This is rather unlikely to break the device if done right after when such event occurs. -## 5. Anti-Cheat and Antivirus software +## 6. Anti-Cheat and Antivirus software Since this project uses direct manipulation of kernel memory via `inpoutx64.dll` it might trigger Antivirus and Anti-Cheat software. @@ -250,6 +250,12 @@ it might trigger Antivirus and Anti-Cheat software. You might consider disabling all tools if this happens. Unfortunatelly there's no worakound for that unless someone gets access to driver signing certificate for Windows. +## 7. Development + +It should be enough to run `scripts/build.bat` to see binaries in `build-release/`. + +You might also run `scripts/test_debug.bat` which will build and run built version. + ## Author Kamil TrzciƄski, 2022 diff --git a/RELEASE.md b/RELEASE.md index eacec8c..d29e834 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -4,6 +4,7 @@ - Fix `FanControl` broken context menu - Fix incorrect `CurrentProfile` of `SteamController` - Fix right stick serving as mouse in `X360` mode +- Improve build scripts in `scripts/` ## 0.4.x diff --git a/build.sh b/build.sh deleted file mode 100644 index 670d702..0000000 --- a/build.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -if [[ $# -ne 0 ]] && [[ $# -ne 1 ]]; then - echo "usage: $0 [output_path]" - exit 1 -fi - -set -eo pipefail - -majorVer=$(cat VERSION) -lastVer=$(git tag --sort version:refname --list "$majorVer.*" | tail -n1) -if [[ -n "$lastVer" ]]; then - newVer=(${lastVer//./ }) - newVer[-1]="$((${newVer[-1]}+1))" - nextVer="${newVer[*]}" - nextVer="${nextVer// /.}" -else - nextVer="$majorVer.0" -fi - -echo "MajorVer=$majorVer LastVer=$lastVer NextVer=$nextVer" - -args="--configuration Release /property:Version=$nextVer" -dotnet build $args --output "${1:-build-release/}" diff --git a/scripts/build.bat b/scripts/build.bat new file mode 100644 index 0000000..8cd2fb0 --- /dev/null +++ b/scripts/build.bat @@ -0,0 +1,2 @@ +powershell -ExecutionPolicy UnRestricted -File "%~dp0\build.ps1" +timeout /t 5 diff --git a/scripts/build.ps1 b/scripts/build.ps1 new file mode 100644 index 0000000..aa04f44 --- /dev/null +++ b/scripts/build.ps1 @@ -0,0 +1,31 @@ +cd "$PSScriptRoot/.." + +$configuration = "Release" +if ($args[0]) { + $configuration = $args[0] +} + +$path = "build-$configuration" +if ($args[1]) { + $path = $args[1] +} + +$majorVer = Get-Content VERSION +$lastVer = git tag --sort version:refname --list "$majorVer.*" | Select -last 1 + +echo "Configuration: $configuration" +echo "BuildPath: $path" +echo "Major: $majorVer" +echo "lastVer: $lastVer" + +if ($lastVer -ne "") { + $nextVer = $lastVer.Split('.') + $lastItem = $nextVer.Length-1 + $nextVer[$lastItem] = [int]$nextVer[$lastItem] + 1 + $nextVer = $nextVer -Join '.' +} else { + $nextVer="$majorVer.0" +} + +dotnet --list-sdks -or winget install Microsoft.DotNet.SDK.6 +dotnet build --configuration "$configuration" "/property:Version=$nextVer" --output "$path" diff --git a/scripts/run_loop.bat b/scripts/run_loop.bat new file mode 100644 index 0000000..b64934d --- /dev/null +++ b/scripts/run_loop.bat @@ -0,0 +1,15 @@ +if not "%1"=="am_admin" (powershell start -verb runas '%0' 'am_admin,%1' & exit /b) +if "%2"=="" (echo missing name & timeout /t 3 & exit /b) + +cd "%~dp0" + +:retry + +taskkill /F /IM "%1.exe" +del %1\bin\Debug\net6.0-windows\%1.exe + +dotnet build +%1\bin\Debug\net6.0-windows\%1.exe + +timeout /t 3 +goto retry diff --git a/scripts/test_debug.bat b/scripts/test_debug.bat new file mode 100644 index 0000000..8fa0e6b --- /dev/null +++ b/scripts/test_debug.bat @@ -0,0 +1,20 @@ +if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b) + +:retry +cd "%~dp0" + +set configuration=Debug + +taskkill /F /IM FanControl.exe +taskkill /F /IM PerformanceOverlay.exe +taskkill /F /IM PowerControl.exe +taskkill /F /IM SteamController.exe + +powershell -ExecutionPolicy UnRestricted -File "%~dp0\build.ps1" "%configuration%" + +start ..\build-%configuration%\FanControl.exe +start ..\build-%configuration%\PerformanceOverlay.exe +start ..\build-%configuration%\PowerControl.exe +start ..\build-%configuration%\SteamController.exe + +timeout /t 5 diff --git a/scripts/test_release.bat b/scripts/test_release.bat new file mode 100644 index 0000000..8fa0e6b --- /dev/null +++ b/scripts/test_release.bat @@ -0,0 +1,20 @@ +if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b) + +:retry +cd "%~dp0" + +set configuration=Debug + +taskkill /F /IM FanControl.exe +taskkill /F /IM PerformanceOverlay.exe +taskkill /F /IM PowerControl.exe +taskkill /F /IM SteamController.exe + +powershell -ExecutionPolicy UnRestricted -File "%~dp0\build.ps1" "%configuration%" + +start ..\build-%configuration%\FanControl.exe +start ..\build-%configuration%\PerformanceOverlay.exe +start ..\build-%configuration%\PowerControl.exe +start ..\build-%configuration%\SteamController.exe + +timeout /t 5