aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Input/in_avi/api.cpp
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Input/in_avi/api.cpp
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Input/in_avi/api.cpp')
-rw-r--r--Src/Plugins/Input/in_avi/api.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/Src/Plugins/Input/in_avi/api.cpp b/Src/Plugins/Input/in_avi/api.cpp
new file mode 100644
index 00000000..545c00ac
--- /dev/null
+++ b/Src/Plugins/Input/in_avi/api.cpp
@@ -0,0 +1,50 @@
+#include "api__in_avi.h"
+#include "main.h"
+#include <api/service/waservicefactory.h>
+
+api_config *AGAVE_API_CONFIG = 0;
+api_application *WASABI_API_APP = 0;
+api_stats *AGAVE_API_STATS = 0;
+api_language *WASABI_API_LNG = 0;
+HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
+
+template <class api_T>
+void ServiceBuild(api_T *&api_t, GUID factoryGUID_t)
+{
+ if (plugin.service)
+ {
+ waServiceFactory *factory = plugin.service->service_getServiceByGuid(factoryGUID_t);
+ if (factory)
+ api_t = reinterpret_cast<api_T *>( factory->getInterface() );
+ }
+}
+
+template <class api_T>
+void ServiceRelease(api_T *api_t, GUID factoryGUID_t)
+{
+ if (plugin.service && api_t)
+ {
+ waServiceFactory *factory = plugin.service->service_getServiceByGuid(factoryGUID_t);
+ if (factory)
+ factory->releaseInterface(api_t);
+ }
+ api_t = NULL;
+}
+
+void WasabiInit()
+{
+ ServiceBuild(AGAVE_API_CONFIG, AgaveConfigGUID);
+ ServiceBuild(WASABI_API_APP, applicationApiServiceGuid);
+ ServiceBuild(AGAVE_API_STATS, AnonymousStatsGUID);
+ ServiceBuild(WASABI_API_LNG, languageApiGUID);
+ // need to have this initialised before we try to do anything with localisation features
+ WASABI_API_START_LANG(plugin.hDllInstance,InAviLangGUID);
+}
+
+void WasabiQuit()
+{
+ ServiceRelease(AGAVE_API_CONFIG, AgaveConfigGUID);
+ ServiceRelease(WASABI_API_APP, applicationApiServiceGuid);
+ ServiceRelease(AGAVE_API_STATS, AnonymousStatsGUID);
+ ServiceRelease(WASABI_API_LNG, languageApiGUID);
+} \ No newline at end of file