Disable AI Super Resolution on Windows 10

Add explicit checks to prevent AI Super Resolution features from initializing or running on Windows 10. AI detection and initialization are now skipped on Windows 10, and the AI state is set to NotSupported. AI capability detection in the runner is only started on Windows 11 or later. This ensures AI Super Resolution is only available on supported Windows versions.
This commit is contained in:
Yu Leng
2025-12-11 12:04:54 +08:00
parent adc5a43fd4
commit abef72dc25
2 changed files with 49 additions and 21 deletions

View File

@@ -84,6 +84,15 @@ namespace ImageResizer
return; return;
} }
// AI Super Resolution is not supported on Windows 10 - skip cache check entirely
if (OSVersionHelper.IsWindows10())
{
AiAvailabilityState = AiAvailabilityState.NotSupported;
ResizeBatch.SetAiSuperResolutionService(Services.NoOpAiSuperResolutionService.Instance);
Logger.LogInfo("AI Super Resolution not supported on Windows 10");
}
else
{
// Load AI availability from cache (written by Runner's background detection) // Load AI availability from cache (written by Runner's background detection)
var cachedState = Services.AiAvailabilityCacheService.LoadCache(); var cachedState = Services.AiAvailabilityCacheService.LoadCache();
@@ -109,6 +118,7 @@ namespace ImageResizer
// AI not available - set NoOp service immediately // AI not available - set NoOp service immediately
ResizeBatch.SetAiSuperResolutionService(Services.NoOpAiSuperResolutionService.Instance); ResizeBatch.SetAiSuperResolutionService(Services.NoOpAiSuperResolutionService.Instance);
} }
}
var batch = ResizeBatch.FromCommandLine(Console.In, e?.Args); var batch = ResizeBatch.FromCommandLine(Console.In, e?.Args);
@@ -130,6 +140,15 @@ namespace ImageResizer
{ {
Logger.LogInfo("Running AI detection mode..."); Logger.LogInfo("Running AI detection mode...");
// AI Super Resolution is not supported on Windows 10
if (OSVersionHelper.IsWindows10())
{
Logger.LogInfo("AI detection skipped: Windows 10 does not support AI Super Resolution");
Services.AiAvailabilityCacheService.SaveCache(AiAvailabilityState.NotSupported);
Environment.Exit(0);
return;
}
// Perform detection (reuse existing logic) // Perform detection (reuse existing logic)
var state = CheckAiAvailability(); var state = CheckAiAvailability();

View File

@@ -38,6 +38,7 @@
#include "centralized_kb_hook.h" #include "centralized_kb_hook.h"
#include "centralized_hotkeys.h" #include "centralized_hotkeys.h"
#include "ai_detection.h" #include "ai_detection.h"
#include <common/utils/package.h>
#if _DEBUG && _WIN64 #if _DEBUG && _WIN64
#include "unhandled_exception_handler.h" #include "unhandled_exception_handler.h"
@@ -210,9 +211,17 @@ int runner(bool isProcessElevated, bool openSettings, std::string settingsWindow
PeriodicUpdateWorker(); PeriodicUpdateWorker();
} }.detach(); } }.detach();
// Start AI capability detection in background // Start AI capability detection in background (Windows 11+ only)
// AI Super Resolution is not supported on Windows 10
// This calls ImageResizer --detect-ai which writes result to cache file // This calls ImageResizer --detect-ai which writes result to cache file
if (package::IsWin11OrGreater())
{
DetectAiCapabilitiesAsync(); DetectAiCapabilitiesAsync();
}
else
{
Logger::info(L"AI capability detection skipped: Windows 10 does not support AI Super Resolution");
}
std::thread{ [] { std::thread{ [] {
if (updating::uninstall_previous_msix_version_async().get()) if (updating::uninstall_previous_msix_version_async().get())