diff --git a/build.bat b/build.bat
deleted file mode 100644
index 06c43dcd2a..0000000000
--- a/build.bat
+++ /dev/null
@@ -1 +0,0 @@
-msbuild .\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32
diff --git a/build_g2.bat b/build_g2.bat
deleted file mode 100644
index 5d9efefebb..0000000000
--- a/build_g2.bat
+++ /dev/null
@@ -1 +0,0 @@
-.\build\release\openrct2.exe sprite build "data\g2.dat" "resources\g2"
diff --git a/pre-build.ps1 b/pre-build.ps1
deleted file mode 100644
index 3e350d0c26..0000000000
--- a/pre-build.ps1
+++ /dev/null
@@ -1,34 +0,0 @@
-#init
-$libversion = 4
-$path = Split-Path $Script:MyInvocation.MyCommand.Path
-$zip = $path+'\orctlibs.zip'
-$libs = $path+'\lib'
-$libsVFile = $path+'\libversion'
-$liburl = 'https://openrct2.website/files/orctlibs-vs.zip'
-$libsTest = Test-Path $libs
-
-#libs version test
-$libsVersionTest = Test-Path $libsVFile
-$currentVersion = 0
-$needsdownload = $true
-if ($libsVersionTest) {
- $currentVersion = [IO.File]::ReadAllText($libsVFile)
-}
-if ($currentVersion -ge $libversion) {
- $needsdownload = $false
-}
-
-#download
-if (!$libsTest -or $needsdownload) {
- if ($libsTest) {
- rm $libs -Recurse -Force
- }
- mkdir $libs
- Invoke-WebRequest $liburl -OutFile $path\orctlibs.zip
- [System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
- [System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $libs)
- rm $path\orctlibs.zip -Force -ErrorAction SilentlyContinue
- $libversion | Set-Content $libsVFile
-} else {
- echo 'All libs up to date'
-}
diff --git a/projects/libs/libs.vcxproj b/projects/libs/libs.vcxproj
index aa57182937..013a74598e 100644
--- a/projects/libs/libs.vcxproj
+++ b/projects/libs/libs.vcxproj
@@ -106,9 +106,6 @@
libcurl.lib;Ws2_32.lib;SDL2_ttf.lib;%(AdditionalDependencies)
true
-
- Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"
-
@@ -131,9 +128,6 @@
libcurl.lib;Ws2_32.lib;SDL2_ttf.lib;%(AdditionalDependencies)
-
- Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"
-
@@ -156,9 +150,6 @@
libcurl.lib;Ws2_32.lib;SDL2_ttf.lib;%(AdditionalDependencies)
-
- Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"
-
@@ -181,9 +172,6 @@
libcurl.lib;Ws2_32.lib;SDL2_ttf.lib;%(AdditionalDependencies)
-
- Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"
-
diff --git a/scripts/build.ps1 b/scripts/build.ps1
new file mode 100644
index 0000000000..ee5776c0c9
--- /dev/null
+++ b/scripts/build.ps1
@@ -0,0 +1 @@
+msbuild ..\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32 /v:minimal
diff --git a/scripts/build_g2.ps1 b/scripts/build_g2.ps1
new file mode 100644
index 0000000000..5fdd155a1f
--- /dev/null
+++ b/scripts/build_g2.ps1
@@ -0,0 +1 @@
+..\build\release\openrct2.exe sprite build "data\g2.dat" "resources\g2"
diff --git a/scripts/common.psm1 b/scripts/common.psm1
new file mode 100644
index 0000000000..21552a3096
--- /dev/null
+++ b/scripts/common.psm1
@@ -0,0 +1,12 @@
+#########################################################
+# Common functions for OpenRCT2 PowerShell scripts
+#########################################################
+
+function Prompt-User($message)
+{
+ $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes"
+ $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No"
+ $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
+ $choice = $host.UI.PromptForChoice("", $message, $options, 1)
+ return ($choice -eq 0)
+}
diff --git a/scripts/install.ps1 b/scripts/install.ps1
new file mode 100644
index 0000000000..f61e579d89
--- /dev/null
+++ b/scripts/install.ps1
@@ -0,0 +1,62 @@
+#########################################################
+# Script to install the latest dependencies for OpenRCT2
+#########################################################
+param (
+ [switch]$Force
+)
+Write-Output "Installing OpenRCT2 development environment for Windows"
+Import-Module ".\common.psm1" -DisableNameChecking
+
+# Settings
+$libsUrl = "https://openrct2.website/files/orctlibs-vs.zip"
+
+# Dependencies version (increment this when the dependencies is updated)
+$libsVersion = 4
+
+# Get paths
+$scriptPath = $Script:MyInvocation.MyCommand.Path
+$scriptsPath = Split-Path $scriptPath
+$rootPath = Split-Path $scriptsPath
+$libsPath = Join-Path $rootPath "lib"
+$zipPath = Join-Path $libsPath "orctlibs.zip"
+$libsVersionPath = Join-Path $libsPath "libversion"
+
+# Check if we need to update the dependencies
+$currentLibsVersion = 0
+$updateLibs = $true
+if (Test-Path $libsVersionPath)
+{
+ $currentLibsVersion = [IO.File]::ReadAllText($libsVersionPath)
+}
+if ($currentLibsVersion -ge $libsVersion)
+{
+ $updateLibs = $false
+}
+
+# Check if user needs to download dependencies
+$libsPathExists = Test-Path $libsPath
+if ($libsPathExists -and -not $updateLibs -and -not $Force)
+{
+ if (Prompt-User "Dependencies already exists, reinstall?")
+ {
+ $updateLibs = $true
+ }
+}
+else
+{
+ $updateLibs = $true
+}
+
+# Download latest version of the dependencies
+if ($updateLibs) {
+ Write-Output "Updating dependencies..."
+
+ Remove-Item -Force -Recurse $libsPath -ErrorAction SilentlyContinue
+ New-Item -Force -ItemType Directory $libsPath > $null
+
+ Invoke-WebRequest $libsUrl -OutFile $zipPath
+ [System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
+ [System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, $libsPath)
+ Remove-Item $zipPath -Force -ErrorAction SilentlyContinue
+ $libsVersion | Set-Content $libsVersionPath
+}
diff --git a/publish.ps1 b/scripts/publish.ps1
similarity index 58%
rename from publish.ps1
rename to scripts/publish.ps1
index 5a292e5c15..b26a6af9ec 100644
--- a/publish.ps1
+++ b/scripts/publish.ps1
@@ -1,10 +1,11 @@
-# Publish script for OpenRCT2
+#########################################################
+# Script to build and package OpenRCT2
# - Sets the source code preprocessor defines
# - Builds a clean release of OpenRCT2
# - Creates a ZIP for distribution
-
+#########################################################
param (
- [string]$server = "",
+ [string]$server = "",
[string]$buildNo = ""
)
@@ -42,30 +43,31 @@ function do-prepareSource($build_server = "", $build_number = "")
function do-build()
{
Write-Output "Building OpenRCT2..."
- msbuild .\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32 /t:rebuild /v:minimal
+ msbuild ..\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32 /t:rebuild /v:minimal
}
# Package
function do-package()
{
Write-Output "Publishing OpenRCT2..."
- $releaseDir = ".\build\Release"
- $distDir = ".\distribution"
- $tempDir = ".\artifacts\temp"
- $outZip = ".\artifacts\openrct2.zip"
+ $releaseDir = "..\build\Release"
+ $distDir = "..\distribution"
+ $tempDir = "..\artifacts\temp"
+ $outZip = "..\artifacts\openrct2.zip"
# Create new temp directory
Remove-Item -Force -Recurse $tempDir -ErrorAction SilentlyContinue
New-Item -Force -ItemType Directory $tempDir > $null
# Copy files to be archived
- Copy-Item -Force "$releaseDir\openrct2.exe" $tempDir -ErrorAction Stop
- Copy-Item -Force "$releaseDir\openrct2.dll" $tempDir -ErrorAction Stop
- Copy-Item -Force "$releaseDir\curl-ca-bundle.crt" $tempDir -ErrorAction Stop
- Copy-Item -Force "$releaseDir\SDL2.dll" $tempDir -ErrorAction Stop
- Copy-Item -Force "$distDir\changelog.txt" $tempDir -ErrorAction Stop
- Copy-Item -Force "$distDir\known_issues.txt" $tempDir -ErrorAction Stop
- Copy-Item -Force "$distDir\readme.txt" $tempDir -ErrorAction Stop
+ Copy-Item -Force -Recurse "$releaseDir\data" $tempDir -ErrorAction Stop
+ Copy-Item -Force "$releaseDir\openrct2.exe" $tempDir -ErrorAction Stop
+ Copy-Item -Force "$releaseDir\openrct2.dll" $tempDir -ErrorAction Stop
+ Copy-Item -Force "$releaseDir\curl-ca-bundle.crt" $tempDir -ErrorAction Stop
+ Copy-Item -Force "$releaseDir\SDL2.dll" $tempDir -ErrorAction Stop
+ Copy-Item -Force "$distDir\changelog.txt" $tempDir -ErrorAction Stop
+ Copy-Item -Force "$distDir\known_issues.txt" $tempDir -ErrorAction Stop
+ Copy-Item -Force "$distDir\readme.txt" $tempDir -ErrorAction Stop
# Create archive
7za a -tzip -mx9 $outZip "$tempDir\*"
@@ -74,6 +76,6 @@ function do-package()
Remove-Item -Force -Recurse $tempDir -ErrorAction SilentlyContinue
}
-do-prepareSource $server $buildNo
-do-build
+# do-prepareSource $server $buildNo
+# do-build
do-package