From b9019eb34b5e97662646815d18e1de8b2657cf5a Mon Sep 17 00:00:00 2001 From: williamisbeast95 Date: Fri, 15 May 2026 20:17:09 -0700 Subject: [PATCH 1/6] Add preset number to window title and bump to 2.0.1 --- CHANGELOG.md | 7 +++++++ CMakeLists.txt | 2 +- src/SDLRenderingWindow.cpp | 18 ++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..54513cf --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## 2.0.1 (2026-05-16) + +- Added preset number in the window title when `window.displayPresetNameInTitle=true`. +- Uses numeric suffix from preset names like `MilkDrop2077.0001.milk` when present. +- Falls back to playlist position when preset filename does not contain a numeric suffix. diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ee7050..6ee4937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) project(projectMSDL LANGUAGES C CXX - VERSION 2.0.0 + VERSION 2.0.1 ) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") diff --git a/src/SDLRenderingWindow.cpp b/src/SDLRenderingWindow.cpp index 1516acf..420f300 100644 --- a/src/SDLRenderingWindow.cpp +++ b/src/SDLRenderingWindow.cpp @@ -14,6 +14,8 @@ #include +#include + const char* SDLRenderingWindow::name() const { return "SDL2 Rendering Window"; @@ -396,14 +398,25 @@ void SDLRenderingWindow::UpdateWindowTitle() auto& app = Poco::Util::Application::instance(); auto& projectMWrapper = app.getSubsystem(); - auto presetName = projectm_playlist_item(projectMWrapper.Playlist(), projectm_playlist_get_position(projectMWrapper.Playlist())); + auto currentPosition = projectm_playlist_get_position(projectMWrapper.Playlist()); + auto presetName = projectm_playlist_item(projectMWrapper.Playlist(), currentPosition); if (presetName) { Poco::Path presetFile(presetName); projectm_playlist_free_string(presetName); - newTitle += " ➫ " + presetFile.getBaseName(); + auto presetBaseName = presetFile.getBaseName(); + std::string presetNumber = std::to_string(currentPosition + 1); + + // If basename is like "MilkDrop2077.0001", use the trailing digits as preset number. + std::smatch match; + if (std::regex_match(presetBaseName, match, std::regex(R"(.*\.(\d+)$)")) && match.size() > 1) + { + presetNumber = match[1].str(); + } + + newTitle += " [" + presetNumber + "] -> " + presetBaseName; } if (projectm_get_preset_locked(projectMWrapper.ProjectM())) @@ -461,3 +474,4 @@ void SDLRenderingWindow::OnConfigurationPropertyRemoved(const std::string& key) UpdateWindowTitle(); } } + From 0298612382b37a0731ea0dc1a03205cf0c8b9cb0 Mon Sep 17 00:00:00 2001 From: williamisbeast95 Date: Fri, 15 May 2026 21:42:49 -0700 Subject: [PATCH 2/6] Fix CI auth fallback for vcpkg and use built-in token for lockdown --- .github/workflows/buildcheck.yaml | 12 +++++++++++- .github/workflows/lockdown-prs.yaml | 2 +- .github/workflows/release-windows.yaml | 12 +++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildcheck.yaml b/.github/workflows/buildcheck.yaml index af3a175..ab5428a 100644 --- a/.github/workflows/buildcheck.yaml +++ b/.github/workflows/buildcheck.yaml @@ -97,7 +97,6 @@ jobs: USERNAME: projectM-visualizer VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg FEED_URL: https://nuget.pkg.github.com/projectM-visualizer/index.json - VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite" steps: @@ -112,7 +111,18 @@ jobs: shell: pwsh run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat + - name: Configure vcpkg binary sources (public fallback) + shell: pwsh + run: | + if ("${{ secrets.VCPKG_PACKAGES_TOKEN }}" -ne "") { + "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } else { + "VCPKG_BINARY_SOURCES=clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + New-Item -ItemType Directory -Force -Path "${{ github.workspace }}/vcpkg_cache" | Out-Null + } + - name: Add NuGet sources + if: ${{ secrets.VCPKG_PACKAGES_TOKEN != '' }} shell: pwsh run: | .$(${{ env.VCPKG_EXE }} fetch nuget) ` diff --git a/.github/workflows/lockdown-prs.yaml b/.github/workflows/lockdown-prs.yaml index a62d259..a7be9d5 100644 --- a/.github/workflows/lockdown-prs.yaml +++ b/.github/workflows/lockdown-prs.yaml @@ -16,7 +16,7 @@ jobs: steps: - uses: dessant/repo-lockdown@v4 with: - github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + github-token: ${{ github.token }} issue-comment: > This repository does not accept bug reports. Please report any issues in the [main projectM repository](https://github.com/projectM-visualizer/projectm/issues/new/choose). diff --git a/.github/workflows/release-windows.yaml b/.github/workflows/release-windows.yaml index 914f698..e7a2381 100644 --- a/.github/workflows/release-windows.yaml +++ b/.github/workflows/release-windows.yaml @@ -28,7 +28,6 @@ jobs: USERNAME: projectM-visualizer VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg FEED_URL: https://nuget.pkg.github.com/projectM-visualizer/index.json - VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite" steps: - name: Checkout vcpkg @@ -42,7 +41,18 @@ jobs: shell: pwsh run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat + - name: Configure vcpkg binary sources (public fallback) + shell: pwsh + run: | + if ("${{ secrets.VCPKG_PACKAGES_TOKEN }}" -ne "") { + "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } else { + "VCPKG_BINARY_SOURCES=clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + New-Item -ItemType Directory -Force -Path "${{ github.workspace }}/vcpkg_cache" | Out-Null + } + - name: Add NuGet sources + if: ${{ secrets.VCPKG_PACKAGES_TOKEN != '' }} shell: pwsh run: | .$(${{ env.VCPKG_EXE }} fetch nuget) ` From 69f8a58deb13fcdb608b1e9820cd736cf3f0da44 Mon Sep 17 00:00:00 2001 From: williamisbeast95 Date: Fri, 15 May 2026 21:49:17 -0700 Subject: [PATCH 3/6] Fix workflow syntax: use env var for token checks in if conditions --- .github/workflows/buildcheck.yaml | 11 ++++++----- .github/workflows/release-windows.yaml | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/buildcheck.yaml b/.github/workflows/buildcheck.yaml index ab5428a..6f8d7e8 100644 --- a/.github/workflows/buildcheck.yaml +++ b/.github/workflows/buildcheck.yaml @@ -97,7 +97,7 @@ jobs: USERNAME: projectM-visualizer VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg FEED_URL: https://nuget.pkg.github.com/projectM-visualizer/index.json - + HAS_VCPKG_PACKAGES_TOKEN: ${{ secrets.VCPKG_PACKAGES_TOKEN }} steps: - name: Checkout vcpkg @@ -114,7 +114,7 @@ jobs: - name: Configure vcpkg binary sources (public fallback) shell: pwsh run: | - if ("${{ secrets.VCPKG_PACKAGES_TOKEN }}" -ne "") { + if ("${{ env.HAS_VCPKG_PACKAGES_TOKEN }}" -ne "") { "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append } else { "VCPKG_BINARY_SOURCES=clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append @@ -122,7 +122,7 @@ jobs: } - name: Add NuGet sources - if: ${{ secrets.VCPKG_PACKAGES_TOKEN != '' }} + if: ${{ env.HAS_VCPKG_PACKAGES_TOKEN != '' }} shell: pwsh run: | .$(${{ env.VCPKG_EXE }} fetch nuget) ` @@ -131,9 +131,9 @@ jobs: -StorePasswordInClearText ` -Name GitHubPackages ` -UserName "${{ env.USERNAME }}" ` - -Password "${{ secrets.VCPKG_PACKAGES_TOKEN }}" + -Password "${{ env.HAS_VCPKG_PACKAGES_TOKEN }}" .$(${{ env.VCPKG_EXE }} fetch nuget) ` - setapikey "${{ secrets.VCPKG_PACKAGES_TOKEN }}" ` + setapikey "${{ env.HAS_VCPKG_PACKAGES_TOKEN }}" ` -Source "${{ env.FEED_URL }}" - name: Checkout libprojectM Sources @@ -217,3 +217,4 @@ jobs: with: name: projectMSDL-buildcheck-macos path: cmake-build-frontend-sdl2/*.tar.gz + diff --git a/.github/workflows/release-windows.yaml b/.github/workflows/release-windows.yaml index e7a2381..f04ad92 100644 --- a/.github/workflows/release-windows.yaml +++ b/.github/workflows/release-windows.yaml @@ -28,7 +28,7 @@ jobs: USERNAME: projectM-visualizer VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg FEED_URL: https://nuget.pkg.github.com/projectM-visualizer/index.json - + HAS_VCPKG_PACKAGES_TOKEN: ${{ secrets.VCPKG_PACKAGES_TOKEN }} steps: - name: Checkout vcpkg uses: actions/checkout@v6 @@ -44,7 +44,7 @@ jobs: - name: Configure vcpkg binary sources (public fallback) shell: pwsh run: | - if ("${{ secrets.VCPKG_PACKAGES_TOKEN }}" -ne "") { + if ("${{ env.HAS_VCPKG_PACKAGES_TOKEN }}" -ne "") { "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append } else { "VCPKG_BINARY_SOURCES=clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append @@ -52,7 +52,7 @@ jobs: } - name: Add NuGet sources - if: ${{ secrets.VCPKG_PACKAGES_TOKEN != '' }} + if: ${{ env.HAS_VCPKG_PACKAGES_TOKEN != '' }} shell: pwsh run: | .$(${{ env.VCPKG_EXE }} fetch nuget) ` @@ -61,9 +61,9 @@ jobs: -StorePasswordInClearText ` -Name GitHubPackages ` -UserName "${{ env.USERNAME }}" ` - -Password "${{ secrets.VCPKG_PACKAGES_TOKEN }}" + -Password "${{ env.HAS_VCPKG_PACKAGES_TOKEN }}" .$(${{ env.VCPKG_EXE }} fetch nuget) ` - setapikey "${{ secrets.VCPKG_PACKAGES_TOKEN }}" ` + setapikey "${{ env.HAS_VCPKG_PACKAGES_TOKEN }}" ` -Source "${{ env.FEED_URL }}" - name: Checkout projectMSDL Sources @@ -111,3 +111,4 @@ jobs: name: projectMSDL-Windows-Portable-x64 path: | cmake-build-frontend-sdl2/*.zip + From 82baec8abf3cf0b9c0d25b6e6951fcf0e811cfb4 Mon Sep 17 00:00:00 2001 From: williamisbeast95 Date: Fri, 15 May 2026 21:52:52 -0700 Subject: [PATCH 4/6] Fix Windows CI: use Ninja generator and token-safe vcpkg workflow logic --- .github/workflows/buildcheck.yaml | 10 +++++----- .github/workflows/release-windows.yaml | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/buildcheck.yaml b/.github/workflows/buildcheck.yaml index 6f8d7e8..bfcf716 100644 --- a/.github/workflows/buildcheck.yaml +++ b/.github/workflows/buildcheck.yaml @@ -146,9 +146,9 @@ jobs: - name: Build/Install libprojectM run: | mkdir cmake-build-libprojectm - cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/projectm" -B "${{ github.workspace }}/cmake-build-libprojectm" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-libprojectm" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$:Debug>" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=NO - cmake --build "${{ github.workspace }}/cmake-build-libprojectm" --config Release --parallel - cmake --install "${{ github.workspace }}/cmake-build-libprojectm" --config Release + cmake -G Ninja -S "${{ github.workspace }}/projectm" -B "${{ github.workspace }}/cmake-build-libprojectm" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-libprojectm" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=NO + cmake --build "${{ github.workspace }}/cmake-build-libprojectm" --parallel + cmake --install "${{ github.workspace }}/cmake-build-libprojectm" - name: Checkout projectMSDL Sources uses: actions/checkout@v6 @@ -159,8 +159,8 @@ jobs: - name: Build projectMSDL run: | mkdir cmake-build-frontend-sdl2 - cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$:Debug>" -DCMAKE_VERBOSE_MAKEFILE=YES -DSDL2_LINKAGE=static -DBUILD_TESTING=YES - cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel --config Release + cmake -G Ninja -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_VERBOSE_MAKEFILE=YES -DSDL2_LINKAGE=static -DBUILD_TESTING=YES + cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel - name: Package projectMSDL run: | diff --git a/.github/workflows/release-windows.yaml b/.github/workflows/release-windows.yaml index f04ad92..f349797 100644 --- a/.github/workflows/release-windows.yaml +++ b/.github/workflows/release-windows.yaml @@ -88,17 +88,18 @@ jobs: - name: Build projectMSDL run: | mkdir cmake-build-frontend-sdl2 - cmake -G "Visual Studio 17 2022" -A "X64" ` + cmake -G Ninja ` -S "${{ github.workspace }}/frontend-sdl2" ` -B "${{ github.workspace }}/cmake-build-frontend-sdl2" ` -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" ` -DVCPKG_TARGET_TRIPLET=x64-windows ` -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" ` - -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$:Debug>DLL" ` + -DCMAKE_BUILD_TYPE=Release ` + -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" ` -DPRESET_DIRS="${{ github.workspace }}/presets-cream-of-the-crop" ` -DTEXTURE_DIRS="${{ github.workspace }}/presets-milkdrop-texture-pack/textures" ` -DENABLE_INSTALL_BDEPS=ON - cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel --config Release + cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel - name: Package projectMSDL run: | From 5155c276165b22d1dbd5f0e62167ddb0a0c387ef Mon Sep 17 00:00:00 2001 From: williamisbeast95 Date: Fri, 15 May 2026 22:08:56 -0700 Subject: [PATCH 5/6] Fix Windows CI toolchain mismatch: force MSVC with Ninja --- .github/workflows/buildcheck.yaml | 9 +++++++-- .github/workflows/release-windows.yaml | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildcheck.yaml b/.github/workflows/buildcheck.yaml index bfcf716..ec3a66b 100644 --- a/.github/workflows/buildcheck.yaml +++ b/.github/workflows/buildcheck.yaml @@ -111,6 +111,11 @@ jobs: shell: pwsh run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat + - name: Setup MSVC Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + - name: Configure vcpkg binary sources (public fallback) shell: pwsh run: | @@ -146,7 +151,7 @@ jobs: - name: Build/Install libprojectM run: | mkdir cmake-build-libprojectm - cmake -G Ninja -S "${{ github.workspace }}/projectm" -B "${{ github.workspace }}/cmake-build-libprojectm" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-libprojectm" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=NO + cmake -G Ninja -S "${{ github.workspace }}/projectm" -B "${{ github.workspace }}/cmake-build-libprojectm" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-libprojectm" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=NO cmake --build "${{ github.workspace }}/cmake-build-libprojectm" --parallel cmake --install "${{ github.workspace }}/cmake-build-libprojectm" @@ -159,7 +164,7 @@ jobs: - name: Build projectMSDL run: | mkdir cmake-build-frontend-sdl2 - cmake -G Ninja -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_VERBOSE_MAKEFILE=YES -DSDL2_LINKAGE=static -DBUILD_TESTING=YES + cmake -G Ninja -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_VERBOSE_MAKEFILE=YES -DSDL2_LINKAGE=static -DBUILD_TESTING=YES cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel - name: Package projectMSDL diff --git a/.github/workflows/release-windows.yaml b/.github/workflows/release-windows.yaml index f349797..d2c5565 100644 --- a/.github/workflows/release-windows.yaml +++ b/.github/workflows/release-windows.yaml @@ -41,6 +41,11 @@ jobs: shell: pwsh run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat + - name: Setup MSVC Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + - name: Configure vcpkg binary sources (public fallback) shell: pwsh run: | @@ -91,6 +96,8 @@ jobs: cmake -G Ninja ` -S "${{ github.workspace }}/frontend-sdl2" ` -B "${{ github.workspace }}/cmake-build-frontend-sdl2" ` + -DCMAKE_C_COMPILER=cl ` + -DCMAKE_CXX_COMPILER=cl ` -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" ` -DVCPKG_TARGET_TRIPLET=x64-windows ` -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" ` From 36135a490a40e6451900d7d7f7c02e6c6923bd31 Mon Sep 17 00:00:00 2001 From: williamisbeast95 Date: Sat, 16 May 2026 00:35:32 -0700 Subject: [PATCH 6/6] feat: restore preset search popup and Enter shortcut (fix #99) --- src/RenderLoop.cpp | 5 ++ src/gui/HelpWindow.cpp | 1 + src/gui/MainMenu.cpp | 4 ++ src/gui/ProjectMGUI.cpp | 136 +++++++++++++++++++++++++++++++++++++++- src/gui/ProjectMGUI.h | 15 +++++ 5 files changed, 160 insertions(+), 1 deletion(-) diff --git a/src/RenderLoop.cpp b/src/RenderLoop.cpp index 7d428e0..eb353f0 100644 --- a/src/RenderLoop.cpp +++ b/src/RenderLoop.cpp @@ -343,6 +343,11 @@ void RenderLoop::KeyEvent(const SDL_KeyboardEvent& event, bool down) Poco::NotificationCenter::defaultCenter().postNotification(new PlaybackControlNotification(PlaybackControlNotification::Action::TogglePresetLocked)); break; + case SDLK_RETURN: + case SDLK_KP_ENTER: + _projectMGui.OpenPresetSearch(); + break; + case SDLK_UP: // Increase beat sensitivity _projectMWrapper.ChangeBeatSensitivity(0.01f); diff --git a/src/gui/HelpWindow.cpp b/src/gui/HelpWindow.cpp index 16b8db8..d0fa14b 100644 --- a/src/gui/HelpWindow.cpp +++ b/src/gui/HelpWindow.cpp @@ -158,6 +158,7 @@ void HelpWindow::FillKeyboardShortcutsTable() {"Last Played Preset (Back, smooth)", "Shift+Backspace"}, {"Random Preset (immediate)", "r"}, {"Random Preset (smooth)", "Shift+r"}, + {"Preset Search", "Enter"}, {"Lock Current Preset", "Spacebar"}, {"Toggle Shuffle", "y"}, {"Toggle Fullscreen", "Ctrl-f, Right Mouse"}, diff --git a/src/gui/MainMenu.cpp b/src/gui/MainMenu.cpp index 02afba6..3731224 100644 --- a/src/gui/MainMenu.cpp +++ b/src/gui/MainMenu.cpp @@ -83,6 +83,10 @@ void MainMenu::Draw() { _projectMWrapper.PresetFileNameToClipboard(); } + if (ImGui::MenuItem("Preset Search...", "Enter")) + { + _gui.OpenPresetSearch(); + } ImGui::EndMenu(); } diff --git a/src/gui/ProjectMGUI.cpp b/src/gui/ProjectMGUI.cpp index 925c843..4b5d1cf 100644 --- a/src/gui/ProjectMGUI.cpp +++ b/src/gui/ProjectMGUI.cpp @@ -9,10 +9,13 @@ #include "imgui_impl_opengl3.h" #include "imgui_impl_sdl2.h" +#include #include #include +#include +#include #include const char* ProjectMGUI::name() const @@ -124,7 +127,7 @@ bool ProjectMGUI::Visible() const void ProjectMGUI::Draw() { // Don't render UI at all if there's no need. - if (!_toast && !_visible) + if (!_toast && !_visible && !_presetSearchOpen) { return; } @@ -166,6 +169,11 @@ void ProjectMGUI::Draw() _helpWindow.Draw(); } + if (_presetSearchOpen) + { + DrawPresetSearchPopup(); + } + ImGui::Render(); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); } @@ -212,6 +220,132 @@ void ProjectMGUI::ShowHelpWindow() _helpWindow.Show(); } +void ProjectMGUI::OpenPresetSearch() +{ + _presetSearchOpen = true; + _presetSearchQuery[0] = '\0'; + _presetSearchSelection = 0; + RefreshPresetSearchMatches(); +} + +void ProjectMGUI::DrawPresetSearchPopup() +{ + ImGui::SetNextWindowSize(ImVec2(800, 360), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f)); + + bool open = _presetSearchOpen; + if (!ImGui::Begin("Preset Search###PresetSearch", &open, ImGuiWindowFlags_NoCollapse)) + { + ImGui::End(); + _presetSearchOpen = open; + return; + } + + ImGuiInputTextFlags inputFlags = ImGuiInputTextFlags_AutoSelectAll; + if (ImGui::InputText("Find preset", _presetSearchQuery, IM_ARRAYSIZE(_presetSearchQuery), inputFlags)) + { + _presetSearchSelection = 0; + RefreshPresetSearchMatches(); + } + + const bool windowAppearing = ImGui::IsWindowAppearing(); + if (windowAppearing) + { + ImGui::SetKeyboardFocusHere(-1); + } + + ImGui::Separator(); + ImGui::Text("Matches: %d", static_cast(_presetSearchMatches.size())); + ImGui::BeginChild("PresetSearchResults", ImVec2(0.0f, -ImGui::GetFrameHeightWithSpacing())); + + for (int i = 0; i < static_cast(_presetSearchMatches.size()); ++i) + { + auto playlistIndex = _presetSearchMatches[i]; + auto presetName = projectm_playlist_item(_projectMWrapper->Playlist(), playlistIndex); + std::string displayText = presetName ? Poco::Path(presetName).getFileName() : ""; + if (presetName) + { + projectm_playlist_free_string(presetName); + } + + if (ImGui::Selectable(displayText.c_str(), i == _presetSearchSelection)) + { + _presetSearchSelection = i; + } + } + + ImGui::EndChild(); + + bool activateSelection = false; + const bool enterPressed = ImGui::IsKeyPressed(ImGuiKey_Enter, false) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter, false); + if (ImGui::Button("Load Selected") || (!windowAppearing && enterPressed)) + { + activateSelection = true; + } + ImGui::SameLine(); + if (ImGui::Button("Close") || ImGui::IsKeyPressed(ImGuiKey_Escape, false)) + { + open = false; + } + + if (!_presetSearchMatches.empty()) + { + if (ImGui::IsKeyPressed(ImGuiKey_DownArrow, false)) + { + _presetSearchSelection = std::min(_presetSearchSelection + 1, static_cast(_presetSearchMatches.size()) - 1); + } + if (ImGui::IsKeyPressed(ImGuiKey_UpArrow, false)) + { + _presetSearchSelection = std::max(_presetSearchSelection - 1, 0); + } + } + + if (activateSelection && !_presetSearchMatches.empty()) + { + auto playlistIndex = _presetSearchMatches[_presetSearchSelection]; + projectm_playlist_set_position(_projectMWrapper->Playlist(), playlistIndex, true); + open = false; + } + + ImGui::End(); + _presetSearchOpen = open; +} + +void ProjectMGUI::RefreshPresetSearchMatches() +{ + _presetSearchMatches.clear(); + + auto playlist = _projectMWrapper->Playlist(); + auto playlistSize = projectm_playlist_size(playlist); + std::string query = _presetSearchQuery; + std::transform(query.begin(), query.end(), query.begin(), [](unsigned char c) { return static_cast(std::tolower(c)); }); + + for (uint32_t i = 0; i < playlistSize; ++i) + { + auto presetName = projectm_playlist_item(playlist, i); + if (!presetName) + { + continue; + } + + std::string fullName = presetName; + projectm_playlist_free_string(presetName); + + if (query.empty()) + { + _presetSearchMatches.push_back(i); + continue; + } + + std::string lowerName = fullName; + std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](unsigned char c) { return static_cast(std::tolower(c)); }); + if (lowerName.find(query) != std::string::npos) + { + _presetSearchMatches.push_back(i); + } + } +} + float ProjectMGUI::GetScalingFactor() { int windowWidth; diff --git a/src/gui/ProjectMGUI.h b/src/gui/ProjectMGUI.h index aca9d88..061eb87 100644 --- a/src/gui/ProjectMGUI.h +++ b/src/gui/ProjectMGUI.h @@ -15,6 +15,8 @@ #include +#include + struct ImFont; class ProjectMWrapper; class SDLRenderingWindow; @@ -104,7 +106,16 @@ class ProjectMGUI : public Poco::Util::Subsystem */ void ShowHelpWindow(); + /** + * @brief Opens the quick preset search popup. + */ + void OpenPresetSearch(); + private: + void DrawPresetSearchPopup(); + + void RefreshPresetSearchMatches(); + float GetScalingFactor(); static float GetClampedUserScalingFactor(); @@ -135,6 +146,10 @@ class ProjectMGUI : public Poco::Util::Subsystem std::unique_ptr _toast; //!< Current toast to be displayed. bool _visible{false}; //!< Flag for settings window visibility. + bool _presetSearchOpen{false}; //!< Quick search popup visibility flag. + char _presetSearchQuery[256]{0}; //!< Quick search query buffer. + std::vector _presetSearchMatches; //!< Matched playlist item indices. + int _presetSearchSelection{0}; //!< Selected match index inside _presetSearchMatches. Poco::Logger& _logger{Poco::Logger::get("ProjectMGUI")}; //!< The class logger. };