ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/video.cpp
(Generate patch)

Comparing BasiliskII/src/video.cpp (file contents):
Revision 1.9 by cebix, 2001-06-27T19:03:35Z vs.
Revision 1.13 by cebix, 2001-06-29T12:51:20Z

# Line 31 | Line 31
31   #include "cpu_emulation.h"
32   #include "main.h"
33   #include "macos_util.h"
34 + #include "slot_rom.h"
35   #include "video.h"
36   #include "video_defs.h"
37  
# Line 39 | Line 40
40  
41  
42   // List of supported video modes
43 < vector<video_mode> VideoModes;
43 > std::vector<video_mode> VideoModes;
44  
45   // Description of the main monitor
46   monitor_desc VideoMonitor;
# Line 50 | Line 51 | struct {
51          uint8 palette[256 * 3];         // Color palette, 256 entries, RGB
52          bool luminance_mapping;         // Luminance mapping on/off
53          bool interrupts_enabled;        // VBL interrupts on/off
54 +        uint32 gamma_table;                     // Mac address of gamma table
55          uint16 current_mode;            // Currently selected depth/resolution
56          uint32 current_id;
57          uint16 preferred_mode;          // Preferred depth/resolution
58          uint32 preferred_id;
59 +        uint32 sp;                                      // Mac address of Slot Manager parameter block
60   } VidLocal;
61  
62  
# Line 63 | Line 66 | struct {
66  
67   static bool has_resolution(uint32 id)
68   {
69 <        vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
69 >        std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
70          while (i != end) {
71                  if (i->resolution_id == id)
72                          return true;
# Line 74 | Line 77 | static bool has_resolution(uint32 id)
77  
78  
79   /*
80 + *  Find specified mode (depth/resolution) (or VideoModes.end() if not found)
81 + */
82 +
83 + static std::vector<video_mode>::const_iterator find_mode(uint16 mode, uint32 id)
84 + {
85 +        std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
86 +        while (i != end) {
87 +                if (i->resolution_id == id && DepthToAppleMode(i->depth) == mode)
88 +                        return i;
89 +                ++i;
90 +        }
91 +        return i;
92 + }
93 +
94 +
95 + /*
96   *  Find maximum supported depth for given resolution ID
97   */
98  
99   static video_depth max_depth_of_resolution(uint32 id)
100   {
101          video_depth m = VDEPTH_1BIT;
102 <        vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
102 >        std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
103          while (i != end) {
104                  if (i->depth > m)
105                          m = i->depth;
# Line 96 | Line 115 | static video_depth max_depth_of_resoluti
115  
116   static void get_size_of_resolution(uint32 id, uint32 &x, uint32 &y)
117   {
118 <        vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
118 >        std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
119          while (i != end) {
120                  if (i->resolution_id == id) {
121                          x = i->x;
# Line 109 | Line 128 | static void get_size_of_resolution(uint3
128  
129  
130   /*
131 + *  Set palette to 50% gray
132 + */
133 +
134 + static void set_gray_palette(void)
135 + {
136 +        if (!IsDirectMode(VidLocal.current_mode)) {
137 +                for (int i=0; i<256; i++) {
138 +                        VidLocal.palette[i * 3 + 0] = 127;
139 +                        VidLocal.palette[i * 3 + 1] = 127;
140 +                        VidLocal.palette[i * 3 + 2] = 127;
141 +                }
142 +                video_set_palette(VidLocal.palette);
143 +        }
144 + }
145 +
146 +
147 + /*
148   *  Driver Open() routine
149   */
150  
# Line 129 | Line 165 | int16 VideoDriverOpen(uint32 pb, uint32
165          VidLocal.preferred_mode = VidLocal.current_mode;
166          VidLocal.preferred_id = VidLocal.current_id;
167  
168 +        // Allocate Slot Manager parameter block in Mac RAM
169 +        M68kRegisters r;
170 +        r.d[0] = SIZEOF_SPBlock;
171 +        Execute68kTrap(0xa71e, &r);     // NewPtrSysClear()
172 +        if (r.a[0] == 0)
173 +                return memFullErr;
174 +        VidLocal.sp = r.a[0];
175 +        D(bug("SPBlock at %08x\n", VidLocal.sp));
176 +
177 +        // Find and set default gamma table
178 +        VidLocal.gamma_table = 0; //!!
179 +
180          // Init color palette (solid gray)
181 <        if (!IsDirectMode(VidLocal.desc->mode)) {
134 <                for (int i=0; i<256; i++) {
135 <                        VidLocal.palette[i * 3 + 0] = 127;
136 <                        VidLocal.palette[i * 3 + 1] = 127;
137 <                        VidLocal.palette[i * 3 + 2] = 127;
138 <                }
139 <                video_set_palette(VidLocal.palette);
140 <        }
181 >        set_gray_palette();
182          return noErr;
183   }
184  
# Line 156 | Line 197 | int16 VideoDriverControl(uint32 pb, uint
197                  case cscSetMode: {              // Set color depth
198                          uint16 mode = ReadMacInt16(param + csMode);
199                          D(bug(" SetMode %04x\n", mode));
200 <                        //!! switch mode
200 >
201 >                        // Set old base address in case the switch fails
202                          WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
203 <                        //!! VidLocal.current_mode = mode;
204 <                        if (mode != VidLocal.current_mode)
203 >
204 >                        if (ReadMacInt16(param + csPage))
205                                  return paramErr;
206 <                        else
207 <                                return noErr;
206 >
207 >                        if (mode != VidLocal.current_mode) {
208 >                                std::vector<video_mode>::const_iterator i = find_mode(mode, VidLocal.current_id);
209 >                                if (i == VideoModes.end())
210 >                                        return paramErr;
211 >                                set_gray_palette();
212 >                                video_switch_to_mode(*i);
213 >                                VidLocal.current_mode = mode;
214 >                                WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
215 >                                WriteMacInt32(dce + dCtlDevBase, VidLocal.desc->mac_frame_base);
216 >                        }
217 >                        D(bug("  base %08x\n", VidLocal.desc->mac_frame_base));
218 >                        return noErr;
219                  }
220  
221                  case cscSetEntries: {   // Set palette
222 <                        D(bug(" SetEntries table %08lx, count %d, start %d\n", ReadMacInt32(param + csTable), ReadMacInt16(param + csCount), ReadMacInt16(param + csStart)));
223 <                        if (IsDirectMode(VidLocal.desc->mode))
222 >                        D(bug(" SetEntries table %08x, count %d, start %d\n", ReadMacInt32(param + csTable), ReadMacInt16(param + csCount), ReadMacInt16(param + csStart)));
223 >                        if (IsDirectMode(VidLocal.current_mode))
224                                  return controlErr;
225  
226                          uint32 s_pal = ReadMacInt32(param + csTable);   // Source palette
227                          uint8 *d_pal;                                                                   // Destination palette
228 +                        uint16 start = ReadMacInt16(param + csStart);
229                          uint16 count = ReadMacInt16(param + csCount);
230 <                        if (!s_pal || count > 255)
230 >                        if (s_pal == 0 || count > 255)
231                                  return paramErr;
232  
233 <                        if (ReadMacInt16(param + csStart) == 0xffff) {  // Indexed
233 >                        if (start == 0xffff) {  // Indexed
234                                  for (uint32 i=0; i<=count; i++) {
235 <                                        d_pal = VidLocal.palette + ReadMacInt16(s_pal) * 3;
235 >                                        d_pal = VidLocal.palette + (ReadMacInt16(s_pal) & 0xff) * 3;
236                                          uint8 red = (uint16)ReadMacInt16(s_pal + 2) >> 8;
237                                          uint8 green = (uint16)ReadMacInt16(s_pal + 4) >> 8;
238                                          uint8 blue = (uint16)ReadMacInt16(s_pal + 6) >> 8;
239                                          if (VidLocal.luminance_mapping)
240                                                  red = green = blue = (red * 0x4ccc + green * 0x970a + blue * 0x1c29) >> 16;
241 +                                        //!! gamma correction
242                                          *d_pal++ = red;
243                                          *d_pal++ = green;
244                                          *d_pal++ = blue;
245                                          s_pal += 8;
246                                  }
247 <                        } else {                                                                                // Sequential
248 <                                d_pal = VidLocal.palette + ReadMacInt16(param + csStart) * 3;
247 >                        } else {                                // Sequential
248 >                                if (start + count > 255)
249 >                                        return paramErr;
250 >                                d_pal = VidLocal.palette + start * 3;
251                                  for (uint32 i=0; i<=count; i++) {
252                                          uint8 red = (uint16)ReadMacInt16(s_pal + 2) >> 8;
253                                          uint8 green = (uint16)ReadMacInt16(s_pal + 4) >> 8;
254                                          uint8 blue = (uint16)ReadMacInt16(s_pal + 6) >> 8;
255                                          if (VidLocal.luminance_mapping)
256                                                  red = green = blue = (red * 0x4ccc + green * 0x970a + blue * 0x1c29) >> 16;
257 +                                        //!! gamma correction
258                                          *d_pal++ = red;
259                                          *d_pal++ = green;
260                                          *d_pal++ = blue;
# Line 210 | Line 268 | int16 VideoDriverControl(uint32 pb, uint
268                  case cscSetGamma:               // Set gamma table
269                          D(bug(" SetGamma\n"));
270                          //!!
271 <                        return noErr;
271 >                        return controlErr;
272  
273                  case cscGrayPage: {             // Fill page with dithered gray pattern
274                          D(bug(" GrayPage %d\n", ReadMacInt16(param + csPage)));
# Line 227 | Line 285 | int16 VideoDriverControl(uint32 pb, uint
285                          };
286                          uint32 p = VidLocal.desc->mac_frame_base;
287                          uint32 pat = pattern[VidLocal.desc->mode.depth];
288 +                        bool invert = (VidLocal.desc->mode.depth == VDEPTH_32BIT);
289                          for (uint32 y=0; y<VidLocal.desc->mode.y; y++) {
290                                  for (uint32 x=0; x<VidLocal.desc->mode.bytes_per_row; x+=4) {
291                                          WriteMacInt32(p + x, pat);
292 <                                        if (VidLocal.desc->mode.depth == VDEPTH_32BIT)
292 >                                        if (invert)
293                                                  pat = ~pat;
294                                  }
295                                  p += VidLocal.desc->mode.bytes_per_row;
296                                  pat = ~pat;
297                          }
298 +                        //!! if direct mode, load gamma table to CLUT
299                          return noErr;
300                  }
301  
# Line 249 | Line 309 | int16 VideoDriverControl(uint32 pb, uint
309                          VidLocal.interrupts_enabled = (ReadMacInt8(param + csMode) == 0);
310                          return noErr;
311  
252                // case cscDirectSetEntries:
253
312                  case cscSetDefaultMode: { // Set default color depth
313                          uint16 mode = ReadMacInt16(param + csMode);
314                          D(bug(" SetDefaultMode %04x\n", mode));
# Line 262 | Line 320 | int16 VideoDriverControl(uint32 pb, uint
320                          uint16 mode = ReadMacInt16(param + csMode);
321                          uint32 id = ReadMacInt32(param + csData);
322                          D(bug(" SwitchMode %04x, %08x\n", mode, id));
323 <                        //!! switch mode
323 >
324 >                        // Set old base address in case the switch fails
325                          WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
326 <                        //!! VidLocal.current_mode = mode;
327 <                        //!! VidLocal.current_id = id;
269 <                        if (mode != VidLocal.current_mode || id != VidLocal.current_id)
326 >
327 >                        if (ReadMacInt16(param + csPage))
328                                  return paramErr;
329 <                        else
330 <                                return noErr;
329 >
330 >                        if (mode != VidLocal.current_mode || id != VidLocal.current_id) {
331 >                                std::vector<video_mode>::const_iterator i = find_mode(mode, id);
332 >                                if (i == VideoModes.end())
333 >                                        return paramErr;
334 >                                set_gray_palette();
335 >                                video_switch_to_mode(*i);
336 >                                VidLocal.current_mode = mode;
337 >                                VidLocal.current_id = id;
338 >                                uint32 frame_base = VidLocal.desc->mac_frame_base;
339 >                                WriteMacInt32(param + csBaseAddr, frame_base);
340 >
341 >                                M68kRegisters r;
342 >                                uint32 sp = VidLocal.sp;
343 >                                r.a[0] = sp;
344 >
345 >                                // Find functional sResource for this display
346 >                                WriteMacInt8(sp + spSlot, ReadMacInt8(dce + dCtlSlot));
347 >                                WriteMacInt8(sp + spID, ReadMacInt8(dce + dCtlSlotId));
348 >                                WriteMacInt8(sp + spExtDev, 0);
349 >                                r.d[0] = 0x0016;
350 >                                Execute68kTrap(0xa06e, &r);     // SRsrcInfo()
351 >                                uint32 rsrc = ReadMacInt32(sp + spPointer);
352 >
353 >                                // Patch minorBase (otherwise rebooting won't work)
354 >                                WriteMacInt8(sp + spID, 0x0a); // minorBase
355 >                                r.d[0] = 0x0006;
356 >                                Execute68kTrap(0xa06e, &r); // SFindStruct()
357 >                                uint32 minor_base = ReadMacInt32(sp + spPointer) - ROMBaseMac;
358 >                                ROMBaseHost[minor_base + 0] = frame_base >> 24;
359 >                                ROMBaseHost[minor_base + 1] = frame_base >> 16;
360 >                                ROMBaseHost[minor_base + 2] = frame_base >> 8;
361 >                                ROMBaseHost[minor_base + 3] = frame_base;
362 >
363 >                                // Patch video mode parameter table
364 >                                WriteMacInt32(sp + spPointer, rsrc);
365 >                                WriteMacInt8(sp + spID, mode);
366 >                                r.d[0] = 0x0006;
367 >                                Execute68kTrap(0xa06e, &r); // SFindStruct()
368 >                                WriteMacInt8(sp + spID, 0x01);
369 >                                r.d[0] = 0x0006;
370 >                                Execute68kTrap(0xa06e, &r); // SFindStruct()
371 >                                uint32 p = ReadMacInt32(sp + spPointer) - ROMBaseMac;
372 >                                ROMBaseHost[p +  8] = i->bytes_per_row >> 8;
373 >                                ROMBaseHost[p +  9] = i->bytes_per_row;
374 >                                ROMBaseHost[p + 14] = i->y >> 8;
375 >                                ROMBaseHost[p + 15] = i->y;
376 >                                ROMBaseHost[p + 16] = i->x >> 8;
377 >                                ROMBaseHost[p + 17] = i->x;
378 >
379 >                                // Recalculate slot ROM checksum
380 >                                ChecksumSlotROM();
381 >
382 >                                // Update sResource
383 >                                WriteMacInt8(sp + spID, ReadMacInt8(dce + dCtlSlotId));
384 >                                r.d[0] = 0x002b;
385 >                                Execute68kTrap(0xa06e, &r); // SUpdateSRT()
386 >
387 >                                // Update frame buffer base in DCE
388 >                                WriteMacInt32(dce + dCtlDevBase, frame_base);
389 >                        }
390 >                        D(bug("  base %08x\n", VidLocal.desc->mac_frame_base));
391 >                        return noErr;
392                  }
393  
394                  case cscSavePreferredConfiguration: {
# Line 306 | Line 425 | int16 VideoDriverStatus(uint32 pb, uint3
425                          WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
426                          return noErr;
427  
428 <                // case cscGetEntries:
428 >                case cscGetEntries: {           // Read palette
429 >                        D(bug(" GetEntries table %08x, count %d, start %d\n", ReadMacInt32(param + csTable), ReadMacInt16(param + csCount), ReadMacInt16(param + csStart)));
430 >
431 >                        uint8 *s_pal;                                                                   // Source palette
432 >                        uint32 d_pal = ReadMacInt32(param + csTable);   // Destination palette
433 >                        uint16 start = ReadMacInt16(param + csStart);
434 >                        uint16 count = ReadMacInt16(param + csCount);
435 >                        if (d_pal == 0 || count > 255)
436 >                                return paramErr;
437  
438 <                case cscGetPageCnt:                     // Get number of pages
439 <                        D(bug(" GetPageCnt -> 1\n"));
438 >                        if (start == 0xffff) {  // Indexed
439 >                                for (uint32 i=0; i<=count; i++) {
440 >                                        s_pal = VidLocal.palette + (ReadMacInt16(d_pal) & 0xff) * 3;
441 >                                        uint8 red = *s_pal++;
442 >                                        uint8 green = *s_pal++;
443 >                                        uint8 blue = *s_pal++;
444 >                                        WriteMacInt16(d_pal + 2, red * 0x0101);
445 >                                        WriteMacInt16(d_pal + 4, green * 0x0101);
446 >                                        WriteMacInt16(d_pal + 6, blue * 0x0101);
447 >                                        d_pal += 8;
448 >                                }
449 >                        } else {                                // Sequential
450 >                                if (start + count > 255)
451 >                                        return paramErr;
452 >                                s_pal = VidLocal.palette + start * 3;
453 >                                for (uint32 i=0; i<=count; i++) {
454 >                                        uint8 red = *s_pal++;
455 >                                        uint8 green = *s_pal++;
456 >                                        uint8 blue = *s_pal++;
457 >                                        WriteMacInt16(d_pal + 2, red * 0x0101);
458 >                                        WriteMacInt16(d_pal + 4, green * 0x0101);
459 >                                        WriteMacInt16(d_pal + 6, blue * 0x0101);
460 >                                        d_pal += 8;
461 >                                }
462 >                        }
463 >                        return noErr;
464 >                }
465 >
466 >                case cscGetPages:                       // Get number of pages
467 >                        D(bug(" GetPages -> 1\n"));
468                          WriteMacInt16(param + csPage, 1);
469                          return noErr;
470  
471 <                case cscGetPageBase:            // Get page base address
472 <                        D(bug(" GetPageBase -> %08x\n", VidLocal.desc->mac_frame_base));
471 >                case cscGetBaseAddress:         // Get page base address
472 >                        D(bug(" GetBaseAddress -> %08x\n", VidLocal.desc->mac_frame_base));
473                          WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
474 <                        return noErr;
474 >                        if (ReadMacInt16(param + csPage))
475 >                                return paramErr;
476 >                        else
477 >                                return noErr;
478  
479                  case cscGetGray:                        // Get luminance mapping flag
480                          D(bug(" GetGray -> %d\n", VidLocal.luminance_mapping));
481 <                        WriteMacInt8(param, VidLocal.luminance_mapping ? 1 : 0);
481 >                        WriteMacInt16(param, VidLocal.luminance_mapping ? 0x0100 : 0);
482                          return noErr;
483  
484                  case cscGetInterrupt:           // Get interrupt disable flag
485                          D(bug(" GetInterrupt -> %d\n", VidLocal.interrupts_enabled));
486 <                        WriteMacInt8(param, VidLocal.interrupts_enabled ? 0 : 1);
486 >                        WriteMacInt16(param, VidLocal.interrupts_enabled ? 0 : 0x0100);
487                          return noErr;
488  
489 <                // case cscGetGamma:
489 >                case cscGetGamma:
490 >                        D(bug(" GetGamma -> \n"));
491 >                        //!!
492 >                        return statusErr;
493  
494                  case cscGetDefaultMode:         // Get default color depth
495                          D(bug(" GetDefaultMode -> %04x\n", VidLocal.preferred_mode));
496                          WriteMacInt16(param + csMode, VidLocal.preferred_mode);
497                          return noErr;
498  
499 <                case cscGetCurMode:                     // Get current video mode (depth and resolution)
500 <                        D(bug(" GetCurMode -> %04x/%08x\n", VidLocal.current_mode, VidLocal.current_id));
499 >                case cscGetCurrentMode:         // Get current video mode (depth and resolution)
500 >                        D(bug(" GetCurMode -> %04x/%08x, base %08x\n", VidLocal.current_mode, VidLocal.current_id, VidLocal.desc->mac_frame_base));
501                          WriteMacInt16(param + csMode, VidLocal.current_mode);
502                          WriteMacInt32(param + csData, VidLocal.current_id);
503                          WriteMacInt16(param + csPage, 0);
# Line 345 | Line 506 | int16 VideoDriverStatus(uint32 pb, uint3
506  
507                  case cscGetConnection:          // Get monitor information
508                          D(bug(" GetConnection\n"));
509 <                        WriteMacInt16(param + csDisplayType, 6);                // 21" Multiscan
510 <                        WriteMacInt8(param + csConnectTaggedType, 6);
511 <                        WriteMacInt8(param + csConnectTaggedData, 0x23);
512 <                        WriteMacInt32(param + csConnectFlags, 0x03);    // All modes valid and safe
509 >                        WriteMacInt16(param + csDisplayType, 8);                // Modeless connection
510 >                        WriteMacInt8(param + csConnectTaggedType, 0);
511 >                        WriteMacInt8(param + csConnectTaggedData, 0);
512 >                        WriteMacInt32(param + csConnectFlags, 0x43);    // All modes valid and safe, non-standard tagging
513                          WriteMacInt32(param + csDisplayComponent, 0);
514                          return noErr;
515  
516 +                case cscGetModeTiming: {        // Get video timing for specified resolution
517 +                        uint32 id = ReadMacInt32(param + csTimingMode);
518 +                        D(bug(" GetModeTiming %08x\n", id));
519 +                        if (!has_resolution(id))
520 +                                return paramErr;
521 +
522 +                        WriteMacInt32(param + csTimingFormat, FOURCC('d', 'e', 'c', 'l'));
523 +                        WriteMacInt32(param + csTimingData, 0); // unknown
524 +                        uint32 flags = 0xb; // mode valid, safe and shown in Monitors panel
525 +                        if (id == VidLocal.preferred_id)
526 +                                flags |= 4; // default mode
527 +                        WriteMacInt32(param + csTimingFlags, flags);
528 +                        return noErr;
529 +                }
530 +
531                  case cscGetModeBaseAddress:     // Get frame buffer base address
532 <                        D(bug(" GetModeBaseAddress -> %08x\n", VidLocal.desc->mac_frame_base));
533 <                        WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);       // Base address of video RAM for the current DisplayModeID and relative bit depth
532 >                        D(bug(" GetModeBaseAddress -> base %08x\n", VidLocal.desc->mac_frame_base));
533 >                        WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
534                          return noErr;
535  
536                  case cscGetPreferredConfiguration: // Get default video mode (depth and resolution)
# Line 401 | Line 577 | int16 VideoDriverStatus(uint32 pb, uint3
577                          WriteMacInt32(param + csVerticalLines, y);
578                          WriteMacInt32(param + csRefreshRate, 75 << 16);
579                          WriteMacInt16(param + csMaxDepthMode, DepthToAppleMode(max_depth_of_resolution(id)));
404                        uint32 flags = 0xb; // mode valid, safe and shown in Monitors panel
405                        if (id == VidLocal.preferred_id)
406                                flags |= 4; // default mode
407                        WriteMacInt32(param + csResolutionFlags, flags);
580                          return noErr;
581                  }
582  
# Line 413 | Line 585 | int16 VideoDriverStatus(uint32 pb, uint3
585                          uint16 mode = ReadMacInt16(param + csDepthMode);
586                          D(bug(" GetVideoParameters %04x/%08x\n", mode, id));
587  
588 <                        vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
588 >                        std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
589                          while (i != end) {
590                                  if (DepthToAppleMode(i->depth) == mode && i->resolution_id == id) {
591                                          uint32 vp = ReadMacInt32(param + csVPBlockPtr);
# Line 426 | Line 598 | int16 VideoDriverStatus(uint32 pb, uint3
598                                          WriteMacInt16(vp + vpVersion, 0);
599                                          WriteMacInt16(vp + vpPackType, 0);
600                                          WriteMacInt32(vp + vpPackSize, 0);
601 <                                        WriteMacInt32(vp + vpHRes, 0x00480000);
601 >                                        WriteMacInt32(vp + vpHRes, 0x00480000); // 72 dpi
602                                          WriteMacInt32(vp + vpVRes, 0x00480000);
603                                          uint32 pix_type, pix_size, cmp_count, cmp_size, dev_type;
604                                          switch (i->depth) {
# Line 474 | Line 646 | int16 VideoDriverStatus(uint32 pb, uint3
646                          return paramErr; // specified resolution/depth not supported
647                  }
648  
477                case cscGetModeTiming: {        // Get video timing for specified resolution
478                        uint32 id = ReadMacInt32(param + csTimingMode);
479                        D(bug(" GetModeTiming %08x\n", id));
480                        if (!has_resolution(id))
481                                return paramErr;
482
483                        WriteMacInt32(param + csTimingFormat, FOURCC('d', 'e', 'c', 'l'));
484                        WriteMacInt32(param + csTimingData, 0); // unknown
485                        uint32 flags = 0xb; // mode valid, safe and shown in Monitors panel
486                        if (id == VidLocal.preferred_id)
487                                flags |= 4; // default mode
488                        WriteMacInt32(param + csTimingFlags, flags);
489                        return noErr;
490                }
491
649                  default:
650                          printf("WARNING: Unknown VideoDriverStatus(%d)\n", code);
651                          return statusErr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines