1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010-2011 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "tile_utility.h"
21 #include <nel/misc/common.h>
22 #include <nel/misc/debug.h>
23 #include "nel/misc/app_context.h"
24 #include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
26 #include <maxversion.h>
28 extern ClassDesc2
* GetTile_utilityDesc();
29 extern ClassDesc
* GetRGBAddDesc();
32 int controlsInit
= FALSE
;
34 // This function is called by Windows when the DLL is loaded. This
35 // function may also be called many times during time critical operations
36 // like rendering. Therefore developers need to be careful what they
37 // do inside this function. In the code below, note how after the DLL is
38 // loaded the first time only a few statements are executed.
40 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
,ULONG fdwReason
,LPVOID lpvReserved
)
42 // initialize nel context
43 if (!NLMISC::INelContext::isContextInitialised())
45 new NLMISC::CLibraryContext(GetSharedNelContext());
46 nldebug("NeL Tile Utility: DllMain");
49 hInstance
= hinstDLL
; // Hang on to this DLL's instance handle.
53 #if MAX_VERSION_MAJOR < 14
54 InitCustomControls(hInstance
); // Initialize MAX's custom controls
56 InitCommonControls(); // Initialize Win95 controls
62 // This function returns a string that describes the DLL and where the user
63 // could purchase the DLL if they don't have it.
64 __declspec( dllexport
) const TCHAR
* LibDescription()
66 return GetString(IDS_LIBDESCRIPTION
);
69 // This function returns the number of plug-in classes this DLL
70 //TODO: Must change this number when adding a new class
71 __declspec( dllexport
) int LibNumberClasses()
76 // This function returns the number of plug-in classes this DLL
77 __declspec( dllexport
) ClassDesc
* LibClassDesc(int i
)
80 case 0: return GetTile_utilityDesc();
81 case 1: return GetRGBAddDesc();
86 // This function returns a pre-defined constant indicating the version of
87 // the system under which it was compiled. It is used to allow the system
88 // to catch obsolete DLLs.
89 __declspec( dllexport
) ULONG
LibVersion()
91 return VERSION_3DSMAX
;
94 TCHAR
*GetString(int id
)
96 static TCHAR buf
[256];
99 return LoadString(hInstance
, id
, buf
, sizeof(buf
)) ? buf
: NULL
;