Added missing values to VGA Mode 19 (256 color) palette registers with comments for related VGA operations. Windows programs that access VGA directly or through BIOS that previously displayed black for many values should now show correct values for many more cases.

Jeremiah Flerchinger jeremiah.flerchinger at gmail.com
Fri Oct 17 16:28:26 CDT 2008


---
 dlls/winedos/vga.c |  317 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 289 insertions(+), 28 deletions(-)

diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c
index 96cadb9..8b61174 100644
--- a/dlls/winedos/vga.c
+++ b/dlls/winedos/vga.c
@@ -159,10 +159,12 @@ static void CALLBACK VGA_Poll( LPVOID arg, DWORD low, DWORD high );
 static HWND vga_hwnd = NULL;
 
 /*
- * For simplicity, I'm creating a second palette.
- * 16 color accesses will use these pointers and insert
- * entries from the 64-color palette into the default
- * palette.   --Robert 'Admiral' Coeyman
+ *  VGA Palette Registers, in actual 18 bit color
+ *  port 3C0H - 6 bit rgbRGB format
+ *
+ *  16 color accesses will use these pointers and insert
+ *  entries from the 64-color palette (mode 18) into the default
+ *  palette.   --Robert 'Admiral' Coeyman
  */
 
 static char vga_16_palette[17]={
@@ -173,7 +175,7 @@ static char vga_16_palette[17]={
   0x04,  /* 4 - Red           */
   0x05,  /* 5 - Magenta       */
   0x14,  /* 6 - Brown         */
-  0x07,  /* 7 - Light gray    */
+  0x07,  /* 7 - White (Light gray)        */
   0x38,  /* 8 - Dark gray     */
   0x39,  /* 9 - Light blue    */
   0x3a,  /* A - Light green   */
@@ -181,35 +183,286 @@ static char vga_16_palette[17]={
   0x3c,  /* C - Light red     */
   0x3d,  /* D - Light magenta */
   0x3e,  /* E - Yellow        */
-  0x3f,  /* F - White         */
+  0x3f,  /* F - Bright White (White) */
   0x00   /* Border Color      */
 };
 
+/*
+ *  Mode 19 Default Color Register Setting
+ *  DAC palette registers, converted from actual 18 bit color to 24.
+ */
 static PALETTEENTRY vga_def_palette[256]={
 /* red  green  blue */
-  {0x00, 0x00, 0x00}, /* 0 - Black */
-  {0x00, 0x00, 0x80}, /* 1 - Blue */
-  {0x00, 0x80, 0x00}, /* 2 - Green */
-  {0x00, 0x80, 0x80}, /* 3 - Cyan */
-  {0x80, 0x00, 0x00}, /* 4 - Red */
-  {0x80, 0x00, 0x80}, /* 5 - Magenta */
-  {0x80, 0x80, 0x00}, /* 6 - Brown */
-  {0xC0, 0xC0, 0xC0}, /* 7 - Light gray */
-  {0x80, 0x80, 0x80}, /* 8 - Dark gray */
-  {0x00, 0x00, 0xFF}, /* 9 - Light blue */
-  {0x00, 0xFF, 0x00}, /* A - Light green */
-  {0x00, 0xFF, 0xFF}, /* B - Light cyan */
-  {0xFF, 0x00, 0x00}, /* C - Light red */
-  {0xFF, 0x00, 0xFF}, /* D - Light magenta */
-  {0xFF, 0xFF, 0x00}, /* E - Yellow */
-  {0xFF, 0xFF, 0xFF}, /* F - White */
-  {0,0,0} /* FIXME: a series of continuous rainbow hues should follow */
+  /* 16 colors in IRGB values */
+  {0x00, 0x00, 0x00}, /* 0 (0) - Black */
+  {0x00, 0x00, 0xAA}, /* 1 (1) - Blue */
+  {0x00, 0xAA, 0x00}, /* 2 (2) - Green */
+  {0x00, 0xAA, 0xAA}, /* 3 (3) - Cyan */
+  {0xAA, 0x00, 0x00}, /* 4 (4) - Red */
+  {0xAA, 0x00, 0xAA}, /* 5 (5) - Magenta */
+  {0xAA, 0x55, 0x00}, /* 6 (6) - Brown */
+  {0xAA, 0xAA, 0xAA}, /* 7 (7) - White (Light gray) */
+  {0x55, 0x55, 0x55}, /* 8 (8) - Dark gray */
+  {0x55, 0x55, 0xFF}, /* 9 (9) - Light blue */
+  {0x55, 0xFF, 0x55}, /* 10 (A) - Light green */
+  {0x55, 0xFF, 0xFF}, /* 11 (B) - Light cyan */
+  {0xFF, 0x55, 0x55}, /* 12 (C) - Light red */
+  {0xFF, 0x55, 0xFF}, /* 13 (D) - Light magenta */
+  {0xFF, 0xFF, 0x55}, /* 14 (E) -  Yellow */
+  {0xFF, 0xFF, 0xFF}, /* 15 (F) - Bright White (White) */
+  /* 16 shades of gray */
+  {0x00, 0x00, 0x00}, /* 16 (10) */
+  {0x10, 0x10, 0x10}, /* 17 (11) */
+  {0x20, 0x20, 0x20}, /* 18 (12) */
+  {0x35, 0x35, 0x35}, /* 19 (13) */
+  {0x45, 0x45, 0x45}, /* 20 (14) */
+  {0x55, 0x55, 0x55}, /* 21 (15) */
+  {0x65, 0x65, 0x65}, /* 22 (16) */
+  {0x75, 0x75, 0x75}, /* 23 (17) */
+  {0x8A, 0x8A, 0x8A}, /* 24 (18) */
+  {0x9A, 0x9A, 0x9A}, /* 25 (19) */
+  {0xAA, 0xAA, 0xAA}, /* 26 (1A) */
+  {0xBA, 0xBA, 0xBA}, /* 27 (1B) */
+  {0xCA, 0xCA, 0xCA}, /* 28 (1C) */
+  {0xDF, 0xDF, 0xDF}, /* 29 (1D) */
+  {0xEF, 0xEF, 0xEF}, /* 30 (1E) */
+  {0xFF, 0xFF, 0xFF}, /* 31 (1F) */
+  /* High Intensity group - 72 colors in 1/3 saturation groups (20H-37H high) */
+  {0x00, 0x00, 0xFF}, /* 32 (20) */
+  {0x41, 0x00, 0xFF}, /* 33 (21) */
+  {0x82, 0x00, 0xFF}, /* 34 (22) */
+  {0xBE, 0x00, 0xFF}, /* 35 (23) */
+  {0xFF, 0x00, 0xFF}, /* 36 (24) */
+  {0xFF, 0x00, 0xBE}, /* 37 (25) */
+  {0xFF, 0x00, 0x82}, /* 38 (26) */
+  {0xFF, 0x00, 0x41}, /* 39 (27) */
+  {0xFF, 0x00, 0x00}, /* 40 (28) */
+  {0xFF, 0x41, 0x00}, /* 41 (29) */
+  {0xFF, 0x82, 0x00}, /* 42 (2A) */
+  {0xFF, 0xBE, 0x00}, /* 43 (2B) */
+  {0xFF, 0xFF, 0x00}, /* 44 (2C) */
+  {0xBE, 0xFF, 0x00}, /* 45 (2D) */
+  {0x82, 0xFF, 0x00}, /* 46 (2E) */
+  {0x41, 0xFF, 0x00}, /* 47 (2F) */
+  {0x00, 0xFF, 0x00}, /* 48 (30) */
+  {0x00, 0xFF, 0x41}, /* 49 (31) */
+  {0x00, 0xFF, 0x82}, /* 50 (32) */
+  {0x00, 0xFF, 0xBE}, /* 51 (33) */
+  {0x00, 0xFF, 0xFF}, /* 52 (34) */
+  {0x00, 0xBE, 0xFF}, /* 53 (35) */
+  {0x00, 0x82, 0xFF}, /* 54 (36) */
+  {0x00, 0x41, 0xFF}, /* 55 (37) */
+  /* High Intensity group - 72 colors in 2/3 saturation groups (38H-4FH moderate) */
+  {0x82, 0x82, 0xFF}, /* 56 (38) */
+  {0x9E, 0x82, 0xFF}, /* 57 (39) */
+  {0xBE, 0x82, 0xFF}, /* 58 (3A) */
+  {0xDF, 0x82, 0xFF}, /* 59 (3B) */
+  {0xFF, 0x82, 0xFF}, /* 60 (3C) */
+  {0xFF, 0x82, 0xDF}, /* 61 (3D) */
+  {0xFF, 0x82, 0xBE}, /* 62 (3E) */
+  {0xFF, 0x82, 0x9E}, /* 63 (3F) */
+  {0xFF, 0x82, 0x82}, /* 64 (40) */
+  {0xFF, 0x9E, 0x82}, /* 65 (41) */
+  {0xFF, 0xBE, 0x82}, /* 66 (42) */
+  {0xFF, 0xDF, 0x82}, /* 67 (43) */
+  {0xFF, 0xFF, 0x82}, /* 68 (44) */
+  {0xDF, 0xFF, 0x82}, /* 69 (45) */
+  {0xBE, 0xFF, 0x82}, /* 70 (46) */
+  {0x9E, 0xFF, 0x82}, /* 71 (47) */
+  {0x82, 0xFF, 0x82}, /* 72 (48) */
+  {0x82, 0xFF, 0x9E}, /* 73 (49) */
+  {0x82, 0xFF, 0xBE}, /* 74 (4A) */
+  {0x82, 0xFF, 0xDF}, /* 75 (4B) */
+  {0x82, 0xFF, 0xFF}, /* 76 (4C) */
+  {0x82, 0xDF, 0xFF}, /* 77 (4D) */
+  {0x82, 0xBE, 0xFF}, /* 78 (4E) */
+  {0x82, 0x9E, 0xFF}, /* 79 (4F) */
+  /* High Intensity group - 72 colors in 3/3 saturation groups (50H-67H low) */
+  {0xBA, 0xBA, 0xFF}, /* 80 (50) */
+  {0xCA, 0xBA, 0xFF}, /* 81 (51) */
+  {0xDF, 0xBA, 0xFF}, /* 82 (52) */
+  {0xEF, 0xBA, 0xFF}, /* 83 (53) */
+  {0xFF, 0xBA, 0xFF}, /* 84 (54) */
+  {0xFF, 0xBA, 0xEF}, /* 85 (55) */
+  {0xFF, 0xBA, 0xDF}, /* 86 (56) */
+  {0xFF, 0xBA, 0xCA}, /* 87 (57) */
+  {0xFF, 0xBA, 0xBA}, /* 88 (58) */
+  {0xFF, 0xCA, 0xBA}, /* 89 (59) */
+  {0xFF, 0xDF, 0xBA}, /* 90 (5A) */
+  {0xFF, 0xEF, 0xBA}, /* 91 (5B) */
+  {0xFF, 0xFF, 0xBA}, /* 92 (5C) */
+  {0xEF, 0xFF, 0xBA}, /* 93 (5D) */
+  {0xDF, 0xFF, 0xBA}, /* 94 (5E) */
+  {0xCA, 0xFF, 0xBA}, /* 95 (5F) */
+  {0xBA, 0xFF, 0xBA}, /* 96 (60) */
+  {0xBA, 0xFF, 0xCA}, /* 97 (61) */
+  {0xBA, 0xFF, 0xDF}, /* 98 (62) */
+  {0xBA, 0xFF, 0xEF}, /* 99 (63) */
+  {0xBA, 0xFF, 0xFF}, /* 100 (64) */
+  {0xBA, 0xEF, 0xFF}, /* 101 (65) */
+  {0xBA, 0xDF, 0xFF}, /* 102 (66) */
+  {0xBA, 0xCA, 0xFF}, /* 103 (67) */
+  /* Medium Intensity group - 72 colors in 1/3 saturation groups (68H-7FH high) */
+  {0x00, 0x00, 0x71}, /* 104 (68) */
+  {0x1C, 0x00, 0x71}, /* 105 (69) */
+  {0x39, 0x00, 0x71}, /* 106 (6A) */
+  {0x55, 0x00, 0x71}, /* 107 (6B) */
+  {0x71, 0x00, 0x71}, /* 108 (6C) */
+  {0x71, 0x00, 0x55}, /* 109 (6D) */
+  {0x71, 0x00, 0x39}, /* 110 (6E) */
+  {0x71, 0x00, 0x1C}, /* 111 (6F) */
+  {0x71, 0x00, 0x00}, /* 112 (70) */
+  {0x71, 0x1C, 0x00}, /* 113 (71) */
+  {0x71, 0x39, 0x00}, /* 114 (72) */
+  {0x71, 0x55, 0x00}, /* 115 (73) */
+  {0x71, 0x71, 0x00}, /* 116 (74) */
+  {0x55, 0x71, 0x00}, /* 117 (75) */
+  {0x39, 0x71, 0x00}, /* 118 (76) */
+  {0x1C, 0x71, 0x00}, /* 119 (77) */
+  {0x00, 0x71, 0x00}, /* 120 (78) */
+  {0x00, 0x71, 0x1C}, /* 121 (79) */
+  {0x00, 0x71, 0x39}, /* 122 (7A) */
+  {0x00, 0x71, 0x55}, /* 123 (7B) */
+  {0x00, 0x71, 0x71}, /* 124 (7C) */
+  {0x00, 0x55, 0x71}, /* 125 (7D) */
+  {0x00, 0x39, 0x71}, /* 126 (7E) */
+  {0x00, 0x1C, 0x71}, /* 127 (7F) */
+  /* Medium Intensity group - 72 colors in 2/3 saturation groups (80H-97H moderate) */
+  {0x39, 0x39, 0x71}, /* 128 (80) */
+  {0x45, 0x39, 0x71}, /* 129 (81) */
+  {0x55, 0x39, 0x71}, /* 130 (82) */
+  {0x61, 0x39, 0x71}, /* 131 (83) */
+  {0x71, 0x39, 0x71}, /* 132 (84) */
+  {0x71, 0x39, 0x61}, /* 133 (85) */
+  {0x71, 0x39, 0x55}, /* 134 (86) */
+  {0x71, 0x39, 0x45}, /* 135 (87) */
+  {0x71, 0x39, 0x39}, /* 136 (88) */
+  {0x71, 0x45, 0x39}, /* 137 (89) */
+  {0x71, 0x55, 0x39}, /* 138 (8A) */
+  {0x71, 0x61, 0x39}, /* 139 (8B) */
+  {0x71, 0x71, 0x39}, /* 140 (8C) */
+  {0x61, 0x71, 0x39}, /* 141 (8D) */
+  {0x55, 0x71, 0x39}, /* 142 (8E) */
+  {0x45, 0x71, 0x39}, /* 143 (8F) */
+  {0x39, 0x71, 0x39}, /* 144 (90) */
+  {0x39, 0x71, 0x45}, /* 145 (91) */
+  {0x39, 0x71, 0x55}, /* 146 (92) */
+  {0x39, 0x71, 0x61}, /* 147 (93) */
+  {0x39, 0x71, 0x71}, /* 148 (94) */
+  {0x39, 0x61, 0x71}, /* 149 (95) */
+  {0x39, 0x55, 0x71}, /* 150 (96) */
+  {0x39, 0x45, 0x71}, /* 151 (97) */
+  /* Medium Intensity group - 72 colors in 3/3 saturation groups (98H-AFH low) */
+  {0x51, 0x51, 0x71}, /* 152 (98) */
+  {0x59, 0x51, 0x71}, /* 153 (99) */
+  {0x61, 0x51, 0x71}, /* 154 (9A) */
+  {0x69, 0x51, 0x71}, /* 155 (9B) */
+  {0x71, 0x51, 0x71}, /* 156 (9C) */
+  {0x71, 0x51, 0x69}, /* 157 (9D) */
+  {0x71, 0x51, 0x61}, /* 158 (9E) */
+  {0x71, 0x51, 0x59}, /* 159 (9F) */
+  {0x71, 0x51, 0x51}, /* 160 (A0) */
+  {0x71, 0x59, 0x51}, /* 161 (A1) */
+  {0x71, 0x61, 0x51}, /* 162 (A2) */
+  {0x71, 0x69, 0x51}, /* 163 (A3) */
+  {0x71, 0x71, 0x51}, /* 164 (A4) */
+  {0x69, 0x71, 0x51}, /* 165 (A5) */
+  {0x61, 0x71, 0x51}, /* 166 (A6) */
+  {0x59, 0x71, 0x51}, /* 167 (A7) */
+  {0x51, 0x71, 0x51}, /* 168 (A8) */
+  {0x51, 0x71, 0x59}, /* 169 (A9) */
+  {0x51, 0x71, 0x61}, /* 170 (AA) */
+  {0x51, 0x71, 0x69}, /* 171 (AB) */
+  {0x51, 0x71, 0x71}, /* 172 (AC) */
+  {0x51, 0x69, 0x71}, /* 173 (AD) */
+  {0x51, 0x61, 0x71}, /* 174 (AE) */
+  {0x51, 0x59, 0x71}, /* 175 (AF) */
+  /* Low Intensity group - 72 colors in 1/3 saturation groups (B0H-C7H high) */
+  {0x00, 0x00, 0x41}, /* 176 (B0) */
+  {0x10, 0x00, 0x41}, /* 177 (B1) */
+  {0x20, 0x00, 0x41}, /* 178 (B2) */
+  {0x31, 0x00, 0x41}, /* 179 (B3) */
+  {0x41, 0x00, 0x41}, /* 180 (B4) */
+  {0x41, 0x00, 0x31}, /* 181 (B5) */
+  {0x41, 0x00, 0x20}, /* 182 (B6) */
+  {0x41, 0x00, 0x10}, /* 183 (B7) */
+  {0x41, 0x00, 0x00}, /* 184 (B8) */
+  {0x41, 0x10, 0x00}, /* 185 (B9) */
+  {0x41, 0x20, 0x00}, /* 186 (BA) */
+  {0x41, 0x31, 0x00}, /* 187 (BB) */
+  {0x41, 0x41, 0x00}, /* 188 (BC) */
+  {0x31, 0x41, 0x00}, /* 189 (BD) */
+  {0x20, 0x41, 0x00}, /* 190 (BE) */
+  {0x10, 0x41, 0x00}, /* 191 (BF) */
+  {0x00, 0x41, 0x00}, /* 192 (C0) */
+  {0x00, 0x41, 0x10}, /* 193 (C1) */
+  {0x00, 0x41, 0x20}, /* 194 (C2) */
+  {0x00, 0x41, 0x31}, /* 195 (C3) */
+  {0x00, 0x41, 0x41}, /* 196 (C4) */
+  {0x00, 0x31, 0x41}, /* 197 (C5) */
+  {0x00, 0x20, 0x41}, /* 198 (C6) */
+  {0x00, 0x10, 0x41}, /* 199 (C7) */
+  /* Low Intensity group - 72 colors in 2/3 saturation groups (C8H-DFH moderate) */
+  {0x20, 0x20, 0x41}, /* 200 (C8) */
+  {0x28, 0x20, 0x41}, /* 201 (C9) */
+  {0x31, 0x20, 0x41}, /* 202 (CA) */
+  {0x39, 0x20, 0x41}, /* 203 (CB) */
+  {0x41, 0x20, 0x41}, /* 204 (CC) */
+  {0x41, 0x20, 0x39}, /* 205 (CD) */
+  {0x41, 0x20, 0x31}, /* 206 (CE) */
+  {0x41, 0x20, 0x28}, /* 207 (CF) */
+  {0x41, 0x20, 0x20}, /* 208 (D0) */
+  {0x41, 0x28, 0x20}, /* 209 (D1) */
+  {0x41, 0x31, 0x20}, /* 210 (D2) */
+  {0x41, 0x39, 0x20}, /* 211 (D3) */
+  {0x41, 0x41, 0x20}, /* 212 (D4) */
+  {0x39, 0x41, 0x20}, /* 213 (D5) */
+  {0x31, 0x41, 0x20}, /* 214 (D6) */
+  {0x28, 0x41, 0x20}, /* 215 (D7) */
+  {0x20, 0x41, 0x20}, /* 216 (D8) */
+  {0x20, 0x41, 0x28}, /* 217 (D9) */
+  {0x20, 0x41, 0x31}, /* 218 (DA) */
+  {0x20, 0x41, 0x39}, /* 219 (DB) */
+  {0x20, 0x41, 0x41}, /* 220 (DC) */
+  {0x20, 0x39, 0x41}, /* 221 (DD) */
+  {0x20, 0x31, 0x41}, /* 222 (DE) */
+  {0x20, 0x28, 0x41}, /* 223 (DF) */
+  /* Low Intensity group - 72 colors in 3/3 saturation groups (E0H-F7H low) */
+  {0x2D, 0x2D, 0x41}, /* 223 (E0) */
+  {0x31, 0x2D, 0x41}, /* 224 (E1) */
+  {0x35, 0x2D, 0x41}, /* 225 (E2) */
+  {0x3D, 0x2D, 0x41}, /* 226 (E3) */
+  {0x41, 0x2D, 0x41}, /* 227 (E4) */
+  {0x41, 0x2D, 0x3D}, /* 228 (E5) */
+  {0x41, 0x2D, 0x35}, /* 229 (E6) */
+  {0x41, 0x2D, 0x31}, /* 230 (E7) */
+  {0x41, 0x2D, 0x2D}, /* 231 (E8) */
+  {0x41, 0x31, 0x2D}, /* 232 (E9) */
+  {0x41, 0x35, 0x2D}, /* 233 (EA) */
+  {0x41, 0x3D, 0x2D}, /* 234 (EB) */
+  {0x41, 0x41, 0x2D}, /* 235 (EC) */
+  {0x3D, 0x41, 0x2D}, /* 236 (ED) */
+  {0x35, 0x41, 0x2D}, /* 237 (EE) */
+  {0x31, 0x41, 0x2D}, /* 238 (EF) */
+  {0x2D, 0x41, 0x2D}, /* 239 (F0) */
+  {0x2D, 0x41, 0x31}, /* 240 (F1) */
+  {0x2D, 0x41, 0x35}, /* 241 (F2) */
+  {0x2D, 0x41, 0x3D}, /* 242 (F3) */
+  {0x2D, 0x41, 0x41}, /* 243 (F4) */
+  {0x2D, 0x3D, 0x41}, /* 244 (F5) */
+  {0x2D, 0x35, 0x41}, /* 245 (F6) */
+  {0x2D, 0x31, 0x41}, /* 246 (F7) */
+  /* Fill up remainder of palettes with black */
+  {0,0,0}
 };
 
 /*
- *   This palette is the dos default, converted from 18 bit color to 24.
- *      It contains only 64 entries of colors--all others are zeros.
- *          --Robert 'Admiral' Coeyman
+ *  Mode 18 Default Color Register Setting
+ *  DAC palette registers, converted from actual 18 bit color to 24.
+ *
+ *  This palette is the dos default, converted from 18 bit color to 24.
+ *  It contains only 64 entries of colors--all others are zeros.
+ *      --Robert 'Admiral' Coeyman
  */
 static PALETTEENTRY vga_def64_palette[256]={
 /* red  green  blue */
@@ -220,7 +473,7 @@ static PALETTEENTRY vga_def64_palette[256]={
   {0xaa, 0x00, 0x00}, /* 0x04      Red        */
   {0xaa, 0x00, 0xaa}, /* 0x05      Magenta    */
   {0xaa, 0xaa, 0x00}, /* 0x06      */
-  {0xaa, 0xaa, 0xaa}, /* 0x07      Light Gray */
+  {0xaa, 0xaa, 0xaa}, /* 0x07      White (Light Gray) */
   {0x00, 0x00, 0x55}, /* 0x08      */
   {0x00, 0x00, 0xff}, /* 0x09      */
   {0x00, 0xaa, 0x55}, /* 0x0a      */
@@ -390,7 +643,6 @@ static void VGA_SyncWindow( BOOL target_is_fb )
         memmove( VGA_WINDOW_START, vga_fb_data + vga_fb_window, size );
 }
 
-
 static void WINAPI VGA_DoExit(ULONG_PTR arg)
 {
     VGA_DeinstallTimer();
@@ -409,8 +661,10 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
     ModeSet *par = (ModeSet *)arg;
     par->ret=1;
 
+    /* check for previously set display */
     if (lpddraw) VGA_DoExit(0);
     if (!lpddraw) {
+        /* check/get pointer to DirectDrawCreate function */
         if (!pDirectDrawCreate)
         {
             HMODULE hmod = LoadLibraryA( "ddraw.dll" );
@@ -420,12 +674,15 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
 		return;
 	    }
         }
+        /* Creates legacy DirectDraw Interfaces (pre-7). dlls/ddraw/main.c - jjf */
         res = pDirectDrawCreate(NULL,&lpddraw,NULL);
         if (!lpddraw) {
             ERR("DirectDraw is not available (res = 0x%x)\n",res);
             return;
         }
+        /* check/get/create a window handle */
         if (!vga_hwnd) {
+	    /* create a ddraw window handle */
             vga_hwnd = CreateWindowExA(0,"STATIC","WINEDOS VGA",
                                        WS_POPUP|WS_VISIBLE|SS_NOTIFY,0,0,
                                        par->Xres,par->Yres,0,0,0,NULL);
@@ -444,6 +701,7 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
 	    ERR("Could not set cooperative level to exclusive (0x%x)\n",res);
 	}
 
+	/* request a display mode */
         res=IDirectDraw_SetDisplayMode(lpddraw,par->Xres,par->Yres,par->Depth);
         if (res != S_OK) {
             ERR("DirectDraw does not support requested display mode (%dx%dx%d), res = 0x%x!\n",par->Xres,par->Yres,par->Depth,res);
@@ -452,6 +710,7 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
             return;
         }
 
+	/* Create palette */
         res=IDirectDraw_CreatePalette(lpddraw,DDPCAPS_8BIT,NULL,&lpddpal,NULL);
         if (res != S_OK) {
 	    ERR("Could not create palette (res = 0x%x)\n",res);
@@ -464,6 +723,8 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
             ERR("Could not set default palette entries (res = 0x%x)\n", res);
         }
 
+        /* handle any other display setup */
+        /* configure & setup ddraw surface */
         memset(&sdesc,0,sizeof(sdesc));
         sdesc.dwSize=sizeof(sdesc);
 	sdesc.dwFlags = DDSD_CAPS;
-- 
1.5.4.3




More information about the wine-patches mailing list