rddesc.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WW3D *
  23. * *
  24. * $Archive:: /Commando/Code/ww3d2/rddesc.h $*
  25. * *
  26. * $Author:: Jani_p $*
  27. * *
  28. * $Modtime:: 12/04/01 5:20p $*
  29. * *
  30. * $Revision:: 6 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef RDDESC_H
  39. #define RDDESC_H
  40. #include "vector.h"
  41. #include "wwstring.h"
  42. #include <d3d8types.h>
  43. #include <d3d8caps.h>
  44. class ResolutionDescClass
  45. {
  46. public:
  47. ResolutionDescClass(void) : Width(0), Height(0), BitDepth(0) { }
  48. ResolutionDescClass(int w,int h,int bits) : Width(w), Height(h), BitDepth(bits) { }
  49. bool operator == (const ResolutionDescClass & src) { return ((Width==src.Width) && (Height==src.Height) && (BitDepth==src.BitDepth)); }
  50. bool operator != (const ResolutionDescClass & src) { return ((Width!=src.Width) || (Height!=src.Height) || (BitDepth!=src.BitDepth)); }
  51. int Width;
  52. int Height;
  53. int BitDepth;
  54. int RefreshRate;
  55. };
  56. class RenderDeviceDescClass
  57. {
  58. public:
  59. RenderDeviceDescClass(void) : DeviceName(NULL), DeviceVendor(NULL), DevicePlatform(NULL),
  60. DriverName(NULL), DriverVendor(NULL), DriverVersion(NULL),
  61. HardwareName(NULL), HardwareVendor(NULL), HardwareChipset(NULL)
  62. {
  63. }
  64. ~RenderDeviceDescClass(void)
  65. {
  66. }
  67. RenderDeviceDescClass & operator = (const RenderDeviceDescClass & src)
  68. {
  69. set_device_name(src.Get_Device_Name());
  70. set_device_vendor(src.Get_Device_Vendor());
  71. set_device_platform(src.Get_Device_Platform());
  72. set_driver_name(src.Get_Driver_Name());
  73. set_driver_vendor(src.Get_Driver_Vendor());
  74. set_driver_version(src.Get_Driver_Version());
  75. set_hardware_name(src.Get_Hardware_Name());
  76. set_hardware_vendor(src.Get_Hardware_Vendor());
  77. set_hardware_chipset(src.Get_Hardware_Chipset());
  78. Caps=src.Caps;
  79. AdapterIdentifier=src.AdapterIdentifier;
  80. ResArray = src.ResArray;
  81. return *this;
  82. }
  83. bool operator == (const RenderDeviceDescClass & /*src*/) { return false; }
  84. bool operator != (const RenderDeviceDescClass & /*src*/) { return true; }
  85. const char * Get_Device_Name() const { return DeviceName; }
  86. const char * Get_Device_Vendor() const { return DeviceVendor; }
  87. const char * Get_Device_Platform() const { return DevicePlatform; }
  88. const char * Get_Driver_Name() const { return DriverName; }
  89. const char * Get_Driver_Vendor() const { return DriverVendor; }
  90. const char * Get_Driver_Version() const { return DriverVersion; }
  91. const char * Get_Hardware_Name() const { return HardwareName; }
  92. const char * Get_Hardware_Vendor() const { return HardwareVendor; }
  93. const char * Get_Hardware_Chipset() const { return HardwareChipset; }
  94. const DynamicVectorClass<ResolutionDescClass> & Enumerate_Resolutions(void) const { return ResArray; }
  95. const D3DCAPS8& Get_Caps() const { return Caps; }
  96. const D3DADAPTER_IDENTIFIER8& Get_Adapter_Identifier() const { return AdapterIdentifier; }
  97. private:
  98. void set_device_name(const char * name) { DeviceName=name; }
  99. void set_device_vendor(const char * name) { DeviceVendor=name; }
  100. void set_device_platform(const char * name) { DevicePlatform=name; }
  101. void set_driver_name(const char * name) { DriverName=name; }
  102. void set_driver_vendor(const char * name) { DriverVendor=name; }
  103. void set_driver_version(const char * name) { DriverVersion=name; }
  104. void set_hardware_name(const char * name) { HardwareName=name; }
  105. void set_hardware_vendor(const char * name) { HardwareVendor=name; }
  106. void set_hardware_chipset(const char * name) { HardwareChipset=name; }
  107. void reset_resolution_list(void) { ResArray.Delete_All(); }
  108. void add_resolution(int w,int h,int bits);
  109. StringClass DeviceName;
  110. StringClass DeviceVendor;
  111. StringClass DevicePlatform;
  112. StringClass DriverName;
  113. StringClass DriverVendor;
  114. StringClass DriverVersion;
  115. StringClass HardwareName;
  116. StringClass HardwareVendor;
  117. StringClass HardwareChipset;
  118. D3DCAPS8 Caps;
  119. D3DADAPTER_IDENTIFIER8 AdapterIdentifier;
  120. DynamicVectorClass<ResolutionDescClass> ResArray;
  121. friend class WW3D;
  122. friend class DX8Wrapper;
  123. };
  124. inline void RenderDeviceDescClass::add_resolution(int w,int h,int bits)
  125. {
  126. bool found = false;
  127. for (int i=0; i<ResArray.Count(); i++) {
  128. if ( (ResArray[i].Width == w) &&
  129. (ResArray[i].Height == h) &&
  130. (ResArray[i].BitDepth == bits))
  131. {
  132. found = true;
  133. }
  134. }
  135. if (!found) {
  136. ResArray.Add(ResolutionDescClass(w,h,bits));
  137. }
  138. }
  139. #endif