mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[client] egl: added egl:preset
to load a default preset at startup
This commit is contained in:
parent
89c83dafc1
commit
aa426d13a7
@ -74,6 +74,12 @@ void egl_postProcessEarlyInit(void)
|
|||||||
.type = OPTION_TYPE_STRING,
|
.type = OPTION_TYPE_STRING,
|
||||||
.value.x_string = ""
|
.value.x_string = ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.module = "egl",
|
||||||
|
.name = "preset",
|
||||||
|
.description = "The initial filter preset to load",
|
||||||
|
.type = OPTION_TYPE_STRING
|
||||||
|
},
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
option_register(options);
|
option_register(options);
|
||||||
@ -82,6 +88,8 @@ void egl_postProcessEarlyInit(void)
|
|||||||
EGL_Filters[i]->earlyInit();
|
EGL_Filters[i]->earlyInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void loadPreset(struct EGL_PostProcess * this, const char * name);
|
||||||
|
|
||||||
static void loadPresetList(struct EGL_PostProcess * this)
|
static void loadPresetList(struct EGL_PostProcess * this)
|
||||||
{
|
{
|
||||||
DIR * dir = NULL;
|
DIR * dir = NULL;
|
||||||
@ -114,6 +122,8 @@ static void loadPresetList(struct EGL_PostProcess * this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct dirent * entry;
|
struct dirent * entry;
|
||||||
|
const char * preset = option_get_string("egl", "preset");
|
||||||
|
bool presetValid = false;
|
||||||
while ((entry = readdir(dir)) != NULL)
|
while ((entry = readdir(dir)) != NULL)
|
||||||
{
|
{
|
||||||
if (entry->d_type != DT_REG)
|
if (entry->d_type != DT_REG)
|
||||||
@ -127,10 +137,22 @@ static void loadPresetList(struct EGL_PostProcess * this)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
stringlist_push(this->presets, name);
|
stringlist_push(this->presets, name);
|
||||||
|
|
||||||
|
if (strcmp(preset, name) == 0)
|
||||||
|
presetValid = true;
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
||||||
this->activePreset = -1;
|
this->activePreset = -1;
|
||||||
|
|
||||||
|
if (preset)
|
||||||
|
{
|
||||||
|
if (presetValid)
|
||||||
|
loadPreset(this, preset);
|
||||||
|
else
|
||||||
|
DEBUG_WARN("egl:preset '%s' does not exist", preset);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
Loading…
Reference in New Issue
Block a user