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/Wasabi/api/apiinit.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 Src/Wasabi/api/apiinit.h (limited to 'Src/Wasabi/api/apiinit.h') diff --git a/Src/Wasabi/api/apiinit.h b/Src/Wasabi/api/apiinit.h new file mode 100644 index 00000000..2bf3adae --- /dev/null +++ b/Src/Wasabi/api/apiinit.h @@ -0,0 +1,255 @@ +#ifndef __API_INIT_H +#define __API_INIT_H + +#include +#include +#include +#include +#include + +class api_configI; +class SkinApi; +class api_makiI; +class MemMgrApi; +class TimerApi; +class WndApi; +class ForeignWnd; +class ClickWnd; + +class ImgLdrApi; +#ifdef WASABI_COMPILE_FONTS +class FontApi; +#endif +#ifdef WASABI_COMPILE_WNDMGR +class WndMgrApi; +#endif +#ifdef WASABI_COMPILE_MAKIDEBUG +class MakiDebuggerApi; +#endif +#ifdef WASABI_COMPILE_FILEREADER +class FileReaderApi; +#endif +#ifdef WASABI_COMPILE_LOCALES +class api_localesI; +#endif +#ifndef WA3COMPATIBILITY +#ifdef WASABI_COMPILE_MEDIACORE +class Core; +#endif +#endif + + + +#include + + + + +#ifdef WASABI_COMPILE_MEDIACORE + +#include + +class CoreApiService : public waServiceBase { +public: + CoreApiService() : waServiceBase(coreApiServiceGuid) {} + static const char *getServiceName() { return "Core API"; } + virtual api_core *getService() { return coreApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#endif // WASABI_COMPILE_MEDIACORE + +#ifdef WASABI_COMPILE_FILEREADER + +#include + +class FileReaderApiService : public waServiceBase { +public: + FileReaderApiService() : waServiceBase(fileReaderApiServiceGuid) {} + static const char *getServiceName() { return "FileReader API"; } + virtual api_fileReader *getService() { return fileApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#endif // WASABI_COMPILE_FILEREADER + +#ifdef WASABI_COMPILE_CONFIG + +#include + +class ConfigApiService : public waServiceBase { +public: + ConfigApiService() : waServiceBase(configApiServiceGuid) {} + static const char *getServiceName() { return "Config API"; } + virtual api_config *getService() { return configApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#endif // WASABI_COMPILE_CONFIG + +#ifdef WASABI_COMPILE_IMGLDR + +#include + +class ImgLdrApiService: public waServiceBase { +public: + ImgLdrApiService() : waServiceBase(imgLdrApiServiceGuid) {} + static const char *getServiceName() { return "Image Loading API"; } + virtual imgldr_api *getService() { return imgLoaderApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#endif // WASABI_COMPILE_IMGLDR + +#ifdef WASABI_COMPILE_FONTS + +#include + +class FontApiService : public waServiceBase { +public: + FontApiService() : waServiceBase(fontApiServiceGuid) {} + static const char *getServiceName() { return "Font Rendering API"; } + virtual api_font *getService() { return fontApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#endif // WASABI_COMPILE_FONT + + +#include + +class LocalesApiService : public waServiceBase { +public: + LocalesApiService() : waServiceBase(localesApiServiceGuid) {} + static const char *getServiceName() { return "Locales API"; } + virtual api_locales *getService() { return localesApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + + + +#include + +class WndApiService : public waServiceBase { +public: + WndApiService() : waServiceBase(wndApiServiceGuid) {} + static const char *getServiceName() { return "Windowing API"; } + virtual wnd_api *getService() { return wndApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + + +#include + +class WndMgrApiService : public waServiceBase { +public: + WndMgrApiService() : waServiceBase(wndMgrApiServiceGuid) {} + static const char *getServiceName() { return "Window Manager API"; } + virtual wndmgr_api *getService() { return wndManagerApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#include + +class SkinApiService : public waServiceBase { +public: + SkinApiService() : waServiceBase(skinApiServiceGuid) {} + static const char *getServiceName() { return "Skinning API"; } + virtual api_skin *getService() { return skinApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#include + +class MakiApiService : public waServiceBase { +public: + MakiApiService() : waServiceBase(makiApiServiceGuid) {} + static const char *getServiceName() { return "MAKI Scripting API"; } + virtual api_maki *getService() { return makiApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#ifdef WASABI_COMPILE_MAKIDEBUG + +#include + +class MakiDebugApiService : public waServiceBase { +public: + MakiDebugApiService() : waServiceBase(makiDebugApiServiceGuid) {} + static const char *getServiceName() { return "MAKI Debugger API"; } + virtual api_makiDebugger *getService() { return debugApi; } + static FOURCC getServiceType() { return WaSvc::UNIQUE; } +}; + +#endif // WASABI_COMPILE_SKIN + +class ApiInit +{ +public: + static int init(OSMODULEHANDLE hinstance, OSWINDOWHANDLE mainwnd, api_service *wa5_svc); // 0 == error, 1 == success + static int shutdown(); // 0 == error, 1 == success + static int getInitCount(); // if you do init / shutdown more than once in the session, this may be useful to invalid some caches + +private: + #ifdef WASABI_COMPILE_SKIN + #ifdef WASABI_COMPILE_COMPONENTS + static waServiceFactoryI * groupcreate; + #endif //WASABI_COMPILE_COMPONENTS + #endif //WASABI_COMPILE_SKIN + + static waServiceFactoryI * win32Font; + static FontApiService *fontapisvc; + +public: + static Widgets * widgets; +private: + static SkinApiService *skinapisvc; + + static api_configI * cfg; + static ConfigApiService *cfgapisvc; + static ImgLdrApi * img; + static ImgLdrApiService *imgldrapisvc; + + #ifdef WASABI_COMPILE_FONTS + static FontApi * font; + #endif + + #ifdef WASABI_COMPILE_FILEREADER + static FileReaderApi * fr; + #ifdef WASABI_COMPILE_ZIPREADER + static waServiceFactoryI * zipRead; + #endif + static FileReaderApiService *frapisvc; + #endif + + static api_localesI *loc; + static LocalesApiService *localesapisvc; + + static WndApi * wnd; + static ForeignWnd * mainWnd; + static ClickWnd * default_mainWnd; + static WndApiService *wndapisvc; + + static WndMgrApi * wndmgr; + static WndMgrApiService *wndmgrapisvc; + + + static api_makiI * maki; + static MakiApiService *makiapisvc; + + static SkinApi * skin; + + #ifdef WASABI_COMPILE_MAKIDEBUG + static MakiDebuggerApi * debug; + static MakiDebugApiService *makidebugapisvc; + #endif + + #ifdef WASABI_COMPILE_MEDIACORE + static CoreApiService *coreapisvc; + #endif + + static int initcount; +}; + +#endif + -- cgit