dllmain.cpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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 8 7/24/01 5:11p Moumine_ballo $ */
  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 "MeshDeform.H"
  52. #include "AlphaModifier.h"
  53. #include "gridsnapmodifier.h"
  54. #include "resource.h"
  55. #define DLLEXPORT __declspec(dllexport)
  56. /*****************************************************************************
  57. * Globals
  58. *****************************************************************************/
  59. HINSTANCE AppInstance = NULL;
  60. static int ControlsInit = FALSE;
  61. static W3dClassDesc W3d_Export_Class_Descriptor;
  62. /***********************************************************************************************
  63. * DllMain -- Entry point for the dll *
  64. * *
  65. * INPUT: *
  66. * *
  67. * OUTPUT: *
  68. * *
  69. * WARNINGS: *
  70. * *
  71. * HISTORY: *
  72. * 06/09/1997 GH : Created. *
  73. *=============================================================================================*/
  74. BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG /*fdwReason*/,LPVOID /*lpvReserved*/)
  75. {
  76. AppInstance = hinstDLL;
  77. if ( !ControlsInit )
  78. {
  79. ControlsInit = TRUE;
  80. InitCustomControls(AppInstance);
  81. InitCommonControls();
  82. }
  83. return TRUE;
  84. }
  85. /***********************************************************************************************
  86. * LibDescription -- Returns description of this library *
  87. * *
  88. * INPUT: *
  89. * *
  90. * OUTPUT: *
  91. * *
  92. * WARNINGS: *
  93. * *
  94. * HISTORY: *
  95. * 06/09/1997 GH : Created. *
  96. *=============================================================================================*/
  97. DLLEXPORT const TCHAR * LibDescription()
  98. {
  99. return Get_String(IDS_LIB_DESCRIPTION);
  100. }
  101. /***********************************************************************************************
  102. * LibNumberClasses -- Returns number of classes in this library *
  103. * *
  104. * INPUT: *
  105. * *
  106. * OUTPUT: *
  107. * *
  108. * WARNINGS: *
  109. * *
  110. * HISTORY: *
  111. * 06/09/1997 GH : Created. *
  112. *=============================================================================================*/
  113. DLLEXPORT int LibNumberClasses()
  114. {
  115. return 9; //Moumine 7/24/2001 4:38:27 PM was 10. Removed Mesh_Deformation(#6)
  116. }
  117. /***********************************************************************************************
  118. * LibClassDesc -- Returns a ClassDesc for the specified class *
  119. * *
  120. * INPUT: *
  121. * *
  122. * OUTPUT: *
  123. * *
  124. * WARNINGS: *
  125. * *
  126. * HISTORY: *
  127. * 06/09/1997 GH : Created. *
  128. *=============================================================================================*/
  129. DLLEXPORT ClassDesc * LibClassDesc(int i)
  130. {
  131. switch(i)
  132. {
  133. case 0: return & W3d_Export_Class_Descriptor; break;
  134. case 1: return Get_W3D_Utility_Desc(); break;
  135. case 2: return Get_Skin_Obj_Desc(); break;
  136. case 3: return Get_Skin_Mod_Desc(); break;
  137. case 4: return Get_Game_Material_Desc(); break;
  138. case 5: return Get_Game_Maps_Desc(); break;
  139. case 6: return Get_PS2_Game_Material_Desc(); break;
  140. case 7: return Get_PS2_Material_Conversion(); break;
  141. case 8: return Get_Alpha_Desc(); break;
  142. //case 6: return Get_Mesh_Deform_Desc(); break;
  143. //Moumine 7/24/2001 4:33:52 PM Removed #6 and shifted up instead of returning NULL
  144. // NULL causes a crash in "File->Summary info->Plug-in ifo..."
  145. default: return NULL; break;
  146. }
  147. }
  148. /***********************************************************************************************
  149. * LibVersion -- Returns the version number of this library *
  150. * *
  151. * INPUT: *
  152. * *
  153. * OUTPUT: *
  154. * *
  155. * WARNINGS: *
  156. * *
  157. * HISTORY: *
  158. * 06/09/1997 GH : Created. *
  159. *=============================================================================================*/
  160. DLLEXPORT ULONG LibVersion()
  161. {
  162. return VERSION_3DSMAX;
  163. }
  164. /***********************************************************************************************
  165. * Get_String -- Gets a string out of the resources *
  166. * *
  167. * INPUT: *
  168. * *
  169. * OUTPUT: *
  170. * *
  171. * WARNINGS: *
  172. * *
  173. * HISTORY: *
  174. * 06/09/1997 GH : Created. *
  175. *=============================================================================================*/
  176. TCHAR * Get_String( int id )
  177. {
  178. static TCHAR buf[256];
  179. if (AppInstance)
  180. return LoadString(AppInstance, id, buf, sizeof(buf)) ? buf : NULL;
  181. return NULL;
  182. }