From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/gif/wa5_gif.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Src/gif/wa5_gif.cpp (limited to 'Src/gif/wa5_gif.cpp') diff --git a/Src/gif/wa5_gif.cpp b/Src/gif/wa5_gif.cpp new file mode 100644 index 00000000..cd3734e1 --- /dev/null +++ b/Src/gif/wa5_gif.cpp @@ -0,0 +1,63 @@ +#include "api__gif.h" +#include "wa5_gif.h" +#include +#include "MyFactory.h" + +#include "GIFLoader.h" +#include "GIFWriter.h" + +WA5_GIF wa5_gif; + +// {1ED6714D-2478-45dd-A803-A193EE20B75D} +static const GUID gifWriterGUID = +{ 0x1ed6714d, 0x2478, 0x45dd, { 0xa8, 0x3, 0xa1, 0x93, 0xee, 0x20, 0xb7, 0x5d } }; + +// {4D724110-1E35-406f-8976-C1E9873E0C15} +static const GUID gifLoaderGUID = +{ 0x4d724110, 0x1e35, 0x406f, { 0x89, 0x76, 0xc1, 0xe9, 0x87, 0x3e, 0xc, 0x15 } }; + + +MyFactory gifWriteFactory(gifWriterGUID); +MyFactory gifLoadFactory(gifLoaderGUID); + +api_service *serviceManager=0; +api_memmgr *memoryManager=0; + +void WA5_GIF::RegisterServices(api_service *service) +{ + WASABI_API_SVC = service; + + // get memory manager + waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid); + if (sf) memoryManager = reinterpret_cast(sf->getInterface()); + + WASABI_API_SVC->service_register(&gifLoadFactory); + WASABI_API_SVC->service_register(&gifWriteFactory); +} + +int WA5_GIF::RegisterServicesSafeModeOk() +{ + return 1; +} + +void WA5_GIF::DeregisterServices(api_service *service) +{ + service->service_deregister(&gifWriteFactory); + service->service_deregister(&gifLoadFactory); + + waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid); + if (sf) sf->releaseInterface(memoryManager); +} + +extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent() +{ + return &wa5_gif; +} + +#define CBCLASS WA5_GIF +START_DISPATCH; +VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices) +CB(15, RegisterServicesSafeModeOk) +VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices) +END_DISPATCH; +#undef CBCLASS \ No newline at end of file -- cgit