Skip to content

Commit

Permalink
Fix loading user config for mac
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Dec 16, 2024
1 parent 449318a commit aa4643a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion multistream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,24 @@ void showVerticalWarning(QVBoxLayout *verticalLayout)

#if LIBOBS_API_VER < MAKE_SEMANTIC_VERSION(31, 0, 0)
static config_t *(*get_user_config_func)(void) = nullptr;
static config_t *user_config = nullptr;
#endif

config_t *get_user_config(void)
{
#if LIBOBS_API_VER < MAKE_SEMANTIC_VERSION(31, 0, 0)
if (user_config)
return user_config;
if (!get_user_config_func) {
if (obs_get_version() < MAKE_SEMANTIC_VERSION(31, 0, 0)) {
get_user_config_func = obs_frontend_get_global_config;
blog(LOG_INFO, "[Aitum Multistream] use global config");
} else {
#ifdef __APPLE__
auto handle = os_dlopen("obs-frontend-api.dylib");
#else
auto handle = os_dlopen("obs-frontend-api");
#endif
if (handle) {
get_user_config_func = (config_t * (*)(void)) os_dlsym(handle, "obs_frontend_get_user_config");
os_dlclose(handle);
Expand All @@ -172,7 +179,8 @@ config_t *get_user_config(void)
}
if (get_user_config_func)
return get_user_config_func();
return obs_frontend_get_global_config();
user_config = obs_frontend_get_global_config();
return user_config;
#else
return obs_frontend_get_user_config();
#endif
Expand Down

0 comments on commit aa4643a

Please sign in to comment.