sm64coopdx/docs/c/sections/configfile.md
EmeraldLockdown 7e10a3bb13
Add in C documentation (#1176)
* Add in C documentation

* update readme

* Remove unecessary spacing
2026-04-21 21:35:01 -04:00

38 lines
No EOL
1.3 KiB
Markdown

## [:rewind: C Reference](../c.md)
# Config File
The configuration file is where all of the user's settings are stored. It's a decently easy to use system that allows you to add entries to the config file and use it with ease.
## Configuring the config file
Entries for the config file are handled in 2 files, `configfile.c`, and `configfile.h`, both are found in the `src/pc` directory.
To add an entry, at the top of the file there are a bunch of different variables. Go to wherever you deem appropriate and add your entry. A config file has these valid types:
```c
enum ConfigOptionType {
CONFIG_TYPE_BOOL,
CONFIG_TYPE_UINT,
CONFIG_TYPE_FLOAT,
CONFIG_TYPE_BIND,
CONFIG_TYPE_STRING,
CONFIG_TYPE_U64,
CONFIG_TYPE_COLOR,
};
```
In the `options` array, you can add in your config file entry. Go to the same place you deemed appropriate, and add in your entry. An entry consists of a name, this is the key used to find your value. It then takes in a type, which is the type of the value. It lastly takes in that value set. These are the possible types of value:
```c
union {
bool *boolValue;
unsigned int *uintValue;
float *floatValue;
char *stringValue;
u64 *u64Value;
u8 (*colorValue)[3];
};
```
Lastly, head to the header file, or `configfile.h`, and add your variable there.