Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ English (US) release notes, mirroring CHANGELOG.md (Brazilian Portuguese). Befor

## [Unreleased]

## [1.7.0-legacy]
**Legacy** is Console Mode 1.6.2, with both interfaces (Desktop and Console), published next to 1.7.0 for those who prefer the old interface. It is frozen: no new features and no fixes.
### Changes
- Keeps the settings only the current version has (added apps, per-game profiles, the opening, the Task View shortcut...) and saves them back untouched: switching to Legacy and back to the current version loses nothing.
- It never checks for updates or offers the current version; the update settings are gone from both interfaces. To go back to the current version, install it over this one.
- It shows as **Console Mode Legacy** in the window title, the tray, Settings and the installer.

## [1.6.2]
### What's new
- Minimize to the system tray: with the new option in Settings (also in the Console interface, under System), minimizing the window takes Console Mode off the taskbar and leaves just its icon in the hidden icons; one click on the icon opens it again. Off by default. (#150)
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Notas em português do Brasil; a versão em inglês (Estados Unidos) fica em `CH

## [Unreleased]

## [1.7.0-legacy]
A **Legacy** é o Console Mode 1.6.2, com as duas interfaces (Desktop e Console), publicada junto da 1.7.0 para quem prefere a interface antiga. Está congelada: não recebe novas funções nem correções.
### Mudanças
- Guarda os ajustes que só a versão atual tem (aplicativos adicionados, perfis por jogo, abertura, atalho da visão de tarefas...) e os grava de volta sem mexer: trocar para a Legacy e voltar para a versão atual não perde nada.
- Não procura atualizações nem avisa da versão atual; os ajustes de atualização saem das duas interfaces. Para voltar à versão atual, instale-a por cima.
- Aparece como **Console Mode Legacy** no título da janela, na bandeja, em Ajustes e no instalador.

## [1.6.2]
### Novidades
- Minimizar para a bandeja: com a nova opção em Ajustes (também na interface Console, em Sistema), minimizar a janela tira o Console Mode da barra de tarefas e deixa só o ícone nos ícones ocultos; um clique no ícone abre de novo. Vem desligada. (#150)
Expand Down
4 changes: 2 additions & 2 deletions build/ConsoleMode.iss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
AppId={{6C1C3E8B-4F0E-4E0B-9C62-3A7E1D0C5B21}
AppName={#AppName}
AppVersion={#AppVersion}
AppVerName={#AppName} {#AppVersion}
AppVerName={#AppName} {#AppVersion} Legacy
AppPublisher=lippdev
AppPublisherURL=https://github.com/lippdev/consolemode
AppSupportURL=https://github.com/lippdev/consolemode/issues
Expand All @@ -38,7 +38,7 @@ OutputDir={#OutputDir}
OutputBaseFilename=ConsoleMode-Setup-{#Arch}
SetupIconFile=..\assets\icon.ico
UninstallDisplayIcon={app}\{#AppExe}
UninstallDisplayName={#AppName}
UninstallDisplayName={#AppName} Legacy
Compression=lzma2/ultra64
SolidCompression=yes
WizardStyle=modern
Expand Down
2 changes: 1 addition & 1 deletion src/ConsoleMode/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)
AppLog.Write("Controles: " + ControllerInput.DescribeDevices().ReplaceLineEndings(" | "));
ProtocolService.EnsureRegistered();
AppLog.Write($"Startup: exe={Environment.ProcessPath}, args={string.Join(' ', Environment.GetCommandLineArgs().Skip(1))}, " +
$"rtss-cli={AppPaths.HasRtssCli}");
$"rtss-cli={AppPaths.HasRtssCli}, edição={AppEdition.Name} {UpdateService.CurrentVersion}");

ViewModel = new MainViewModel();
_window = new MainWindow(ViewModel);
Expand Down
8 changes: 4 additions & 4 deletions src/ConsoleMode/ConsoleMode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<Version>1.6.2</Version>
<AssemblyVersion>1.6.2.0</AssemblyVersion>
<FileVersion>1.6.2.0</FileVersion>
<InformationalVersion>1.6.2</InformationalVersion>
<Version>1.7.0</Version>
<AssemblyVersion>1.7.0.0</AssemblyVersion>
<FileVersion>1.7.0.0</FileVersion>
<InformationalVersion>1.7.0</InformationalVersion>
<AssemblyTitle>Console Mode</AssemblyTitle>
<Product>Console Mode</Product>
<Authors>lippdev</Authors>
Expand Down
2 changes: 1 addition & 1 deletion src/ConsoleMode/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="using:ConsoleMode.Views"
Title="Console Mode">
Title="Console Mode Legacy">

<Grid x:Name="RootGrid">
<Grid.RowDefinitions>
Expand Down
6 changes: 6 additions & 0 deletions src/ConsoleMode/Models/Models.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using ConsoleMode.Services;

Expand All @@ -7,6 +8,11 @@ public sealed class AppConfig
{
/// <summary>2 = monitor fields hold <see cref="MonitorInfo.StableId"/>; 0/1 = GDI names (\\.\DISPLAYn).</summary>
public int Version { get; set; }
/// <summary>
/// Settings this build doesn't have (the current Console Mode wrote them: custom apps, game profiles, the
/// opening...). Kept as they came and saved back, so switching to Legacy and back loses nothing.
/// </summary>
[JsonExtensionData] public Dictionary<string, JsonElement>? NewerSettings { get; set; }
/// <summary>Empty until the user (or the installer) picks one; the app then follows Windows.</summary>
public string AppLanguage { get; set; } = "";
public string FocusMonitor { get; set; } = "";
Expand Down
13 changes: 13 additions & 0 deletions src/ConsoleMode/Services/AppEdition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace ConsoleMode.Services;

/// <summary>
/// This build is "Legacy": Console Mode 1.6.2 with both interfaces, published next to 1.7.0 for those who prefer
/// the old one. It is frozen, so it has nothing to update to.
/// </summary>
public static class AppEdition
{
public const string Name = "Legacy";

/// <summary>Never: the only newer release is the current app, which a Legacy user chose not to use.</summary>
public static readonly bool ChecksForUpdates = false;
}
2 changes: 1 addition & 1 deletion src/ConsoleMode/Services/TrayService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public TrayService(Window window, MainViewModel vm)
_vm = vm;
_icon = new TaskbarIcon
{
ToolTipText = "Console Mode"
ToolTipText = "Console Mode Legacy"
};

var iconPath = AppPaths.IconPath;
Expand Down
3 changes: 2 additions & 1 deletion src/ConsoleMode/ViewModels/MainViewModel.Updates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ private void RefreshHomeButtonHint()
/// <summary>Startup check: quiet on failure, respects "ignorar esta versão".</summary>
private async Task CheckForUpdatesOnStartupAsync()
{
if (!CheckUpdates) return;
// Legacy is frozen: there is nothing to update to, and it must not keep offering the current app.
if (!AppEdition.ChecksForUpdates || !CheckUpdates) return;
await CheckForUpdatesAsync(manual: false);
}

Expand Down
16 changes: 14 additions & 2 deletions src/ConsoleMode/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public partial class MainViewModel : ObservableObject

/// <summary>Last config read from disk; monitor fields survive a failed monitor listing.</summary>
private AppConfig _loadedConfig = new();
/// <summary>
/// The launcher the current app saved when Legacy doesn't have it (one of its custom apps). Steam Big Picture
/// shows and opens here; the saved one goes back to the file as it came, until another launcher is picked.
/// </summary>
private string? _newerLaunchMode;
private List<AudioDevice> _availableAudioDevices = [];

public MainViewModel() => LocalizationService.LanguageChanged += OnLanguageChanged;
Expand Down Expand Up @@ -70,7 +75,7 @@ public partial class MainViewModel : ObservableObject
[ObservableProperty] private MonitorRowViewModel? _selectedMonitor;
[ObservableProperty] private MonitorRowViewModel? _focusRow;

public string AppVersion => UpdateService.CurrentVersion;
public string AppVersion => $"{UpdateService.CurrentVersion} {AppEdition.Name}";

public bool HasSelectedMonitor => SelectedMonitor is not null;
public bool HasFocusRow => FocusRow is not null;
Expand Down Expand Up @@ -303,6 +308,7 @@ private void Apply(LoadResult data)
IsPlayniteAvailable = Engine.Launch.IsPlayniteAvailable();
BuildLocalizedOptions();
SelectedLaunch = LaunchOptions.FirstOrDefault(o => o.Value == config.FullscreenMode) ?? LaunchOptions[0];
_newerLaunchMode = config.FullscreenMode is { } saved && saved.StartsWith("customApp", StringComparison.Ordinal) ? saved : null;
ApplyTv(config.Tv);
HdrEnable = config.HdrEnable;
VrrEnable = config.VrrEnable;
Expand Down Expand Up @@ -538,6 +544,7 @@ partial void OnSelectedLanguageChanged(ComboOption? value)
partial void OnVrrEnableChanged(bool value) { SettingChanged(); OnPropertyChanged(nameof(VrrText)); }
partial void OnSelectedLaunchChanged(ComboOption? value)
{
if (!_applying) _newerLaunchMode = null;
OnPropertyChanged(nameof(LaunchDescription));
SettingChanged();
}
Expand Down Expand Up @@ -899,6 +906,7 @@ private AppConfig BuildConfig()
var auto = audioId == ConsoleEngine.AudioOnConnectId;
var config = new AppConfig
{
NewerSettings = _loadedConfig.NewerSettings,
AppLanguage = SelectedLanguage?.Value ?? LocalizationService.Language,
// Listing failed: keep the saved screens instead of wiping them.
FocusMonitor = _loadedConfig.FocusMonitor,
Expand Down Expand Up @@ -965,7 +973,11 @@ private void TrySave(AppConfig config)
{
try
{
ConfigService.Save(config);
// Only in the file: what runs here is the launcher on screen.
var shown = config.FullscreenMode;
if (_newerLaunchMode is not null) config.FullscreenMode = _newerLaunchMode;
try { ConfigService.Save(config); }
finally { config.FullscreenMode = shown; }
_loadedConfig = config;
}
catch (Exception ex)
Expand Down
6 changes: 3 additions & 3 deletions src/ConsoleMode/Views/ConsoleHomeView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -624,19 +624,19 @@
<TextBlock Grid.Column="1" Style="{StaticResource RowValue}" Text="{x:Bind ViewModel.OnOff(ViewModel.MinimizeToTray), Mode=OneWay}"/>
</Grid>
</Button>
<Button Style="{StaticResource ConsoleRow}" Command="{x:Bind ViewModel.CycleSettingCommand}" CommandParameter="updates">
<Button Style="{StaticResource ConsoleRow}" Command="{x:Bind ViewModel.CycleSettingCommand}" CommandParameter="updates" Visibility="Collapsed">
<Grid ColumnSpacing="24"><Grid.ColumnDefinitions><ColumnDefinition Width="3*"/><ColumnDefinition Width="2*"/></Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource RowLabel}" Text="{x:Bind ViewModel.Texts.NotifyUpdatesCard, Mode=OneWay}"/>
<TextBlock Grid.Column="1" Style="{StaticResource RowValue}" Text="{x:Bind ViewModel.OnOff(ViewModel.CheckUpdates), Mode=OneWay}"/>
</Grid>
</Button>
<Button Style="{StaticResource ConsoleRow}" Command="{x:Bind ViewModel.CycleSettingCommand}" CommandParameter="betas">
<Button Style="{StaticResource ConsoleRow}" Command="{x:Bind ViewModel.CycleSettingCommand}" CommandParameter="betas" Visibility="Collapsed">
<Grid ColumnSpacing="24"><Grid.ColumnDefinitions><ColumnDefinition Width="3*"/><ColumnDefinition Width="2*"/></Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource RowLabel}" Text="{x:Bind ViewModel.Texts.BetaUpdatesCard, Mode=OneWay}"/>
<TextBlock Grid.Column="1" Style="{StaticResource RowValue}" Text="{x:Bind ViewModel.OnOff(ViewModel.BetaUpdates), Mode=OneWay}"/>
</Grid>
</Button>
<Button Style="{StaticResource ConsoleRow}" Command="{x:Bind ViewModel.CheckNowCommand}">
<Button Style="{StaticResource ConsoleRow}" Command="{x:Bind ViewModel.CheckNowCommand}" Visibility="Collapsed">
<Grid ColumnSpacing="24"><Grid.ColumnDefinitions><ColumnDefinition Width="3*"/><ColumnDefinition Width="2*"/></Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource RowLabel}" Text="{x:Bind ViewModel.Texts.CheckNow, Mode=OneWay}"/>
<TextBlock Grid.Column="1" Style="{StaticResource RowValue}" Text="{x:Bind ViewModel.UpdateStatusText, Mode=OneWay}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" FontWeight="Normal" FontSize="16"/>
Expand Down
6 changes: 3 additions & 3 deletions src/ConsoleMode/Views/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
<ToggleSwitch IsOn="{x:Bind ViewModel.MinimizeToTray, Mode=TwoWay}"
OnContent="{x:Bind ViewModel.Texts.ToggleOn, Mode=OneWay}" OffContent="{x:Bind ViewModel.Texts.ToggleOff, Mode=OneWay}"/>
</ctk:SettingsCard>
<ctk:SettingsCard Header="{x:Bind ViewModel.Texts.UpdatesCard, Mode=OneWay}" Description="{x:Bind ViewModel.UpdateStatusText, Mode=OneWay}">
<ctk:SettingsCard Header="{x:Bind ViewModel.Texts.UpdatesCard, Mode=OneWay}" Description="{x:Bind ViewModel.UpdateStatusText, Mode=OneWay}" Visibility="Collapsed">
<ctk:SettingsCard.HeaderIcon>
<FontIcon Glyph="&#xE895;"/>
</ctk:SettingsCard.HeaderIcon>
Expand All @@ -295,14 +295,14 @@
<Button Content="{x:Bind ViewModel.Texts.CheckNow, Mode=OneWay}" Command="{x:Bind ViewModel.CheckNowCommand}"/>
</StackPanel>
</ctk:SettingsCard>
<ctk:SettingsCard Header="{x:Bind ViewModel.Texts.NotifyUpdatesCard, Mode=OneWay}" Description="{x:Bind ViewModel.Texts.NotifyUpdatesDescription, Mode=OneWay}">
<ctk:SettingsCard Header="{x:Bind ViewModel.Texts.NotifyUpdatesCard, Mode=OneWay}" Description="{x:Bind ViewModel.Texts.NotifyUpdatesDescription, Mode=OneWay}" Visibility="Collapsed">
<ctk:SettingsCard.HeaderIcon>
<FontIcon Glyph="&#xEA8F;"/>
</ctk:SettingsCard.HeaderIcon>
<ToggleSwitch IsOn="{x:Bind ViewModel.CheckUpdates, Mode=TwoWay}"
OnContent="{x:Bind ViewModel.Texts.ToggleOn, Mode=OneWay}" OffContent="{x:Bind ViewModel.Texts.ToggleOff, Mode=OneWay}"/>
</ctk:SettingsCard>
<ctk:SettingsCard Header="{x:Bind ViewModel.Texts.BetaUpdatesCard, Mode=OneWay}" Description="{x:Bind ViewModel.Texts.BetaUpdatesDescription, Mode=OneWay}">
<ctk:SettingsCard Header="{x:Bind ViewModel.Texts.BetaUpdatesCard, Mode=OneWay}" Description="{x:Bind ViewModel.Texts.BetaUpdatesDescription, Mode=OneWay}" Visibility="Collapsed">
<ctk:SettingsCard.HeaderIcon>
<FontIcon Glyph="&#xE9D5;"/>
</ctk:SettingsCard.HeaderIcon>
Expand Down
1 change: 1 addition & 0 deletions tests/ConsoleMode.Tests/ConsoleMode.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<Compile Include="../../src/ConsoleMode/Services/ControlFsRelease.cs" Link="ControlFsRelease.cs" />
<Compile Include="../../src/ConsoleMode/Services/SteamShutdown.cs" Link="SteamShutdown.cs" />
<Compile Include="../../src/ConsoleMode/Models/Models.cs" Link="Models.cs" />
<Compile Include="../../src/ConsoleMode/Services/AppEdition.cs" Link="AppEdition.cs" />
<Compile Include="../../src/ConsoleMode/Services/Tv/AdbProtocol.cs" Link="Tv/AdbProtocol.cs" />
<Compile Include="../../src/ConsoleMode/Services/Tv/AdbShellOutput.cs" Link="Tv/AdbShellOutput.cs" />
<Compile Include="../../src/ConsoleMode/Services/Tv/WakeOnLan.cs" Link="Tv/WakeOnLan.cs" />
Expand Down
68 changes: 68 additions & 0 deletions tests/ConsoleMode.Tests/LegacyConfigTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using ConsoleMode.Models;

namespace ConsoleMode.Tests;

/// <summary>Legacy reads the current app's config.json and must hand every setting it doesn't know back untouched.</summary>
public class LegacyConfigTests
{
// The same options as JsonUtil.Options (AppPaths.cs, not linked here: it touches the file system).
private static readonly JsonSerializerOptions Options = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};

private const string FromCurrentApp = """
{
"version": 2,
"focusMonitor": "MONITOR\\GSM0001\\{x}\\0002",
"fullscreenMode": "customApp:a1",
"customApps": [ { "id": "a1", "path": "C:\\Games\\Emu\\emu.exe", "arguments": "-f", "watchProcess": "" } ],
"customAppId": "a1",
"gameProfiles": [ { "steamAppId": 620, "name": "Portal 2", "fpsLimit": 60 } ],
"introStyle": "x360",
"parkPointer": true,
"taskViewShortcut": 16416,
"menuOutsideSession": false,
"checkUpdates": true
}
""";

[Fact]
public void Settings_of_the_current_app_survive_a_save()
{
var config = JsonSerializer.Deserialize<AppConfig>(FromCurrentApp, Options)!;
// What Legacy knows, it reads as always.
Assert.Equal(@"MONITOR\GSM0001\{x}\0002", config.FocusMonitor);
Assert.True(config.CheckUpdates);
// What it changes, changes; the rest goes back as it came.
config.HdrEnable = true;
using var saved = JsonDocument.Parse(JsonSerializer.Serialize(config, Options));
var root = saved.RootElement;

Assert.True(root.GetProperty("hdrEnable").GetBoolean());
Assert.Equal("a1", root.GetProperty("customAppId").GetString());
Assert.Equal(@"C:\Games\Emu\emu.exe", root.GetProperty("customApps")[0].GetProperty("path").GetString());
Assert.Equal(620, root.GetProperty("gameProfiles")[0].GetProperty("steamAppId").GetInt32());
Assert.Equal("x360", root.GetProperty("introStyle").GetString());
Assert.True(root.GetProperty("parkPointer").GetBoolean());
Assert.Equal(16416, root.GetProperty("taskViewShortcut").GetInt32());
// False is a value too, not something to drop.
Assert.False(root.GetProperty("menuOutsideSession").GetBoolean());
}

[Fact]
public void A_config_of_its_own_has_nothing_extra()
{
var config = JsonSerializer.Deserialize<AppConfig>("""{ "version": 2, "uiMode": "desktop" }""", Options)!;
Assert.Equal("desktop", config.UiMode);
Assert.Null(config.NewerSettings);
Assert.DoesNotContain("newerSettings", JsonSerializer.Serialize(config, Options));
}

[Fact]
public void Legacy_never_checks_for_updates() => Assert.False(ConsoleMode.Services.AppEdition.ChecksForUpdates);
}
Loading