/**************************************************************************** REMARKS: Main program entry point ****************************************************************************/ int main( int argc, char *argv[]) { GA_devCtx *dc = NULL; GA_configInfo info; N_uint8 capabilities = 0; N_int32 numMonitorPorts; GA_SCIFuncs sci; uchar edid[128]; EDID_record rec; N_int32 channel = SCI_channelMonitorPrimary; /* Get command line option for SNAP DDC channel */ if (argc > 1) channel = atoi(argv[1]); /* Now handle the query */ dc = LoadDriver(0); if (!dc) { printf("Unable to load SNAP DDC driver!\n"); return -1; } /* Display graphics driver info */ banner(); info.dwSize = sizeof(info); init.GetConfigInfo(&info); printf("Doing DDC for %s %s (device %d) on channel %d:\n\n", info.ManufacturerName, info.ChipsetName, dc->DeviceIndex, channel); /* Detect if the SCI interface is active */ sci.dwSize = sizeof(sci); if (GA_queryFunctions(dc,GA_GET_SCIFUNCS,&sci) && sci.SCIdetect(&capabilities,&numMonitorPorts)) { /* Initialise DDC2B communications */ if (DDC_initExt(dc,channel) == 0) { /* Read EDID data */ DDC_readEDID(0xA0,edid,sizeof(edid),0,channel); /* Parse EDID data and dump into formatted text file */ if (!EDID_parse(edid,&rec,false)) printf("Unable to parse EDID data!\n"); else if (!EDID_format(&rec,EDID_FILENAME)) printf("Unable to format EDID data!\n"); else printf("EDID data formatted into text file " EDID_FILENAME " \n"); printf("DDC channel %d EDID: %s %s\n",channel,rec.mfrName,rec.modelName); } else { printf("Could not perform DDC2B communications!\n"); } } else { printf("No DDC services available in driver!\n"); } /* Unload SNAP and exit */ GA_unloadDriver(dc); return 0; }
/**************************************************************************** REMARKS: Main program entry point ****************************************************************************/ int main( int argc, char *argv[]) { /* Now handle the query */ if (argc >= 2 && stricmp(argv[1],"show") == 0) ShowSettings(0); else if (argc >= 3) { LoadDriver(0); opt.LCDPanelWidth = atoi(argv[1]); opt.LCDPanelHeight = atoi(argv[2]); init.SetOptions(&opt); GA_saveOptions(dc,&opt); ShowSettings(0); } else help(); if (dc) GA_unloadDriver(dc); return 0; }
/**************************************************************************** REMARKS: Main program entry point ****************************************************************************/ int main( int argc, char *argv[]) { GA_devCtx *dc = NULL; /* Now handle the query */ if (argc >= 2 && stricmp(argv[1],"show") == 0) { dc = LoadDriver((argc > 2) ? atoi(argv[2]) : 0); ShowSettings(dc); } else if (argc >= 2 && stricmp(argv[1],"showvbe") == 0) { dc = LoadDriver((argc > 2) ? atoi(argv[2]) : 0); ShowVBESettings(dc); } else if (argc >= 5 && stricmp(argv[1],"add") == 0) { dc = LoadDriver((argc > 5) ? atoi(argv[5]) : 0); AddMode(dc,atoi(argv[2]),atoi(argv[3]),atoi(argv[4])); } else if (argc >= 5 && stricmp(argv[1],"addref") == 0) { dc = LoadDriver((argc > 5) ? atoi(argv[5]) : 0); AddRefresh(dc,atoi(argv[2]),atoi(argv[3]),atoi(argv[4])); } else if (argc >= 5 && stricmp(argv[1],"del") == 0) { dc = LoadDriver((argc > 5) ? atoi(argv[5]) : 0); DelMode(dc,atoi(argv[2]),atoi(argv[3]),atoi(argv[4])); } else if (argc >= 6 && stricmp(argv[1],"set") == 0) { dc = LoadDriver((argc > 6) ? atoi(argv[6]) : 0); SetMode(dc,atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]), (argc > 7) ? atoi(argv[7]) : 0); } else help(); if (dc) GA_unloadDriver(dc); return 0; }
/**************************************************************************** REMARKS: Main routine. Expects the x & y resolution of the desired video mode to be passed on the command line. Will print out a list of available video modes if no command line is present. ****************************************************************************/ int main( int argc, char *argv[]) { /* Check to see if we are running in a window */ if (PM_runningInAWindow()) { printf("This program cannot run in a window. Please switch to a fullscreen mode.\n"); return -1; } /* Save the state of the console */ hwndConsole = PM_openConsole(0,0,640,480,8,true); if ((stateBuf = malloc(PM_getConsoleStateSize())) == NULL) PM_fatalError("Out of memory!"); PM_saveConsoleState(stateBuf,hwndConsole); /* Register our fatal error cleanup handler */ PM_setFatalErrorCleanup(FatalErrorCleanup); /* Register the ISV license file if desired */ #ifdef ISV_LICENSE GA_registerLicense(OemLicense,false); #endif /* Load the device driver for this device */ if ((dc = GA_loadDriver(0,false)) == NULL) PM_fatalError(GA_errorMsg(GA_status())); init.dwSize = sizeof(init); if (!GA_queryFunctions(dc,GA_GET_INITFUNCS,&init)) PM_fatalError("Unable to get device driver functions!"); driver.dwSize = sizeof(driver); if (!GA_queryFunctions(dc,GA_GET_DRIVERFUNCS,&driver)) PM_fatalError("Unable to get device driver functions!"); /* Display available modes for invalid command line */ if (argc != 4) { /* Restore the console */ PM_restoreConsoleState(stateBuf,hwndConsole); PM_closeConsole(hwndConsole); AvailableModes(); GA_unloadDriver(dc); return 0; } /* Get requested resolution, start graphics and draw pattern */ xRes = atoi(argv[1]); yRes = atoi(argv[2]); bpp = atoi(argv[3]); if ((oldMode = InitGraphics(xRes,yRes,bpp)) != -1) { DrawMoire(); PM_getch(); virtualX = virtualY = bytesPerLine = -1; init.SetVideoMode(oldMode,&virtualX,&virtualY,&bytesPerLine,&maxMem,0,NULL); } /* Restore the console */ ExitSoftwareRasterizer(); PM_restoreConsoleState(stateBuf,hwndConsole); PM_closeConsole(hwndConsole); /* Unload the device driver */ GA_unloadDriver(dc); if (oldMode == -1) printf("Unable to find specified graphics mode, or error starting mode.\n"); return 0; }