--- BasiliskII/src/AmigaOS/video_amiga.cpp 2000/07/14 21:29:12 1.6 +++ BasiliskII/src/AmigaOS/video_amiga.cpp 2000/10/16 17:37:58 1.11 @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,6 +33,7 @@ #include #include "sysdeps.h" +#include "cpu_emulation.h" #include "main.h" #include "adb.h" #include "prefs.h" @@ -57,6 +58,8 @@ static int display_type = DISPLAY_WINDOW static struct Screen *the_screen = NULL; static struct Window *the_win = NULL; static struct BitMap *the_bitmap = NULL; +static UWORD *null_pointer = NULL; // Blank mouse pointer data +static UWORD *current_pointer = (UWORD *)-1; // Currently visible mouse pointer data static LONG black_pen = -1, white_pen = -1; static struct Process *periodic_proc = NULL; // Periodic process @@ -282,7 +285,8 @@ static bool init_screen_cgfx(ULONG mode_ break; case 15: case 16: - if (format != PIXFMT_RGB16) { + // !!! PIXFMT_RGB15 is correct !!! + if (format != PIXFMT_RGB15) { ErrorAlert(GetString(STR_WRONG_SCREEN_FORMAT_ERR)); return false; } @@ -352,6 +356,13 @@ static bool init_screen_cgfx(ULONG mode_ bool VideoInit(bool classic) { + // Allocate blank mouse pointer data + null_pointer = (UWORD *)AllocMem(12, MEMF_PUBLIC | MEMF_CHIP | MEMF_CLEAR); + if (null_pointer == NULL) { + ErrorAlert(GetString(STR_NO_MEM_ERR)); + return false; + } + // Read frame skip prefs frame_skip = PrefsFindInt32("frameskip"); if (frame_skip == 0) @@ -488,6 +499,12 @@ void VideoExit(void) } break; } + + // Free mouse pointer + if (null_pointer) { + FreeMem(null_pointer, 12); + null_pointer = NULL; + } } @@ -598,10 +615,26 @@ static __saveds void periodic_func(void) // Handle message according to class switch (cl) { case IDCMP_MOUSEMOVE: - if (display_type == DISPLAY_SCREEN || display_type == DISPLAY_SCREEN_CGFX) + if (display_type == DISPLAY_SCREEN_P96 || display_type == DISPLAY_SCREEN_CGFX) ADBMouseMoved(mx, my); - else + else { ADBMouseMoved(mx - the_win->BorderLeft, my - the_win->BorderTop); + if (mx < the_win->BorderLeft + || my < the_win->BorderTop + || mx >= the_win->BorderLeft + VideoMonitor.x + || my >= the_win->BorderTop + VideoMonitor.y) { + if (current_pointer) { + ClearPointer(the_win); + current_pointer = NULL; + } + } else { + if (current_pointer != null_pointer) { + // Hide mouse pointer inside window + SetPointer(the_win, null_pointer, 1, 16, 0, 0); + current_pointer = null_pointer; + } + } + } break; case IDCMP_MOUSEBUTTONS: @@ -622,6 +655,13 @@ static __saveds void periodic_func(void) case IDCMP_RAWKEY: if (qualifier & IEQUALIFIER_REPEAT) // Keyboard repeat is done by MacOS break; + if ((qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL)) == + (IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL) && code == 0x5f) { + SetInterruptFlag(INTFLAG_NMI); + TriggerInterrupt(); + break; + } + if (code & IECODE_UP_PREFIX) ADBKeyUp(keycode2mac[code & 0x7f]); else