From 45351102210fbf851144bc795e59e5199b8bf1e8 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Fri, 12 Jun 2026 08:11:06 -0700 Subject: [PATCH] od-unix: ship starter filter presets The Filter page's preset list was empty until the user saved their own (GitHub issue #4). Add a set of bundled presets built from the portable filter controls the Unix GLSL pipeline implements (Sharp Pixels, Soft Bilinear, CRT Scanlines, Warm TV), installed under the shared data directory on Linux and into the app bundle resources on macOS. The preset combo lists user presets and bundled presets together; the user directory wins on name collisions, saving always writes to the user directory, and loading falls back to the bundled file when no user preset of that name exists. --- CMakeLists.txt | 3 ++ od-unix/qt/launcher.cpp | 36 ++++++++++++++++--- .../share/filter-presets/CRT Scanlines.filter | 6 ++++ .../share/filter-presets/Sharp Pixels.filter | 5 +++ .../share/filter-presets/Soft Bilinear.filter | 5 +++ od-unix/share/filter-presets/Warm TV.filter | 11 ++++++ tools/macos-bundle.sh | 3 ++ 7 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 od-unix/share/filter-presets/CRT Scanlines.filter create mode 100644 od-unix/share/filter-presets/Sharp Pixels.filter create mode 100644 od-unix/share/filter-presets/Soft Bilinear.filter create mode 100644 od-unix/share/filter-presets/Warm TV.filter diff --git a/CMakeLists.txt b/CMakeLists.txt index 8541987c..b71c1e8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1728,6 +1728,9 @@ if(TARGET winuae_unix AND NOT APPLE) PATTERN "*.manifest" EXCLUDE PATTERN "resource.h" EXCLUDE ) + install(DIRECTORY od-unix/share/filter-presets/ + DESTINATION "${CMAKE_INSTALL_DATADIR}/winuae/od-unix/share/filter-presets" + ) if(WINUAE_UNIX_WITH_PPC_QEMU) install(FILES "${WINUAE_QEMU_UAE_PLUGIN_PATH}" DESTINATION "${WINUAE_UNIX_INSTALL_PLUGINDIR_RELATIVE}" diff --git a/od-unix/qt/launcher.cpp b/od-unix/qt/launcher.cpp index 8e044556..20fb2d6c 100644 --- a/od-unix/qt/launcher.cpp +++ b/od-unix/qt/launcher.cpp @@ -12657,6 +12657,24 @@ private: return QDir(filterPresetDirectoryPath()).filePath(normalizedFilterPresetName(name) + QStringLiteral(".filter")); } + QString systemFilterPresetDirectory() const + { + return resourceFile(QStringLiteral("od-unix/share/filter-presets")); + } + + QString findFilterPresetFile(const QString &name) const + { + const QString user = filterPresetPath(name); + if (QFileInfo::exists(user)) { + return user; + } + const QString system = QDir(systemFilterPresetDirectory()).filePath(normalizedFilterPresetName(name) + QStringLiteral(".filter")); + if (QFileInfo::exists(system)) { + return system; + } + return user; + } + void refreshFilterPresetList(const QString &preferred = QString()) { if (!filterPresetName) { @@ -12666,11 +12684,19 @@ private: QSignalBlocker blocker(filterPresetName); filterPresetName->clear(); filterPresetName->addItem(QString()); - QDir dir(filterPresetDirectoryPath()); - const QStringList files = dir.entryList({ QStringLiteral("*.filter") }, QDir::Files, QDir::Name | QDir::IgnoreCase); - for (const QString &file : files) { - filterPresetName->addItem(QFileInfo(file).completeBaseName()); + QStringList names; + for (const QString &directory : { filterPresetDirectoryPath(), systemFilterPresetDirectory() }) { + QDir dir(directory); + const QStringList files = dir.entryList({ QStringLiteral("*.filter") }, QDir::Files, QDir::Name | QDir::IgnoreCase); + for (const QString &file : files) { + const QString name = QFileInfo(file).completeBaseName(); + if (!names.contains(name, Qt::CaseInsensitive)) { + names.append(name); + } + } } + names.sort(Qt::CaseInsensitive); + filterPresetName->addItems(names); filterPresetName->setCurrentText(current); } @@ -12720,7 +12746,7 @@ private: if (name.isEmpty()) { return; } - QFile file(filterPresetPath(name)); + QFile file(findFilterPresetFile(name)); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { QMessageBox::warning(this, windowTitle(), QStringLiteral("Could not read %1:\n%2").arg(file.fileName(), file.errorString())); return; diff --git a/od-unix/share/filter-presets/CRT Scanlines.filter b/od-unix/share/filter-presets/CRT Scanlines.filter new file mode 100644 index 00000000..5b1ac801 --- /dev/null +++ b/od-unix/share/filter-presets/CRT Scanlines.filter @@ -0,0 +1,6 @@ +# WinUAE Qt filter preset +gfx_filter_enable=1 +gfx_filter_bilinear=1 +gfx_filter_scanlines=50 +gfx_filter_scanlinelevel=12 +gfx_filter_scanlineoffset=0 diff --git a/od-unix/share/filter-presets/Sharp Pixels.filter b/od-unix/share/filter-presets/Sharp Pixels.filter new file mode 100644 index 00000000..d1765a60 --- /dev/null +++ b/od-unix/share/filter-presets/Sharp Pixels.filter @@ -0,0 +1,5 @@ +# WinUAE Qt filter preset +gfx_filter_enable=1 +gfx_filter_bilinear=0 +gfx_filter_autoscale=integer +gfx_filter_scanlines=0 diff --git a/od-unix/share/filter-presets/Soft Bilinear.filter b/od-unix/share/filter-presets/Soft Bilinear.filter new file mode 100644 index 00000000..24186c24 --- /dev/null +++ b/od-unix/share/filter-presets/Soft Bilinear.filter @@ -0,0 +1,5 @@ +# WinUAE Qt filter preset +gfx_filter_enable=1 +gfx_filter_bilinear=1 +gfx_filter_autoscale=auto +gfx_filter_scanlines=0 diff --git a/od-unix/share/filter-presets/Warm TV.filter b/od-unix/share/filter-presets/Warm TV.filter new file mode 100644 index 00000000..33ed27d7 --- /dev/null +++ b/od-unix/share/filter-presets/Warm TV.filter @@ -0,0 +1,11 @@ +# WinUAE Qt filter preset +gfx_filter_enable=1 +gfx_filter_bilinear=1 +gfx_filter_saturation=200 +gfx_filter_contrast=60 +gfx_filter_luminance=20 +gfx_filter_gamma=60 +gfx_filter_blur=120 +gfx_filter_noise=60 +gfx_filter_scanlines=30 +gfx_filter_scanlinelevel=10 diff --git a/tools/macos-bundle.sh b/tools/macos-bundle.sh index 5d62c136..62522bef 100755 --- a/tools/macos-bundle.sh +++ b/tools/macos-bundle.sh @@ -161,6 +161,9 @@ find "${source_dir}/od-win32/resources" -maxdepth 1 -type f \ ! -name '*.manifest' \ ! -name 'resource.h' \ -exec cp '{}' "${resources_dir}/od-win32/resources/" ';' +mkdir -p "${resources_dir}/od-unix/share/filter-presets" +cp "${source_dir}/od-unix/share/filter-presets/"*.filter \ + "${resources_dir}/od-unix/share/filter-presets/" cp "${source_dir}/README_unix.md" "${resources_dir}/README_unix.md" if [[ -f "${source_dir}/od-win32/resources/winuae.ico" ]]; then -- 2.47.3