mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Disable Chroma API stuff on non-Windows platforms
This commit is contained in:
parent
d4121948cd
commit
397a15cdf7
1 changed files with 40 additions and 35 deletions
|
|
@ -6,7 +6,11 @@
|
||||||
|
|
||||||
bool INIT_SUCCESS = false;
|
bool INIT_SUCCESS = false;
|
||||||
|
|
||||||
HINSTANCE hLib = NULL;
|
#ifdef _WIN32
|
||||||
|
HINSTANCE hLib = NULL;
|
||||||
|
#else
|
||||||
|
int* hLib = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
//dynamic-loaded proc pointers
|
//dynamic-loaded proc pointers
|
||||||
PluginPlayAnimation _playAnimation = NULL;
|
PluginPlayAnimation _playAnimation = NULL;
|
||||||
|
|
@ -20,39 +24,38 @@ int lastAnimId = -1;
|
||||||
|
|
||||||
void _attemptLinkSdk() {
|
void _attemptLinkSdk() {
|
||||||
Debug() << "Attempting to bind Chroma SDK";
|
Debug() << "Attempting to bind Chroma SDK";
|
||||||
#if !defined(_WIN32) && !defined(_WIN64)
|
#ifdef _WIN32
|
||||||
// currently razr chroma is windows-only.
|
hLib = LoadLibrary(L"ChromaApi.dll");
|
||||||
// so, if we are not building for windows platform
|
if (hLib != NULL) {
|
||||||
// then don't bother with chroma stuff
|
Debug() << "Chroma Impl @" << hLib;
|
||||||
Debug() << "Chroma: Unsupported Platform";
|
INIT_SUCCESS = true;
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hLib = LoadLibrary(L"ChromaApi.dll");
|
_playAnimation = (PluginPlayAnimation) GetProcAddress(hLib, "PluginPlayAnimation");
|
||||||
if (hLib != NULL) {
|
INIT_SUCCESS &= _playAnimation != NULL;
|
||||||
Debug() << "Chroma Impl @" << hLib;
|
Debug() << "Plugin method @" << (long)_playAnimation;
|
||||||
INIT_SUCCESS = true;
|
|
||||||
|
|
||||||
_playAnimation = (PluginPlayAnimation) GetProcAddress(hLib, "PluginPlayAnimation");
|
_openAnimation = (PluginOpenAnimation) GetProcAddress(hLib, "PluginOpenAnimation");
|
||||||
INIT_SUCCESS &= _playAnimation != NULL;
|
INIT_SUCCESS &= _openAnimation != NULL;
|
||||||
Debug() << "Plugin method @" << (long)_playAnimation;
|
|
||||||
|
|
||||||
_openAnimation = (PluginOpenAnimation) GetProcAddress(hLib, "PluginOpenAnimation");
|
_pluginInit = (PluginInit) GetProcAddress(hLib, "PluginInit");
|
||||||
INIT_SUCCESS &= _openAnimation != NULL;
|
INIT_SUCCESS &= _pluginInit != NULL;
|
||||||
|
|
||||||
_pluginInit = (PluginInit) GetProcAddress(hLib, "PluginInit");
|
_pluginIsInitialized = (PluginIsInitialized) GetProcAddress(hLib, "PluginIsInitialized");
|
||||||
INIT_SUCCESS &= _pluginInit != NULL;
|
INIT_SUCCESS &= _pluginInit != NULL;
|
||||||
|
if (INIT_SUCCESS && !_pluginIsInitialized()) {
|
||||||
_pluginIsInitialized = (PluginIsInitialized) GetProcAddress(hLib, "PluginIsInitialized");
|
Debug() << "Initializing chroma plugin";
|
||||||
INIT_SUCCESS &= _pluginInit != NULL;
|
_pluginInit();
|
||||||
if (INIT_SUCCESS && !_pluginIsInitialized()) {
|
}
|
||||||
Debug() << "Initializing chroma plugin";
|
_pluginUninit = (PluginUninit) GetProcAddress(hLib, "PluginUninit");
|
||||||
_pluginInit();
|
INIT_SUCCESS &= _pluginUninit != NULL;
|
||||||
|
Debug() << "Plugin init success:" << INIT_SUCCESS;
|
||||||
}
|
}
|
||||||
_pluginUninit = (PluginUninit) GetProcAddress(hLib, "PluginUninit");
|
#else
|
||||||
INIT_SUCCESS &= _pluginUninit != NULL;
|
// Currently the Razor Chroma API is Windows-only.
|
||||||
Debug() << "Plugin init success:" << INIT_SUCCESS;
|
// 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() {
|
void chromaBindingRelease() {
|
||||||
if (hLib != NULL) {
|
#ifdef _WIN32
|
||||||
_pluginUninit();
|
if (hLib != NULL) {
|
||||||
FreeLibrary(hLib);
|
_pluginUninit();
|
||||||
hLib = NULL;
|
FreeLibrary(hLib);
|
||||||
INIT_SUCCESS = false;
|
hLib = NULL;
|
||||||
}
|
INIT_SUCCESS = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue