launcher: get viewing config options for plugins working (no saving yet, but they do trigger the save prompt)

This commit is contained in:
somewhatlurker
2019-08-30 00:16:34 +10:00
parent de1eba2582
commit 066208bcda
3 changed files with 153 additions and 13 deletions
@@ -273,7 +273,7 @@ struct PluginInfo {
std::wstring filename;
std::wstring name;
std::wstring description;
std::vector<PluginConfig::PluginConfigOption> configopts;
std::vector<ConfigOptionBase*> configopts;
};
std::vector<PluginInfo> LoadPlugins()
{
@@ -316,7 +316,7 @@ std::vector<PluginInfo> LoadPlugins()
thisplugin.description = (thisplugin.filename + L" Plugin").c_str();
if (optsFunc != NULL)
thisplugin.configopts = optsFunc();
thisplugin.configopts = PluginConfig::GetConfigOptionVec(optsFunc());
// afaik FreeLibrary should be fine because of ref counting, but it isn't. whatever.
// FreeLibrary(thisplugin.handle);
@@ -332,6 +332,20 @@ std::vector<PluginInfo> LoadPlugins()
}
std::vector<PluginInfo> AllPlugins = LoadPlugins();
std::vector<PluginOption*> GetPluginOptions(std::vector<PluginInfo>* plugins)
{
std::vector<PluginOption*> outvec;
for (PluginInfo &pi : *plugins)
{
PluginOption* opt = new PluginOption(pi.filename.c_str(), L"plugins", CONFIG_FILE, pi.name.c_str(), pi.description.c_str(), true, pi.configopts);
outvec.push_back(opt);
}
return outvec;
}
std::vector<PluginOption*> AllPluginOpts = GetPluginOptions(&AllPlugins);
// used to trick Optimus into switching to the NVIDIA GPU
HMODULE nvcudaModule = LoadLibraryW(L"nvcuda.dll");