From 68e61c90e5ef10f5bf1e36c52dc067993ee1a36f Mon Sep 17 00:00:00 2001 From: MatthewWertman Date: Fri, 1 Nov 2024 21:43:21 -0700 Subject: [PATCH 01/25] add pirq gen option --- GUI.xaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GUI.xaml b/GUI.xaml index 2bce5de..c079ba2 100644 --- a/GUI.xaml +++ b/GUI.xaml @@ -27,6 +27,9 @@ + + + From 3b0c664ac2fb5378dd59268a5e674979e6433e6a Mon Sep 17 00:00:00 2001 From: MatthewWertman Date: Sat, 2 Nov 2024 23:43:56 -0700 Subject: [PATCH 02/25] move scripts to src --- GUI.xaml => src/GUI.xaml | 0 config.json.example => src/config.json.example | 2 +- {configs => src/configs}/default.json | 0 {configs => src/configs}/gi-enabled.json | 0 {configs => src/configs}/tests.json | 0 gen_expected.ps1 => src/gen_expected.ps1 | 4 ++-- glt_launcher.ps1 => src/glt_launcher.ps1 | 0 .../gpu_lookup_tableGUI.ps1 | 2 +- help_man.ps1 => src/help_man.ps1 | 0 p7zip_util.ps1 => src/include/p7zip_util.ps1 | 0 .../resources}/icons/BitCapLngLogo_BLK-04.ico | Bin .../resources}/icons/BitCapLngLogo_BLK-04.png | Bin run_tests.ps1 => src/run_tests.ps1 | 4 ++-- 13 files changed, 6 insertions(+), 6 deletions(-) rename GUI.xaml => src/GUI.xaml (100%) rename config.json.example => src/config.json.example (84%) rename {configs => src/configs}/default.json (100%) rename {configs => src/configs}/gi-enabled.json (100%) rename {configs => src/configs}/tests.json (100%) rename gen_expected.ps1 => src/gen_expected.ps1 (96%) rename glt_launcher.ps1 => src/glt_launcher.ps1 (100%) rename gpu_lookup_tableGUI.ps1 => src/gpu_lookup_tableGUI.ps1 (99%) rename help_man.ps1 => src/help_man.ps1 (100%) rename p7zip_util.ps1 => src/include/p7zip_util.ps1 (100%) rename {resources => src/resources}/icons/BitCapLngLogo_BLK-04.ico (100%) rename {resources => src/resources}/icons/BitCapLngLogo_BLK-04.png (100%) rename run_tests.ps1 => src/run_tests.ps1 (98%) diff --git a/GUI.xaml b/src/GUI.xaml similarity index 100% rename from GUI.xaml rename to src/GUI.xaml diff --git a/config.json.example b/src/config.json.example similarity index 84% rename from config.json.example rename to src/config.json.example index 0d201b8..6e952ce 100644 --- a/config.json.example +++ b/src/config.json.example @@ -2,7 +2,7 @@ "forceLocalPrograms": false, "params": { "awesomeMinerAPIConfig": { - enabled: false, + "enabled": false, "awesomeHostURL": "", "awesomeAPIKey": "" } diff --git a/configs/default.json b/src/configs/default.json similarity index 100% rename from configs/default.json rename to src/configs/default.json diff --git a/configs/gi-enabled.json b/src/configs/gi-enabled.json similarity index 100% rename from configs/gi-enabled.json rename to src/configs/gi-enabled.json diff --git a/configs/tests.json b/src/configs/tests.json similarity index 100% rename from configs/tests.json rename to src/configs/tests.json diff --git a/gen_expected.ps1 b/src/gen_expected.ps1 similarity index 96% rename from gen_expected.ps1 rename to src/gen_expected.ps1 index ad0b037..8bad1b0 100644 --- a/gen_expected.ps1 +++ b/src/gen_expected.ps1 @@ -1,4 +1,4 @@ -. .\p7zip_util.ps1 +. .\include\p7zip_util.ps1 if (Test-Path -Path '.\instance.json') { $instance = (Get-Content '.\instance.json') | ConvertFrom-Json @@ -12,7 +12,7 @@ else -$test_dirs = '.\tests\Amd', '.\tests\Baseboards', '.\tests\Nvidia' +$test_dirs = '..\tests\Amd', '..\tests\Baseboards', '..\tests\Nvidia' foreach ($test_path in $test_dirs) { if (Test-Path $test_path) diff --git a/glt_launcher.ps1 b/src/glt_launcher.ps1 similarity index 100% rename from glt_launcher.ps1 rename to src/glt_launcher.ps1 diff --git a/gpu_lookup_tableGUI.ps1 b/src/gpu_lookup_tableGUI.ps1 similarity index 99% rename from gpu_lookup_tableGUI.ps1 rename to src/gpu_lookup_tableGUI.ps1 index 09b5add..7086005 100644 --- a/gpu_lookup_tableGUI.ps1 +++ b/src/gpu_lookup_tableGUI.ps1 @@ -16,7 +16,7 @@ $plink = $config.programs.plink if (-not $config.tests.testMode) { - . .\p7zip_util.ps1 + . .\include\p7zip_util.ps1 $P7Zip = $config.programs.p7zip } diff --git a/help_man.ps1 b/src/help_man.ps1 similarity index 100% rename from help_man.ps1 rename to src/help_man.ps1 diff --git a/p7zip_util.ps1 b/src/include/p7zip_util.ps1 similarity index 100% rename from p7zip_util.ps1 rename to src/include/p7zip_util.ps1 diff --git a/resources/icons/BitCapLngLogo_BLK-04.ico b/src/resources/icons/BitCapLngLogo_BLK-04.ico similarity index 100% rename from resources/icons/BitCapLngLogo_BLK-04.ico rename to src/resources/icons/BitCapLngLogo_BLK-04.ico diff --git a/resources/icons/BitCapLngLogo_BLK-04.png b/src/resources/icons/BitCapLngLogo_BLK-04.png similarity index 100% rename from resources/icons/BitCapLngLogo_BLK-04.png rename to src/resources/icons/BitCapLngLogo_BLK-04.png diff --git a/run_tests.ps1 b/src/run_tests.ps1 similarity index 98% rename from run_tests.ps1 rename to src/run_tests.ps1 index e05ff96..2549c15 100644 --- a/run_tests.ps1 +++ b/src/run_tests.ps1 @@ -1,4 +1,4 @@ -. .\p7zip_util.ps1 +. .\include\p7zip_util.ps1 if (Test-Path -Path '.\instance.json') { $instance = (Get-Content '.\instance.json') | ConvertFrom-Json @@ -68,7 +68,7 @@ Function Test-Expected-Value $test_results = @() -$test_dirs = '.\tests\Amd', '.\tests\Baseboards', '.\tests\Nvidia' +$test_dirs = '..\tests\Amd', '..\tests\Baseboards', '..\tests\Nvidia' foreach ($test_path in $test_dirs) { if (Test-Path $test_path) From c9f2cce8b03727e5ca36f0051d0f7f37038b5ac5 Mon Sep 17 00:00:00 2001 From: MatthewWertman Date: Sun, 3 Nov 2024 16:44:31 -0800 Subject: [PATCH 03/25] add includes --- src/gpu_lookup_tableGUI.ps1 | 244 +--------------------- src/include/{p7zip_util.ps1 => p7zip.ps1} | 2 +- src/include/pirq.ps1 | 211 +++++++++++++++++++ src/include/util.ps1 | 23 ++ 4 files changed, 240 insertions(+), 240 deletions(-) rename src/include/{p7zip_util.ps1 => p7zip.ps1} (99%) create mode 100644 src/include/pirq.ps1 create mode 100644 src/include/util.ps1 diff --git a/src/gpu_lookup_tableGUI.ps1 b/src/gpu_lookup_tableGUI.ps1 index 7086005..dc82e22 100644 --- a/src/gpu_lookup_tableGUI.ps1 +++ b/src/gpu_lookup_tableGUI.ps1 @@ -3,6 +3,10 @@ Param ( [string]$ConfigFile ) +# Includes +. .\include\pirq.ps1 +. .\include\util.ps1 + if (! $ConfigFile) { $ConfigFile = '.\instance.json' } $config = (Get-Content $ConfigFile) | ConvertFrom-Json @@ -16,7 +20,7 @@ $plink = $config.programs.plink if (-not $config.tests.testMode) { - . .\include\p7zip_util.ps1 + . .\include\p7zip.ps1 $P7Zip = $config.programs.p7zip } @@ -25,43 +29,6 @@ if (-not $config.tests.testMode) [Regex]$BUSID_REGEX = '(:[0-9a-f]{2}){2}\.\d' [Regex]$GPU_BUSID_REGEX = '(:[0-9a-f]{2})(:00)\.\d' -# Supported baseboard names -$SUPPORTED_BASEBOARDS = @( - 'BTC-T37', - 'BTC-S37', - 'ONDA B250 BTC V1.05', - 'TB85', - # OctoMiner - '12XTREME', - 'X12ULTRA', - 'B85 ULTRA', - 'CRESCENTBAY', - 'B75', - 'skylake' -) - -## PIRQ MAPS -# ONDA B250 -$b250_pirq_hard_map = @(16, 37, 38, 39, 40, 41, 42, 43, 48, 53, 54, 55) -# BTC-T37, BTC-S37 -$x37_pirq_hard_map = @(16, 9, 10, 16, 17, 18, 33, 34) -# TB85 -$tb85_pirq_hard_map = @(16, 33, 34, 8, 9, 10) -# Octo 8x (ULTRA) -$octo8_pirq_hard_map = @(34, 33, 32, 39, 35, 36, 37, 38) -# CRESCENTBAY -$crescentbay_pirq_hard_map = @(16, 33, 34, 35, 36, 37, 38, 39) -# B75 -$b75_pirq_hard_map = @(33, 34, 8, 9, 10, 6, 17, 18) #slot 6 doesn't have a slot number -# skylake -$skylake_pirq_hard_map = @(32, 37, 36, 35, 40, 43, 41, 33) - -## End PIRQ MAPS - -# OctoMiner 12x (XTREME/ULTRA) -$octo12_hard_map = @('01', '07', '0c', '0d', '0b', '05', '0a', '04', '09', '03', '08', '02') - - # FUNCTIONS @@ -273,182 +240,6 @@ Function Get-Baseboard-Product-Name } -# PIRQ TABLE FUNCS - - -Function Test-For-PIRQ-Table -{ - if ((Get-Content .\biosdecode.txt | Select-String -Pattern 'PCI Interrupt Routing').Matches) { return 0 } - return 1 -} - - -Function Read-Baseboard-BIOS -{ - return (Get-Content .\dmidecodebios.txt) -} - - -Function Update-Baseboard-Product-Name -{ - for ($idx = 0; $idx -lt $SUPPORTED_BASEBOARDS.Count; $idx++) - { - if ($SUPPORTED_BASEBOARDS[$idx] -eq $mb_product_name) - { - return ( $idx + 1 ) - } - } - return $mb_product_name -} - - -Function Search-PIRQ-Hard-Maps -{ - $support_idx = $mb_product -as [int] - if ($null -eq $support_idx) - { Throw "ERROR (Unsupported: The detected motherboard model is not supported: $mb_product)" } - - switch ($support_idx) - { - # BTC-S37, BTC-T37 - { ($_ -eq 1) -or ($_ -eq 2) } { return Write-Output -NoEnumerate $x37_pirq_hard_map } - # ONDA B250 - 3 { return Write-Output -NoEnumerate $b250_pirq_hard_map } - # TB85 - 4 { return Write-Output -NoEnumerate $tb85_pirq_hard_map } - # 12XTREME, X12ULTRA - { ($_ -eq 5) -or ($_ -eq 6) } { return Write-Output -NoEnumerate $octo12_hard_map } - # B85 ULTRA - 7 { return Write-Output -NoEnumerate $octo8_pirq_hard_map } - # CRESCENTBAY - 8 { return Write-Output -NoEnumerate $crescentbay_pirq_hard_map } - # B75 - 9 { return Write-Output -NoEnumerate $b75_pirq_hard_map } - # skylake - 10 { return Write-Output -NoEnumerate $skylake_pirq_hard_map } - } -} - - -Function Read-PIRQ-Device-Slot-Ids -{ - $devices = $gpu_busids - if ((Get-Content .\gpu_driver.txt | Select-String -Pattern 'amdgpu').Matches -and (Find-GPU-Context-Offset) -ne 1) - { - $devices = $pci_busids - } - $pirq_device_slot_ids = @() - # OctoMiner 12x - if ($mb_product_name -eq '12XTREME' -or $mb_product_name -eq 'X12ULTRA') - { - foreach ($bus in $devices) - { - for ($idx = 0; $idx -lt $pirq_map.Count; $idx++) - { - if ("$bus".Substring(0, 2) -eq $pirq_map[$idx]) - { - $pirq_device_slot_ids += $idx - break - } - } - } - return Write-Output -NoEnumerate $pirq_device_slot_ids - } - $cp_of_pirq_map = $pirq_map.Clone() - foreach ($bus in $devices) - { - if ($bus -eq 'MISSING') { continue } - $is_pirq_slot_number_match = (Get-Content .\biosdecode.txt | Select-String -Pattern $bus.Split('.')[0] | Out-String -Stream | Select-String -Pattern 'slot(?: number | )([0-9]{1,})') - try - { - $pirq_slot_number = $is_pirq_slot_number_match.Matches.Groups[1].Value - } - catch - { - # - } - - # little bit of headache to get around multiple "16" entries with crescentbay boards - if ($bus -eq '01:00.0' -and $pirq_slot_number -eq '16') - { - $pirq_device_slot_ids += 0 - $cp_of_pirq_map[0] = '' - continue - } - elseif ($pirq_slot_number -eq '16' -and $bus -ne '01:00.0') - { - $cp_of_pirq_map[0] = '' - } - # fix BTC-X37 showing slot 1 MISSING when slot 7 is MISSING - if ($mb_product_name -eq 'BTC-T37' -or $mb_product_name -eq 'BTC-S37') - { - if ($pirq_slot_number -eq '33' -and $bus -eq '01:00.0') - { - $pirq_device_slot_ids += 0 - $cp_of_pirq_map[0] = '' - continue - } - } - # fix B75 slot 6 not having slot number - if ($mb_product_name -eq 'B75') - { - if ($null -eq $is_pirq_slot_number_match) - { - $pirq_device_slot_ids += 5 - $cp_of_pirq_map[5] = '' - continue - } - } - for ($idx = 0; $idx -lt $cp_of_pirq_map.Count; $idx++) - { - if ($cp_of_pirq_map[$idx] -eq $pirq_slot_number) - { - $pirq_device_slot_ids += $idx - $cp_of_pirq_map[$idx] = '' - break - } - } - } - Remove-Variable devices - Remove-Variable cp_of_pirq_map - return Write-Output -NoEnumerate $pirq_device_slot_ids -} - - -Function Get-Missing-Slot-Ids -{ - $missing_slot_ids = @() - if ($PIRQ_FOUND) - { - $slot_ids = @(0..($pirq_map.Count - 1)) - } - else - { $slot_ids = @(0..((Get-PCI-Handle-Count) - 1)) } - foreach ($id in $slot_ids) - { - if ($pci_info_ids -notcontains $id) - { - $missing_slot_ids += $id - } - } - return Write-Output -NoEnumerate $missing_slot_ids -} - - -Function Get-PIRQ-Device-Designations -{ - $pirq_device_slot_designations = @() - foreach ($id in $pci_info_ids) - { - $pirq_device_slot_designations += "PCIE $( $id + 1 )" - } - return Write-Output -NoEnumerate $pirq_device_slot_designations -} - - -## END PIRQ TABLE FUNCS - - Function Request-Data { # Need to make manual connection first to accept remote host key @@ -699,31 +490,6 @@ Function Show-Table } -Function Show-Column -{ - param ( - [Parameter(Mandatory, ValueFromPipeline)][string]$line, - [string]$Delimiter, - [int]$Column - ) - if (! $Delimiter) { $Delimiter = ' ' } - ($line -split $Delimiter)[$Column] -} - - -Function Unprotect-SecureString -{ - param ( - [System.Security.SecureString]$SecureString - ) - $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) - $Plain = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) - [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR) - $SecureString = $SecureString.Dispose() - Return $Plain -} - - if ($config.debug.debugMode) { $DebugPreference = 'Continue' diff --git a/src/include/p7zip_util.ps1 b/src/include/p7zip.ps1 similarity index 99% rename from src/include/p7zip_util.ps1 rename to src/include/p7zip.ps1 index c060c4c..00512ba 100644 --- a/src/include/p7zip_util.ps1 +++ b/src/include/p7zip.ps1 @@ -44,4 +44,4 @@ Function Update-Tar } else { & $P7Zip -bso0 -bsp0 a $tarFile $(, $files) } -} \ No newline at end of file +} diff --git a/src/include/pirq.ps1 b/src/include/pirq.ps1 new file mode 100644 index 0000000..d507987 --- /dev/null +++ b/src/include/pirq.ps1 @@ -0,0 +1,211 @@ +# Supported baseboard names +$SUPPORTED_BASEBOARDS = @( + 'BTC-T37', + 'BTC-S37', + 'ONDA B250 BTC V1.05', + 'TB85', + # OctoMiner + '12XTREME', + 'X12ULTRA', + 'B85 ULTRA', + 'CRESCENTBAY', + 'B75', + 'skylake' +) + +## PIRQ MAPS +# ONDA B250 +$b250_pirq_hard_map = @(16, 37, 38, 39, 40, 41, 42, 43, 48, 53, 54, 55) +# BTC-T37, BTC-S37 +$x37_pirq_hard_map = @(16, 9, 10, 16, 17, 18, 33, 34) +# TB85 +$tb85_pirq_hard_map = @(16, 33, 34, 8, 9, 10) +# Octo 8x (ULTRA) +$octo8_pirq_hard_map = @(34, 33, 32, 39, 35, 36, 37, 38) +# CRESCENTBAY +$crescentbay_pirq_hard_map = @(16, 33, 34, 35, 36, 37, 38, 39) +# B75 +$b75_pirq_hard_map = @(33, 34, 8, 9, 10, 6, 17, 18) #slot 6 doesn't have a slot number +# skylake +$skylake_pirq_hard_map = @(32, 37, 36, 35, 40, 43, 41, 33) + +## End PIRQ MAPS + +# OctoMiner 12x (XTREME/ULTRA) +$octo12_hard_map = @('01', '07', '0c', '0d', '0b', '05', '0a', '04', '09', '03', '08', '02') + + +# PIRQ TABLE FUNCS + + +Function Test-For-PIRQ-Table +{ + if ((Get-Content .\biosdecode.txt | Select-String -Pattern 'PCI Interrupt Routing').Matches) { return 0 } + return 1 +} + + +Function Read-Baseboard-BIOS +{ + return (Get-Content .\dmidecodebios.txt) +} + + +Function Update-Baseboard-Product-Name +{ + for ($idx = 0; $idx -lt $SUPPORTED_BASEBOARDS.Count; $idx++) + { + if ($SUPPORTED_BASEBOARDS[$idx] -eq $mb_product_name) + { + return ( $idx + 1 ) + } + } + return $mb_product_name +} + + +Function Search-PIRQ-Hard-Maps +{ + $support_idx = $mb_product -as [int] + if ($null -eq $support_idx) + { Throw "ERROR (Unsupported: The detected motherboard model is not supported: $mb_product)" } + + switch ($support_idx) + { + # BTC-S37, BTC-T37 + { ($_ -eq 1) -or ($_ -eq 2) } { return Write-Output -NoEnumerate $x37_pirq_hard_map } + # ONDA B250 + 3 { return Write-Output -NoEnumerate $b250_pirq_hard_map } + # TB85 + 4 { return Write-Output -NoEnumerate $tb85_pirq_hard_map } + # 12XTREME, X12ULTRA + { ($_ -eq 5) -or ($_ -eq 6) } { return Write-Output -NoEnumerate $octo12_hard_map } + # B85 ULTRA + 7 { return Write-Output -NoEnumerate $octo8_pirq_hard_map } + # CRESCENTBAY + 8 { return Write-Output -NoEnumerate $crescentbay_pirq_hard_map } + # B75 + 9 { return Write-Output -NoEnumerate $b75_pirq_hard_map } + # skylake + 10 { return Write-Output -NoEnumerate $skylake_pirq_hard_map } + } +} + + +Function Read-PIRQ-Device-Slot-Ids +{ + $devices = $gpu_busids + if ((Get-Content .\gpu_driver.txt | Select-String -Pattern 'amdgpu').Matches -and (Find-GPU-Context-Offset) -ne 1) + { + $devices = $pci_busids + } + $pirq_device_slot_ids = @() + # OctoMiner 12x + if ($mb_product_name -eq '12XTREME' -or $mb_product_name -eq 'X12ULTRA') + { + foreach ($bus in $devices) + { + for ($idx = 0; $idx -lt $pirq_map.Count; $idx++) + { + if ("$bus".Substring(0, 2) -eq $pirq_map[$idx]) + { + $pirq_device_slot_ids += $idx + break + } + } + } + return Write-Output -NoEnumerate $pirq_device_slot_ids + } + $cp_of_pirq_map = $pirq_map.Clone() + foreach ($bus in $devices) + { + if ($bus -eq 'MISSING') { continue } + $is_pirq_slot_number_match = (Get-Content .\biosdecode.txt | Select-String -Pattern $bus.Split('.')[0] | Out-String -Stream | Select-String -Pattern 'slot(?: number | )([0-9]{1,})') + try + { + $pirq_slot_number = $is_pirq_slot_number_match.Matches.Groups[1].Value + } + catch + { + # + } + + # little bit of headache to get around multiple "16" entries with crescentbay boards + if ($bus -eq '01:00.0' -and $pirq_slot_number -eq '16') + { + $pirq_device_slot_ids += 0 + $cp_of_pirq_map[0] = '' + continue + } + elseif ($pirq_slot_number -eq '16' -and $bus -ne '01:00.0') + { + $cp_of_pirq_map[0] = '' + } + # fix BTC-X37 showing slot 1 MISSING when slot 7 is MISSING + if ($mb_product_name -eq 'BTC-T37' -or $mb_product_name -eq 'BTC-S37') + { + if ($pirq_slot_number -eq '33' -and $bus -eq '01:00.0') + { + $pirq_device_slot_ids += 0 + $cp_of_pirq_map[0] = '' + continue + } + } + # fix B75 slot 6 not having slot number + if ($mb_product_name -eq 'B75') + { + if ($null -eq $is_pirq_slot_number_match) + { + $pirq_device_slot_ids += 5 + $cp_of_pirq_map[5] = '' + continue + } + } + for ($idx = 0; $idx -lt $cp_of_pirq_map.Count; $idx++) + { + if ($cp_of_pirq_map[$idx] -eq $pirq_slot_number) + { + $pirq_device_slot_ids += $idx + $cp_of_pirq_map[$idx] = '' + break + } + } + } + Remove-Variable devices + Remove-Variable cp_of_pirq_map + return Write-Output -NoEnumerate $pirq_device_slot_ids +} + + +Function Get-Missing-Slot-Ids +{ + $missing_slot_ids = @() + if ($PIRQ_FOUND) + { + $slot_ids = @(0..($pirq_map.Count - 1)) + } + else + { $slot_ids = @(0..((Get-PCI-Handle-Count) - 1)) } + foreach ($id in $slot_ids) + { + if ($pci_info_ids -notcontains $id) + { + $missing_slot_ids += $id + } + } + return Write-Output -NoEnumerate $missing_slot_ids +} + + +Function Get-PIRQ-Device-Designations +{ + $pirq_device_slot_designations = @() + foreach ($id in $pci_info_ids) + { + $pirq_device_slot_designations += "PCIE $( $id + 1 )" + } + return Write-Output -NoEnumerate $pirq_device_slot_designations +} + + +## END PIRQ TABLE FUNCS diff --git a/src/include/util.ps1 b/src/include/util.ps1 new file mode 100644 index 0000000..f126a82 --- /dev/null +++ b/src/include/util.ps1 @@ -0,0 +1,23 @@ +Function Show-Column +{ + param ( + [Parameter(Mandatory, ValueFromPipeline)][string]$line, + [string]$Delimiter, + [int]$Column + ) + if (! $Delimiter) { $Delimiter = ' ' } + ($line -split $Delimiter)[$Column] +} + + +Function Unprotect-SecureString +{ + param ( + [System.Security.SecureString]$SecureString + ) + $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) + $Plain = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR) + $SecureString = $SecureString.Dispose() + Return $Plain +} From 7b0b17a21b3689bdc10fcafcccd36233749e1ca4 Mon Sep 17 00:00:00 2001 From: MatthewWertman Date: Sun, 3 Nov 2024 17:01:37 -0800 Subject: [PATCH 04/25] move GUI to ui --- src/glt_launcher.ps1 | 2 +- src/{ => ui}/GUI.xaml | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/{ => ui}/GUI.xaml (100%) diff --git a/src/glt_launcher.ps1 b/src/glt_launcher.ps1 index 76302d1..49ef7f7 100644 --- a/src/glt_launcher.ps1 +++ b/src/glt_launcher.ps1 @@ -199,7 +199,7 @@ try catch { Throw 'ERROR (Failed Operation: Unable to load WPF Dependencies)' } -$GUI_PATH = '.\GUI.xaml' +$GUI_PATH = '.\ui\GUI.xaml' [xml]$XML_WPF = Get-Content -Path $GUI_PATH if (! $XML_WPF) { Throw "ERROR (Failed Operation: Unabled to find 'GUI.xaml' in script directory.)" } diff --git a/src/GUI.xaml b/src/ui/GUI.xaml similarity index 100% rename from src/GUI.xaml rename to src/ui/GUI.xaml From 92e66cdef0d94cc5a51255d093b48d4990d92efd Mon Sep 17 00:00:00 2001 From: MatthewWertman Date: Mon, 4 Nov 2024 19:17:58 -0800 Subject: [PATCH 05/25] move getters to util --- src/gpu_lookup_tableGUI.ps1 | 13 ------------- src/include/util.ps1 | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/gpu_lookup_tableGUI.ps1 b/src/gpu_lookup_tableGUI.ps1 index dc82e22..f70e044 100644 --- a/src/gpu_lookup_tableGUI.ps1 +++ b/src/gpu_lookup_tableGUI.ps1 @@ -227,19 +227,6 @@ Function Read-PCI-Slot-Info } -Function Get-PCI-Handle-Count -{ - $pci_handles = @((Get-Content .\dmidecodet9.txt | Select-String -Pattern 'Handle ' -AllMatches) | ForEach-Object { $_ | Show-Column -Column 1 }) - return $pci_handles.Count -} - - -Function Get-Baseboard-Product-Name -{ - return (Get-Content .\mb_product_name.txt) -} - - Function Request-Data { # Need to make manual connection first to accept remote host key diff --git a/src/include/util.ps1 b/src/include/util.ps1 index f126a82..d433a03 100644 --- a/src/include/util.ps1 +++ b/src/include/util.ps1 @@ -1,3 +1,18 @@ +## GETTERS +Function Get-Baseboard-Product-Name +{ + return (Get-Content .\mb_product_name.txt) +} + + +Function Get-PCI-Handle-Count +{ + $pci_handles = @((Get-Content .\dmidecodet9.txt | Select-String -Pattern 'Handle ' -AllMatches) | ForEach-Object { $_ | Show-Column -Column 1 }) + return $pci_handles.Count +} +## END GETTERS + + Function Show-Column { param ( From a1366bf092161e35787c7cdd6d5075d0329f8032 Mon Sep 17 00:00:00 2001 From: MatthewWertman Date: Mon, 4 Nov 2024 19:18:26 -0800 Subject: [PATCH 06/25] add Popup and Input UI templates --- src/ui/Input.xaml | 22 ++++++++++++++++++++++ src/ui/Popup.xaml | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/ui/Input.xaml create mode 100644 src/ui/Popup.xaml diff --git a/src/ui/Input.xaml b/src/ui/Input.xaml new file mode 100644 index 0000000..22ef795 --- /dev/null +++ b/src/ui/Input.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + +