From 0b4fe8ed2afc3aaa12926c01d37cf2cf84f1089b Mon Sep 17 00:00:00 2001 From: Ivan Tustanivskyi Date: Mon, 2 Mar 2026 19:50:52 +0200 Subject: [PATCH 1/4] feat: Add import/export device settings utils for PS5 --- .../DeviceProviders/DeviceProvider.ps1 | 10 ++++++ .../DeviceProviders/PlayStation5Provider.ps1 | 1 + app-runner/Public/Export-DeviceSettings.ps1 | 33 +++++++++++++++++++ app-runner/Public/Import-DeviceSettings.ps1 | 33 +++++++++++++++++++ app-runner/SentryAppRunner.psd1 | 2 ++ 5 files changed, 79 insertions(+) create mode 100644 app-runner/Public/Export-DeviceSettings.ps1 create mode 100644 app-runner/Public/Import-DeviceSettings.ps1 diff --git a/app-runner/Private/DeviceProviders/DeviceProvider.ps1 b/app-runner/Private/DeviceProviders/DeviceProvider.ps1 index 8570926..1668175 100644 --- a/app-runner/Private/DeviceProviders/DeviceProvider.ps1 +++ b/app-runner/Private/DeviceProviders/DeviceProvider.ps1 @@ -554,6 +554,16 @@ SDK Path: $($this.SdkPath) return "$($this.Platform) ($(Get-Date -Format 'HH:mm:ss'))" } + [void] ExportSettings([string]$OutputFile) { + Write-Debug "$($this.Platform): Exporting settings to: $OutputFile" + $this.InvokeCommand('settingsexport', @($OutputFile)) + } + + [void] ImportSettings([string]$InputFile) { + Write-Debug "$($this.Platform): Importing settings from: $InputFile" + $this.InvokeCommand('settingsimport', @($InputFile)) + } + [bool] TestInternetConnection() { Write-Debug "$($this.Platform): Testing internet connection" $this.LogNotImplemented('TestInternetConnection') diff --git a/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 b/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 index 891ce65..7c525cf 100644 --- a/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 +++ b/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 @@ -45,6 +45,7 @@ class PlayStation5Provider : DeviceProvider { 'ipconfig' = @($this.TargetControlTool, 'network ip-config') 'natinfo' = @($this.TargetControlTool, 'network get-nat-traversal-info') 'settingsexport' = @($this.TargetControlTool, 'settings export "{0}"') + 'settingsimport' = @($this.TargetControlTool, 'settings import "{0}"') 'processlist' = @($this.TargetControlTool, 'process list', { $Input | ConvertFrom-Yaml }) # Target management commands for DetectAndSetDefaultTarget() 'get-default-target' = @($this.TargetControlTool, 'target get-default') diff --git a/app-runner/Public/Export-DeviceSettings.ps1 b/app-runner/Public/Export-DeviceSettings.ps1 new file mode 100644 index 0000000..ce1fd10 --- /dev/null +++ b/app-runner/Public/Export-DeviceSettings.ps1 @@ -0,0 +1,33 @@ +function Export-DeviceSettings { + <# + .SYNOPSIS + Exports the settings of the connected device to a file. + + .DESCRIPTION + Exports the current settings of the connected device to an XML file. + Uses the current device session. + + .PARAMETER OutputFile + Path to the output XML file where settings will be saved. + + .EXAMPLE + Connect-Device -Platform "PlayStation5" + Export-DeviceSettings -OutputFile "settings.xml" + #> + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$OutputFile + ) + + Assert-DeviceSession + + Write-Debug "Exporting device settings: $($script:CurrentSession.Platform)" + Write-Debug "Output file: $OutputFile" + + $provider = $script:CurrentSession.Provider + $provider.ExportSettings($OutputFile) + + Write-Output "Settings exported to: $OutputFile" +} diff --git a/app-runner/Public/Import-DeviceSettings.ps1 b/app-runner/Public/Import-DeviceSettings.ps1 new file mode 100644 index 0000000..1bdafb2 --- /dev/null +++ b/app-runner/Public/Import-DeviceSettings.ps1 @@ -0,0 +1,33 @@ +function Import-DeviceSettings { + <# + .SYNOPSIS + Imports settings from a file to the connected device. + + .DESCRIPTION + Imports settings from an XML file to the connected device. + Uses the current device session. + + .PARAMETER InputFile + Path to the input XML file containing settings to import. + + .EXAMPLE + Connect-Device -Platform "PlayStation5" + Import-DeviceSettings -InputFile "settings.xml" + #> + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$InputFile + ) + + Assert-DeviceSession + + Write-Debug "Importing device settings: $($script:CurrentSession.Platform)" + Write-Debug "Input file: $InputFile" + + $provider = $script:CurrentSession.Provider + $provider.ImportSettings($InputFile) + + Write-Output "Settings imported from: $InputFile" +} diff --git a/app-runner/SentryAppRunner.psd1 b/app-runner/SentryAppRunner.psd1 index eeafe27..ccc8aef 100644 --- a/app-runner/SentryAppRunner.psd1 +++ b/app-runner/SentryAppRunner.psd1 @@ -32,6 +32,8 @@ 'Connect-Device', 'Copy-DeviceItem', 'Disconnect-Device', + 'Export-DeviceSettings', + 'Import-DeviceSettings', 'Get-DeviceDiagnostics', 'Get-DeviceLogs', 'Get-DeviceScreenshot', From 527cde4e9c8e0cb1a08c72acac3cdaa505cd51fc Mon Sep 17 00:00:00 2001 From: Ivan Tustanivskyi Date: Mon, 2 Mar 2026 20:24:09 +0200 Subject: [PATCH 2/4] Fix module exports --- app-runner/SentryAppRunner.psm1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app-runner/SentryAppRunner.psm1 b/app-runner/SentryAppRunner.psm1 index a910624..ef00a35 100644 --- a/app-runner/SentryAppRunner.psm1 +++ b/app-runner/SentryAppRunner.psm1 @@ -74,5 +74,9 @@ Export-ModuleMember -Function @( 'Get-DeviceLogs', 'Get-DeviceScreenshot', 'Get-DeviceDiagnostics', - 'Copy-DeviceItem' + 'Copy-DeviceItem', + + # Settings Management + 'Export-DeviceSettings', + 'Import-DeviceSettings' ) From 271d8e4ce8d7a09d9b30632cbe814f60d43559f0 Mon Sep 17 00:00:00 2001 From: Ivan Tustanivskyi Date: Tue, 3 Mar 2026 10:06:29 +0200 Subject: [PATCH 3/4] FIx PR suggestions --- app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 b/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 index 7c525cf..0ebf5f1 100644 --- a/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 +++ b/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 @@ -191,7 +191,7 @@ class PlayStation5Provider : DeviceProvider { # Run prospero-ctrl settings export try { $settingsFile = Join-Path $OutputDirectory "$datePrefix-settings.xml" - $this.InvokeCommand('settingsexport', @($settingsFile)) + $this.ExportSettings($settingsFile) $results.Files += $settingsFile Write-Debug "Settings exported to: $settingsFile" } catch { From 5dedc02b71441b01d9a9024cf209c509d354a1a5 Mon Sep 17 00:00:00 2001 From: Ivan Tustanivskyi Date: Tue, 3 Mar 2026 10:13:29 +0200 Subject: [PATCH 4/4] Move impl --- app-runner/Private/DeviceProviders/DeviceProvider.ps1 | 6 ++---- .../Private/DeviceProviders/PlayStation5Provider.ps1 | 10 ++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app-runner/Private/DeviceProviders/DeviceProvider.ps1 b/app-runner/Private/DeviceProviders/DeviceProvider.ps1 index 1668175..b9bafbc 100644 --- a/app-runner/Private/DeviceProviders/DeviceProvider.ps1 +++ b/app-runner/Private/DeviceProviders/DeviceProvider.ps1 @@ -555,13 +555,11 @@ SDK Path: $($this.SdkPath) } [void] ExportSettings([string]$OutputFile) { - Write-Debug "$($this.Platform): Exporting settings to: $OutputFile" - $this.InvokeCommand('settingsexport', @($OutputFile)) + $this.LogNotImplemented('ExportSettings') } [void] ImportSettings([string]$InputFile) { - Write-Debug "$($this.Platform): Importing settings from: $InputFile" - $this.InvokeCommand('settingsimport', @($InputFile)) + $this.LogNotImplemented('ImportSettings') } [bool] TestInternetConnection() { diff --git a/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 b/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 index 0ebf5f1..112e1a6 100644 --- a/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 +++ b/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 @@ -148,6 +148,16 @@ class PlayStation5Provider : DeviceProvider { }) } + [void] ExportSettings([string]$OutputFile) { + Write-Debug "$($this.Platform): Exporting settings to: $OutputFile" + $this.InvokeCommand('settingsexport', @($OutputFile)) + } + + [void] ImportSettings([string]$InputFile) { + Write-Debug "$($this.Platform): Importing settings from: $InputFile" + $this.InvokeCommand('settingsimport', @($InputFile)) + } + [hashtable] GetDiagnostics([string]$OutputDirectory) { # Call base implementation to collect standard diagnostics $results = ([DeviceProvider]$this).GetDiagnostics($OutputDirectory)