From 8ebc47825f7721937e6b8c6fb9d0b14cc5f2fd66 Mon Sep 17 00:00:00 2001 From: ZKWolf <34097612+wolfswolke@users.noreply.github.com> Date: Mon, 29 Jul 2024 19:51:28 +0200 Subject: [PATCH] Updated updater.md to explain the script in detail --- Doc/updater.md | 142 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 117 insertions(+), 25 deletions(-) diff --git a/Doc/updater.md b/Doc/updater.md index 1b13f0c..82895e4 100644 --- a/Doc/updater.md +++ b/Doc/updater.md @@ -1,4 +1,4 @@ -# Updater WIP DOC! +# Updater The Updater is a self writen Script that updates the Game modifications to the latest build. @@ -6,47 +6,139 @@ In the future there will also be a in-game part that will show you when you need # 1. Script explained -## 1.1 Script Part X +## SET COMMANDS +``SET`` is used to set a name to with a value. -# 2. Endpoints +This is used, so you can for instance have a url and multiple paths and if you change the URL you only need to change it once -These Endpoints are used by the updater to download its files, check for newer versions,... +``%~dp0\`` This is a special Windows command that gets the path of the script. -ROOT: /updater/ +It's used to get the current folder and to not have to search for DEATHGARDEN. -## 2.1 /updater/version/* -Type: GET +``%SYSTEMROOT%`` This variable is used to get the path of the Windows folder. -Response Type: JSON +We need the powershell application to download the files and check the version. -Example: {"version": 1} +This is also possible in CMD, but it's a lot more complicated. -Description: Used to check for newer Versions. +## IF NOT EXIST -### 2.1.1 Sub-Endpoints -/script +``IF NOT EXIST`` is used to check if a file or folder exists. -/pak +We use it 4 times. -/sig +1. Check if we are currently in the DEATHGARDEN folder +2. Check if the ``updater_versions`` folder exists +3. Check if the ``pak_version.txt`` file exists +4. Check if the ``sig_version.txt`` file exists -## 2.2 /updater/files/* -Type: GET +Between those we also use the ``SET`` command again to get the content of the ``pak_version.txt`` and ``sig_version.txt`` files. -Response: FILE +We set those into the variables ``pak_version`` and ``sig_version`` for later use. -Description: Used for downloading Files. +## CHOICE -### 2.2.1 Sub-Endpoints -/script +``CHOICE`` As the name says you can CHOOSE something and depending on what you choose GOTO will be used to jump to a specific part of the script. -/pak +## GOTO -/sig +``GOTO`` is used to jump to a specific part of the script. -# 3. In-Game Part +Anything that can be jumped to is marked with a ``:`` at the beginning. Like ``:FirstTimeSetup`` -What it does +## POWER SHELL -How its done \ No newline at end of file +The next 3 commands are the "brain" of the script. + +1. Check if the script is up-to-date + +``%power%`` anything after this will be run in PowerShell. + +``[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;`` This is used to set the security protocol to TLS 1.2. + +``$webRequest = Invoke-WebRequest https://api.zkwolf.com/updater/versions -UseBasicParsing;`` This is used to get the latest version from the API. + +``$Data = ConvertFrom-Json $webRequest.Content;`` This is used to convert the JSON content to a PowerShell object. + +``if ( $Data.script_version -gt '%updater_version%' ) {`` This is used to check if the script version is higher than the current version. + +``'A new Version of this Script is available. Please download it here: ' + 'V-' + $Data.script_version + '.';`` This is used to show a message if a new version is available. + +``echo 'https://api.zkwolf.com/updater/files/script';`` This is used to show the download link. + +2. Check if the PAK file is up-to-date and if not download it + +``%power% `` anything after this will be run in PowerShell. + +``[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;`` This is used to set the security protocol to TLS 1.2. + +``$webRequest = Invoke-WebRequest https://api.zkwolf.com/updater/versions -UseBasicParsing;`` This is used to get the latest version from the API. + +``$Data = ConvertFrom-Json $webRequest.Content;`` This is used to convert the JSON content to a PowerShell object. + +``$pak_version = '%pak_version%' -replace '\D', '';`` This is used to get the current version of the PAK file. + +``if ( $Data.pak_version -gt $pak_version ) {`` This is used to check if the PAK file version is higher than the current version. + +``'A new Version of the PAK File is available. Downloading it now: ' + 'V-' + $Data.pak_version + '.';`` This is used to show a message if a new version is available. + +``Invoke-WebRequest '%download_url%pak/' -OutFile '%pak_folder%TheExitRebirthBackendAPI-WindowsNoEditor_P.pak';`` This is used to download the new PAK file. + +3. Check if the SIG file is up-to-date and if not download it + +`` %power% `` anything after this will be run in PowerShell. + +``[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;`` This is used to set the security protocol to TLS 1.2. + +``$webRequest = Invoke-WebRequest https://api.zkwolf.com/updater/versions -UseBasicParsing;`` This is used to get the latest version from the API. + +``$Data = ConvertFrom-Json $webRequest.Content;`` This is used to convert the JSON content to a PowerShell object. + +``$sig_version = '%sig_version%' -replace '\D', '';`` This is used to get the current version of the SIG file. + +``if ( $Data.sig_version -gt $sig_version ) {`` This is used to check if the SIG file version is higher than the current version. + +``'A new Version of the SIG File is available. Downloading it now: ' + 'V-' + $Data.sig_version + '.';`` This is used to show a message if a new version is available. + +``Invoke-WebRequest '%download_url%sig/' -OutFile '%pak_folder%TheExitRebirthBackendAPI-WindowsNoEditor_P.sig';`` This is used to download the new SIG file. + +## CLS + +This is used to clear the console. (Clear means removing all text above) + +## ECHO + +This just shows a message in the console. + +## PAUSE + +This is used to pause the script, so you can read the messages. + +## FirstTimeSetup + +This is used to set up the game folder if you have never played the game. + +It does these 3 things. + +1. DELETE the Battleye folder +2. DELETE the TheExit_BE.exe file (This is the Battleye Launcher) +3. RENAME the TheExit.exe file to TheExit_BE.exe (This is done because steam opens this file when you click START.) + +## RMDIR + +This is used to delete a folder. + +## DEL + +This is used to delete a file. + +## REN + +This is used to rename a file. + +# 2. How to use the Script + +1. Download the script from GitHub +2. Put it into the DEATHGARDEN folder +3. Run the script \ No newline at end of file