bool intern initmonitor( void ) /*****************************/ { struct _VIOMODEINFO vioMode; struct _VIOCONFIGINFO config; if( UIData == NULL ) { UIData = &ui_data; } vioMode.cb = sizeof(vioMode); if( VioGetMode(&vioMode, HANDLE) != 0 ) return( FALSE ); UIData->width = vioMode.col; UIData->height = vioMode.row; config.cb = sizeof(config); if( VioGetConfig(0,&config,0) != 0 ) return( FALSE ); if( config.display == 3 ) { UIData->colour = M_BW; } else { switch( config.adapter ) { case 0: UIData->colour = M_MONO; break; case 1: UIData->colour = M_CGA; break; case 2: UIData->colour = M_EGA; break; case 3: UIData->colour = M_VGA; break; default: UIData->colour = M_VGA; break; } } return( TRUE ); }
/* * ScreenInit - get screen info */ void ScreenInit( void ) { unsigned short solvb; struct _VIOCONFIGINFO config; struct _VIOMODEINFO vioMode; void * SEG16 ptr; vioMode.cb = sizeof( vioMode ); if( VioGetMode( &vioMode, 0 ) != 0 ) { FatalError( ERR_WIND_INVALID ); } EditVars.WindMaxWidth = vioMode.col; EditVars.WindMaxHeight = vioMode.row; config.cb = sizeof( config ); if( VioGetConfig( 0, &config, 0 ) != 0 ) { FatalError( ERR_WIND_INVALID ); } if( config.display == 3 ) { EditFlags.BlackAndWhite = TRUE; } else { if( config.adapter == 0 ) { EditFlags.Monocolor = TRUE; } else { EditFlags.Color = TRUE; } } VioGetBuf( (PULONG) &ptr, (PUSHORT) &solvb, 0); Scrn = ptr; ScreenPage( 0 ); } /* ScreenInit */
int PDC_query_adapter_type( VIOCONFIGINFO *configinfo ) #endif /***********************************************************************/ { #ifndef EMXVIDEO VIOCONFIGINFO aconfiginfo; #else int retval = _NONE; #endif #ifdef PDCDEBUG if (trace_on) PDC_debug("PDC_query_adapter_type() - called\n"); #endif #ifdef EMXVIDEO if (v_hardware() == V_MONOCHROME) retval = _UNIX_MONO; else retval = _UNIX_COLOR; return(retval); #else VioGetConfig( 0, &aconfiginfo, 0 ); *configinfo = aconfiginfo; return(OK); #endif }
/* * ScreenInit - get screen info */ void ScreenInit( void ) { unsigned short solvb; struct _VIOCONFIGINFO config; struct _VIOMODEINFO vioMode; void * SEG16 ptr; /* Set the cb member of VIOMODEINFO/VIOCONFIGINFO to smaller values * in order to be backward compatible with old OS/2 versions. */ vioMode.cb = offsetof( VIOMODEINFO, buf_addr ); if( VioGetMode( &vioMode, 0 ) != 0 ) { StartupError( ERR_WIND_INVALID ); } WindMaxWidth = vioMode.col; WindMaxHeight = vioMode.row; config.cb = offsetof( VIOCONFIGINFO, Configuration ); if( VioGetConfig( 0, &config, 0 ) != 0 ) { StartupError( ERR_WIND_INVALID ); } if( config.display == 3 ) { EditFlags.BlackAndWhite = TRUE; } else { if( config.adapter == 0 ) { EditFlags.Monocolor = TRUE; } else { EditFlags.Color = TRUE; } } VioGetBuf( (PULONG) &ptr, (PUSHORT) &solvb, 0); Scrn = ptr; ScreenPage( 0 ); } /* ScreenInit */
USHORT __pascal VIOGETCONFIG(const USHORT ConfigId, VIOCONFIGINFO * vioin, const HVIO hvio) { return VioGetConfig(ConfigId, vioin, hvio); }
//bool Vid::init(void) bool vid_init(void) { VIOMODEINFO viomode; VIOCONFIGINFO vioconfig; //USHORT _far16 *disp_address; //USHORT _far16 **temp = &disp_address; // BCC optimize workaround USHORT mode = 0; USHORT w_mode; vioconfig.cb = sizeof(vioconfig); rc = VioGetConfig(0, &vioconfig, 0); if(rc != 0) err_exit("Unknown VIDEO adapter", rc); /* #define COLORS_2 0x0001 VIOMODEINFO.color constants #define COLORS_4 0x0002 #define COLORS_16 0x0004 */ viomode.cb = sizeof(viomode); rc = VioGetMode(&viomode, 0); if(rc != 0) err_exit("Unknown VIDEO mode", rc); // set disp_address ptr, vidbufsize // rc = VioGetBuf((PULONG16)temp , &usvidbufsize, 0); // if(rc != 0) // err_exit(" Error in winstart.c VIOGETBUF", rc); mode = vioconfig.adapter; // set globals // saved_cursor= Vid::get_cursor(); /* #define DISPLAY_MONOCHROME 0x0000 VIOCONFIGINFO.adapter constants #define DISPLAY_CGA 0x0001 #define DISPLAY_EGA 0x0002 #define DISPLAY_VGA 0x0003 #define DISPLAY_8514A 0x0007 #define DISPLAY_IMAGEADAPTER 0x0008 #define DISPLAY_XGA 0x0009 */ /* #define MONITOR_MONOCHROME 0x0000 VIOCONFIGINFO.display constants #define MONITOR_COLOR 0x0001 #define MONITOR_ENHANCED 0x0002 #define MONITOR_8503 0x0003 #define MONITOR_851X_COLOR 0x0004 #define MONITOR_8514 0x0009 #define MONITOR_FLATPANEL 0x000A #define MONITOR_8507_8604 0x000B #define MONITOR_8515 0x000C #define MONITOR_9515 0x000F #define MONITOR_9517 0x0011 #define MONITOR_9518 0x0012 */ switch (mode) { case 0: // MDA adapter if(vioconfig.display == 0x0000) // monochrome screen w_mode = 2; break; case 1: w_mode= 1; // if((vioconfig.display == 0x0000) || (vioconfig.display == 13)) if(vioconfig.display == 0x0000) w_mode = 2; /* color card with mono screen */ break; case 2: case 3: /* color card */ /* OS/2 2.0 returns 8 for vga */ case 8: w_mode= 1; if(vioconfig.display == 0x0000) w_mode = 2; /* color card with mono screen */ break; case 7: w_mode= 2; /* BW card */ break; /* add more cases here, if needed */ case 10: /* OS/2 2.1 returns 10 for SVGA */ default: w_mode= 1; /* assume color SVGA card */ break; // return FALSE; /* unknown card */ } // vid_buf_length = viomode.buf_length; //#ifdef TESTING DBG_WIN1(dout<<endl<<" viomode.rows = "<< viomode.row<<endl); DBG_WIN1(dout<< "viomode.cols = " <<viomode.col<<endl); DBG_WIN1(dout<< "vid_buf_length = "<< viomode.buf_length<<endl); // writelog( "vid_full_length = %d\n", viomode.full_length); // writelog( "video buf size = %d\n", usvidbufsize); // pause(); // err_exit(" TEST", 14); //#endif return TRUE; }