Update GPU and VRAM detection

marked as 24.1.4.0
This commit is contained in:
Blueprint Coding
2024-08-30 11:31:56 -06:00
parent 1f87612e83
commit 8bb38755db
2 changed files with 14 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ REM Issues: https://github.com/SillyTavern/SillyTavern-Launcher/issues
title STL [STARTUP CHECK]
setlocal
set "stl_version=24.1.3.0"
set "stl_version=24.1.4.0"
set "stl_title_pid=STL [TROUBLESHOOTING]"
REM ANSI Escape Code for Colors
@@ -269,6 +269,7 @@ set /p "update_choice=Update now? [Y/n]: "
if /i "%update_choice%"=="" set update_choice=Y
if /i "%update_choice%"=="Y" (
REM Update the repository
del "%log_dir%\gpu_info_output.txt"
git pull
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% %green_fg_strong%SillyTavern-Launcher updated successfully. Restarting launcher...%reset%
timeout /t 10

View File

@@ -1,20 +1,20 @@
@echo off
REM Initialize variables
setlocal enabledelayedexpansion
set "GPU_name=Unknown"
set "VRAM=Unknown"
set "GPU_TYPE=Unknown"
set "primary_gpu_found=false"
set "gpuDetected=false"
setlocal enabledelayedexpansion
REM Detect GPU name using wmic based on AdapterRAM size
REM Detect GPU and store name, excluding integrated GPUs if discrete GPUs are found
for /f "tokens=2 delims==" %%f in ('wmic path Win32_VideoController where "AdapterRAM > 0" get name /value ^| find "="') do (
set "current_gpu=%%f"
if /i "!current_gpu!" neq "Microsoft Basic Display Adapter" (
set "GPU_name=!current_gpu!"
set "primary_gpu_found=true"
goto :vram_check
if /i "!current_gpu!" neq "Intel(R) HD Graphics" (
set "GPU_name=!current_gpu!"
set "primary_gpu_found=true"
goto :vram_check
)
) else if "!primary_gpu_found!" equ "false" (
set "GPU_name=!current_gpu!"
goto :vram_check
@@ -23,14 +23,11 @@ for /f "tokens=2 delims==" %%f in ('wmic path Win32_VideoController where "Adapt
:vram_check
REM Run PowerShell command to retrieve VRAM size and divide by 1GB
for /f "usebackq tokens=*" %%i in (powershell -Command "$qwMemorySize = (Get-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0*' -Name HardwareInformation.qwMemorySize -ErrorAction SilentlyContinue).'HardwareInformation.qwMemorySize'; if ($null -ne $qwMemorySize -and $qwMemorySize -is [array]) { $qwMemorySize = [double]$qwMemorySize[0] } else { $qwMemorySize = [double]$qwMemorySize }; if ($null -ne $qwMemorySize) { [math]::Round($qwMemorySize/1GB) } else { 'Property not found' }") do (
for /f "usebackq tokens=*" %%i in (`powershell -Command "$qwMemorySize = (Get-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0*' -Name HardwareInformation.qwMemorySize -ErrorAction SilentlyContinue).'HardwareInformation.qwMemorySize'; if ($null -ne $qwMemorySize -and $qwMemorySize -is [array]) { $qwMemorySize = [double]$qwMemorySize[0] } else { $qwMemorySize = [double]$qwMemorySize }; if ($null -ne $qwMemorySize) { [math]::Round($qwMemorySize/1GB) } else { 'Property not found' }"`) do (
set "VRAM=%%i"
)
set "gpuDetected=true"
:gpu_found
if "%gpuDetected%"=="true" (
echo GPU: %cyan_fg_strong%%GPU_name%%reset% - VRAM: %cyan_fg_strong%%VRAM%%reset% GB
) else (
echo GPU Info not found
)
REM Display GPU name and VRAM
echo GPU: %cyan_fg_strong%%GPU_name%%reset% - VRAM: %cyan_fg_strong%%VRAM%%reset% GB
endlocal