1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #include "crkutil.hh"
|
---|
10 | #include "memory/malloc.hh"
|
---|
11 | #include "string/string.hh"
|
---|
12 | #include "debug.hh"
|
---|
13 |
|
---|
14 | char *gmod_sig = "GMOD";
|
---|
15 |
|
---|
16 | HINSTANCE hInstance;
|
---|
17 | extern void * my_instance;
|
---|
18 |
|
---|
19 | int controlsInit = FALSE;
|
---|
20 |
|
---|
21 | /** public functions **/
|
---|
22 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
---|
23 | {
|
---|
24 | my_instance = hInstance = hinstDLL;
|
---|
25 |
|
---|
26 | if (!controlsInit)
|
---|
27 | {
|
---|
28 | controlsInit = TRUE;
|
---|
29 |
|
---|
30 | // jaguar controls
|
---|
31 | InitCustomControls(hInstance);
|
---|
32 |
|
---|
33 | // initialize Chicago controls
|
---|
34 | InitCommonControls();
|
---|
35 | }
|
---|
36 |
|
---|
37 | return (TRUE);
|
---|
38 | }
|
---|
39 |
|
---|
40 |
|
---|
41 | //------------------------------------------------------
|
---|
42 | // This is the interface to Jaguar:
|
---|
43 | //------------------------------------------------------
|
---|
44 |
|
---|
45 | __declspec( dllexport ) const TCHAR * LibDescription()
|
---|
46 | {
|
---|
47 | return _T("Crack Utilities");
|
---|
48 | }
|
---|
49 |
|
---|
50 | /// MUST CHANGE THIS NUMBER WHEN ADD NEW CLASS
|
---|
51 | __declspec( dllexport ) int LibNumberClasses()
|
---|
52 | {
|
---|
53 | return 3;
|
---|
54 | }
|
---|
55 |
|
---|
56 | __declspec( dllexport ) ClassDesc* LibClassDesc(int i)
|
---|
57 | {
|
---|
58 | switch(i)
|
---|
59 | {
|
---|
60 | case 0: return GetCrackUtilDesc();
|
---|
61 | case 1: return GetCrackImportDesc();
|
---|
62 | // case 2: return GetGMODMatDesc();
|
---|
63 | default: return 0;
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | // Return version so can detect obsolete DLLs
|
---|
68 | __declspec( dllexport ) ULONG LibVersion()
|
---|
69 | {
|
---|
70 | return VERSION_3DSMAX;
|
---|
71 | }
|
---|
72 |
|
---|
73 | TCHAR *GetString(int id)
|
---|
74 | {
|
---|
75 | static TCHAR buf[256];
|
---|
76 |
|
---|
77 | if (hInstance)
|
---|
78 | return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL;
|
---|
79 |
|
---|
80 | return NULL;
|
---|
81 | }
|
---|
82 |
|
---|
83 | int i4_crkutil_error(const char *st)
|
---|
84 | {
|
---|
85 | dbg("Error: %s\n",st);
|
---|
86 | return 0;
|
---|
87 | }
|
---|
88 |
|
---|
89 |
|
---|
90 | int i4_crkutil_warning(const char *st)
|
---|
91 | {
|
---|
92 | dbg("Warning: %s\n",st);
|
---|
93 | return 0;
|
---|
94 | }
|
---|
95 |
|
---|
96 | void initialize_i4()
|
---|
97 | {
|
---|
98 | if (!i4_is_initialized())
|
---|
99 | {
|
---|
100 | i4_set_error_function(i4_crkutil_error);
|
---|
101 | i4_set_error_function(i4_crkutil_warning);
|
---|
102 | i4_set_max_memory_used(4096000);
|
---|
103 | i4_init();
|
---|
104 | i4_string_man.load("resource.res");
|
---|
105 | }
|
---|
106 | }
|
---|