Posted by: ZylonBane
« on: 08. July 2021, 16:42:53 »I just had a thought that it would be nice if the mod manager could somehow also manage bloom settings. Like, have it automatically recognize blablabla.bloom files and copy their values into cam_ext. Currently the only way to mess with bloom is to manually edit a config file, which is a bit much for most users. If bloom presets could be managed like any other mod, that would be pretty slick.
The algorithm wouldn't be too complicated:
- Only apply the highest-priority bloom file.
- On applying a bloom file, if a file named cam_ext.bak does not exist, make a copy of cam_ext.cfg with that name. Just insurance in case cam_ext.cfg somehow gets corrupted.
- Load cam_ext.cfg and split it into lines.
- Remove any previous BMM-applied bloom config:
Search for a line that starts with "; BMM BLOOM START".
Search for a line that starts with "; BMM BLOOM END".
If both found, delete all lines between those two lines, inclusive.
If only one found, the user has probably been manually mucking around. Best we can do is delete the line that we found.
- Disable any current bloom config:
Search for any lines that start with with either "postprocess" or "bloom".
If found, change the lines to be prefixed with a semicolon (i.e., comment them out).
- Add bloom config:
Append to end "; BMM BLOOM START".
Append "postprocess 1".
For each line of the bloom mod file that starts with "bloom", append that line. Ignore lines that start with anything else. We could hard-code all the current bloom config commands, but just keying on "bloom" gives us future-proofing.
Append "; BMM BLOOM END".
- Write out new cam_ext.cfg.
On disabling a bloom mod, just run the part that scans for and removes the BMM bloom block.
The algorithm wouldn't be too complicated:
- Only apply the highest-priority bloom file.
- On applying a bloom file, if a file named cam_ext.bak does not exist, make a copy of cam_ext.cfg with that name. Just insurance in case cam_ext.cfg somehow gets corrupted.
- Load cam_ext.cfg and split it into lines.
- Remove any previous BMM-applied bloom config:
Search for a line that starts with "; BMM BLOOM START".
Search for a line that starts with "; BMM BLOOM END".
If both found, delete all lines between those two lines, inclusive.
If only one found, the user has probably been manually mucking around. Best we can do is delete the line that we found.
- Disable any current bloom config:
Search for any lines that start with with either "postprocess" or "bloom".
If found, change the lines to be prefixed with a semicolon (i.e., comment them out).
- Add bloom config:
Append to end "; BMM BLOOM START".
Append "postprocess 1".
For each line of the bloom mod file that starts with "bloom", append that line. Ignore lines that start with anything else. We could hard-code all the current bloom config commands, but just keying on "bloom" gives us future-proofing.
Append "; BMM BLOOM END".
- Write out new cam_ext.cfg.
On disabling a bloom mod, just run the part that scans for and removes the BMM bloom block.