diff --git a/.gitignore b/.gitignore index 940d8b2a..dc2953cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ node_modules /dist -/src/build.json yarn.lock .vscode @@ -10,4 +9,7 @@ yarn.lock /BuildAssets.config.ps1 /build.js /build-worker.js +/payware +/src/build.json +/src/mod/Assets/RSC/AcelaPack01/InputMappers/AcelaExpert.xml *.dds \ No newline at end of file diff --git a/BuildAssets.ps1 b/BuildAssets.ps1 index 4647ea51..19f2f7e4 100644 --- a/BuildAssets.ps1 +++ b/BuildAssets.ps1 @@ -12,6 +12,78 @@ if (Test-Path .\BuildAssets.config.ps1) { . .\BuildAssets.config.ps1 } +Add-Type -Assembly System.IO.Compression.FileSystem + +# Step 1: Extract and modify payware assets. + +function Mkdir { + param( + [string]$Path + ) + New-Item $Path -ItemType Directory -ErrorAction SilentlyContinue +} + +function ExtractFromZip { + param( + [string]$Zip, + [string]$Entry, + [string]$Out + ) + try { + Mkdir $(Split-Path -Path $Out -Parent) + $ZipFile = [IO.Compression.ZipFile]::OpenRead($Zip) + $ZipEntry = $ZipFile.Entries | Where-Object FullName -EQ $Entry + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($ZipEntry, $Out, $True) + } finally { + $ZipFile.Dispose() + } +} + +function UnSerz { + [CmdletBinding()] + param( + [string]$In, + [string]$Out + ) + & "$RailWorks\serz.exe" $In "/xml:$Out" +} + +ExtractFromZip "$RailWorks\Assets\RSC\AcelaPack01\AcelaPack01Assets.ap" ` + "InputMappers/AcelaExpert.bin" ` + ".\payware\Assets\RSC\AcelaPack01\InputMappers\AcelaExpert.bin" +UnSerz ".\payware\Assets\RSC\AcelaPack01\InputMappers\AcelaExpert.bin" ` + ".\payware\Assets\RSC\AcelaPack01\InputMappers\AcelaExpert.xml" +(Get-Content -Path ".\payware\Assets\RSC\AcelaPack01\InputMappers\AcelaExpert.xml").Replace( + "", + @" + + + 0 + Keyboard + ButtonDown + + NoShift + NoAxis + IncreaseControlStart + AWSReset + 0 + + + 0 + Keyboard + ButtonUp + + NoShift + NoAxis + DecreaseControlStart + AWSReset + 0 + + +"@) | Set-Content -Path ".\src\mod\Assets\RSC\AcelaPack01\InputMappers\AcelaExpert.xml" + +# Step 2: Build our new assets. + function FindModPaths { [CmdletBinding()] param( @@ -37,7 +109,7 @@ function ToDist { ) foreach ($ModPath in $Input) { $OutDir = ".\dist\$(Split-Path -Path $ModPath -Parent)" - New-Item $OutDir -ItemType Directory -ErrorAction SilentlyContinue + Mkdir $OutDir $Build.Invoke(".\src\mod\$ModPath", ".\dist\$( $ModPath -replace '\.[\w]*$',$Extension )") } } @@ -84,23 +156,17 @@ function ConvertToTg { } function CopyOutput { - New-Item ` - "dist\Assets\DTG\WashingtonBaltimore\InputMapper" ` - -Type Directory -Force + Mkdir "dist\Assets\DTG\WashingtonBaltimore\InputMapper" Copy-Item ` "dist\Assets\RSC\AcelaPack01\InputMappers\AcelaExpert.bin" ` "dist\Assets\DTG\WashingtonBaltimore\InputMapper\AcelaExpert.bin" - New-Item ` - "dist\Assets\DTG\WashingtonBaltimore\Audio\RailVehicles\Electric\Acela\Cab" ` - -Type Directory -Force + Mkdir "dist\Assets\DTG\WashingtonBaltimore\Audio\RailVehicles\Electric\Acela\Cab" Copy-Item ` "dist\Assets\RSC\AcelaPack01\Audio\RailVehicles\Electric\Acela\Cab\*" ` "dist\Assets\DTG\WashingtonBaltimore\Audio\RailVehicles\Electric\Acela\Cab" - New-Item ` - "dist\Assets\DTG\WashingtonBaltimore\RailVehicles\Electric\Acela\Default\FirstCar\destinations" ` - -Type Directory -Force + Mkdir "dist\Assets\DTG\WashingtonBaltimore\RailVehicles\Electric\Acela\Default\FirstCar\destinations" Copy-Item ` "dist\Assets\RSC\AcelaPack01\RailVehicles\Electric\Acela\Default\FirstCar\destinations\*" ` "dist\Assets\DTG\WashingtonBaltimore\RailVehicles\Electric\Acela\Default\FirstCar\destinations" diff --git a/src/mod/Assets/RSC/AcelaPack01/InputMappers/AcelaExpert.xml b/src/mod/Assets/RSC/AcelaPack01/InputMappers/AcelaExpert.xml deleted file mode 100644 index eb39a675..00000000 --- a/src/mod/Assets/RSC/AcelaPack01/InputMappers/AcelaExpert.xml +++ /dev/null @@ -1,597 +0,0 @@ - - - - - AcelaExpressExpert - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - Headlights - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - IncreaseControlStop - Headlights - 0 - - - 0 - Keyboard - ButtonDown - - Shift - NoAxis - DecreaseControlStart - Headlights - 0 - - - 0 - Keyboard - ButtonUp - - Shift - NoAxis - DecreaseControlStop - Headlights - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - Bell - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - Wipers - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - CruiseControl - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - Reverser - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - IncreaseControlStop - Reverser - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - DecreaseControlStart - Reverser - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStop - Reverser - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - VirtualBrake - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - IncreaseControlStop - VirtualBrake - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - DecreaseControlStart - VirtualBrake - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStop - VirtualBrake - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - HandBrake - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - Sander - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStart - Sander - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - Horn - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStart - Horn - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - FrontCone - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - VirtualThrottle - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - IncreaseControlStop - VirtualThrottle - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - DecreaseControlStart - VirtualThrottle - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStop - VirtualThrottle - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - Startup - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - SelPanto - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - IncreaseControlStop - SelPanto - 0 - - - 0 - Keyboard - ButtonDown - - Shift - NoAxis - DecreaseControlStart - SelPanto - 0 - - - 0 - Keyboard - ButtonUp - - Shift - NoAxis - DecreaseControlStop - SelPanto - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - PantographControl - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - GroundLights - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - IncreaseControlStop - GroundLights - 0 - - - 0 - Keyboard - ButtonDown - - Shift - NoAxis - DecreaseControlStart - GroundLights - 0 - - - 0 - Keyboard - ButtonUp - - Shift - NoAxis - DecreaseControlStop - GroundLights - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - DynamicBrake - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - IncreaseControlStop - DynamicBrake - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - DecreaseControlStart - DynamicBrake - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStop - DynamicBrake - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - EmergencyBrake - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStart - EmergencyBrake - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - TiltIsolate - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - DestJoy - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - DecreaseControlStart - DestJoy - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - IncreaseControlStop - DestJoy - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStop - DestJoy - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - CabLight - 0 - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - ToggleControl - Dimmer - 0 - - - 0 - Keyboard - ButtonDown - - Control - NoAxis - ToggleControl - ATCCutIn - 0 - - - 0 - Keyboard - ButtonDown - - Control - NoAxis - ToggleControl - ACSESCutIn - 0 - - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - IncreaseControlStart - AWSReset - 0 - - - 0 - Keyboard - ButtonUp - - NoShift - NoAxis - DecreaseControlStart - AWSReset - 0 - - - - - - 0 - Keyboard - ButtonDown - - NoShift - NoAxis - - - 0 - - - - - \ No newline at end of file