dllmain.cpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: /Commando/Code/Tools/max2w3d/dllmain.cpp 12 4/08/02 4:07p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando / G *
  24. * *
  25. * File Name : DLLMAIN.CPP *
  26. * *
  27. * Programmer : Greg Hjelstrom *
  28. * *
  29. * Start Date : 06/09/97 *
  30. * *
  31. * Last Update : June 9, 1997 [GH] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * DllMain -- Entry point for the dll *
  36. * LibDescription -- Returns description of this library *
  37. * LibNumberClasses -- Returns number of classes in this library *
  38. * LibClassDesc -- Returns a ClassDesc for the specified class *
  39. * LibVersion -- Returns the version number of this library *
  40. * GetString -- Gets a string out of the resources *
  41. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  42. #include <stdio.h>
  43. #include <Max.h>
  44. #include "dllmain.h"
  45. #include "w3ddesc.h"
  46. #include "w3dexp.h"
  47. #include "w3dutil.h"
  48. #include "skin.h"
  49. #include "gamemtl.h"
  50. #include "gamemaps.h"
  51. #include "AlphaModifier.h"
  52. #include "gridsnapmodifier.h"
  53. #include "resource.h"
  54. #define DLLEXPORT __declspec(dllexport)
  55. /*****************************************************************************
  56. * Globals
  57. *****************************************************************************/
  58. HINSTANCE AppInstance = NULL;
  59. static int ControlsInit = FALSE;
  60. static W3dClassDesc W3d_Export_Class_Descriptor;
  61. /***********************************************************************************************
  62. * DllMain -- Entry point for the dll *
  63. * *
  64. * INPUT: *
  65. * *
  66. * OUTPUT: *
  67. * *
  68. * WARNINGS: *
  69. * *
  70. * HISTORY: *
  71. * 06/09/1997 GH : Created. *
  72. *=============================================================================================*/
  73. BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG /*fdwReason*/,LPVOID /*lpvReserved*/)
  74. {
  75. AppInstance = hinstDLL;
  76. if ( !ControlsInit )
  77. {
  78. ControlsInit = TRUE;
  79. InitCustomControls(AppInstance);
  80. InitCommonControls();
  81. INITCOMMONCONTROLSEX icc;
  82. icc.dwSize = sizeof( icc );
  83. icc.dwICC = ICC_WIN95_CLASSES | ICC_USEREX_CLASSES | ICC_COOL_CLASSES | ICC_LISTVIEW_CLASSES;
  84. InitCommonControlsEx( &icc );
  85. }
  86. return TRUE;
  87. }
  88. /***********************************************************************************************
  89. * LibDescription -- Returns description of this library *
  90. * *
  91. * INPUT: *
  92. * *
  93. * OUTPUT: *
  94. * *
  95. * WARNINGS: *
  96. * *
  97. * HISTORY: *
  98. * 06/09/1997 GH : Created. *
  99. *=============================================================================================*/
  100. DLLEXPORT const TCHAR * LibDescription()
  101. {
  102. return Get_String(IDS_LIB_DESCRIPTION);
  103. }
  104. /***********************************************************************************************
  105. * LibNumberClasses -- Returns number of classes in this library *
  106. * *
  107. * INPUT: *
  108. * *
  109. * OUTPUT: *
  110. * *
  111. * WARNINGS: *
  112. * *
  113. * HISTORY: *
  114. * 06/09/1997 GH : Created. *
  115. *=============================================================================================*/
  116. DLLEXPORT int LibNumberClasses()
  117. {
  118. #ifdef W3D_GMAXDEV
  119. return 7;
  120. #else
  121. return 9;
  122. #endif
  123. }
  124. /***********************************************************************************************
  125. * LibClassDesc -- Returns a ClassDesc for the specified class *
  126. * *
  127. * INPUT: *
  128. * *
  129. * OUTPUT: *
  130. * *
  131. * WARNINGS: *
  132. * *
  133. * HISTORY: *
  134. * 06/09/1997 GH : Created. *
  135. *=============================================================================================*/
  136. DLLEXPORT ClassDesc * LibClassDesc(int i)
  137. {
  138. switch(i)
  139. {
  140. case 0: return & W3d_Export_Class_Descriptor; break;
  141. case 1: return Get_W3D_Utility_Desc(); break;
  142. case 2: return Get_Skin_Obj_Desc(); break;
  143. case 3: return Get_Skin_Mod_Desc(); break;
  144. case 4: return Get_Game_Material_Desc(); break;
  145. case 5: return Get_Game_Maps_Desc(); break;
  146. case 6: return Get_Alpha_Desc(); break;
  147. #ifndef W3D_GMAXDEV
  148. case 7: return Get_PS2_Game_Material_Desc(); break;
  149. case 8: return Get_PS2_Material_Conversion(); break;
  150. #endif
  151. default: return NULL; break;
  152. }
  153. }
  154. /***********************************************************************************************
  155. * LibVersion -- Returns the version number of this library *
  156. * *
  157. * INPUT: *
  158. * *
  159. * OUTPUT: *
  160. * *
  161. * WARNINGS: *
  162. * *
  163. * HISTORY: *
  164. * 06/09/1997 GH : Created. *
  165. *=============================================================================================*/
  166. DLLEXPORT ULONG LibVersion()
  167. {
  168. return VERSION_3DSMAX;
  169. }
  170. /***********************************************************************************************
  171. * Get_String -- Gets a string out of the resources *
  172. * *
  173. * INPUT: *
  174. * *
  175. * OUTPUT: *
  176. * *
  177. * WARNINGS: *
  178. * *
  179. * HISTORY: *
  180. * 06/09/1997 GH : Created. *
  181. *=============================================================================================*/
  182. TCHAR * Get_String( int id )
  183. {
  184. static TCHAR buf[256];
  185. if (AppInstance)
  186. return LoadString(AppInstance, id, buf, sizeof(buf)) ? buf : NULL;
  187. return NULL;
  188. }