Beispiel #1
0
void
VGLEnd(void)
{
struct vt_mode smode;

  if (!VGLInitDone)
    return;
  VGLInitDone = 0;
  VGLSwitchPending = 0;
  VGLAbortPending = 0;

  signal(SIGUSR1, SIG_IGN);

  if (VGLMem != MAP_FAILED) {
    VGLClear(VGLDisplay, 0);
    munmap(VGLMem, VGLAdpInfo.va_window_size);
  }

  if (VGLOldMode >= M_VESA_BASE) {
    /* ugly, but necessary */
    ioctl(0, _IO('V', VGLOldMode - M_VESA_BASE), 0);
    if (VGLOldMode == M_VESA_800x600) {
      int size[3];
      size[0] = VGLOldWSize.ws_col;
      size[1] = VGLOldWSize.ws_row;
      size[2] = 16;
      ioctl(0, KDRASTER, size);
    }
  } else {
    ioctl(0, _IO('S', VGLOldMode), 0);
  }
  ioctl(0, KDDISABIO, 0);
  ioctl(0, KDSETMODE, KD_TEXT);
  smode.mode = VT_AUTO;
  ioctl(0, VT_SETMODE, &smode);
  if (VGLBuf)
    free(VGLBuf);
  VGLBuf = NULL;
  free(VGLDisplay);
  VGLDisplay = NULL;
  VGLKeyboardEnd();
}
void VGL_VideoQuit(_THIS)
{
	int i, j;

	
	VGLKeyboardEnd();

	
	if (VGLCurMode != NULL) {
		VGLEnd();
		SDL_free(VGLCurMode);
		VGLCurMode = NULL;
	}

	
	if (hw_lock != NULL) {
		SDL_DestroyMutex(hw_lock);
		hw_lock = NULL;
	}

	
	for (i = 0; i < NUM_MODELISTS; i++) {
		if (SDL_modelist[i] != NULL) {
			for (j = 0; SDL_modelist[i][j] != NULL; ++j) {
				SDL_free(SDL_modelist[i][j]);
			}
			SDL_free(SDL_modelist[i]);
			SDL_modelist[i] = NULL;
		}
	}

	if ( this->screen && (this->screen->flags & SDL_HWSURFACE) ) {
	
		this->screen->pixels = NULL;
	}
}
Beispiel #3
0
/* Note:  If we are terminated, this could be called in the middle of
   another SDL video routine -- notably UpdateRects.
*/
void VGL_VideoQuit(_THIS)
{
	int i, j;

	/* Return the keyboard to the normal state */
	VGLKeyboardEnd();

	/* Reset the console video mode if we actually initialised one */
	if (VGLCurMode != NULL) {
		VGLEnd();
		SDL_free(VGLCurMode);
		VGLCurMode = NULL;
	}

	/* Clear the lock mutex */
	if (hw_lock != NULL) {
		SDL_DestroyMutex(hw_lock);
		hw_lock = NULL;
	}

	/* Free video mode lists */
	for (i = 0; i < NUM_MODELISTS; i++) {
		if (SDL_modelist[i] != NULL) {
			for (j = 0; SDL_modelist[i][j] != NULL; ++j) {
				SDL_free(SDL_modelist[i][j]);
			}
			SDL_free(SDL_modelist[i]);
			SDL_modelist[i] = NULL;
		}
	}

	if ( this->screen && (this->screen->flags & SDL_HWSURFACE) ) {
	/* Direct screen access, not a memory buffer */
		this->screen->pixels = NULL;
	}
}
Beispiel #4
0
void restorekeyb(void)
{
	VGLKeyboardEnd();
}