1 |
|
/* |
2 |
|
* video_amiga.cpp - Video/graphics emulation, AmigaOS specific stuff |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2001 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 |
22 |
|
#include <intuition/intuition.h> |
23 |
|
#include <graphics/rastport.h> |
24 |
|
#include <graphics/gfx.h> |
25 |
< |
#include <cybergraphx/cybergraphics.h> |
25 |
> |
#include <cybergraphics/cybergraphics.h> |
26 |
|
#include <dos/dostags.h> |
27 |
|
#include <devices/timer.h> |
28 |
|
#include <proto/exec.h> |
33 |
|
#include <proto/cybergraphics.h> |
34 |
|
|
35 |
|
#include "sysdeps.h" |
36 |
+ |
#include "cpu_emulation.h" |
37 |
|
#include "main.h" |
38 |
|
#include "adb.h" |
39 |
|
#include "prefs.h" |
48 |
|
enum { |
49 |
|
DISPLAY_WINDOW, |
50 |
|
DISPLAY_PIP, |
51 |
< |
DISPLAY_SCREEN |
51 |
> |
DISPLAY_SCREEN_P96, |
52 |
> |
DISPLAY_SCREEN_CGFX |
53 |
|
}; |
54 |
|
|
55 |
|
// Global variables |
58 |
|
static struct Screen *the_screen = NULL; |
59 |
|
static struct Window *the_win = NULL; |
60 |
|
static struct BitMap *the_bitmap = NULL; |
61 |
+ |
static UWORD *null_pointer = NULL; // Blank mouse pointer data |
62 |
+ |
static UWORD *current_pointer = (UWORD *)-1; // Currently visible mouse pointer data |
63 |
|
static LONG black_pen = -1, white_pen = -1; |
64 |
|
static struct Process *periodic_proc = NULL; // Periodic process |
61 |
– |
static bool is_cgfx = false; // Flag: screen mode is a CyberGfx mode |
62 |
– |
static bool is_p96 = false; // Flag: screen mode is a Picasso96 mode |
65 |
|
|
66 |
|
extern struct Task *MainTask; // Pointer to main task (from main_amiga.cpp) |
67 |
|
|
95 |
|
* Initialization |
96 |
|
*/ |
97 |
|
|
98 |
+ |
// Add resolution to list of supported modes and set VideoMonitor |
99 |
+ |
static void set_video_monitor(uint32 width, uint32 height, uint32 bytes_per_row, int depth) |
100 |
+ |
{ |
101 |
+ |
video_mode mode; |
102 |
+ |
|
103 |
+ |
mode.x = width; |
104 |
+ |
mode.y = height; |
105 |
+ |
mode.resolution_id = 0x80; |
106 |
+ |
mode.bytes_per_row = bytes_per_row; |
107 |
+ |
|
108 |
+ |
switch (depth) { |
109 |
+ |
case 1: |
110 |
+ |
mode.depth = VDEPTH_1BIT; |
111 |
+ |
break; |
112 |
+ |
case 2: |
113 |
+ |
mode.depth = VDEPTH_2BIT; |
114 |
+ |
break; |
115 |
+ |
case 4: |
116 |
+ |
mode.depth = VDEPTH_4BIT; |
117 |
+ |
break; |
118 |
+ |
case 8: |
119 |
+ |
mode.depth = VDEPTH_8BIT; |
120 |
+ |
break; |
121 |
+ |
case 15: |
122 |
+ |
case 16: |
123 |
+ |
mode.depth = VDEPTH_16BIT; |
124 |
+ |
break; |
125 |
+ |
case 24: |
126 |
+ |
case 32: |
127 |
+ |
mode.depth = VDEPTH_32BIT; |
128 |
+ |
break; |
129 |
+ |
} |
130 |
+ |
|
131 |
+ |
VideoModes.push_back(mode); |
132 |
+ |
VideoMonitor.mode = mode; |
133 |
+ |
} |
134 |
+ |
|
135 |
|
// Open window |
136 |
|
static bool init_window(int width, int height) |
137 |
|
{ |
154 |
|
TAG_END |
155 |
|
); |
156 |
|
if (the_win == NULL) { |
157 |
< |
ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); |
157 |
> |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
158 |
|
return false; |
159 |
|
} |
160 |
|
|
161 |
|
// Create bitmap ("height + 2" for safety) |
162 |
|
the_bitmap = AllocBitMap(width, height + 2, 1, BMF_CLEAR, NULL); |
163 |
|
if (the_bitmap == NULL) { |
164 |
< |
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
164 |
> |
ErrorAlert(STR_NO_MEM_ERR); |
165 |
|
return false; |
166 |
|
} |
167 |
|
|
168 |
< |
// Set VideoMonitor |
168 |
> |
// Add resolution and set VideoMonitor |
169 |
> |
set_video_monitor(width, height, the_bitmap->BytesPerRow, 1); |
170 |
|
VideoMonitor.mac_frame_base = (uint32)the_bitmap->Planes[0]; |
131 |
– |
VideoMonitor.bytes_per_row = the_bitmap->BytesPerRow; |
132 |
– |
VideoMonitor.x = width; |
133 |
– |
VideoMonitor.y = height; |
134 |
– |
VideoMonitor.mode = VMODE_1BIT; |
171 |
|
|
172 |
|
// Set FgPen and BgPen |
173 |
|
black_pen = ObtainBestPenA(the_win->WScreen->ViewPort.ColorMap, 0, 0, 0, NULL); |
206 |
|
TAG_END |
207 |
|
); |
208 |
|
if (the_win == NULL || error) { |
209 |
< |
ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); |
209 |
> |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
210 |
|
return false; |
211 |
|
} |
212 |
|
|
213 |
|
// Find bitmap |
214 |
|
p96PIP_GetTags(the_win, P96PIP_SourceBitMap, (ULONG)&the_bitmap, TAG_END); |
215 |
|
|
216 |
< |
// Set VideoMonitor |
216 |
> |
// Add resolution and set VideoMonitor |
217 |
|
VideoMonitor.mac_frame_base = p96GetBitMapAttr(the_bitmap, P96BMA_MEMORY); |
218 |
< |
VideoMonitor.bytes_per_row = p96GetBitMapAttr(the_bitmap, P96BMA_BYTESPERROW); |
183 |
< |
VideoMonitor.x = width; |
184 |
< |
VideoMonitor.y = height; |
185 |
< |
VideoMonitor.mode = VMODE_16BIT; |
218 |
> |
set_video_monitor(width, height, p96GetBitMapAttr(the_bitmap, P96BMA_BYTESPERROW), 16); |
219 |
|
return true; |
220 |
|
} |
221 |
|
|
222 |
< |
// Open screen (requires Picasso96/CyberGfx as we need chunky modes) |
223 |
< |
static bool init_screen(ULONG mode_id) |
222 |
> |
// Open Picasso96 screen |
223 |
> |
static bool init_screen_p96(ULONG mode_id) |
224 |
|
{ |
225 |
|
// Set relative mouse mode |
226 |
|
ADBSetRelMouseMode(true); |
227 |
|
|
228 |
< |
// Check whether the mode is a Picasso96 mode or a CyberGfx mode |
229 |
< |
if (P96Base && p96GetModeIDAttr(mode_id, P96IDA_ISP96)) |
230 |
< |
is_p96 = true; |
231 |
< |
else if (CyberGfxBase && IsCyberModeID(mode_id)) |
232 |
< |
is_cgfx = true; |
233 |
< |
else { |
234 |
< |
ErrorAlert(GetString(STR_NO_P96_MODE_ERR)); |
228 |
> |
// Check if the mode is one we can handle |
229 |
> |
uint32 depth = p96GetModeIDAttr(mode_id, P96IDA_DEPTH); |
230 |
> |
uint32 format = p96GetModeIDAttr(mode_id, P96IDA_RGBFORMAT); |
231 |
> |
|
232 |
> |
switch (depth) { |
233 |
> |
case 8: |
234 |
> |
break; |
235 |
> |
case 15: |
236 |
> |
case 16: |
237 |
> |
if (format != RGBFB_R5G5B5) { |
238 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
239 |
> |
return false; |
240 |
> |
} |
241 |
> |
break; |
242 |
> |
case 24: |
243 |
> |
case 32: |
244 |
> |
if (format != RGBFB_A8R8G8B8) { |
245 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
246 |
> |
return false; |
247 |
> |
} |
248 |
> |
break; |
249 |
> |
default: |
250 |
> |
ErrorAlert(STR_WRONG_SCREEN_DEPTH_ERR); |
251 |
> |
return false; |
252 |
> |
} |
253 |
> |
|
254 |
> |
// Yes, get width and height |
255 |
> |
uint32 width = p96GetModeIDAttr(mode_id, P96IDA_WIDTH); |
256 |
> |
uint32 height = p96GetModeIDAttr(mode_id, P96IDA_HEIGHT); |
257 |
> |
|
258 |
> |
// Open screen |
259 |
> |
the_screen = p96OpenScreenTags( |
260 |
> |
P96SA_DisplayID, mode_id, |
261 |
> |
P96SA_Title, (ULONG)GetString(STR_WINDOW_TITLE), |
262 |
> |
P96SA_Quiet, TRUE, |
263 |
> |
P96SA_NoMemory, TRUE, |
264 |
> |
P96SA_NoSprite, TRUE, |
265 |
> |
P96SA_Exclusive, TRUE, |
266 |
> |
TAG_END |
267 |
> |
); |
268 |
> |
if (the_screen == NULL) { |
269 |
> |
ErrorAlert(STR_OPEN_SCREEN_ERR); |
270 |
> |
return false; |
271 |
> |
} |
272 |
> |
|
273 |
> |
// Open window |
274 |
> |
the_win = OpenWindowTags(NULL, |
275 |
> |
WA_Left, 0, WA_Top, 0, |
276 |
> |
WA_Width, width, WA_Height, height, |
277 |
> |
WA_NoCareRefresh, TRUE, |
278 |
> |
WA_Borderless, TRUE, |
279 |
> |
WA_Activate, TRUE, |
280 |
> |
WA_RMBTrap, TRUE, |
281 |
> |
WA_ReportMouse, TRUE, |
282 |
> |
WA_CustomScreen, (ULONG)the_screen, |
283 |
> |
TAG_END |
284 |
> |
); |
285 |
> |
if (the_win == NULL) { |
286 |
> |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
287 |
|
return false; |
288 |
|
} |
289 |
|
|
290 |
< |
uint32 depth; |
291 |
< |
uint32 format; |
290 |
> |
ScreenToFront(the_screen); |
291 |
> |
|
292 |
> |
// Add resolution and set VideoMonitor |
293 |
> |
set_video_monitor(width, height, p96GetBitMapAttr(the_screen->RastPort.BitMap, P96BMA_BYTESPERROW), depth); |
294 |
> |
VideoMonitor.mac_frame_base = p96GetBitMapAttr(the_screen->RastPort.BitMap, P96BMA_MEMORY); |
295 |
> |
return true; |
296 |
> |
} |
297 |
> |
|
298 |
> |
// Open CyberGraphX screen |
299 |
> |
static bool init_screen_cgfx(ULONG mode_id) |
300 |
> |
{ |
301 |
> |
// Set relative mouse mode |
302 |
> |
ADBSetRelMouseMode(true); |
303 |
|
|
304 |
|
// Check if the mode is one we can handle |
305 |
< |
if (is_p96) { |
306 |
< |
depth = p96GetModeIDAttr(mode_id, P96IDA_DEPTH); |
211 |
< |
format = p96GetModeIDAttr(mode_id, P96IDA_RGBFORMAT); |
212 |
< |
} else { |
213 |
< |
depth = GetCyberIDAttr(CYBRIDATTR_DEPTH, mode_id); |
214 |
< |
format = GetCyberIDAttr(CYBRIDATTR_PIXFMT, mode_id); |
215 |
< |
} |
305 |
> |
uint32 depth = GetCyberIDAttr(CYBRIDATTR_DEPTH, mode_id); |
306 |
> |
uint32 format = GetCyberIDAttr(CYBRIDATTR_PIXFMT, mode_id); |
307 |
|
|
308 |
|
switch (depth) { |
309 |
|
case 8: |
219 |
– |
VideoMonitor.mode = VMODE_8BIT; |
310 |
|
break; |
311 |
|
case 15: |
312 |
|
case 16: |
313 |
< |
if (format != RGBFB_R5G5B5 && format != PIXFMT_RGB16) { |
314 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_FORMAT_ERR)); |
313 |
> |
// !!! PIXFMT_RGB15 is correct !!! |
314 |
> |
if (format != PIXFMT_RGB15) { |
315 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
316 |
|
return false; |
317 |
|
} |
227 |
– |
VideoMonitor.mode = VMODE_16BIT; |
318 |
|
break; |
319 |
|
case 24: |
320 |
|
case 32: |
321 |
< |
if (format != RGBFB_A8R8G8B8 && format != PIXFMT_ARGB32) { |
322 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_FORMAT_ERR)); |
321 |
> |
if (format != PIXFMT_ARGB32) { |
322 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
323 |
|
return false; |
324 |
|
} |
235 |
– |
VideoMonitor.mode = VMODE_32BIT; |
325 |
|
break; |
326 |
|
default: |
327 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_DEPTH_ERR)); |
327 |
> |
ErrorAlert(STR_WRONG_SCREEN_DEPTH_ERR); |
328 |
|
return false; |
329 |
|
} |
330 |
|
|
331 |
|
// Yes, get width and height |
332 |
< |
uint32 width; |
333 |
< |
uint32 height; |
245 |
< |
|
246 |
< |
if (is_p96) { |
247 |
< |
width = p96GetModeIDAttr(mode_id, P96IDA_WIDTH); |
248 |
< |
height = p96GetModeIDAttr(mode_id, P96IDA_HEIGHT); |
249 |
< |
} else { |
250 |
< |
width = GetCyberIDAttr(CYBRIDATTR_WIDTH, mode_id); |
251 |
< |
height = GetCyberIDAttr(CYBRIDATTR_HEIGHT, mode_id); |
252 |
< |
} |
253 |
< |
VideoMonitor.x = width; |
254 |
< |
VideoMonitor.y = height; |
332 |
> |
uint32 width = GetCyberIDAttr(CYBRIDATTR_WIDTH, mode_id); |
333 |
> |
uint32 height = GetCyberIDAttr(CYBRIDATTR_HEIGHT, mode_id); |
334 |
|
|
335 |
|
// Open screen |
336 |
< |
if (is_p96) { |
337 |
< |
the_screen = p96OpenScreenTags( |
338 |
< |
P96SA_DisplayID, mode_id, |
339 |
< |
P96SA_Title, (ULONG)GetString(STR_WINDOW_TITLE), |
340 |
< |
P96SA_Quiet, TRUE, |
341 |
< |
P96SA_NoMemory, TRUE, |
342 |
< |
P96SA_NoSprite, TRUE, |
264 |
< |
P96SA_Exclusive, TRUE, |
265 |
< |
TAG_END |
266 |
< |
); |
267 |
< |
} else { |
268 |
< |
the_screen = OpenScreenTags(NULL, |
269 |
< |
SA_DisplayID, mode_id, |
270 |
< |
SA_Title, (ULONG)GetString(STR_WINDOW_TITLE), |
271 |
< |
SA_Quiet, TRUE, |
272 |
< |
SA_Exclusive, TRUE, |
273 |
< |
TAG_END |
274 |
< |
); |
275 |
< |
} |
276 |
< |
|
336 |
> |
the_screen = OpenScreenTags(NULL, |
337 |
> |
SA_DisplayID, mode_id, |
338 |
> |
SA_Title, (ULONG)GetString(STR_WINDOW_TITLE), |
339 |
> |
SA_Quiet, TRUE, |
340 |
> |
SA_Exclusive, TRUE, |
341 |
> |
TAG_END |
342 |
> |
); |
343 |
|
if (the_screen == NULL) { |
344 |
< |
ErrorAlert(GetString(STR_OPEN_SCREEN_ERR)); |
344 |
> |
ErrorAlert(STR_OPEN_SCREEN_ERR); |
345 |
|
return false; |
346 |
|
} |
347 |
|
|
358 |
|
TAG_END |
359 |
|
); |
360 |
|
if (the_win == NULL) { |
361 |
< |
ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); |
361 |
> |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
362 |
|
return false; |
363 |
|
} |
364 |
|
|
299 |
– |
// Set VideoMonitor |
365 |
|
ScreenToFront(the_screen); |
366 |
< |
if (is_p96) { |
367 |
< |
VideoMonitor.mac_frame_base = p96GetBitMapAttr(the_screen->RastPort.BitMap, P96BMA_MEMORY); |
368 |
< |
VideoMonitor.bytes_per_row = p96GetBitMapAttr(the_screen->RastPort.BitMap, P96BMA_BYTESPERROW); |
369 |
< |
} else { |
370 |
< |
static UWORD ptr[] = { 0, 0, 0, 0 }; |
371 |
< |
SetPointer(the_win, ptr, 0, 0, 0, 0); // Hide Pointer |
372 |
< |
|
373 |
< |
APTR handle = LockBitMapTags(the_screen->RastPort.BitMap, |
374 |
< |
LBMI_BASEADDRESS, (ULONG)&VideoMonitor.mac_frame_base, |
375 |
< |
TAG_END); |
376 |
< |
UnLockBitMap(handle); |
377 |
< |
VideoMonitor.bytes_per_row = GetCyberMapAttr(the_screen->RastPort.BitMap, CYBRMATTR_XMOD); |
313 |
< |
} |
366 |
> |
static UWORD ptr[] = { 0, 0, 0, 0 }; |
367 |
> |
SetPointer(the_win, ptr, 0, 0, 0, 0); // Hide mouse pointer |
368 |
> |
|
369 |
> |
// Set VideoMonitor |
370 |
> |
ULONG frame_base; |
371 |
> |
APTR handle = LockBitMapTags(the_screen->RastPort.BitMap, |
372 |
> |
LBMI_BASEADDRESS, (ULONG)&frame_base, |
373 |
> |
TAG_END |
374 |
> |
); |
375 |
> |
UnLockBitMap(handle); |
376 |
> |
set_video_monitor(width, height, GetCyberMapAttr(the_screen->RastPort.BitMap, CYBRMATTR_XMOD), depth); |
377 |
> |
VideoMonitor.mac_frame_base = frame_base; |
378 |
|
return true; |
379 |
|
} |
380 |
|
|
381 |
|
bool VideoInit(bool classic) |
382 |
|
{ |
383 |
+ |
// Allocate blank mouse pointer data |
384 |
+ |
null_pointer = (UWORD *)AllocMem(12, MEMF_PUBLIC | MEMF_CHIP | MEMF_CLEAR); |
385 |
+ |
if (null_pointer == NULL) { |
386 |
+ |
ErrorAlert(STR_NO_MEM_ERR); |
387 |
+ |
return false; |
388 |
+ |
} |
389 |
+ |
|
390 |
|
// Read frame skip prefs |
391 |
|
frame_skip = PrefsFindInt32("frameskip"); |
392 |
|
if (frame_skip == 0) |
408 |
|
display_type = DISPLAY_WINDOW; |
409 |
|
else if (sscanf(mode_str, "pip/%d/%d", &width, &height) == 2 && P96Base) |
410 |
|
display_type = DISPLAY_PIP; |
411 |
< |
else if (sscanf(mode_str, "scr/%08lx", &mode_id) == 1 && (CyberGfxBase || P96Base)) |
412 |
< |
display_type = DISPLAY_SCREEN; |
411 |
> |
else if (sscanf(mode_str, "scr/%08lx", &mode_id) == 1 && (CyberGfxBase || P96Base)) { |
412 |
> |
if (P96Base && p96GetModeIDAttr(mode_id, P96IDA_ISP96)) |
413 |
> |
display_type = DISPLAY_SCREEN_P96; |
414 |
> |
else if (CyberGfxBase && IsCyberModeID(mode_id)) |
415 |
> |
display_type = DISPLAY_SCREEN_CGFX; |
416 |
> |
else { |
417 |
> |
ErrorAlert(STR_NO_P96_MODE_ERR); |
418 |
> |
return false; |
419 |
> |
} |
420 |
> |
} |
421 |
|
} |
422 |
|
|
423 |
|
// Open display |
432 |
|
return false; |
433 |
|
break; |
434 |
|
|
435 |
< |
case DISPLAY_SCREEN: |
436 |
< |
if (!init_screen(mode_id)) |
435 |
> |
case DISPLAY_SCREEN_P96: |
436 |
> |
if (!init_screen_p96(mode_id)) |
437 |
> |
return false; |
438 |
> |
break; |
439 |
> |
|
440 |
> |
case DISPLAY_SCREEN_CGFX: |
441 |
> |
if (!init_screen_cgfx(mode_id)) |
442 |
|
return false; |
443 |
|
break; |
444 |
|
} |
451 |
|
TAG_END |
452 |
|
); |
453 |
|
if (periodic_proc == NULL) { |
454 |
< |
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
454 |
> |
ErrorAlert(STR_NO_MEM_ERR); |
455 |
|
return false; |
456 |
|
} |
457 |
|
return true; |
497 |
|
p96PIP_Close(the_win); |
498 |
|
break; |
499 |
|
|
500 |
< |
case DISPLAY_SCREEN: |
500 |
> |
case DISPLAY_SCREEN_P96: |
501 |
|
|
502 |
|
// Close window |
503 |
|
if (the_win) |
505 |
|
|
506 |
|
// Close screen |
507 |
|
if (the_screen) { |
508 |
< |
if (is_p96) |
509 |
< |
p96CloseScreen(the_screen); |
510 |
< |
else |
511 |
< |
CloseScreen(the_screen); |
508 |
> |
p96CloseScreen(the_screen); |
509 |
> |
the_screen = NULL; |
510 |
> |
} |
511 |
> |
break; |
512 |
> |
|
513 |
> |
case DISPLAY_SCREEN_CGFX: |
514 |
> |
|
515 |
> |
// Close window |
516 |
> |
if (the_win) |
517 |
> |
CloseWindow(the_win); |
518 |
|
|
519 |
+ |
// Close screen |
520 |
+ |
if (the_screen) { |
521 |
+ |
CloseScreen(the_screen); |
522 |
|
the_screen = NULL; |
523 |
|
} |
524 |
|
break; |
525 |
|
} |
526 |
+ |
|
527 |
+ |
// Free mouse pointer |
528 |
+ |
if (null_pointer) { |
529 |
+ |
FreeMem(null_pointer, 12); |
530 |
+ |
null_pointer = NULL; |
531 |
+ |
} |
532 |
|
} |
533 |
|
|
534 |
|
|
538 |
|
|
539 |
|
void video_set_palette(uint8 *pal) |
540 |
|
{ |
541 |
< |
if (display_type == DISPLAY_SCREEN) { |
541 |
> |
if ((display_type == DISPLAY_SCREEN_P96 || display_type == DISPLAY_SCREEN_CGFX) |
542 |
> |
&& !IsDirectMode(VideoMonitor.mode)) { |
543 |
|
|
544 |
|
// Convert palette to 32 bits |
545 |
|
ULONG table[2 + 256 * 3]; |
558 |
|
|
559 |
|
|
560 |
|
/* |
561 |
+ |
* Switch video mode |
562 |
+ |
*/ |
563 |
+ |
|
564 |
+ |
void video_switch_to_mode(const video_mode &mode) |
565 |
+ |
{ |
566 |
+ |
} |
567 |
+ |
|
568 |
+ |
|
569 |
+ |
/* |
570 |
|
* Video message handling (not neccessary under AmigaOS, handled by periodic_func()) |
571 |
|
*/ |
572 |
|
|
591 |
|
if (win_port) { |
592 |
|
win_mask = 1 << win_port->mp_SigBit; |
593 |
|
the_win->UserPort = win_port; |
594 |
< |
ModifyIDCMP(the_win, IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_RAWKEY | (display_type == DISPLAY_SCREEN ? IDCMP_DELTAMOVE : 0)); |
594 |
> |
ModifyIDCMP(the_win, IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_RAWKEY | ((display_type == DISPLAY_SCREEN_P96 || display_type == DISPLAY_SCREEN_CGFX) ? IDCMP_DELTAMOVE : 0)); |
595 |
|
} |
596 |
|
|
597 |
|
// Start 60Hz timer for window refresh |
624 |
|
|
625 |
|
// Timer tick, update display |
626 |
|
BltTemplate(the_bitmap->Planes[0], 0, the_bitmap->BytesPerRow, the_win->RPort, |
627 |
< |
the_win->BorderLeft, the_win->BorderTop, VideoMonitor.x, VideoMonitor.y); |
627 |
> |
the_win->BorderLeft, the_win->BorderTop, VideoMonitor.mode.x, VideoMonitor.mode.y); |
628 |
|
|
629 |
|
// Restart timer |
630 |
|
timer_io->tr_node.io_Command = TR_ADDREQUEST; |
649 |
|
// Handle message according to class |
650 |
|
switch (cl) { |
651 |
|
case IDCMP_MOUSEMOVE: |
652 |
< |
if (display_type == DISPLAY_SCREEN) |
652 |
> |
if (display_type == DISPLAY_SCREEN_P96 || display_type == DISPLAY_SCREEN_CGFX) |
653 |
|
ADBMouseMoved(mx, my); |
654 |
< |
else |
654 |
> |
else { |
655 |
|
ADBMouseMoved(mx - the_win->BorderLeft, my - the_win->BorderTop); |
656 |
+ |
if (mx < the_win->BorderLeft |
657 |
+ |
|| my < the_win->BorderTop |
658 |
+ |
|| mx >= the_win->BorderLeft + VideoMonitor.mode.x |
659 |
+ |
|| my >= the_win->BorderTop + VideoMonitor.mode.y) { |
660 |
+ |
if (current_pointer) { |
661 |
+ |
ClearPointer(the_win); |
662 |
+ |
current_pointer = NULL; |
663 |
+ |
} |
664 |
+ |
} else { |
665 |
+ |
if (current_pointer != null_pointer) { |
666 |
+ |
// Hide mouse pointer inside window |
667 |
+ |
SetPointer(the_win, null_pointer, 1, 16, 0, 0); |
668 |
+ |
current_pointer = null_pointer; |
669 |
+ |
} |
670 |
+ |
} |
671 |
+ |
} |
672 |
|
break; |
673 |
|
|
674 |
|
case IDCMP_MOUSEBUTTONS: |
689 |
|
case IDCMP_RAWKEY: |
690 |
|
if (qualifier & IEQUALIFIER_REPEAT) // Keyboard repeat is done by MacOS |
691 |
|
break; |
692 |
+ |
if ((qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL)) == |
693 |
+ |
(IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL) && code == 0x5f) { |
694 |
+ |
SetInterruptFlag(INTFLAG_NMI); |
695 |
+ |
TriggerInterrupt(); |
696 |
+ |
break; |
697 |
+ |
} |
698 |
+ |
|
699 |
|
if (code & IECODE_UP_PREFIX) |
700 |
|
ADBKeyUp(keycode2mac[code & 0x7f]); |
701 |
|
else |