23 |
|
* SEE ALSO |
24 |
|
* Inside Macintosh: Devices, chapter 1 "Device Manager" |
25 |
|
* Designing Cards and Drivers for the Macintosh Family, Second Edition |
26 |
+ |
* Designing PCI Cards and Drivers for Power Macintosh Computers |
27 |
+ |
* Display Device Driver Guide |
28 |
|
*/ |
29 |
|
|
30 |
|
#include <stdio.h> |
42 |
|
|
43 |
|
|
44 |
|
// List of supported video modes |
45 |
< |
std::vector<video_mode> VideoModes; |
45 |
> |
vector<video_mode> VideoModes; |
46 |
|
|
47 |
|
// Description of the main monitor |
48 |
|
monitor_desc VideoMonitor; |
49 |
|
|
50 |
+ |
// Depth code -> Apple mode mapping |
51 |
+ |
uint16 apple_mode_for_depth[6]; |
52 |
+ |
|
53 |
|
// Local variables (per monitor) |
54 |
|
struct { |
55 |
|
monitor_desc *desc; // Pointer to description of monitor handled by this instance of the driver |
56 |
|
uint8 palette[256 * 3]; // Color palette, 256 entries, RGB |
57 |
|
bool luminance_mapping; // Luminance mapping on/off |
58 |
|
bool interrupts_enabled; // VBL interrupts on/off |
59 |
+ |
bool dm_present; // We received a GetVideoParameters call, so the Display Manager seems to be present |
60 |
|
uint32 gamma_table; // Mac address of gamma table |
61 |
|
int alloc_gamma_table_size; // Allocated size of gamma table |
62 |
|
uint16 current_mode; // Currently selected depth/resolution |
68 |
|
|
69 |
|
|
70 |
|
/* |
71 |
+ |
* Initialize apple_mode_for_depth[] array from VideoModes list |
72 |
+ |
*/ |
73 |
+ |
|
74 |
+ |
void video_init_depth_list(void) |
75 |
+ |
{ |
76 |
+ |
uint16 mode = 0x80; |
77 |
+ |
for (int depth = VDEPTH_1BIT; depth <= VDEPTH_32BIT; depth++) { |
78 |
+ |
if (video_has_depth(video_depth(depth))) |
79 |
+ |
apple_mode_for_depth[depth] = mode++; |
80 |
+ |
else |
81 |
+ |
apple_mode_for_depth[depth] = 0; |
82 |
+ |
} |
83 |
+ |
} |
84 |
+ |
|
85 |
+ |
|
86 |
+ |
/* |
87 |
+ |
* Check whether a mode with the specified depth exists |
88 |
+ |
*/ |
89 |
+ |
|
90 |
+ |
bool video_has_depth(video_depth depth) |
91 |
+ |
{ |
92 |
+ |
vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end(); |
93 |
+ |
while (i != end) { |
94 |
+ |
if (i->depth == depth) |
95 |
+ |
return true; |
96 |
+ |
++i; |
97 |
+ |
} |
98 |
+ |
return false; |
99 |
+ |
} |
100 |
+ |
|
101 |
+ |
|
102 |
+ |
/* |
103 |
|
* Check whether specified resolution ID is one of the supported resolutions |
104 |
|
*/ |
105 |
|
|
106 |
|
static bool has_resolution(uint32 id) |
107 |
|
{ |
108 |
< |
std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end(); |
109 |
< |
while (i != end) { |
108 |
> |
vector<video_mode>::const_iterator i, end = VideoModes.end(); |
109 |
> |
for (i = VideoModes.begin(); i != end; ++i) { |
110 |
|
if (i->resolution_id == id) |
111 |
|
return true; |
74 |
– |
++i; |
112 |
|
} |
113 |
|
return false; |
114 |
|
} |
118 |
|
* Find specified mode (depth/resolution) (or VideoModes.end() if not found) |
119 |
|
*/ |
120 |
|
|
121 |
< |
static std::vector<video_mode>::const_iterator find_mode(uint16 mode, uint32 id) |
121 |
> |
static vector<video_mode>::const_iterator find_mode(uint16 mode, uint32 id) |
122 |
|
{ |
123 |
< |
std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end(); |
124 |
< |
while (i != end) { |
123 |
> |
vector<video_mode>::const_iterator i, end = VideoModes.end(); |
124 |
> |
for (i = VideoModes.begin(); i != end; ++i) { |
125 |
|
if (i->resolution_id == id && DepthToAppleMode(i->depth) == mode) |
126 |
|
return i; |
90 |
– |
++i; |
127 |
|
} |
128 |
|
return i; |
129 |
|
} |
136 |
|
static video_depth max_depth_of_resolution(uint32 id) |
137 |
|
{ |
138 |
|
video_depth m = VDEPTH_1BIT; |
139 |
< |
std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end(); |
140 |
< |
while (i != end) { |
139 |
> |
vector<video_mode>::const_iterator i, end = VideoModes.end(); |
140 |
> |
for (i = VideoModes.begin(); i != end; ++i) { |
141 |
|
if (i->depth > m) |
142 |
|
m = i->depth; |
107 |
– |
++i; |
143 |
|
} |
144 |
|
return m; |
145 |
|
} |
151 |
|
|
152 |
|
static void get_size_of_resolution(uint32 id, uint32 &x, uint32 &y) |
153 |
|
{ |
154 |
< |
std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end(); |
155 |
< |
while (i != end) { |
154 |
> |
vector<video_mode>::const_iterator i, end = VideoModes.end(); |
155 |
> |
for (i = VideoModes.begin(); i != end; ++i) { |
156 |
|
if (i->resolution_id == id) { |
157 |
|
x = i->x; |
158 |
|
y = i->y; |
159 |
|
return; |
160 |
|
} |
161 |
< |
++i; |
161 |
> |
} |
162 |
> |
x = y = 0; |
163 |
> |
} |
164 |
> |
|
165 |
> |
|
166 |
> |
/* |
167 |
> |
* Get bytes-per-row value for specified resolution/depth |
168 |
> |
*/ |
169 |
> |
|
170 |
> |
uint32 video_bytes_per_row(video_depth depth, uint32 id) |
171 |
> |
{ |
172 |
> |
vector<video_mode>::const_iterator i, end = VideoModes.end(); |
173 |
> |
for (i = VideoModes.begin(); i != end; ++i) { |
174 |
> |
if (i->depth == depth && i->resolution_id == id) |
175 |
> |
return i->bytes_per_row; |
176 |
> |
} |
177 |
> |
uint32 x, y; |
178 |
> |
get_size_of_resolution(id, x, y); |
179 |
> |
return TrivialBytesPerRow(x, depth); |
180 |
> |
} |
181 |
> |
|
182 |
> |
|
183 |
> |
/* |
184 |
> |
* Find palette size for given color depth |
185 |
> |
*/ |
186 |
> |
|
187 |
> |
static int palette_size(video_depth depth) |
188 |
> |
{ |
189 |
> |
switch (depth) { |
190 |
> |
case VDEPTH_1BIT: return 2; |
191 |
> |
case VDEPTH_2BIT: return 4; |
192 |
> |
case VDEPTH_4BIT: return 16; |
193 |
> |
case VDEPTH_8BIT: return 256; |
194 |
> |
case VDEPTH_16BIT: return 32; |
195 |
> |
case VDEPTH_32BIT: return 256; |
196 |
> |
default: return 0; |
197 |
|
} |
198 |
|
} |
199 |
|
|
209 |
|
VidLocal.palette[i * 3 + 1] = 127; |
210 |
|
VidLocal.palette[i * 3 + 2] = 127; |
211 |
|
} |
212 |
< |
video_set_palette(VidLocal.palette); |
212 |
> |
video_set_palette(VidLocal.palette, 256); |
213 |
|
} |
214 |
|
|
215 |
|
|
252 |
|
*p++ = blue; |
253 |
|
} |
254 |
|
|
255 |
< |
video_set_palette(VidLocal.palette); |
255 |
> |
video_set_palette(VidLocal.palette, num); |
256 |
|
} |
257 |
|
|
258 |
|
|
335 |
|
Mac2Mac_memcpy(table, user_table, size); |
336 |
|
} |
337 |
|
|
338 |
< |
if (IsDirectMode(VidLocal.current_mode)) |
338 |
> |
if (IsDirectMode(VidLocal.desc->mode)) |
339 |
|
load_ramp_palette(); |
340 |
|
|
341 |
|
return true; |
343 |
|
|
344 |
|
|
345 |
|
/* |
346 |
+ |
* Switch video mode |
347 |
+ |
*/ |
348 |
+ |
|
349 |
+ |
static void switch_mode(const video_mode &mode, uint32 param, uint32 dce) |
350 |
+ |
{ |
351 |
+ |
// Switch mode |
352 |
+ |
set_gray_palette(); |
353 |
+ |
video_switch_to_mode(mode); |
354 |
+ |
|
355 |
+ |
// Update VidLocal |
356 |
+ |
VidLocal.current_mode = DepthToAppleMode(mode.depth); |
357 |
+ |
VidLocal.current_id = mode.resolution_id; |
358 |
+ |
|
359 |
+ |
uint32 frame_base = VidLocal.desc->mac_frame_base; |
360 |
+ |
|
361 |
+ |
M68kRegisters r; |
362 |
+ |
uint32 sp = VidLocal.slot_param; |
363 |
+ |
r.a[0] = sp; |
364 |
+ |
|
365 |
+ |
// Find functional sResource for this display |
366 |
+ |
WriteMacInt8(sp + spSlot, ReadMacInt8(dce + dCtlSlot)); |
367 |
+ |
WriteMacInt8(sp + spID, ReadMacInt8(dce + dCtlSlotId)); |
368 |
+ |
WriteMacInt8(sp + spExtDev, 0); |
369 |
+ |
r.d[0] = 0x0016; |
370 |
+ |
Execute68kTrap(0xa06e, &r); // SRsrcInfo() |
371 |
+ |
uint32 rsrc = ReadMacInt32(sp + spPointer); |
372 |
+ |
|
373 |
+ |
// Patch minorBase (otherwise rebooting won't work) |
374 |
+ |
WriteMacInt8(sp + spID, 0x0a); // minorBase |
375 |
+ |
r.d[0] = 0x0006; |
376 |
+ |
Execute68kTrap(0xa06e, &r); // SFindStruct() |
377 |
+ |
uint32 minor_base = ReadMacInt32(sp + spPointer) - ROMBaseMac; |
378 |
+ |
ROMBaseHost[minor_base + 0] = frame_base >> 24; |
379 |
+ |
ROMBaseHost[minor_base + 1] = frame_base >> 16; |
380 |
+ |
ROMBaseHost[minor_base + 2] = frame_base >> 8; |
381 |
+ |
ROMBaseHost[minor_base + 3] = frame_base; |
382 |
+ |
|
383 |
+ |
// Patch video mode parameter table |
384 |
+ |
WriteMacInt32(sp + spPointer, rsrc); |
385 |
+ |
WriteMacInt8(sp + spID, DepthToAppleMode(mode.depth)); |
386 |
+ |
r.d[0] = 0x0006; |
387 |
+ |
Execute68kTrap(0xa06e, &r); // SFindStruct() |
388 |
+ |
WriteMacInt8(sp + spID, 0x01); |
389 |
+ |
r.d[0] = 0x0006; |
390 |
+ |
Execute68kTrap(0xa06e, &r); // SFindStruct() |
391 |
+ |
uint32 p = ReadMacInt32(sp + spPointer) - ROMBaseMac; |
392 |
+ |
ROMBaseHost[p + 8] = mode.bytes_per_row >> 8; |
393 |
+ |
ROMBaseHost[p + 9] = mode.bytes_per_row; |
394 |
+ |
ROMBaseHost[p + 14] = mode.y >> 8; |
395 |
+ |
ROMBaseHost[p + 15] = mode.y; |
396 |
+ |
ROMBaseHost[p + 16] = mode.x >> 8; |
397 |
+ |
ROMBaseHost[p + 17] = mode.x; |
398 |
+ |
|
399 |
+ |
// Recalculate slot ROM checksum |
400 |
+ |
ChecksumSlotROM(); |
401 |
+ |
|
402 |
+ |
// Update sResource |
403 |
+ |
WriteMacInt8(sp + spID, ReadMacInt8(dce + dCtlSlotId)); |
404 |
+ |
r.d[0] = 0x002b; |
405 |
+ |
Execute68kTrap(0xa06e, &r); // SUpdateSRT() |
406 |
+ |
|
407 |
+ |
// Update frame buffer base in DCE and param block |
408 |
+ |
WriteMacInt32(dce + dCtlDevBase, frame_base); |
409 |
+ |
WriteMacInt32(param + csBaseAddr, frame_base); |
410 |
+ |
|
411 |
+ |
// Patch frame buffer base address for MacOS versions <7.6 |
412 |
+ |
if (!VidLocal.dm_present) { // Only do this when no Display Manager seems to be present; otherwise, the screen will not get redrawn |
413 |
+ |
WriteMacInt32(0x824, frame_base); // ScrnBase |
414 |
+ |
WriteMacInt32(0x898, frame_base); // CrsrBase |
415 |
+ |
uint32 gdev = ReadMacInt32(0x8a4); // MainDevice |
416 |
+ |
gdev = ReadMacInt32(gdev); |
417 |
+ |
uint32 pmap = ReadMacInt32(gdev + 0x16); // gdPMap |
418 |
+ |
pmap = ReadMacInt32(pmap); |
419 |
+ |
WriteMacInt32(pmap, frame_base); // baseAddr |
420 |
+ |
} |
421 |
+ |
} |
422 |
+ |
|
423 |
+ |
|
424 |
+ |
/* |
425 |
|
* Driver Open() routine |
426 |
|
*/ |
427 |
|
|
441 |
|
VidLocal.current_id = VidLocal.desc->mode.resolution_id; |
442 |
|
VidLocal.preferred_mode = VidLocal.current_mode; |
443 |
|
VidLocal.preferred_id = VidLocal.current_id; |
444 |
+ |
VidLocal.dm_present = false; |
445 |
|
|
446 |
|
// Allocate Slot Manager parameter block in Mac RAM |
447 |
|
M68kRegisters r; |
485 |
|
return paramErr; |
486 |
|
|
487 |
|
if (mode != VidLocal.current_mode) { |
488 |
< |
std::vector<video_mode>::const_iterator i = find_mode(mode, VidLocal.current_id); |
488 |
> |
vector<video_mode>::const_iterator i = find_mode(mode, VidLocal.current_id); |
489 |
|
if (i == VideoModes.end()) |
490 |
|
return paramErr; |
491 |
< |
set_gray_palette(); |
342 |
< |
video_switch_to_mode(*i); |
343 |
< |
VidLocal.current_mode = mode; |
344 |
< |
WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base); |
345 |
< |
WriteMacInt32(dce + dCtlDevBase, VidLocal.desc->mac_frame_base); |
491 |
> |
switch_mode(*i, param, dce); |
492 |
|
} |
493 |
|
D(bug(" base %08x\n", VidLocal.desc->mac_frame_base)); |
494 |
|
return noErr; |
497 |
|
case cscSetEntries: // Set palette |
498 |
|
case cscDirectSetEntries: { |
499 |
|
D(bug(" (Direct)SetEntries table %08x, count %d, start %d\n", ReadMacInt32(param + csTable), ReadMacInt16(param + csCount), ReadMacInt16(param + csStart))); |
500 |
< |
bool is_direct = IsDirectMode(VidLocal.current_mode); |
500 |
> |
bool is_direct = IsDirectMode(VidLocal.desc->mode); |
501 |
|
if (code == cscSetEntries && is_direct) |
502 |
|
return controlErr; |
503 |
|
if (code == cscDirectSetEntries && !is_direct) |
569 |
|
s_pal += 8; |
570 |
|
} |
571 |
|
} |
572 |
< |
video_set_palette(VidLocal.palette); |
572 |
> |
video_set_palette(VidLocal.palette, palette_size(VidLocal.desc->mode.depth)); |
573 |
|
return noErr; |
574 |
|
} |
575 |
|
|
592 |
|
0xffff0000, // 16 bpp |
593 |
|
0xffffffff // 32 bpp |
594 |
|
}; |
595 |
< |
uint32 p = VidLocal.desc->mac_frame_base; |
595 |
> |
uint32 frame_base = VidLocal.desc->mac_frame_base; |
596 |
|
uint32 pat = pattern[VidLocal.desc->mode.depth]; |
597 |
|
bool invert = (VidLocal.desc->mode.depth == VDEPTH_32BIT); |
598 |
|
for (uint32 y=0; y<VidLocal.desc->mode.y; y++) { |
599 |
|
for (uint32 x=0; x<VidLocal.desc->mode.bytes_per_row; x+=4) { |
600 |
< |
WriteMacInt32(p + x, pat); |
600 |
> |
WriteMacInt32(frame_base + x, pat); |
601 |
|
if (invert) |
602 |
|
pat = ~pat; |
603 |
|
} |
604 |
< |
p += VidLocal.desc->mode.bytes_per_row; |
604 |
> |
frame_base += VidLocal.desc->mode.bytes_per_row; |
605 |
|
pat = ~pat; |
606 |
|
} |
607 |
|
|
608 |
< |
if (IsDirectMode(VidLocal.current_mode)) |
608 |
> |
if (IsDirectMode(VidLocal.desc->mode)) |
609 |
|
load_ramp_palette(); |
610 |
|
|
611 |
|
return noErr; |
622 |
|
return noErr; |
623 |
|
|
624 |
|
case cscSetDefaultMode: { // Set default color depth |
625 |
< |
uint16 mode = ReadMacInt16(param + csMode); |
626 |
< |
D(bug(" SetDefaultMode %04x\n", mode)); |
625 |
> |
uint16 mode = ReadMacInt8(param + csMode); |
626 |
> |
D(bug(" SetDefaultMode %02x\n", mode)); |
627 |
|
VidLocal.preferred_mode = mode; |
628 |
|
return noErr; |
629 |
|
} |
640 |
|
return paramErr; |
641 |
|
|
642 |
|
if (mode != VidLocal.current_mode || id != VidLocal.current_id) { |
643 |
< |
std::vector<video_mode>::const_iterator i = find_mode(mode, id); |
643 |
> |
vector<video_mode>::const_iterator i = find_mode(mode, id); |
644 |
|
if (i == VideoModes.end()) |
645 |
|
return paramErr; |
646 |
< |
set_gray_palette(); |
501 |
< |
video_switch_to_mode(*i); |
502 |
< |
VidLocal.current_mode = mode; |
503 |
< |
VidLocal.current_id = id; |
504 |
< |
uint32 frame_base = VidLocal.desc->mac_frame_base; |
505 |
< |
WriteMacInt32(param + csBaseAddr, frame_base); |
506 |
< |
|
507 |
< |
M68kRegisters r; |
508 |
< |
uint32 sp = VidLocal.slot_param; |
509 |
< |
r.a[0] = sp; |
510 |
< |
|
511 |
< |
// Find functional sResource for this display |
512 |
< |
WriteMacInt8(sp + spSlot, ReadMacInt8(dce + dCtlSlot)); |
513 |
< |
WriteMacInt8(sp + spID, ReadMacInt8(dce + dCtlSlotId)); |
514 |
< |
WriteMacInt8(sp + spExtDev, 0); |
515 |
< |
r.d[0] = 0x0016; |
516 |
< |
Execute68kTrap(0xa06e, &r); // SRsrcInfo() |
517 |
< |
uint32 rsrc = ReadMacInt32(sp + spPointer); |
518 |
< |
|
519 |
< |
// Patch minorBase (otherwise rebooting won't work) |
520 |
< |
WriteMacInt8(sp + spID, 0x0a); // minorBase |
521 |
< |
r.d[0] = 0x0006; |
522 |
< |
Execute68kTrap(0xa06e, &r); // SFindStruct() |
523 |
< |
uint32 minor_base = ReadMacInt32(sp + spPointer) - ROMBaseMac; |
524 |
< |
ROMBaseHost[minor_base + 0] = frame_base >> 24; |
525 |
< |
ROMBaseHost[minor_base + 1] = frame_base >> 16; |
526 |
< |
ROMBaseHost[minor_base + 2] = frame_base >> 8; |
527 |
< |
ROMBaseHost[minor_base + 3] = frame_base; |
528 |
< |
|
529 |
< |
// Patch video mode parameter table |
530 |
< |
WriteMacInt32(sp + spPointer, rsrc); |
531 |
< |
WriteMacInt8(sp + spID, mode); |
532 |
< |
r.d[0] = 0x0006; |
533 |
< |
Execute68kTrap(0xa06e, &r); // SFindStruct() |
534 |
< |
WriteMacInt8(sp + spID, 0x01); |
535 |
< |
r.d[0] = 0x0006; |
536 |
< |
Execute68kTrap(0xa06e, &r); // SFindStruct() |
537 |
< |
uint32 p = ReadMacInt32(sp + spPointer) - ROMBaseMac; |
538 |
< |
ROMBaseHost[p + 8] = i->bytes_per_row >> 8; |
539 |
< |
ROMBaseHost[p + 9] = i->bytes_per_row; |
540 |
< |
ROMBaseHost[p + 14] = i->y >> 8; |
541 |
< |
ROMBaseHost[p + 15] = i->y; |
542 |
< |
ROMBaseHost[p + 16] = i->x >> 8; |
543 |
< |
ROMBaseHost[p + 17] = i->x; |
544 |
< |
|
545 |
< |
// Recalculate slot ROM checksum |
546 |
< |
ChecksumSlotROM(); |
547 |
< |
|
548 |
< |
// Update sResource |
549 |
< |
WriteMacInt8(sp + spID, ReadMacInt8(dce + dCtlSlotId)); |
550 |
< |
r.d[0] = 0x002b; |
551 |
< |
Execute68kTrap(0xa06e, &r); // SUpdateSRT() |
552 |
< |
|
553 |
< |
// Update frame buffer base in DCE |
554 |
< |
WriteMacInt32(dce + dCtlDevBase, frame_base); |
646 |
> |
switch_mode(*i, param, dce); |
647 |
|
} |
648 |
|
D(bug(" base %08x\n", VidLocal.desc->mac_frame_base)); |
649 |
|
return noErr; |
736 |
|
|
737 |
|
case cscGetGray: // Get luminance mapping flag |
738 |
|
D(bug(" GetGray -> %d\n", VidLocal.luminance_mapping)); |
739 |
< |
WriteMacInt16(param, VidLocal.luminance_mapping ? 0x0100 : 0); |
739 |
> |
WriteMacInt8(param, VidLocal.luminance_mapping ? 1 : 0); |
740 |
|
return noErr; |
741 |
|
|
742 |
|
case cscGetInterrupt: // Get interrupt disable flag |
743 |
|
D(bug(" GetInterrupt -> %d\n", VidLocal.interrupts_enabled)); |
744 |
< |
WriteMacInt16(param, VidLocal.interrupts_enabled ? 0 : 0x0100); |
744 |
> |
WriteMacInt8(param, VidLocal.interrupts_enabled ? 0 : 1); |
745 |
|
return noErr; |
746 |
|
|
747 |
|
case cscGetGamma: |
750 |
|
return noErr; |
751 |
|
|
752 |
|
case cscGetDefaultMode: // Get default color depth |
753 |
< |
D(bug(" GetDefaultMode -> %04x\n", VidLocal.preferred_mode)); |
754 |
< |
WriteMacInt16(param + csMode, VidLocal.preferred_mode); |
753 |
> |
D(bug(" GetDefaultMode -> %02x\n", VidLocal.preferred_mode)); |
754 |
> |
WriteMacInt8(param + csMode, VidLocal.preferred_mode); |
755 |
|
return noErr; |
756 |
|
|
757 |
|
case cscGetCurrentMode: // Get current video mode (depth and resolution) |
835 |
|
WriteMacInt32(param + csVerticalLines, y); |
836 |
|
WriteMacInt32(param + csRefreshRate, 75 << 16); |
837 |
|
WriteMacInt16(param + csMaxDepthMode, DepthToAppleMode(max_depth_of_resolution(id))); |
838 |
+ |
WriteMacInt32(param + csResolutionFlags, 0); |
839 |
|
return noErr; |
840 |
|
} |
841 |
|
|
843 |
|
uint32 id = ReadMacInt32(param + csDisplayModeID); |
844 |
|
uint16 mode = ReadMacInt16(param + csDepthMode); |
845 |
|
D(bug(" GetVideoParameters %04x/%08x\n", mode, id)); |
846 |
+ |
VidLocal.dm_present = true; // Display Manager seems to be present |
847 |
|
|
848 |
< |
std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end(); |
849 |
< |
while (i != end) { |
848 |
> |
vector<video_mode>::const_iterator i, end = VideoModes.end(); |
849 |
> |
for (i = VideoModes.begin(); i != end; ++i) { |
850 |
|
if (DepthToAppleMode(i->depth) == mode && i->resolution_id == id) { |
851 |
|
uint32 vp = ReadMacInt32(param + csVPBlockPtr); |
852 |
|
WriteMacInt32(vp + vpBaseOffset, 0); |
901 |
|
WriteMacInt32(param + csDeviceType, dev_type); |
902 |
|
return noErr; |
903 |
|
} |
810 |
– |
++i; |
904 |
|
} |
905 |
|
return paramErr; // specified resolution/depth not supported |
906 |
|
} |
907 |
|
|
908 |
+ |
case cscGetMultiConnect: { |
909 |
+ |
uint32 conn = ReadMacInt32(param + csDisplayCountOrNumber); |
910 |
+ |
D(bug(" GetMultiConnect %08x\n", conn)); |
911 |
+ |
if (conn == 0xffffffff) { // Get number of connections |
912 |
+ |
WriteMacInt32(param + csDisplayCountOrNumber, 1); // Single-headed |
913 |
+ |
return noErr; |
914 |
+ |
} else if (conn == 1) { // Get information about first connection |
915 |
+ |
WriteMacInt16(param + csConnectInfo + csDisplayType, 8); // Modeless connection |
916 |
+ |
WriteMacInt8(param + csConnectInfo + csConnectTaggedType, 0); |
917 |
+ |
WriteMacInt8(param + csConnectInfo + csConnectTaggedData, 0); |
918 |
+ |
WriteMacInt32(param + csConnectInfo + csConnectFlags, 0x43); // All modes valid and safe, non-standard tagging |
919 |
+ |
WriteMacInt32(param + csConnectInfo + csDisplayComponent, 0); |
920 |
+ |
return noErr; |
921 |
+ |
} else |
922 |
+ |
return paramErr; |
923 |
+ |
} |
924 |
+ |
|
925 |
|
default: |
926 |
|
printf("WARNING: Unknown VideoDriverStatus(%d)\n", code); |
927 |
|
return statusErr; |