1 |
|
/* |
2 |
|
* video_amiga.cpp - Video/graphics emulation, AmigaOS specific stuff |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2002 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2004 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
251 |
|
break; |
252 |
|
|
253 |
|
case DISPLAY_PIP: |
254 |
– |
default_depth = VDEPTH_16BIT; |
254 |
|
default_width = window_width; |
255 |
|
default_height = window_height; |
256 |
+ |
default_depth = VDEPTH_16BIT; |
257 |
|
add_modes(window_width, window_height, VDEPTH_16BIT); |
258 |
|
break; |
259 |
|
|
271 |
|
default_width = 1 + dimInfo.Nominal.MaxX - dimInfo.Nominal.MinX; |
272 |
|
default_height = 1 + dimInfo.Nominal.MaxY - dimInfo.Nominal.MinY; |
273 |
|
|
274 |
< |
switch (dimInfo.MaxDepth) |
275 |
< |
{ |
276 |
< |
case 1: |
277 |
< |
default_depth = VDEPTH_1BIT; |
278 |
< |
break; |
279 |
< |
case 8: |
280 |
< |
default_depth = VDEPTH_8BIT; |
281 |
< |
break; |
282 |
< |
case 15: |
283 |
< |
case 16: |
284 |
< |
default_depth = VDEPTH_16BIT; |
285 |
< |
break; |
286 |
< |
case 24: |
287 |
< |
case 32: |
288 |
< |
default_depth = VDEPTH_32BIT; |
289 |
< |
break; |
290 |
< |
} |
274 |
> |
switch (dimInfo.MaxDepth) { |
275 |
> |
case 1: |
276 |
> |
default_depth = VDEPTH_1BIT; |
277 |
> |
break; |
278 |
> |
case 8: |
279 |
> |
default_depth = VDEPTH_8BIT; |
280 |
> |
break; |
281 |
> |
case 15: |
282 |
> |
case 16: |
283 |
> |
default_depth = VDEPTH_16BIT; |
284 |
> |
break; |
285 |
> |
case 24: |
286 |
> |
case 32: |
287 |
> |
default_depth = VDEPTH_32BIT; |
288 |
> |
break; |
289 |
> |
} |
290 |
|
|
291 |
|
for (unsigned d=VDEPTH_8BIT; d<=VDEPTH_32BIT; d++) { |
292 |
|
ULONG mode_id = find_mode_for_depth(default_width, default_height, bits_from_depth(video_depth(d))); |
297 |
|
break; |
298 |
|
} |
299 |
|
|
301 |
– |
// video_init_depth_list(); |
302 |
– |
|
300 |
|
#if DEBUG |
301 |
|
bug("Available video modes:\n"); |
302 |
|
vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end(); |
310 |
|
__LINE__, default_width, default_height, default_depth)); |
311 |
|
|
312 |
|
// Find requested default mode and open display |
313 |
< |
if (VideoModes.size() == 1) |
317 |
< |
{ |
313 |
> |
if (VideoModes.size() == 1) { |
314 |
|
uint32 default_id ; |
315 |
|
|
316 |
|
// Create Amiga_monitor_desc for this (the only) display |
321 |
|
|
322 |
|
// Open display |
323 |
|
return monitor->video_open(); |
324 |
< |
} |
325 |
< |
else { |
324 |
> |
|
325 |
> |
} else { |
326 |
> |
|
327 |
|
// Find mode with specified dimensions |
328 |
|
std::vector<video_mode>::const_iterator i, end = VideoModes.end(); |
329 |
|
for (i = VideoModes.begin(); i != end; ++i) { |
330 |
|
D(bug("VideoInit/%ld: w=%ld h=%ld d=%ld\n", __LINE__, i->x, i->y, bits_from_depth(i->depth))); |
331 |
< |
if (i->x == default_width && i->y == default_height && i->depth == default_depth) |
335 |
< |
{ |
331 |
> |
if (i->x == default_width && i->y == default_height && i->depth == default_depth) { |
332 |
|
// Create Amiga_monitor_desc for this (the only) display |
333 |
|
uint32 default_id = i->resolution_id; |
334 |
|
D(bug("VideoInit/%ld: default_id=%ld\n", __LINE__, default_id)); |
337 |
|
|
338 |
|
// Open display |
339 |
|
return monitor->video_open(); |
340 |
< |
} |
340 |
> |
} |
341 |
|
} |
342 |
|
|
343 |
|
// Create Amiga_monitor_desc for this (the only) display |
367 |
|
return false; |
368 |
|
} |
369 |
|
|
374 |
– |
// VideoMonitor.mode = mode; |
375 |
– |
|
370 |
|
D(bug("video_open/%ld: display_type=%ld\n", __LINE__, display_type)); |
371 |
|
|
372 |
|
// Open display |
429 |
|
} |
430 |
|
|
431 |
|
delete drv; |
432 |
+ |
drv = NULL; |
433 |
|
|
434 |
|
// Free mouse pointer |
435 |
|
if (null_pointer) { |
551 |
|
// D(bug("periodic_func/%ld: display_type=%ld the_win=%08lx\n", __LINE__, drv->monitor.display_type, drv->the_win)); |
552 |
|
|
553 |
|
if (sig & timer_mask) { |
554 |
< |
if (drv->get_bitmap()) |
560 |
< |
{ |
554 |
> |
if (drv->get_bitmap()) { |
555 |
|
// Timer tick, update display |
556 |
|
BltTemplate(drv->get_bitmap()->Planes[0], 0, |
557 |
|
drv->get_bitmap()->BytesPerRow, drv->the_win->RPort, |
558 |
|
drv->the_win->BorderLeft, drv->the_win->BorderTop, |
559 |
|
mode.x, mode.y); |
560 |
< |
} |
560 |
> |
} |
561 |
|
|
562 |
|
// Restart timer |
563 |
|
timer_io->tr_node.io_Command = TR_ADDREQUEST; |
582 |
|
// Handle message according to class |
583 |
|
switch (cl) { |
584 |
|
case IDCMP_MOUSEMOVE: |
585 |
< |
switch (drv->monitor.display_type) |
586 |
< |
{ |
587 |
< |
case DISPLAY_SCREEN_P96: |
588 |
< |
case DISPLAY_SCREEN_CGFX: |
589 |
< |
// D(bug("periodic_func/%ld: IDCMP_MOUSEMOVE mx=%ld my=%ld\n", __LINE__, mx, my)); |
590 |
< |
ADBMouseMoved(mx, my); |
591 |
< |
break; |
592 |
< |
default: |
593 |
< |
// D(bug("periodic_func/%ld: IDCMP_MOUSEMOVE mx=%ld my=%ld\n", __LINE__, mx - drv->the_win->BorderLeft, my - drv->the_win->BorderTop)); |
594 |
< |
ADBMouseMoved(mx - drv->the_win->BorderLeft, my - drv->the_win->BorderTop); |
595 |
< |
if (mx < drv->the_win->BorderLeft |
596 |
< |
|| my < drv->the_win->BorderTop |
597 |
< |
|| mx >= drv->the_win->BorderLeft + mode.x |
598 |
< |
|| my >= drv->the_win->BorderTop + mode.y) { |
599 |
< |
if (current_pointer) { |
600 |
< |
ClearPointer(drv->the_win); |
601 |
< |
current_pointer = NULL; |
585 |
> |
switch (drv->monitor.display_type) { |
586 |
> |
case DISPLAY_SCREEN_P96: |
587 |
> |
case DISPLAY_SCREEN_CGFX: |
588 |
> |
// D(bug("periodic_func/%ld: IDCMP_MOUSEMOVE mx=%ld my=%ld\n", __LINE__, mx, my)); |
589 |
> |
ADBMouseMoved(mx, my); |
590 |
> |
break; |
591 |
> |
default: |
592 |
> |
// D(bug("periodic_func/%ld: IDCMP_MOUSEMOVE mx=%ld my=%ld\n", __LINE__, mx - drv->the_win->BorderLeft, my - drv->the_win->BorderTop)); |
593 |
> |
ADBMouseMoved(mx - drv->the_win->BorderLeft, my - drv->the_win->BorderTop); |
594 |
> |
if (mx < drv->the_win->BorderLeft |
595 |
> |
|| my < drv->the_win->BorderTop |
596 |
> |
|| mx >= drv->the_win->BorderLeft + mode.x |
597 |
> |
|| my >= drv->the_win->BorderTop + mode.y) { |
598 |
> |
if (current_pointer) { |
599 |
> |
ClearPointer(drv->the_win); |
600 |
> |
current_pointer = NULL; |
601 |
> |
} |
602 |
> |
} else { |
603 |
> |
if (current_pointer != null_pointer) { |
604 |
> |
// Hide mouse pointer inside window |
605 |
> |
SetPointer(drv->the_win, null_pointer, 1, 16, 0, 0); |
606 |
> |
current_pointer = null_pointer; |
607 |
> |
} |
608 |
|
} |
609 |
< |
} else { |
610 |
< |
if (current_pointer != null_pointer) { |
611 |
< |
// Hide mouse pointer inside window |
612 |
< |
SetPointer(drv->the_win, null_pointer, 1, 16, 0, 0); |
613 |
< |
current_pointer = null_pointer; |
614 |
< |
} |
615 |
< |
} |
616 |
< |
break; |
617 |
< |
} |
609 |
> |
break; |
610 |
> |
} |
611 |
|
break; |
612 |
|
|
613 |
|
case IDCMP_MOUSEBUTTONS: |
837 |
|
driver_window::driver_window(Amiga_monitor_desc &m, int width, int height) |
838 |
|
: black_pen(-1), white_pen(-1), driver_base(m) |
839 |
|
{ |
840 |
< |
// Set relative mouse mode |
840 |
> |
// Set absolute mouse mode |
841 |
|
ADBSetRelMouseMode(false); |
842 |
|
|
843 |
|
// Open window |
906 |
|
driver_pip::driver_pip(Amiga_monitor_desc &m, int width, int height) |
907 |
|
: driver_base(m) |
908 |
|
{ |
909 |
< |
// Set relative mouse mode |
909 |
> |
// Set absolute mouse mode |
910 |
|
ADBSetRelMouseMode(false); |
911 |
|
|
912 |
+ |
D(bug("driver_pip(%d,%d)\n", width, height)); |
913 |
+ |
|
914 |
|
// Open window |
915 |
|
ULONG error = 0; |
916 |
|
the_win = p96PIP_OpenTags( |
918 |
|
P96PIP_SourceWidth, width, |
919 |
|
P96PIP_SourceHeight, height, |
920 |
|
P96PIP_ErrorCode, (ULONG)&error, |
921 |
+ |
P96PIP_AllowCropping, true, |
922 |
|
WA_Left, 0, WA_Top, 0, |
923 |
|
WA_InnerWidth, width, WA_InnerHeight, height, |
924 |
|
WA_SimpleRefresh, true, |
960 |
|
driver_screen_p96::driver_screen_p96(Amiga_monitor_desc &m, ULONG mode_id) |
961 |
|
: driver_base(m) |
962 |
|
{ |
963 |
< |
// Set absolute mouse mode |
963 |
> |
// Set relative mouse mode |
964 |
|
ADBSetRelMouseMode(true); |
965 |
|
|
966 |
|
// Check if the mode is one we can handle |
1163 |
|
// And load it |
1164 |
|
LoadRGB32(&the_screen->ViewPort, table); |
1165 |
|
} |
1170 |
– |
|