Exemple #1
0
static int enter_graphics_mode (int which)
{
    int oldmode = current_vgamode;
    vga_setmode (TEXT);
    if (vga_setmode (which) < 0) {
	sleep(1);
	vga_setmode (TEXT);
	write_log ("SVGAlib doesn't like my video mode (%d). Giving up.\n", which);
	return 0;
    }
    current_vgamode = which;

    linear_mem = 0;
    if ((modeinfo.flags & CAPABLE_LINEAR) && ! currprefs.svga_no_linear) {
	int val = vga_setlinearaddressing ();
	int new_ul = val != -1 ? !need_dither : 0;
	if (using_linear == -1)
	    using_linear = new_ul;
	else
	    if (using_linear != new_ul) {
		leave_graphics_mode ();
		write_log ("SVGAlib feeling not sure about linear modes???\n");
		abort ();
	    }
	if (val != -1) {
	    linear_mem = (char *)vga_getgraphmem ();
	    write_log ("Using linear addressing: %p.\n", linear_mem);
	}
    }

    return post_enter_graphics ();
}
Exemple #2
0
static void set_window_for_amiga (void)
{
    leave_graphics_mode ();
    enter_graphics_mode (vgamode);
    if (linear_mem != NULL && !need_dither)
	gfxvidinfo.bufmem = linear_mem;

    restore_vga_colors ();
}
Exemple #3
0
static int post_enter_graphics (void)
{
    vga_setmousesupport (1);
    mouse_init("/dev/mouse", vga_getmousetype (), 10);
    if (keyboard_init() != 0) {
	leave_graphics_mode ();
	write_log ("Are you sure you have a keyboard??\n");
	return 0;
    }
    keyboard_seteventhandler (my_kbd_handlerx);
    keyboard_translatekeys (DONT_CATCH_CTRLC);

    mouse_setxrange (-1000, 1000);
    mouse_setyrange (-1000, 1000);
    mouse_setposition (0, 0);

    return 1;
}
Exemple #4
0
void handle_events (void)
{
    int button = mouse_getbutton ();

    gui_requested = 0;
    keyboard_update ();
    mouse_update ();
    lastmx += mouse_getx ();
    lastmy += mouse_gety ();
    mouse_setposition (0, 0);

    buttonstate[0] = button & 4;
    buttonstate[1] = button & 2;
    buttonstate[2] = button & 1;

#ifdef PICASSO96
    if (screen_is_picasso && !picasso_vidinfo.extra_mem) {
	int i;
	char *addr = gfxmemory + (picasso96_state.Address - gfxmem_start);
	for (i = 0; i < picasso_vidinfo.height; i++, addr += picasso96_state.BytesPerRow) {
	    if (!picasso_invalid_lines[i])
		continue;
	    picasso_invalid_lines[i] = 0;
	    vga_drawscanline (i, addr);
	}
    }
#endif

    if (!screen_is_picasso && gui_requested) {
	leave_graphics_mode ();
	gui_changesettings ();
	enter_graphics_mode (vgamode);
	if (linear_mem != NULL && !need_dither)
	    gfxvidinfo.bufmem = linear_mem;
	restore_vga_colors ();
	notice_screen_contents_lost ();
    }
}
Exemple #5
0
void graphics_leave (void)
{
    leave_graphics_mode ();
    dumpcustom();
}