VIDEO.H 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 S T U D I O S **
  20. ***************************************************************************
  21. * *
  22. * Project Name : 32 bit library *
  23. * *
  24. * File Name : VIDEO.H *
  25. * *
  26. * Programmer : Scott K. Bowen *
  27. * *
  28. * Start Date : August 3, 1994 *
  29. * *
  30. * Last Update : August 3, 1994 [SKB] *
  31. * *
  32. *-------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef VIDEO_H
  36. #define VIDEO_H
  37. #ifndef WWSTD_H
  38. #include "wwstd.h"
  39. #endif
  40. /*=========================================================================*/
  41. /* The machine can be in one of the following graphic modes. The global */
  42. /* GraphicMode is set to one of these values. */
  43. /*=========================================================================*/
  44. #define CGA_MODE 4 // DOS 320x200 4 color mode
  45. #define TGA_MODE 9 // TANDY 320x200 16 color mode
  46. #define EGA_MODE 13 // DOS 320x200 16 color mode
  47. #define MCGA_MODE 0x13 // DOS 320x200 256 color mode
  48. #define VGA_MODE 0x13 // DOS 320x200 256 color mode
  49. #define EEGA_MODE 14 // DOS 640x400 16 color mode
  50. #define ETGA_MODE 9 // TANDY 640x400 16 color mode
  51. #define HGA_MODE 7 // DOS 768x400 2 color mode
  52. #define TXT_MODE 3 // DOS plain old color text mode
  53. #define VESA_640X400_256 0x100 // VESA 640x400 256 color mode
  54. #define VESA_640X480_256 0x101 // VESA 640x480 256 color mode
  55. #define VESA_800X600_256 0x103 // VESA 800x600 256 color mode
  56. #define VESA_1024X768_256 0x105 // VESA 1024x768 256 color mode
  57. #define VESA_1280X400_256 0x107 // VESA 1280x400 256 color mode
  58. #define VESA_TEXT_80X60 0x108 // VESA 80x60 text mode
  59. #define VESA_TEXT_132X25 0x109 // VESA 132x25 text mode
  60. #define VESA_TEXT_132X60 0x10C // VESA 132x60 text mode
  61. #define RESET_MODE -1
  62. #define UNINITIALIZED_MODE -1
  63. #define VESA_MIN VESA_640X400_256
  64. #define VESA_MAX VESA_TEXT_132X60
  65. /*=========================================================================*/
  66. /* Define the maximum number of bank entries */
  67. /*=========================================================================*/
  68. #define MAX_BANK_ENTRIES ((1280L*1024L)/65536L)
  69. /*=========================================================================*
  70. * VesaInfoType - General info about this VESA implementation *
  71. * (Filled in by VESA BIOS Function 0) *
  72. * *
  73. * Signature - Will always be 'VESA' *
  74. * Version - Version # *
  75. * OEMString - OEM ID string *
  76. * Capabilities - Not defined by VESA yet *
  77. * AvailModes - List of available modes; terminated with -1 (0xffff) *
  78. * TotalMemory - ??? *
  79. * Reserved - Pads structure to 256 bytes total *
  80. *=========================================================================*/
  81. #ifdef NOT_FOR_WIN95
  82. typedef struct {
  83. char Signature[4];
  84. short Version;
  85. REALPTR OEMString;
  86. long Capabilities;
  87. REALPTR AvailModes;
  88. short TotalMemory;
  89. char Reserved[236];
  90. } VesaInfoType;
  91. #endif //NOT_FOR_WIN95
  92. /*=========================================================================*
  93. * VesaModeInfoType - Info about this VESA mode *
  94. * (Filled in by VESA BIOS Function 1) *
  95. * *
  96. * Attributes - bit 0: 1 = mode is supported *
  97. * bit 1: 1 = optional info available *
  98. * bit 2: 1 = std BIOS output funcs valid in this mode *
  99. * bit 3: 0 = monochrome, 1 = color *
  100. * bit 4: 0 = text mode, 1 = graphics *
  101. * WinA_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
  102. * WinB_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
  103. * WinGranularity - smallest address boundary window can be placed upon; *
  104. * size is in KB (ie 64, 32, 4) *
  105. * WinSize - size of windows in KB (ie 64, 32) *
  106. * WinA_Segment - location of Window A in CPU space (usually 0xa000) *
  107. * WinB_Segment - location of Window B in CPU space (usually 0xb000) *
  108. * WinFunc - address of window-setting function (This is provided *
  109. * as an alternative to Int 10 for speed.) *
  110. * BytesPerScanline - # bytes per scan line *
  111. * *
  112. * Optional info (available if bit 1 of Attributes is set): *
  113. * *
  114. * XRes - X-resolution *
  115. * YRes - Y-resolution *
  116. * XCharSize - Horizontal size of char cell *
  117. * YCharSize - Vertical size of char cell *
  118. * NumPlanes - # of memory planes (???) *
  119. * BitsPerPixel - # bites per pixel *
  120. * NumBanks - # of banks (ie planes) *
  121. * MemoryModel - 00h = Text mode *
  122. * 01h = CGA mode *
  123. * 02h = Hercules *
  124. * 03h = 4 plane planar mode *
  125. * 04h = packed pixel mode (1 byte/pixel) *
  126. * 05h = non-chain 4, 256-color mode *
  127. * 06-0Fh = *
  128. * 10-FFh = OEM-specific *
  129. * BankSize - Bank size in KB *
  130. *=========================================================================*/
  131. #ifdef NOT_FOR_WIN95
  132. typedef struct {
  133. short Attributes;
  134. char WinA_Attributes;
  135. char WinB_Attributes;
  136. short WinGranularity;
  137. short WinSize;
  138. short WinA_Segment;
  139. short WinB_Segment;
  140. REALPTR WinFunc;
  141. short BytesPerScanline;
  142. short XRes;
  143. short YRes;
  144. char XCharSize;
  145. char YCharSize;
  146. char NumPlanes;
  147. char BitsPerPixel;
  148. char NumBanks;
  149. char MemoryModel;
  150. char BankSize;
  151. char NumInputPages;
  152. char Reserved;
  153. char RedMaskSize;
  154. char RedFieldPosition;
  155. char GreenMaskSize;
  156. char GreenFieldPosition;
  157. char BlueMaskSize;
  158. char BlueFieldPosition;
  159. char RsvdMaskSize;
  160. char RsvdFieldPosition;
  161. char DirectColorModeInfo;
  162. char pad[216];
  163. } VesaModeInfoType;
  164. extern REALPTR VesaFunc;
  165. #endif //NOT_FOR_WIN95
  166. extern "C" {
  167. extern int GraphicMode;
  168. extern long XRes;
  169. extern long YRes;
  170. extern long BankTable [];
  171. extern unsigned long RMVesaVector ;
  172. extern unsigned long RMVesaRegs ;
  173. }
  174. /*=========================================================================*/
  175. /* The following prototypes are for the file: VIDEO.CPP */
  176. /*=========================================================================*/
  177. extern "C" int Set_Video_Mode(int mode);
  178. int Get_Video_Mode(void);
  179. void Update_Video_Mode (void) ;
  180. void Vesa_Info(void);
  181. void Vesa_Set_Window(long grain_num);
  182. int Get_Original_Video_Mode(void);
  183. void Set_Original_Video_Mode(int mode);
  184. /*=========================================================================*/
  185. /* The following prototypes are for the file: INITDLAY.CPP */
  186. /*=========================================================================*/
  187. extern VOID Init_Delay(VOID);
  188. extern BOOL VertBlank;
  189. /*=========================================================================*/
  190. /* The following prototypes are for the file: VERTBLNK.ASM */
  191. /*=========================================================================*/
  192. extern "C" {
  193. extern WORD Get_Vert_Blank(VOID);
  194. extern VOID Wait_Vert_Blank(BOOL blank);
  195. }
  196. /*=========================================================================*/
  197. #endif // VIDEO_H