diff --git a/CHANGELOG.md b/CHANGELOG.md index 88a61be..521dcfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,36 @@ All notable changes are documented here. Versions follow the Playnite extension ## [Unreleased] +## [0.8.0] - 2026-09-14 + +### Added + +- Three explicit video-end behaviors: reveal Playnite as soon as it is ready, wait for the video to finish, or loop until Playnite is ready. +- Transparent WebM compatibility playback through a local MKV alias/cache without transcoding or FFmpeg. +- Public `Local\PlayniteBootScreen.StartupIntroHandled.v1` integration marker for themes and helper extensions that need to suppress duplicate startup intros. +- Aniki ReMake extended startup intro as an optional bundled video. + +### Changed + +- Streaming Preload now primes the decoder while the overlay stays hidden, then pauses and rewinds playback so Continue starts the intro from the beginning. +- Bundled videos are seeded into the persistent runtime media library without overwriting existing user files. +- Video settings now use a single mutually exclusive playback selector and explicitly list MP4, MKV, WebM, AVI, and MOV. +- The streaming Host now abandons a missing Continue command after 10 seconds instead of 30 seconds. +- Added an early Continue-entry diagnostic log for failed streaming Detached launches. +- Runtime updated to 1.0.9. + +### Fixed + +- A video ending before Playnite is ready now keeps its final frame instead of exposing the media element's end-of-stream surface. +- Wait mode no longer seeks backward to the held final frame when Playnite is already ready and the video finishes naturally. +- Streaming Preload no longer consumes the beginning of the startup video before the client session continues. +- Desktop-to-Fullscreen bootstrap is suppressed while a streaming Host already owns the startup overlay, preventing an extra black cover during streaming startup. + +### Compatibility + +- Existing 0.7.x playback settings are migrated automatically to the new video-end behavior model. +- Existing custom media, shortcuts, and streaming configuration remain compatible. + ## [0.7.1] - 2026-09-13 ### Fixed diff --git a/PlayniteBoot/Localization/en_US.xaml b/PlayniteBoot/Localization/en_US.xaml index 257b6c6..f154314 100644 --- a/PlayniteBoot/Localization/en_US.xaml +++ b/PlayniteBoot/Localization/en_US.xaml @@ -6,23 +6,27 @@ Installation and diagnostics Choose a boot video from the managed media folder or browse to an external file. Playnite can be revealed on any monitor after its Fullscreen window is detected. - For Sunshine, Apollo and compatible forks: use the first command as Prep and the second as Detached. The video starts before the client stream so the desktop remains covered. + For Sunshine, Apollo and compatible forks: use the first command as Prep and the second as Detached. Prep primes the video while the overlay stays black; playback restarts from the beginning when Continue runs. Video + Playback + Playnite integration Screen Audio and transitions Streaming commands Managed runtime + Status Shortcuts Diagnostics Video file + When to show Playnite Monitor Video scaling Volume Fade in (ms) Fade out (ms) - Minimum display time (ms) + Fallback delay (ms) Playnite window stability (ms) Playnite startup timeout (s) Video-ready position (ms) @@ -38,6 +42,16 @@ Runtime folder Direct launch command Shortcut name + Extension + Runtime + Configuration + + Show Playnite as soon as it's ready + Keeps the last video frame visible if the video ends first. + Wait for the video to finish + Keeps playing even if Playnite is already ready. + Loop the video until Playnite is ready + Restarts the video if it ends while Playnite is still loading. Wait for the video to finish before revealing Playnite Loop the video @@ -50,32 +64,40 @@ Covers Playnite's built-in Desktop to Fullscreen transition with the configured boot video. Playnite starts in the background immediately, but the overlay fades only after Playnite is ready and the video reaches its natural end. Looping is unavailable while waiting for the natural end of the video. - Ignored while waiting for the complete video. + Fallback delay used only when the configured video is missing or cannot be played. + Accepted formats: {0} + Playback depends on the codecs available in Windows. WebM files are handled automatically through compatibility mode. Follow Playnite reads its Fullscreen display choice in read-only mode. If it cannot be read, the last manual monitor choice is used. Keep “auto” unless Playnite is installed in a non-standard location. Refresh list Open video folder - Browse external… + Browse… Use default Restore default settings Copy Install/update runtime + Repair runtime Open runtime folder Open logs Create/update Desktop shortcut Create/update Start shortcut Remove Desktop shortcut Remove Start shortcut - Copy diagnostic information + Copy diagnostics + Create/update + Remove Advanced settings Advanced streaming settings + Manual launch and advanced tools 1. Prep command — Preload 2. Detached command — Continue No Undo command is required. Continue reuses the video already started by Preload. - Copies version and feature status only. File paths, credentials and log contents are not included. + Copied diagnostics include versions and feature status only. File paths, credentials and log contents are not included. + Managed runtime files are installed and synchronized automatically. + Runtime: {0} Match streaming client resolution Use the monitor selected in General @@ -93,14 +115,20 @@ Default — {0} External — {0} Missing — {0} - Video library refreshed — {0} supported file(s) found. + Video library refreshed — {0} accepted file(s) found. Could not refresh the video library: {0} The bundled default video has been selected. Default settings restored. Custom video files and logs were not deleted. Runtime installed: {0}; files copied: {1}. - Runtime ready — version {0}. - Runtime is only partially installed. Use Install/update runtime. - Runtime is not installed yet. + Runtime repaired: {0}; files synchronized: {1}. + ● Runtime ready + Runtime needs repair. + Runtime is not ready yet. Use Repair runtime if automatic synchronization does not complete. + Valid + Needs repair + ● Installed + ○ Not installed + Status unavailable Shortcut “{0}” created or updated in {1}. Shortcut removed from {0}. No managed shortcut was found in {0}. @@ -109,12 +137,15 @@ the Desktop the Start menu + Desktop + Start menu Restore all Playnite Boot Screen settings to their defaults? Custom video files and logs will not be deleted. Remove the Playnite Boot Screen shortcut from {0}? The configured video does not exist: {0} The video path is not valid. + The video format is not accepted. Use: {0}. Volume must be between 0 and 100. The streaming settings section is not valid. Loop video and Wait for video end cannot be enabled at the same time. @@ -131,5 +162,5 @@ PowerShell could not be started to create the shortcut. The shortcut operation timed out. Launch Playnite Fullscreen with a custom boot video and no console window. - Video files|*.mp4;*.mkv;*.webm;*.avi;*.mov|All files|*.* + Video files diff --git a/PlayniteBoot/Localization/it_IT.xaml b/PlayniteBoot/Localization/it_IT.xaml index b404dba..6f475c2 100644 --- a/PlayniteBoot/Localization/it_IT.xaml +++ b/PlayniteBoot/Localization/it_IT.xaml @@ -6,23 +6,27 @@ Installazione e diagnostica Scegli un video di avvio dalla cartella multimediale gestita oppure seleziona un file esterno. Playnite può essere rilevato su qualsiasi monitor quando la finestra Fullscreen è pronta. - Per Sunshine, Apollo e fork compatibili: usa il primo comando come Prep e il secondo come Detached. Il video parte prima dello stream e mantiene coperto il desktop. + Per Sunshine, Apollo e fork compatibili: usa il primo comando come Prep e il secondo come Detached. Prep prepara il video mantenendo nero l’overlay; la riproduzione riparte dall’inizio quando viene eseguito Continue. Video + Riproduzione + Integrazione Playnite Schermo Audio e transizioni Comandi streaming Runtime gestito + Stato Collegamenti Diagnostica File video + Quando mostrare Playnite Monitor Adattamento video Volume Fade-in (ms) Fade-out (ms) - Durata minima (ms) + Ritardo fallback (ms) Stabilità finestra Playnite (ms) Timeout avvio Playnite (s) Posizione video-ready (ms) @@ -38,6 +42,16 @@ Cartella runtime Comando di avvio diretto Nome collegamento + Estensione + Runtime + Configurazione + + Mostra Playnite appena è pronto + Mantiene l'ultimo fotogramma se il video termina prima. + Attendi la fine del video + Continua il video anche se Playnite è già pronto. + Ripeti finché Playnite è pronto + Ricomincia il video se termina durante il caricamento. Attendi la fine del video prima di mostrare Playnite Ripeti il video @@ -50,32 +64,40 @@ Copre la transizione integrata di Playnite da Desktop a Fullscreen con il video di avvio configurato. Playnite parte subito in background, ma l'overlay sfuma solo quando Playnite è pronta e il video raggiunge la fine naturale. La ripetizione non è disponibile quando si attende la fine naturale del video. - Ignorata quando si attende il video completo. + Ritardo di fallback usato solo quando il video configurato manca o non può essere riprodotto. + Formati accettati: {0} + La riproduzione dipende dai codec disponibili in Windows. I file WebM vengono gestiti automaticamente tramite modalità di compatibilità. Segui Playnite legge in sola lettura la scelta del display Fullscreen. Se non è disponibile, viene usata l’ultima scelta manuale del monitor. Mantieni “auto” salvo installazioni di Playnite in percorsi non standard. Aggiorna elenco Apri cartella video - Sfoglia esterno… + Sfoglia… Usa predefinito Ripristina impostazioni predefinite Copia Installa/aggiorna runtime + Ripara runtime Apri cartella runtime Apri log Crea/aggiorna collegamento Desktop Crea/aggiorna collegamento Start Rimuovi collegamento Desktop Rimuovi collegamento Start - Copia informazioni diagnostiche + Copia diagnostica + Crea/aggiorna + Rimuovi Impostazioni avanzate Impostazioni streaming avanzate + Avvio manuale e strumenti avanzati 1. Prep command — Preload 2. Detached command — Continue Non serve alcun comando Undo. Continue riutilizza il video già avviato da Preload. - Copia soltanto versioni e stato delle funzionalità. Non include percorsi dei file, credenziali o contenuto dei log. + La diagnostica copiata include solo versioni e stato delle funzionalità. Non include percorsi dei file, credenziali o contenuto dei log. + I file gestiti del runtime vengono installati e sincronizzati automaticamente. + Runtime: {0} Abbina la risoluzione del client streaming Usa il monitor scelto in Generale @@ -93,14 +115,20 @@ Predefinito — {0} Esterno — {0} Mancante — {0} - Libreria video aggiornata — trovati {0} file supportati. + Libreria video aggiornata — trovati {0} file accettati. Impossibile aggiornare la libreria video: {0} È stato selezionato il video predefinito incluso. Impostazioni predefinite ripristinate. I video personalizzati e i log non sono stati eliminati. Runtime installato: {0}; file copiati: {1}. - Runtime pronto — versione {0}. - Runtime installato solo in parte. Usa Installa/aggiorna runtime. - Runtime non ancora installato. + Runtime riparato: {0}; file sincronizzati: {1}. + ● Runtime pronto + Il runtime richiede una riparazione. + Il runtime non è ancora pronto. Usa Ripara runtime se la sincronizzazione automatica non si completa. + Valida + Da riparare + ● Installato + ○ Non installato + Stato non disponibile Collegamento “{0}” creato o aggiornato in {1}. Collegamento rimosso da {0}. Nessun collegamento gestito trovato in {0}. @@ -109,12 +137,15 @@ Desktop menu Start + Desktop + Menu Start Ripristinare tutte le impostazioni di Playnite Boot Screen? I video personalizzati e i log non verranno eliminati. Rimuovere il collegamento Playnite Boot Screen da {0}? Il video configurato non esiste: {0} Il percorso del video non è valido. + Il formato video non è accettato. Usa: {0}. Il volume deve essere compreso tra 0 e 100. La sezione delle impostazioni streaming non è valida. Ripeti video e Attendi fine video non possono essere attivi contemporaneamente. @@ -131,5 +162,5 @@ Impossibile avviare PowerShell per creare il collegamento. Timeout durante l'operazione sul collegamento. Avvia Playnite Fullscreen con un video personalizzato e senza finestra console. - File video|*.mp4;*.mkv;*.webm;*.avi;*.mov|Tutti i file|*.* + File video diff --git a/PlayniteBoot/Models/PlayniteBootSettingsData.cs b/PlayniteBoot/Models/PlayniteBootSettingsData.cs index e264c72..f485712 100644 --- a/PlayniteBoot/Models/PlayniteBootSettingsData.cs +++ b/PlayniteBoot/Models/PlayniteBootSettingsData.cs @@ -3,9 +3,38 @@ namespace PlayniteBoot.Models { + public static class VideoEndBehaviors + { + public const string Ready = "ready"; + public const string Wait = "wait"; + public const string Loop = "loop"; + + public static bool IsValid(string value) + { + return string.Equals(value, Ready, StringComparison.OrdinalIgnoreCase) || + string.Equals(value, Wait, StringComparison.OrdinalIgnoreCase) || + string.Equals(value, Loop, StringComparison.OrdinalIgnoreCase); + } + + public static string Normalize(string value) + { + if (string.Equals(value, Wait, StringComparison.OrdinalIgnoreCase)) + { + return Wait; + } + + if (string.Equals(value, Loop, StringComparison.OrdinalIgnoreCase)) + { + return Loop; + } + + return Ready; + } + } + public class PlayniteBootSettingsData : ObservableObject { - public const int CurrentSettingsVersion = 3; + public const int CurrentSettingsVersion = 5; private int settingsVersion; private string playniteExecutable = "auto"; @@ -14,8 +43,13 @@ public class PlayniteBootSettingsData : ObservableObject private string monitor = "playnite"; private string monitorFallback = "primary"; private string videoStretch = "UniformToFill"; + private string videoEndBehavior = VideoEndBehaviors.Ready; + + // Kept only so settings saved by 0.7.1 and earlier can be migrated safely. + // New UI/runtime code uses VideoEndBehavior exclusively. private bool loopVideo; private bool waitForVideoEnd; + private bool mute = true; private double volume = 1.0; private int minimumVideoMilliseconds = 900; @@ -47,10 +81,9 @@ public static PlayniteBootSettingsData CreateDefault() public string Monitor { get => monitor; set => SetValue(ref monitor, value); } public string MonitorFallback { get => monitorFallback; set => SetValue(ref monitorFallback, value); } public string VideoStretch { get => videoStretch; set => SetValue(ref videoStretch, value); } - public bool LoopVideo { get => loopVideo; set => SetValue(ref loopVideo, value); } + public string VideoEndBehavior { get => videoEndBehavior; set => SetValue(ref videoEndBehavior, value); } - // When enabled, the overlay remains visible until both Playnite is ready - // and the configured video reaches its natural end. + public bool LoopVideo { get => loopVideo; set => SetValue(ref loopVideo, value); } public bool WaitForVideoEnd { get => waitForVideoEnd; set => SetValue(ref waitForVideoEnd, value); } public bool Mute { get => mute; set => SetValue(ref mute, value); } @@ -72,7 +105,6 @@ public double Volume } } - public int MinimumVideoMilliseconds { get => minimumVideoMilliseconds; set => SetValue(ref minimumVideoMilliseconds, value); } public int ReadyStabilityMilliseconds { get => readyStabilityMilliseconds; set => SetValue(ref readyStabilityMilliseconds, value); } public int StartTimeoutSeconds { get => startTimeoutSeconds; set => SetValue(ref startTimeoutSeconds, value); } diff --git a/PlayniteBoot/Models/StreamingSettings.cs b/PlayniteBoot/Models/StreamingSettings.cs index 2e4fd7a..6b51207 100644 --- a/PlayniteBoot/Models/StreamingSettings.cs +++ b/PlayniteBoot/Models/StreamingSettings.cs @@ -8,7 +8,7 @@ public class StreamingSettings : ObservableObject private string monitor = "clientResolution"; private int preloadReadyTimeoutMilliseconds = 6000; private int continueWaitTimeoutMilliseconds = 10000; - private int preloadAbandonTimeoutMilliseconds = 30000; + private int preloadAbandonTimeoutMilliseconds = 10000; private string fallbackMode = "standalone"; public bool Enabled { get => enabled; set => SetValue(ref enabled, value); } diff --git a/PlayniteBoot/PlayniteBoot.csproj b/PlayniteBoot/PlayniteBoot.csproj index feacc3c..d9708cc 100644 --- a/PlayniteBoot/PlayniteBoot.csproj +++ b/PlayniteBoot/PlayniteBoot.csproj @@ -68,6 +68,7 @@ + diff --git a/PlayniteBoot/PlayniteBootPlugin.cs b/PlayniteBoot/PlayniteBootPlugin.cs index 2e2dbda..a8f6b37 100644 --- a/PlayniteBoot/PlayniteBootPlugin.cs +++ b/PlayniteBoot/PlayniteBootPlugin.cs @@ -32,7 +32,8 @@ public PlayniteBootPlugin(IPlayniteAPI api) : base(api) Paths = new RuntimePaths(GetPluginUserDataPath(), installPath); Commands = new CommandGenerator(Paths); runtimeInstaller = new RuntimeInstaller(Paths); - configWriter = new RuntimeConfigWriter(Paths, PlayniteApi.Paths.ConfigurationPath); + var videoCompatibilityService = new VideoCompatibilityService(Paths); + configWriter = new RuntimeConfigWriter(Paths, PlayniteApi.Paths.ConfigurationPath, videoCompatibilityService); shortcutService = new ShortcutService(Paths); SettingsViewModel = new PlayniteBootSettingsViewModel(this); desktopFullscreenSwitchService = new DesktopFullscreenSwitchService( @@ -99,7 +100,8 @@ public RuntimeInstallResult PrepareRuntime(PlayniteBootSettingsData settings, bo lock (runtimeOperationLock) { var result = runtimeInstaller.EnsureInstalled(forceUpdate); - configWriter.Write(settings); + var compatibilityResult = configWriter.Write(settings); + LogVideoCompatibility(compatibilityResult); logger.Info($"{ProductName} runtime ready at {Paths.RuntimeDirectory}. Version {result.Version}."); return result; } @@ -109,7 +111,8 @@ public void WriteRuntimeConfig(PlayniteBootSettingsData settings) { lock (runtimeOperationLock) { - configWriter.Write(settings); + var compatibilityResult = configWriter.Write(settings); + LogVideoCompatibility(compatibilityResult); } } @@ -118,7 +121,8 @@ public string CreateShortcut(PlayniteBootSettingsData settings, ShortcutLocation lock (runtimeOperationLock) { var result = runtimeInstaller.EnsureInstalled(false); - configWriter.Write(settings); + var compatibilityResult = configWriter.Write(settings); + LogVideoCompatibility(compatibilityResult); logger.Info($"{ProductName} runtime ready at {Paths.RuntimeDirectory}. Version {result.Version}."); return shortcutService.Create( location, @@ -135,6 +139,24 @@ public bool RemoveShortcut(PlayniteBootSettingsData settings, ShortcutLocation l } } + private static void LogVideoCompatibility(VideoCompatibilityResult result) + { + if (result == null) + { + return; + } + + if (result.CacheCreated) + { + logger.Info($"{ProductName} prepared the WebM compatibility alias using {result.Strategy}."); + } + + if (!string.IsNullOrWhiteSpace(result.Warning)) + { + logger.Warn($"{ProductName} could not prepare the WebM compatibility alias; direct playback will be attempted. {result.Warning}"); + } + } + public bool ShortcutExists(PlayniteBootSettingsData settings, ShortcutLocation location) { lock (runtimeOperationLock) diff --git a/PlayniteBoot/PlayniteBootSettings.cs b/PlayniteBoot/PlayniteBootSettings.cs index 98c5133..80fb6d4 100644 --- a/PlayniteBoot/PlayniteBootSettings.cs +++ b/PlayniteBoot/PlayniteBootSettings.cs @@ -12,6 +12,7 @@ using System.Reflection; using System.Text; using System.Windows; +using System.Web.Script.Serialization; using Forms = System.Windows.Forms; namespace PlayniteBoot @@ -23,7 +24,6 @@ public class PlayniteBootSettingsViewModel : ObservableObject, ISettings private PlayniteBootSettingsData editingClone; private PlayniteBootSettingsData settings; private string runtimeStatus; - private bool synchronizingVideoOptions; public PlayniteBootSettingsData Settings { @@ -43,12 +43,14 @@ public PlayniteBootSettingsData Settings OnPropertyChanged(nameof(DirectCommand)); OnPropertyChanged(nameof(PreloadCommand)); OnPropertyChanged(nameof(ContinueCommand)); - OnPropertyChanged(nameof(IsLoopVideoEnabled)); - OnPropertyChanged(nameof(IsMinimumVideoDurationEnabled)); + OnPropertyChanged(nameof(IsVideoEndReady)); + OnPropertyChanged(nameof(IsVideoEndWait)); + OnPropertyChanged(nameof(IsVideoEndLoop)); OnPropertyChanged(nameof(IsVolumeEnabled)); OnPropertyChanged(nameof(VolumePercent)); OnPropertyChanged(nameof(SelectedVideoPath)); OnPropertyChanged(nameof(SelectedVideoPathDisplay)); + NotifyInstallationStatusChanged(); if (videoLibrary != null) { @@ -86,8 +88,45 @@ public string SelectedVideoPath ? string.Empty : GetConfiguredVideoPath(); - public bool IsLoopVideoEnabled => Settings == null || !Settings.WaitForVideoEnd; - public bool IsMinimumVideoDurationEnabled => Settings == null || !Settings.WaitForVideoEnd; + public string AcceptedVideoFormats => F("LOCPlayniteBootAcceptedFormats", VideoLibraryService.AcceptedFormatsDisplay); + public string AcceptedVideoFormatsToolTip => L("LOCPlayniteBootTipAcceptedFormats"); + + public bool IsVideoEndReady + { + get => Settings == null || string.Equals(Settings.VideoEndBehavior, VideoEndBehaviors.Ready, StringComparison.OrdinalIgnoreCase); + set + { + if (value) + { + SetVideoEndBehavior(VideoEndBehaviors.Ready); + } + } + } + + public bool IsVideoEndWait + { + get => Settings != null && string.Equals(Settings.VideoEndBehavior, VideoEndBehaviors.Wait, StringComparison.OrdinalIgnoreCase); + set + { + if (value) + { + SetVideoEndBehavior(VideoEndBehaviors.Wait); + } + } + } + + public bool IsVideoEndLoop + { + get => Settings != null && string.Equals(Settings.VideoEndBehavior, VideoEndBehaviors.Loop, StringComparison.OrdinalIgnoreCase); + set + { + if (value) + { + SetVideoEndBehavior(VideoEndBehaviors.Loop); + } + } + } + public bool IsVolumeEnabled => Settings == null || !Settings.Mute; public int VolumePercent @@ -109,6 +148,21 @@ public int VolumePercent } public string RuntimeDirectory => plugin.Paths.RuntimeDirectory; + public string RuntimeVersionValue => ReadRuntimeVersion(); + public string RuntimeVersionDisplay => F("LOCPlayniteBootRuntimeVersion", RuntimeVersionValue); + public string RuntimeConfigurationStatus => IsRuntimeConfigurationValid() + ? L("LOCPlayniteBootStatusConfigurationValid") + : L("LOCPlayniteBootStatusConfigurationNeedsRepair"); + public string DesktopShortcutStatus => GetShortcutStatus(ShortcutLocation.Desktop); + public string StartMenuShortcutStatus => GetShortcutStatus(ShortcutLocation.StartMenu); + public string ExtensionVersionDisplay + { + get + { + var version = Assembly.GetExecutingAssembly().GetName().Version; + return version == null ? "unknown" : version.ToString(3); + } + } public string DirectCommand => plugin.Commands.DirectCommand; public string PreloadCommand => plugin.Commands.PreloadCommand; public string ContinueCommand => plugin.Commands.ContinueCommand; @@ -123,7 +177,7 @@ public int VolumePercent public RelayCommand OpenVideoFolderCommand { get; } public RelayCommand RestoreDefaultVideoCommand { get; } public RelayCommand ResetSettingsCommand { get; } - public RelayCommand InstallRuntimeCommand { get; } + public RelayCommand RepairRuntimeCommand { get; } public RelayCommand CreateDesktopShortcutCommand { get; } public RelayCommand CreateStartMenuShortcutCommand { get; } public RelayCommand RemoveDesktopShortcutCommand { get; } @@ -161,7 +215,7 @@ public PlayniteBootSettingsViewModel(PlayniteBootPlugin plugin) OpenVideoFolderCommand = new RelayCommand(() => ExecuteAction(OpenVideoFolder)); RestoreDefaultVideoCommand = new RelayCommand(RestoreDefaultVideo); ResetSettingsCommand = new RelayCommand(ResetSettings); - InstallRuntimeCommand = new RelayCommand(() => ExecuteAction(InstallRuntime)); + RepairRuntimeCommand = new RelayCommand(() => ExecuteAction(RepairRuntime)); CreateDesktopShortcutCommand = new RelayCommand(() => ExecuteAction(() => CreateShortcut(ShortcutLocation.Desktop))); CreateStartMenuShortcutCommand = new RelayCommand(() => ExecuteAction(() => CreateShortcut(ShortcutLocation.StartMenu))); RemoveDesktopShortcutCommand = new RelayCommand(() => ExecuteAction(() => RemoveShortcut(ShortcutLocation.Desktop))); @@ -220,6 +274,11 @@ public bool VerifySettings(out List errors) { errors.Add(F("LOCPlayniteBootValidationVideoMissing", videoPath)); } + + if (!VideoLibraryService.IsAcceptedVideo(videoPath)) + { + errors.Add(F("LOCPlayniteBootValidationVideoFormat", VideoLibraryService.AcceptedFormatsDisplay)); + } } catch (Exception) { @@ -251,10 +310,6 @@ public bool VerifySettings(out List errors) ValidateMinimum(errors, Settings.Streaming.PreloadAbandonTimeoutMilliseconds, 5000, L("LOCPlayniteBootLabelPreloadAbandonTimeout")); } - if (Settings.WaitForVideoEnd && Settings.LoopVideo) - { - errors.Add(L("LOCPlayniteBootValidationLoopWaitConflict")); - } ValidateShortcutName(errors, Settings.ShortcutName); return errors.Count == 0; @@ -291,26 +346,35 @@ private void SettingsPropertyChanged(object sender, PropertyChangedEventArgs eve return; } - if (synchronizingVideoOptions || eventArgs.PropertyName != nameof(PlayniteBootSettingsData.WaitForVideoEnd)) + if (eventArgs.PropertyName == nameof(PlayniteBootSettingsData.VideoEndBehavior)) { + OnPropertyChanged(nameof(IsVideoEndReady)); + OnPropertyChanged(nameof(IsVideoEndWait)); + OnPropertyChanged(nameof(IsVideoEndLoop)); return; } - if (Settings.WaitForVideoEnd && Settings.LoopVideo) + if (eventArgs.PropertyName == nameof(PlayniteBootSettingsData.ShortcutName)) { - try - { - synchronizingVideoOptions = true; - Settings.LoopVideo = false; - } - finally - { - synchronizingVideoOptions = false; - } + OnPropertyChanged(nameof(DesktopShortcutStatus)); + OnPropertyChanged(nameof(StartMenuShortcutStatus)); + } + } + + private void SetVideoEndBehavior(string behavior) + { + if (Settings == null) + { + return; + } + + var normalized = VideoEndBehaviors.Normalize(behavior); + if (string.Equals(Settings.VideoEndBehavior, normalized, StringComparison.OrdinalIgnoreCase)) + { + return; } - OnPropertyChanged(nameof(IsLoopVideoEnabled)); - OnPropertyChanged(nameof(IsMinimumVideoDurationEnabled)); + Settings.VideoEndBehavior = normalized; } private void EnsureDefaultsAndMigrate() @@ -348,6 +412,40 @@ private void EnsureDefaultsAndMigrate() settings.EnableDesktopFullscreenSwitch = true; } + if (settings.SettingsVersion < 4) + { + // 0.7.1 and earlier stored two booleans. Prefer the stricter wait + // behavior if an invalid legacy combination has both enabled. + if (settings.WaitForVideoEnd) + { + settings.VideoEndBehavior = VideoEndBehaviors.Wait; + } + else if (settings.LoopVideo) + { + settings.VideoEndBehavior = VideoEndBehaviors.Loop; + } + else + { + settings.VideoEndBehavior = VideoEndBehaviors.Ready; + } + + settings.WaitForVideoEnd = false; + settings.LoopVideo = false; + } + else + { + settings.VideoEndBehavior = VideoEndBehaviors.Normalize(settings.VideoEndBehavior); + } + + if (settings.SettingsVersion < 5 && + settings.Streaming.PreloadAbandonTimeoutMilliseconds == 30000) + { + // 0.8.0 shortens the stale preload Host wait so a missing + // Detached/Continue launch cannot leave a black overlay for + // the previous 30-second default. Preserve custom values. + settings.Streaming.PreloadAbandonTimeoutMilliseconds = 10000; + } + settings.SettingsVersion = PlayniteBootSettingsData.CurrentSettingsVersion; if (string.IsNullOrWhiteSpace(settings.VideoPath)) @@ -480,7 +578,7 @@ private void BrowseVideo() initialDirectory = string.Empty; } - var filter = L("LOCPlayniteBootVideoFileFilter"); + var filter = VideoLibraryService.BuildFileDialogFilter(L("LOCPlayniteBootVideoFileFilterLabel")); var selected = string.IsNullOrWhiteSpace(initialDirectory) ? plugin.PlayniteApi.Dialogs.SelectFile(filter) : plugin.PlayniteApi.Dialogs.SelectFile(filter, initialDirectory); @@ -669,10 +767,10 @@ private void ResetSettings() RuntimeStatus = L("LOCPlayniteBootStatusDefaultsRestored"); } - private void InstallRuntime() + private void RepairRuntime() { var result = plugin.PrepareRuntime(Settings, true); - RuntimeStatus = F("LOCPlayniteBootStatusRuntimeInstalled", result.Version, result.CopiedFiles); + RuntimeStatus = F("LOCPlayniteBootStatusRuntimeRepaired", result.Version, result.CopiedFiles); plugin.PlayniteApi.Dialogs.ShowMessage(RuntimeStatus, PlayniteBootPlugin.ProductName); } @@ -757,7 +855,7 @@ private string BuildDiagnostics() b.AppendLine("Playnite: " + plugin.PlayniteApi.ApplicationInfo.ApplicationVersion); b.AppendLine("Language: " + plugin.PlayniteApi.ApplicationSettings.Language); b.AppendLine("Config version: " + RuntimeConfigWriter.CurrentConfigVersion); - b.AppendLine("Mode: " + (Settings.WaitForVideoEnd ? "waitForVideoEnd" : "readyAndMinimumDuration")); + b.AppendLine("Video end behavior: " + VideoEndBehaviors.Normalize(Settings.VideoEndBehavior)); b.AppendLine("Streaming preload: " + (Settings.Streaming != null && Settings.Streaming.Enabled ? "enabled" : "disabled")); b.AppendLine("Desktop -> Fullscreen boot: " + (Settings.EnableDesktopFullscreenSwitch ? "enabled" : "disabled")); b.AppendLine("Runtime installed: " + YesNo(File.Exists(plugin.Paths.ScriptPath) && File.Exists(plugin.Paths.ConfigPath))); @@ -795,6 +893,8 @@ private void ExecuteAction(Action action) private void RefreshRuntimeStatus(bool overwriteActionStatus = true) { + NotifyInstallationStatusChanged(); + if (!overwriteActionStatus && !string.IsNullOrWhiteSpace(RuntimeStatus)) { return; @@ -802,7 +902,7 @@ private void RefreshRuntimeStatus(bool overwriteActionStatus = true) if (File.Exists(plugin.Paths.ScriptPath) && File.Exists(plugin.Paths.ConfigPath)) { - RuntimeStatus = F("LOCPlayniteBootStatusRuntimeReady", ReadRuntimeVersion()); + RuntimeStatus = L("LOCPlayniteBootStatusRuntimeReady"); } else if (Directory.Exists(plugin.Paths.RuntimeDirectory)) { @@ -814,6 +914,62 @@ private void RefreshRuntimeStatus(bool overwriteActionStatus = true) } } + private void NotifyInstallationStatusChanged() + { + OnPropertyChanged(nameof(RuntimeVersionValue)); + OnPropertyChanged(nameof(RuntimeVersionDisplay)); + OnPropertyChanged(nameof(RuntimeConfigurationStatus)); + OnPropertyChanged(nameof(DesktopShortcutStatus)); + OnPropertyChanged(nameof(StartMenuShortcutStatus)); + OnPropertyChanged(nameof(ExtensionVersionDisplay)); + } + + private bool IsRuntimeConfigurationValid() + { + try + { + if (!File.Exists(plugin.Paths.ConfigPath)) + { + return false; + } + + var json = File.ReadAllText(plugin.Paths.ConfigPath); + var serializer = new JavaScriptSerializer(); + var config = serializer.DeserializeObject(json) as IDictionary; + if (config == null || !config.TryGetValue("configVersion", out var versionValue)) + { + return false; + } + + var configVersion = Convert.ToInt32(versionValue, CultureInfo.InvariantCulture); + if (configVersion != RuntimeConfigWriter.CurrentConfigVersion || + !config.TryGetValue("videoEndBehavior", out var behaviorValue)) + { + return false; + } + + return VideoEndBehaviors.IsValid(Convert.ToString(behaviorValue, CultureInfo.InvariantCulture)); + } + catch + { + return false; + } + } + + private string GetShortcutStatus(ShortcutLocation location) + { + try + { + return plugin.ShortcutExists(Settings, location) + ? L("LOCPlayniteBootStatusInstalled") + : L("LOCPlayniteBootStatusNotInstalled"); + } + catch + { + return L("LOCPlayniteBootStatusUnknown"); + } + } + private string ReadRuntimeVersion() { try diff --git a/PlayniteBoot/PlayniteBootSettingsView.xaml b/PlayniteBoot/PlayniteBootSettingsView.xaml index 7168d23..ade39d1 100644 --- a/PlayniteBoot/PlayniteBootSettingsView.xaml +++ b/PlayniteBoot/PlayniteBootSettingsView.xaml @@ -24,9 +24,6 @@ - - - - + + +