@echo off
REM LA StressLab - pasta USB (onedir = abertura rapida)
REM LASTRESSLAB_USB_FAST=1 força perfil pendrive (menos I/O / carga adiada)
cd /d "%~dp0"
set "LASTRESSLAB_USB_FAST=1"

fltmc >nul 2>&1
if errorlevel 1 (
    echo Solicitando permissao de administrador para sensores e SMART...
    powershell -NoProfile -ExecutionPolicy Bypass -Command ^
        "$env:LASTRESSLAB_USB_FAST='1'; Start-Process -FilePath '%~dp0LAStressLab.exe' -WorkingDirectory '%~dp0' -Verb RunAs"
    exit /b
)

REM Ja admin: instala PawnIO embutido antes do SensorHelper (se faltar).
set "PAWN=%~dp0tools\pawnio\PawnIO_setup.exe"
if not exist "%PAWN%" set "PAWN=%~dp0_internal\tools\pawnio\PawnIO_setup.exe"
if exist "%PAWN%" if not exist "%ProgramFiles%\PawnIO\" (
    echo Preparando driver termico embutido...
    "%PAWN%" -install -silent >nul 2>&1
)

start "" "%~dp0LAStressLab.exe"
