Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: cfg_var array (Read 4009 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

cfg_var array

Hello

Does anyone know if there's any mechanism for saving an array of config values?
I am looking for something like cfg_int but for an array.

Thanks
Alex

cfg_var array

Reply #1
For a fixed size array you can use a define a struct and use cfg_struct<T>:
Code: [Select]
struct my_array_struct {
    COLORREF colors[16];
};
static const my_array_struct g_default_value = {...};
static cfg_struct<my_array_struct> g_var(some_guid, g_default_value);


Otherwise you can use a list based cfg_var. See cfg_structlist_t<T> and cfg_guidlist in foobar2000_sdk_helpers for examples.

 

cfg_var array

Reply #2
For a fixed size array you can use a define a struct and use cfg_struct<T>:
Code: [Select]
struct my_array_struct {
    COLORREF colors[16];
};
static const my_array_struct g_default_value = {...};
static cfg_struct<my_array_struct> g_var(some_guid, g_default_value);


Otherwise you can use a list based cfg_var. See cfg_structlist_t<T> and cfg_guidlist in foobar2000_sdk_helpers for examples.


Sweet. thanks for the code snippet!