Disable Chroma API stuff on non-Windows platforms

This commit is contained in:
Vinyl Darkscratch 2018-02-26 21:09:12 -08:00
parent d4121948cd
commit 397a15cdf7

View file

@ -6,7 +6,11 @@
bool INIT_SUCCESS = false;
#ifdef _WIN32
HINSTANCE hLib = NULL;
#else
int* hLib = NULL;
#endif
//dynamic-loaded proc pointers
PluginPlayAnimation _playAnimation = NULL;
@ -20,14 +24,7 @@ int lastAnimId = -1;
void _attemptLinkSdk() {
Debug() << "Attempting to bind Chroma SDK";
#if !defined(_WIN32) && !defined(_WIN64)
// currently razr chroma is windows-only.
// so, if we are not building for windows platform
// then don't bother with chroma stuff
Debug() << "Chroma: Unsupported Platform";
return;
#endif
#ifdef _WIN32
hLib = LoadLibrary(L"ChromaApi.dll");
if (hLib != NULL) {
Debug() << "Chroma Impl @" << hLib;
@ -53,6 +50,12 @@ void _attemptLinkSdk() {
INIT_SUCCESS &= _pluginUninit != NULL;
Debug() << "Plugin init success:" << INIT_SUCCESS;
}
#else
// Currently the Razor Chroma API is Windows-only.
// So, if we are not building for Windows platform,
// then don't bother with Chroma stuff.
Debug() << "Chroma: Unsupported Platform";
#endif
}
@ -83,10 +86,12 @@ void chromaBindingInit() {
}
void chromaBindingRelease() {
#ifdef _WIN32
if (hLib != NULL) {
_pluginUninit();
FreeLibrary(hLib);
hLib = NULL;
INIT_SUCCESS = false;
}
#endif
}