diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 2a8122b..b05b9e8 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -2,16 +2,9 @@ O **Console Mode** usa as ferramentas abaixo. Algumas são baixadas automaticamente no build; outras devem ser instaladas pelo usuário. -## NirSoft +## NirSoft (até a 1.5) -| Ferramenta | Site | Uso no projeto | -|------------|------|----------------| -| [MultiMonitorTool](https://www.nirsoft.net/utils/multi_monitor_tool.html) | nirsoft.net | Monitores: ativar/desativar, primário, layout, mover janelas | -| [SoundVolumeView](https://www.nirsoft.net/utils/sound_volume_view.html) | nirsoft.net | Listar e trocar saída de áudio padrão | - -O script `build/Get-NirSoftTools.ps1` baixa as ferramentas na hora do build e o `Publish-ConsoleMode.ps1` embute os `.exe` no `ConsoleMode.exe` portátil. Na primeira execução elas são extraídas para `ConsoleMode_Data/tools/`. - -Consulte os termos de uso e a licença de cada ferramenta no site do autor (Nir Sofer / NirSoft). +Até a versão 1.5, o Console Mode embutia o [MultiMonitorTool](https://www.nirsoft.net/utils/multi_monitor_tool.html) e o [SoundVolumeView](https://www.nirsoft.net/utils/sound_volume_view.html), da NirSoft, para controlar monitores e áudio. A partir da 1.6 isso é feito com as APIs do próprio Windows e nenhuma ferramenta da NirSoft é distribuída (issue #91). ## Limite de FPS (opcional) diff --git a/build/Get-NirSoftTools.ps1 b/build/Get-NirSoftTools.ps1 deleted file mode 100644 index 6d97a2b..0000000 --- a/build/Get-NirSoftTools.ps1 +++ /dev/null @@ -1,68 +0,0 @@ -#Requires -Version 5.1 -# Baixa MultiMonitorTool e SoundVolumeView da NirSoft para a raiz do projeto - -param( - [string]$TargetDir = (Split-Path -Parent $PSScriptRoot) -) - -$ErrorActionPreference = "Stop" - -$sources = @( - @{ - Name = "MultiMonitorTool.exe" - Url = "https://www.nirsoft.net/utils/multimonitortool-x64.zip" - Zip = "multimonitortool-x64.zip" - }, - @{ - Name = "SoundVolumeView.exe" - Url = "https://www.nirsoft.net/utils/soundvolumeview-x64.zip" - Zip = "soundvolumeview-x64.zip" - } -) - -$tempDir = Join-Path $env:TEMP "consolemode_tools_dl" -if (Test-Path -LiteralPath $tempDir) { - Remove-Item -LiteralPath $tempDir -Recurse -Force -ErrorAction SilentlyContinue -} -New-Item -ItemType Directory -Path $tempDir -Force | Out-Null - -foreach ($tool in $sources) { - $dest = Join-Path $TargetDir $tool.Name - if (Test-Path -LiteralPath $dest) { - Write-Host "OK: $($tool.Name) ja existe" - continue - } - - $zipPath = Join-Path $tempDir $tool.Zip - Write-Host "Baixando $($tool.Name)..." - $ua = @{ "User-Agent" = "Mozilla/5.0 ConsoleMode-build" } - $downloaded = $false - foreach ($attempt in 1..3) { - try { - Invoke-WebRequest -Uri $tool.Url -OutFile $zipPath -UseBasicParsing -Headers $ua - $downloaded = $true - break - } - catch { - if ($attempt -eq 3) { throw } - Start-Sleep -Seconds (2 * $attempt) - } - } - if (-not $downloaded) { - throw "Falha ao baixar $($tool.Name)" - } - - $extractDir = Join-Path $tempDir ($tool.Name -replace '\.exe$', '') - Expand-Archive -LiteralPath $zipPath -DestinationPath $extractDir -Force - - $found = Get-ChildItem -LiteralPath $extractDir -Filter $tool.Name -Recurse -File -ErrorAction SilentlyContinue | Select-Object -First 1 - if (-not $found) { - throw "Nao encontrei $($tool.Name) dentro do zip baixado" - } - - Copy-Item -LiteralPath $found.FullName -Destination $dest -Force - Write-Host "OK: $($tool.Name) -> $dest" -} - -Remove-Item -LiteralPath $tempDir -Recurse -Force -ErrorAction SilentlyContinue -Write-Host "Ferramentas prontas em $TargetDir" diff --git a/build/Publish-ConsoleMode.ps1 b/build/Publish-ConsoleMode.ps1 index 244c851..dbd0c35 100644 --- a/build/Publish-ConsoleMode.ps1 +++ b/build/Publish-ConsoleMode.ps1 @@ -41,7 +41,6 @@ Write-Host "Versao: $Version" New-Item -ItemType Directory -Path $embedDir, $distDir -Force | Out-Null if (-not $SkipTools) { - & (Join-Path $PSScriptRoot "Get-NirSoftTools.ps1") -TargetDir $embedDir & (Join-Path $PSScriptRoot "Get-RtssCli.ps1") -TargetDir $embedDir } diff --git a/docs/GUIDE.md b/docs/GUIDE.md index d329fe5..3b60cd4 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -41,7 +41,6 @@ Cap the global frame rate while console mode runs (helpful on a 60 Hz TV). Requi - Multi-monitor layouts vary; on some setups restore may need a second try from the tray - Xbox mode does not detect when fullscreen ends — restore manually -- Monitor and audio switching rely on bundled [NirSoft](https://www.nirsoft.net/) tools - The FPS limit is global (RTSS limitation), not per display - The WinUI 3 build currently requires Windows to compile (`net8.0-windows`) @@ -68,7 +67,7 @@ Confirm that the focus monitor supports the feature and that HDR is enabled in W Requires [Visual Studio 2022](https://visualstudio.microsoft.com/) with the **Windows application development** workload, or the .NET 8 SDK plus the Windows App SDK. ```powershell -# Downloads MultiMonitorTool / SoundVolumeView / rtss-cli, then builds both packages +# Downloads rtss-cli, then builds both packages .\build\Publish-ConsoleMode.ps1 -Version 1.4.0 ``` diff --git a/docs/GUIDE.pt-BR.md b/docs/GUIDE.pt-BR.md index 8ea13ef..ee7a86f 100644 --- a/docs/GUIDE.pt-BR.md +++ b/docs/GUIDE.pt-BR.md @@ -41,7 +41,6 @@ Limita a taxa de quadros global durante o modo console (útil em TV 60 Hz). Exig - Layouts multi-monitor variam; em alguns setups a restauração pode precisar de uma nova tentativa pela bandeja - O Modo Xbox não detecta o fim do fullscreen — restaure manualmente -- Monitores e áudio dependem das ferramentas [NirSoft](https://www.nirsoft.net/) incluídas no pacote - O limite de FPS é global (limitação do RTSS), não por tela - O build WinUI 3 precisa ser compilado no Windows (`net8.0-windows`) @@ -68,7 +67,7 @@ Confirme se o monitor de foco é compatível com o recurso e se o HDR está ativ Precisa do [Visual Studio 2022](https://visualstudio.microsoft.com/) com a workload **Desenvolvimento de aplicativos da Windows**, ou do SDK do .NET 8 + Windows App SDK. ```powershell -# Baixa MultiMonitorTool / SoundVolumeView / rtss-cli e compila os dois pacotes +# Baixa o rtss-cli e compila os dois pacotes .\build\Publish-ConsoleMode.ps1 -Version 1.4.0 ``` diff --git a/docs/TESTING.md b/docs/TESTING.md index fb3ff76..2fb122c 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -116,7 +116,7 @@ Pré-condições: Ajustes → Interface = **Automático** (padrão). ## Áudio nativo, sem SoundVolumeView (issue #91) -Pré-condições: app **fechado**; em `config.json` (na pasta de dados) acrescente `"NativeAudio": true` e abra o app. O log (`consolemode.log`) deve mostrar `audio=native` na linha `Startup:`. Para voltar ao SoundVolumeView, troque para `false`. +Pré-condições: a partir da 1.6 o áudio nativo já vem ligado (`"NativeAudio": true` em `config.json`) e o SoundVolumeView não é mais embutido. O log (`consolemode.log`) deve mostrar `audio=native` na linha `Startup:`. Para comparar com o SoundVolumeView, coloque o `SoundVolumeView.exe` na pasta `tools` e troque para `false`. - [ ] Ajustes → Saída de áudio lista as mesmas saídas que com o SoundVolumeView, com os mesmos nomes, e as desativadas aparecem com o sufixo "[Desabilitado]". Resultado: ______ - [ ] A saída que já estava escolhida com o SoundVolumeView continua selecionada (o ID salvo é o mesmo). Resultado: ______ @@ -129,7 +129,7 @@ Pré-condições: app **fechado**; em `config.json` (na pasta de dados) acrescen ## Telas nativas, sem MultiMonitorTool (issue #91) -Pré-condições: app **fechado**; em `config.json` acrescente `"NativeDisplays": true` e abra o app. A linha `Startup:` do log deve mostrar `displays=native`. Para voltar ao MultiMonitorTool, troque para `false`. Faça primeiro uma rodada com `false` e anote o que aparece, para comparar. +Pré-condições: a partir da 1.6 as telas nativas já vêm ligadas (`"NativeDisplays": true` em `config.json`) e o MultiMonitorTool não é mais embutido. A linha `Startup:` do log deve mostrar `displays=native`. Para comparar com o MultiMonitorTool, coloque o `MultiMonitorTool.exe` na pasta `tools` e troque para `false` (ou use a 1.5.0). ### Lista e identidade diff --git a/src/ConsoleMode/Models/Models.cs b/src/ConsoleMode/Models/Models.cs index 42763cf..71887b5 100644 --- a/src/ConsoleMode/Models/Models.cs +++ b/src/ConsoleMode/Models/Models.cs @@ -19,10 +19,10 @@ public sealed class AppConfig public string AudioDeviceId { get; set; } = ""; public string AudioDeviceName { get; set; } = ""; public bool AudioAutoSwitch { get; set; } - /// Use Core Audio instead of SoundVolumeView (issue #91); off until verified on hardware. - public bool NativeAudio { get; set; } - /// Use Windows' display APIs instead of MultiMonitorTool (issue #91); off until verified on hardware. - public bool NativeDisplays { get; set; } + /// Core Audio instead of SoundVolumeView (issue #91). On since 1.6; false needs SoundVolumeView.exe in tools. + public bool NativeAudio { get; set; } = true; + /// Windows' display APIs instead of MultiMonitorTool (issue #91). On since 1.6; false needs MultiMonitorTool.exe in tools. + public bool NativeDisplays { get; set; } = true; public int FpsLimit { get; set; } public Dictionary MonitorModes { get; set; } = new(StringComparer.OrdinalIgnoreCase); public bool HdrEnable { get; set; } diff --git a/src/ConsoleMode/Services/AudioService.cs b/src/ConsoleMode/Services/AudioService.cs index b8c5920..9ab31e5 100644 --- a/src/ConsoleMode/Services/AudioService.cs +++ b/src/ConsoleMode/Services/AudioService.cs @@ -12,8 +12,8 @@ public sealed class AudioService private Dictionary _endpointIds = new(StringComparer.OrdinalIgnoreCase); /// - /// Core Audio instead of SoundVolumeView (issue #91). Off by default while it's verified on real - /// hardware: set "NativeAudio": true in config.json and restart the app. + /// Core Audio instead of SoundVolumeView (issue #91). On by default since 1.6; "NativeAudio": false + /// in config.json goes back to SoundVolumeView, which is no longer bundled (put it in the tools folder). /// public static bool UseNative => _useNative ??= LoadNativeFlag(); diff --git a/src/ConsoleMode/Services/EmbeddedFiles.cs b/src/ConsoleMode/Services/EmbeddedFiles.cs index 2391da5..6b7c3e5 100644 --- a/src/ConsoleMode/Services/EmbeddedFiles.cs +++ b/src/ConsoleMode/Services/EmbeddedFiles.cs @@ -7,7 +7,7 @@ public static class EmbeddedFiles public static void ExtractTools(string toolsDir) { Directory.CreateDirectory(toolsDir); - foreach (var name in new[] { "MultiMonitorTool.exe", "SoundVolumeView.exe", "rtss-cli.exe" }) + foreach (var name in new[] { "rtss-cli.exe" }) { Extract($"ConsoleMode.Tools.{name}", Path.Combine(toolsDir, name)); } diff --git a/src/ConsoleMode/Services/MonitorService.cs b/src/ConsoleMode/Services/MonitorService.cs index 81aa76f..2ba00fe 100644 --- a/src/ConsoleMode/Services/MonitorService.cs +++ b/src/ConsoleMode/Services/MonitorService.cs @@ -20,8 +20,8 @@ public void ClearCache() } /// - /// Windows' own display APIs instead of MultiMonitorTool (issue #91). Off by default while it's - /// verified on real hardware: set "NativeDisplays": true in config.json and restart the app. + /// Windows' own display APIs instead of MultiMonitorTool (issue #91). On by default since 1.6; + /// "NativeDisplays": false goes back to MultiMonitorTool, which is no longer bundled. /// public static bool UseNative => _useNative ??= LoadNativeFlag();