diff --git a/.github/workflows/buildcheck.yaml b/.github/workflows/buildcheck.yaml index af3a175..ec3a66b 100644 --- a/.github/workflows/buildcheck.yaml +++ b/.github/workflows/buildcheck.yaml @@ -97,8 +97,7 @@ 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" - + HAS_VCPKG_PACKAGES_TOKEN: ${{ secrets.VCPKG_PACKAGES_TOKEN }} steps: - name: Checkout vcpkg @@ -112,7 +111,23 @@ 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: | + 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 + New-Item -ItemType Directory -Force -Path "${{ github.workspace }}/vcpkg_cache" | Out-Null + } + - name: Add NuGet sources + if: ${{ env.HAS_VCPKG_PACKAGES_TOKEN != '' }} shell: pwsh run: | .$(${{ env.VCPKG_EXE }} fetch nuget) ` @@ -121,9 +136,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 @@ -136,9 +151,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_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" - name: Checkout projectMSDL Sources uses: actions/checkout@v6 @@ -149,8 +164,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_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 run: | @@ -207,3 +222,4 @@ jobs: with: name: projectMSDL-buildcheck-macos path: cmake-build-frontend-sdl2/*.tar.gz + 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..d2c5565 100644 --- a/.github/workflows/release-windows.yaml +++ b/.github/workflows/release-windows.yaml @@ -28,8 +28,7 @@ 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" - + HAS_VCPKG_PACKAGES_TOKEN: ${{ secrets.VCPKG_PACKAGES_TOKEN }} steps: - name: Checkout vcpkg uses: actions/checkout@v6 @@ -42,7 +41,23 @@ 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: | + 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 + New-Item -ItemType Directory -Force -Path "${{ github.workspace }}/vcpkg_cache" | Out-Null + } + - name: Add NuGet sources + if: ${{ env.HAS_VCPKG_PACKAGES_TOKEN != '' }} shell: pwsh run: | .$(${{ env.VCPKG_EXE }} fetch nuget) ` @@ -51,9 +66,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 @@ -78,17 +93,20 @@ 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_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" ` - -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: | @@ -101,3 +119,4 @@ jobs: name: projectMSDL-Windows-Portable-x64 path: | cmake-build-frontend-sdl2/*.zip + 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(); } } +