12 #include <mach-o/dyld.h>
25 typedef void * (*funcType)(void);
47 static char *workingDirectoryResult = NULL;
50 vuoGetWorkingDirectoryType
vuoGetWorkingDirectory = (vuoGetWorkingDirectoryType) dlsym(RTLD_SELF,
"vuoGetWorkingDirectory");
58 free(compositionState);
63 char currentWorkingDirectory[PATH_MAX+1];
64 getcwd(currentWorkingDirectory, PATH_MAX+1);
65 workingDirectoryResult = strdup(currentWorkingDirectory);
68 return workingDirectoryResult;
78 static char frameworkPath[PATH_MAX+1] =
"";
79 static dispatch_once_t once = 0;
80 dispatch_once(&once, ^{
81 uint32_t imageCount = _dyld_image_count();
82 for (uint32_t i = 0; i < imageCount; ++i)
84 const char *dylibPath = _dyld_get_image_name(i);
86 if ( (pos = strstr(dylibPath,
"/Vuo.framework/")) )
88 strncpy(frameworkPath, dylibPath, pos-dylibPath);
104 static char frameworkPath[PATH_MAX+1] =
"";
105 static dispatch_once_t once = 0;
106 dispatch_once(&once, ^{
107 uint32_t imageCount = _dyld_image_count();
108 for (uint32_t i = 0; i < imageCount; ++i)
110 const char *dylibPath = _dyld_get_image_name(i);
112 if ( (pos = strstr(dylibPath,
"/VuoRunner.framework/")) )
114 strncpy(frameworkPath, dylibPath, pos-dylibPath);
119 return frameworkPath;
125 vuoGetRunnerPidType
vuoGetRunnerPid = (vuoGetRunnerPidType) dlsym(RTLD_SELF,
"vuoGetRunnerPid");
127 vuoGetRunnerPid = (vuoGetRunnerPidType) dlsym(RTLD_DEFAULT,
"vuoGetRunnerPid");
131 free(compositionState);
138 vuoStopCompositionType
vuoStopComposition = (vuoStopCompositionType) dlsym(RTLD_SELF,
"vuoStopComposition");
140 vuoStopComposition = (vuoStopCompositionType) dlsym(RTLD_DEFAULT,
"vuoStopComposition");
144 free(compositionState);
150 vuoStopCompositionType
vuoStopComposition = (vuoStopCompositionType) dlsym(RTLD_SELF,
"vuoStopComposition");
152 vuoStopComposition = (vuoStopCompositionType) dlsym(RTLD_DEFAULT,
"vuoStopComposition");
160 vuoAddCompositionFiniCallbackType
vuoAddCompositionFiniCallback = (vuoAddCompositionFiniCallbackType) dlsym(RTLD_SELF,
"vuoAddCompositionFiniCallback");
168 free(compositionState);
175 vuoDisableTerminationType
vuoDisableTermination = (vuoDisableTerminationType) dlsym(RTLD_SELF,
"vuoDisableTermination");
181 free(compositionState);
187 vuoEnableTerminationType
vuoEnableTermination = (vuoEnableTerminationType) dlsym(RTLD_SELF,
"vuoEnableTermination");
193 free(compositionState);
198 typedef bool (*vuoShouldShowSplashWindowType)(void);
199 vuoShouldShowSplashWindowType vuoShouldShowSplashWindow = (vuoShouldShowSplashWindowType) dlsym(RTLD_DEFAULT,
"vuoShouldShowSplashWindow");
200 if (!vuoShouldShowSplashWindow)
206 return vuoShouldShowSplashWindow();
211 static bool proEnabledResult =
false;
212 static dispatch_once_t once = 0;
213 dispatch_once(&once, ^{
214 bool *proEnabled = (
bool *) dlsym(RTLD_SELF,
"VuoProEnabled");
216 proEnabled = (
bool *) dlsym(RTLD_DEFAULT,
"VuoProEnabled");
219 proEnabledResult = *proEnabled;
221 return proEnabledResult;
231 uint32_t eax = 7, ebx, ecx = 0, edx;
232 __asm__ (
"cpuid" :
"+b" (ebx),
"+a" (eax),
"+c" (ecx),
"=d" (edx) );
233 uint32_t avx2_mask = 1 << 5;
234 return (ebx & avx2_mask) == avx2_mask;