override_config_file(3alleg4)
π override_config_file β NAME π
okay so override_config_file β it's the Allegro manual's function that specifies a file containing config overrides, and it lives in the Allegro game programming library. bestie it's giving "let me sneak my own settings in without touching the user's stuff" energy β¨
πΈ SYNOPSIS πΈ
#include <allegro.h>
void override_config_file(const char *filename);
π DESCRIPTION π
So here's the tea: this function specifies a file containing config overrides. Those settings get used in addition to the parameters in the main config file, and when a variable shows up in both files, this override version takes priority. π
Why is that iconic? Because application programmers can use it to override some of the config settings straight from their code, while still leaving the main config file totally free for the end user to customise. Everyone wins, no cap. For example, you could specify a particular sample frequency and IBK instrument file, but the user could still use an allegro.cfg file to specify the port settings and irq numbers. π
The override config file will not only take precedence when reading, but will also be used for storing values. So when you're done with using the override config file, you can call override_config_file with a NULL parameter, and config data will be directly read from the current config file again. bye bestie, back to normal π¦
Note: the override file is completely independent from the current configuration. You can e.g. callset_config_file, and the override file will still be active. Also theflush_config_filefunction will only affect the current config file (which can be changed withset_config_file), never the overriding one specified with this function. The modified override config is written back to disk whenever you calloverride_config_file. literally every time. remember that. π
Example:
override_config_file("my.cfg");
/* This will read from my.cfg, and if it doesn't find a
* setting, will read from the current config file instead.
*/
language = get_config_string("system", "language", NULL);
/* This will always write to my.cfg, no matter if the
* settings is already present or not.
*/
set_config_string("system", "language", "RU");
/* This forces the changed setting to be written back to
* disk. Else it is written back at the next call to
* override_config_file, or when Allegro shuts down.
*/
override_config_file(NULL);
Note that this function and override_config_data() are mutually exclusive, i.e. calling one will cancel the effects of the other. it's giving "choose one, babe, you can't have both" π
π SEE ALSO π
and that's the whole vibe check, bestie π«Ά this was Allegro version 4.4.3 β the Allegro manual, override_config_file(3alleg4), signing off like the main character she is πβ¨ go forth and override responsibly π
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms