Repository navigation
Join equation lines without a separator, like Milkdrop - #1068
Open
Coastrnaut wants to merge 1 commit into
Open
Coastrnaut wants to merge 1 commit into
Coastrnaut wants to merge 1 commit into
Conversation
Milkdrop reads the numbered code lines of a preset, then removes // and \ comments up to the end of each line and joins the lines without any separator before compiling the expressions (ReadCode() and StripLinefeedCharsAndComments() in state.cpp). Its editor wrapped long lines when saving presets, often in the middle of a variable name or number, e.g. "above(Treb,t" followed by "reb_Att)". projectM joined the lines with a newline, which split these tokens and made the expression parser reject the code, so the whole preset failed to load. The header of GetCode() already documented equations as being returned as a single line with comments stripped. Add PresetFileParser::GetEquationCode(), which joins lines the way Milkdrop does, and use it for all expression code of presets and user sprites. Shader code still uses GetCode(), which keeps the line breaks.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milkdrop reads the numbered code lines of a preset (
per_frame_1=,per_frame_2=, …), removes//and\\comments up to the end of each line and then joins the lines without any separator before compiling the expressions (ReadCode()andStripLinefeedCharsAndComments()in state.cpp). Its editor wrapped long lines when saving presets, often in the middle of a variable name or number:projectM joined the lines with a newline, which split these tokens (
t/reb_Att,is_/beat, …), so projectm-eval rejected the code and the whole preset failed to load. The documentation ofGetCode()already said equations are returned as a single line with comments stripped.This adds
PresetFileParser::GetEquationCode(), which joins lines like Milkdrop does, and uses it for all expression code of presets and user sprites. Shader code still usesGetCode()and keeps its line breaks.Results
0.99l,.-.4); Skip equation code that doesn't compile instead of failing the preset #1069 handles those.PresetFileParsertests, including the wrapped-token cases. All unit tests pass.How I tested it
I loaded all 14,536 presets from cream-of-the-crop, en-d, milkdrop-original and projectm-classic one after another (Windows, RTX A6000), with the preset folders as texture search path, rendered 30 frames each with fixed audio and frame times, and recorded shader compile/link results, failed loads and frame hashes. For the pixel comparison both builds had their random seeds fixed (a local patch only, identical on both sides). The presets this PR fixes are excluded from the pixel comparison, since loading them changes shared state (e.g. the expression evaluator's random generator) for every preset after them.
Retested on current master (2026-11-12)