main.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "api__tagz.h"
  2. #include "api_tagz.h"
  3. #include "../Agave/Component/ifc_wa5component.h"
  4. #include "factory_tagz.h"
  5. TagzFactory tagsFactory;
  6. class TagzComponent : public ifc_wa5component
  7. {
  8. public:
  9. void RegisterServices(api_service *service);
  10. int RegisterServicesSafeModeOk();
  11. void DeregisterServices(api_service *service);
  12. protected:
  13. RECVS_DISPATCH;
  14. };
  15. TagzComponent tagzComponent;
  16. api_service *serviceManager=0;
  17. // wasabi based services for localisation support
  18. api_language *WASABI_API_LNG = 0;
  19. HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
  20. static HINSTANCE GetMyInstance()
  21. {
  22. MEMORY_BASIC_INFORMATION mbi = {0};
  23. if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi)))
  24. return (HINSTANCE)mbi.AllocationBase;
  25. return NULL;
  26. }
  27. void TagzComponent::RegisterServices(api_service *service)
  28. {
  29. WASABI_API_SVC = service;
  30. WASABI_API_SVC->service_register(&tagsFactory);
  31. waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(languageApiGUID);
  32. if (sf) WASABI_API_LNG = reinterpret_cast<api_language*>(sf->getInterface());
  33. // need to have this initialised before we try to do anything with localisation features
  34. WASABI_API_START_LANG(GetMyInstance(),tagzLangGUID);
  35. }
  36. void TagzComponent::DeregisterServices(api_service *service)
  37. {
  38. service->service_deregister(&tagsFactory);
  39. }
  40. int TagzComponent::RegisterServicesSafeModeOk()
  41. {
  42. return 1;
  43. }
  44. extern "C" __declspec(dllexport) ifc_wa5component *GetWinamp5SystemComponent()
  45. {
  46. return &tagzComponent;
  47. }
  48. #ifdef CBCLASS
  49. #undef CBCLASS
  50. #endif
  51. #define CBCLASS TagzComponent
  52. START_DISPATCH;
  53. VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices)
  54. CB(15, RegisterServicesSafeModeOk)
  55. VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices)
  56. END_DISPATCH;