Skip to content

Update to projectM v4.x#133

Open
garbear wants to merge 4 commits intoxbmc:Piersfrom
garbear:projectm-4
Open

Update to projectM v4.x#133
garbear wants to merge 4 commits intoxbmc:Piersfrom
garbear:projectm-4

Conversation

@garbear
Copy link
Copy Markdown
Member

@garbear garbear commented Feb 28, 2026

Description

This PR updates all dependencies, including a bump of projectM from v3 to v4.

All non-dependency changes are currently from #130. Special thanks to @kblaschke for the v4 work.

Motivation and context

We currently have no ProjectM add-on for anything but Windows: https://jenkins.kodi.tv/blue/organizations/jenkins/xbmc%2Fvisualization.projectm/detail/Piers/49/pipeline/162

Windows doesn't build here yet, but we can release this without Windows so that ProjectM won't be missing on any platforms anymore.

How has this been tested?

Builds and runs on my macbook M2:

Screenshot 2026-02-27 at 9 18 59 PM

Windows testing in progress.

@garbear garbear changed the title Update to ProjectM v4 Update to projectM v4 Feb 28, 2026
@kodiai
Copy link
Copy Markdown

kodiai bot commented Feb 28, 2026

Kodiai Review Summary

What Changed

Updates ProjectM from v3 to v4 with new C API, updates dependencies (GLM, angle, dlfcn-win32, dirent), and migrates addon to use projectM 4.0 API. Reviewed: core logic, docs

Strengths

  • ✅ Proper mutex protection added around all ProjectM API calls to prevent race conditions
  • ✅ Resource cleanup improved with explicit null pointer management in destructor

Observations

Impact

[CRITICAL] src/Main.cpp (456): Missing break statement causes case 5 to fall through to case 6
Missing break; statement at line 456 in ChoosePresetPack() causes case 5 (presets_projectM) to fall through to case 6 (presets_stock), incorrectly overwriting m_presetDir when preset pack 5 is selected.

[MAJOR] src/Main.cpp (263): Logic error always returns same value
GetActivePreset() calls projectm_playlist_get_position(m_playlist) twice in the condition check and return statement. When the position is 0 (valid first item), the condition if (m_playlist && projectm_playlist_get_position(m_playlist)) evaluates to false, incorrectly returning 0 instead of 0.

Verdict

🔴 Address before merging -- 2 blocking issue(s) found

Review Details
  • Files reviewed: 38
  • Lines changed: +315 -1112
  • Profile: minimal (auto, lines changed: 1427)
  • Author: core (adapted tone)
  • Findings: 1 critical, 1 major, 0 medium, 0 minor (includes 2 from summary observations)
  • Review completed: 2026-02-28T05:22:29.145Z
  • Keyword parsing: No keywords detected

@ksooo
Copy link
Copy Markdown
Member

ksooo commented Mar 10, 2026

@garbear I played a bit with this and at least on android I was not able to activate other presets. Despite of what I selected the default preset - projectM - was used, even after restarting Kodi. Otherwise the add-on seems to work just fine.

@@ -1 +1 @@
4bcf07266f336bcd540fec5f75e90f027bd5081d3752f9ea5d408ef6ae30a897
6ffcc318f00be192acb611c58aa58ee0cfd96776010680d7f38cf24f3dd8baf9
Copy link
Copy Markdown

@kblaschke kblaschke Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

projectM 4 no longer uses dirent on Windows, instead we've switched to std::filesystem, which is more convenient. So this dependency can probably be removed.from the plug-in.

void CVisualizationProjectM::PresetSwitchedEvent(bool isHardCut, unsigned int index, void* context)
{
auto that = reinterpret_cast<CVisualizationProjectM*>(context);
that->m_lastPresetIdx = static_cast<int>(projectm_playlist_get_position(that->m_playlist));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plug-in should probably save the last preset index in the settings as well here, so playback will continue at the same index on the next load.

@kblaschke
Copy link
Copy Markdown

The Windows build issues should all be sorted with the 4.2 release as we removed SOIL2 and also switched from GLEW to glad for OpenGL function resolving, including a new API that allows the outside app to provide the GL function pointers if needed. We verified it works with Angle, so it should make things easier for Kodi as well!

@garbear garbear force-pushed the projectm-4 branch 2 times, most recently from 98e0f7b to 7a8c084 Compare March 12, 2026 12:18
@garbear garbear changed the title Update to projectM v4 Update to projectM v4.x Mar 12, 2026
@garbear
Copy link
Copy Markdown
Member Author

garbear commented Mar 12, 2026

The Windows build issues should all be sorted with the 4.2 release

When is 4.2 due? Currently I'm based on master on top of 4.1.6 but it might have these changes?

As we removed SOIL2 and also switched from GLEW to glad for OpenGL function resolving

So I should drop soil and add glad as a dependency?

projectM 4 no longer uses dirent on Windows, instead we've switched to std::filesystem

I also dropped dirent from the dependencies.

The plug-in should probably save the last preset index in the settings as well here, so playback will continue at the same index on the next load.

I haven't touched the C++ work, it comes directly from #130. If any changes are suggested, I'd appreciate if they could be done by someone. My contribution is basically the dependencies, so maybe an actual C++ author can open a new PR with my dependency work.

@kblaschke
Copy link
Copy Markdown

I haven't touched the C++ work, it comes directly from #130. If any changes are suggested, I'd appreciate if they could be done by someone. My contribution is basically the dependencies, so maybe an actual C++ author can open a new PR with my dependency work.

When I'm back home in a week, I can have a look at it and add any necessary changes to the other PR (I've opened it, so that's easy). Or just pull in your changes to the other PR or rebase on this PR after it's been merged, whatever is easier!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants