1
0
mirror of https://github.com/dege-diosg/dgVoodoo2 synced 2024-07-08 20:51:02 +02:00
2023-07-21 21:30:21 +02:00

81 lines
1.9 KiB
C++

// *****************************************************************************
// File: Main.cpp
//
// Description: Main file of dgVoodoo Addon DLL
//
// Contact person: DG
//
// *****************************************************************************
// --- Includes ----------------------------------------------------------------
#include <tchar.h>
#include <Windows.h>
#include "..\Inc\Addon\AddonDefs.hpp"
#include "..\Inc\Addon\IAddonMainCallback.hpp"
// --- Defines -----------------------------------------------------------------
// --- Namespaces --------------------------------------------------------------
using namespace dgVoodoo;
// --- Predeclarations ---------------------------------------------------------
class AddonMain;
// --- Externs -----------------------------------------------------------------
extern AddonMain* CreateAddonMain (HINSTANCE hDll, dgVoodoo::IAddonMainCallback* pAddonMainCB);
extern void DeleteAddonMain (AddonMain* pAddonMain);
// --- Variables ---------------------------------------------------------------
HINSTANCE hDll = NULL;
AddonMain* pAddonMain = NULL;
// --- Dll Main ----------------------------------------------------------------
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
hDll = hinstDLL;
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
int APIENTRY _tWinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
return 1;
}
// --- Addon functions ---------------------------------------------------------
extern "C" {
bool API_EXPORT AddOnInit (dgVoodoo::IAddonMainCallback* pAddonMainCB)
{
pAddonMain = CreateAddonMain (hDll, pAddonMainCB);
return pAddonMain != NULL;
}
void API_EXPORT AddOnExit ()
{
DeleteAddonMain (pAddonMain);
pAddonMain = NULL;
}
} // extern "C"