GETCD.CPP 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. ** Command & Conquer Red Alert(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 A S S O C I A T E S **
  20. ***************************************************************************
  21. * *
  22. * Project Name : WWLIB *
  23. * *
  24. * File Name : GETCD.CPP *
  25. * *
  26. * Programmer : STEVE WETHERILL BASED ON JOE BOSTIC CODE *
  27. * *
  28. * Start Date : 5/13/94 *
  29. * *
  30. * Last Update : June 4, 1994 [SW] *
  31. * *
  32. *-------------------------------------------------------------------------*
  33. *-------------------------------------------------------------------------*
  34. * Functions: *
  35. * GetCDClass::GetCDClass -- default constructor *
  36. * GetCDClass::~GetCDClass -- destructor *
  37. * GetCDClass::GetCDDrive -- returns the logical CD drive *
  38. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  39. #include <stddef.h>
  40. #include <stdio.h>
  41. #include <stdlib.h>
  42. #include <string.h>
  43. #include <dos.h>
  44. #include "wwstd.h"
  45. #include "playcd.h"
  46. #include "wwmem.h"
  47. /***************************************************************************
  48. * GetCDClass -- default constructor *
  49. * *
  50. * *
  51. * *
  52. * INPUT: *
  53. * none *
  54. * OUTPUT: *
  55. * none *
  56. * WARNINGS: *
  57. * *
  58. * HISTORY: *
  59. * 05/26/1994 SW : Created. *
  60. * 12/4/95 ST : fixed for Win95 *
  61. *=========================================================================*/
  62. GetCDClass::GetCDClass(VOID)
  63. {
  64. char path[]={"a:\\"};
  65. CDCount = 0;
  66. CDIndex = 0;
  67. /*
  68. ** Set all CD drive placeholders to empty
  69. */
  70. memset (CDDrives, NO_CD_DRIVE, MAX_CD_DRIVES);
  71. for (char i='c' ; i<='z' ; i++){
  72. path[0]=i;
  73. if (GetDriveType (path) == DRIVE_CDROM){
  74. CDDrives[CDCount++] = (int) (i-'a');
  75. }
  76. }
  77. /*
  78. ** Catch the case when there are NO CD-ROM drives available
  79. */
  80. if (CDCount == 0) {
  81. for (char i='a' ; i<='b' ; i++){
  82. path[0]=i;
  83. if (GetDriveType (path) == DRIVE_CDROM){
  84. CDDrives[CDCount++] = (int) (i-'a');
  85. }
  86. }
  87. }
  88. }
  89. /***************************************************************************
  90. * GetCDClass -- destructor *
  91. * *
  92. * *
  93. * *
  94. * INPUT: *
  95. * none *
  96. * OUTPUT: *
  97. * none *
  98. * WARNINGS: *
  99. * *
  100. * HISTORY: *
  101. * 05/26/1994 SW: Created. *
  102. * 12/4/95 ST: fixed for Win95 *
  103. *=========================================================================*/
  104. GetCDClass::~GetCDClass(VOID)
  105. {
  106. // if(cdDrive_addrp.seg)
  107. // DPMI_real_free(cdDrive_addrp); // free up those conventional buffers
  108. }
  109. /* ==================================================================== */