/*
 * DANG_BEGIN_MODULE
 *
 *
 * DANG_END_MODULE
 *
 * DANG_BEGIN_CHANGELOG
 *
 * $Date: $
 * $Source: $
 * $Revision: $
 * $State: $
 *
 * $Log: $
 *
 * DANG_END_CHANGELOG
 */

#include "dosemu.h"
#include "env/setup.h"

extern struct video_system Video_graphics;
extern struct video_system Video_console;
extern struct video_system Video_hgc;


Boolean env_vga_detect(void)
{
  if (i_am_root && config.vga)
    return TRUE;

  config.vga = FALSE;
  if (i_am_root && config.console_video)
    return TRUE;

  config.console_video = FALSE;

#if 0
  if (config.usesX)
    return TRUE;
#endif

  return FALSE;
}

void env_vga_phase0_init(void)
{
}

void env_vga_phase1_init(void)
{
  if (i_am_root && config.vga) {
     v_printf("VID: Video set to Video_graphics\n");
     Video=&Video_graphics;
  }
  else if (i_am_root && config.console_video) {
     v_printf("VID: Video set to Video_console\n");
     Video=&Video_console;
  }
#if 0
  else if (config.usesX) {
     v_printf("VID: Video set to Video_hgc\n");
     Video=&Video_hgc;
  }

#if CONFIG_DUALMON
  {
    extern void init_dualmon(void);
    init_dualmon();
  }
#endif
#endif
  else {
    error("Unable to setup VIDEO structure -- we should never get here\n");
    leavedos(1);
  }

  Video->init();
}

void env_vga_phase1_reset(void)
{
  clear_screen(video_page, 7);
}

void env_vga_term(void)
{
  if (Video && Video->close) {
    Video->close();
  }
}
