WinMain.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. ** Command & Conquer Generals(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. // FILE: WinMain.cpp //////////////////////////////////////////////////////////
  19. //-----------------------------------------------------------------------------
  20. //
  21. // Westwood Studios Pacific.
  22. //
  23. // Confidential Information
  24. // Copyright (C) 2001 - All Rights Reserved
  25. //
  26. //-----------------------------------------------------------------------------
  27. //
  28. // Project: ImagePacker
  29. //
  30. // File name: WinMain.cpp
  31. //
  32. // Created: Colin Day, August 2001
  33. //
  34. // Desc: Application entry point for the image packer tool
  35. //
  36. //-----------------------------------------------------------------------------
  37. ///////////////////////////////////////////////////////////////////////////////
  38. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  39. #include <windows.h>
  40. #include <stdlib.h>
  41. // USER INCLUDES //////////////////////////////////////////////////////////////
  42. #include "Lib/BaseType.h"
  43. #include "Common/GameMemory.h"
  44. #include "Common/Debug.h"
  45. #include "ImagePacker.h"
  46. #include "Resource.h"
  47. #include "WindowProc.h"
  48. // DEFINES ////////////////////////////////////////////////////////////////////
  49. // PRIVATE TYPES //////////////////////////////////////////////////////////////
  50. // PRIVATE DATA ///////////////////////////////////////////////////////////////
  51. ///////////////////////////////////////////////////////////////////////////////
  52. // PUBLIC DATA ////////////////////////////////////////////////////////////////
  53. ///////////////////////////////////////////////////////////////////////////////
  54. HINSTANCE ApplicationHInstance = NULL; ///< our application instance
  55. /// just to satisfy the game libraries we link to
  56. HWND ApplicationHWnd = NULL;
  57. const Char *g_strFile = "data\\Generals.str";
  58. const Char *g_csfFile = "data\\%s\\Generals.csf";
  59. // PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
  60. ///////////////////////////////////////////////////////////////////////////////
  61. // PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
  62. ///////////////////////////////////////////////////////////////////////////////
  63. ///////////////////////////////////////////////////////////////////////////////
  64. // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
  65. ///////////////////////////////////////////////////////////////////////////////
  66. // WinMain ====================================================================
  67. /** Application entry point */
  68. //=============================================================================
  69. Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
  70. LPSTR lpCmdLine, Int nCmdShow )
  71. {
  72. // start the log
  73. DEBUG_INIT(DEBUG_FLAGS_DEFAULT);
  74. initMemoryManager();
  75. // save application instance
  76. ApplicationHInstance = hInstance;
  77. // allocate a new image packer system
  78. TheImagePacker = new ImagePacker;
  79. if( TheImagePacker == NULL )
  80. return 0;
  81. // initialize the system
  82. if( TheImagePacker->init() == FALSE )
  83. {
  84. delete TheImagePacker;
  85. TheImagePacker = NULL;
  86. return 0;
  87. } // end if
  88. // load the dialog box
  89. DialogBox( hInstance, (LPCTSTR)IMAGE_PACKER_DIALOG,
  90. NULL, (DLGPROC)ImagePackerProc );
  91. // delete the image packer
  92. delete TheImagePacker;
  93. TheImagePacker = NULL;
  94. // close the log
  95. shutdownMemoryManager();
  96. DEBUG_SHUTDOWN();
  97. // all done
  98. return 0;
  99. } // end WinMain