Skip to content

Commit

Permalink
UI: Show warning on plugin load failure
Browse files Browse the repository at this point in the history
Allows the user to know what plugins failed to load. This is
particularly useful if we're going to block Qt5 plugins as well, or if
certain plugins can't load because they're incompatible with a newer
version.
  • Loading branch information
jp9000 committed Jul 28, 2022
1 parent 23c3ad4 commit 2b3c90d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions UI/data/locale/en-US.ini
Expand Up @@ -113,6 +113,10 @@ MoveSourceDown="Move Source(s) Down"
SourceProperties="Open Source Properties"
SourceFilters="Open Source Filters"

# warning for plugin load failures
PluginsFailedToLoad.Title="Plugin Load Error"
PluginsFailedToLoad.Text="The following OBS plugins failed to load:\n\n%1\nPlease update or remove these plugins."

# warning if program already open
AlreadyRunning.Title="OBS is already running"
AlreadyRunning.Text="OBS is already running! Unless you meant to do this, please shut down any existing instances of OBS before trying to run a new instance. If you have OBS set to minimize to the system tray, please check to see if it's still running there."
Expand Down
24 changes: 23 additions & 1 deletion UI/window-basic-main.cpp
Expand Up @@ -1778,15 +1778,18 @@ void OBSBasic::OBSInit()
LoadLibraryW(L"Qt6Network");
#endif
#endif
struct obs_module_failure_info mfi;

AddExtraModulePaths();
blog(LOG_INFO, "---------------------------------");
obs_load_all_modules();
obs_load_all_modules2(&mfi);
blog(LOG_INFO, "---------------------------------");
obs_log_loaded_modules();
blog(LOG_INFO, "---------------------------------");
obs_post_load_modules();

BPtr<char *> failed_modules = mfi.failed_modules;

#ifdef BROWSER_AVAILABLE
cef = obs_browser_init_panel();
#endif
Expand Down Expand Up @@ -2071,6 +2074,25 @@ void OBSBasic::OBSInit()
OnFirstLoad();

activateWindow();

/* ------------------------------------------- */
/* display warning message for failed modules */

if (mfi.count) {
QString failed_plugins;

char **plugin = mfi.failed_modules;
while (*plugin) {
failed_plugins += *plugin;
failed_plugins += "\n";
plugin++;
}

QString failed_msg =
QTStr("PluginsFailedToLoad.Text").arg(failed_plugins);
OBSMessageBox::warning(this, QTStr("PluginsFailedToLoad.Title"),
failed_msg);
}
}

void OBSBasic::OnFirstLoad()
Expand Down

0 comments on commit 2b3c90d

Please sign in to comment.