/** * Set Width/Height/BitDepth according to passed GEMRES_640x480, * GEMRES_800x600, GEMRES_OTHER. Align size when necessary. */ void VDI_SetResolution(int GEMColor, int WidthRequest, int HeightRequest) { /* Color depth */ switch (GEMColor) { case GEMCOLOR_2: VDIRes = 2; VDIPlanes = 1; VDIColors = 2; VDICharHeight = 16; break; case GEMCOLOR_4: VDIRes = 1; VDIPlanes = 2; VDIColors = 4; VDICharHeight = 8; break; case GEMCOLOR_16: VDIRes = 0; VDIPlanes = 4; VDIColors = 16; VDICharHeight = 8; break; } /* width needs to be aligned to 16 bytes */ VDIWidth = VDI_Limit(WidthRequest, 128/VDIPlanes, MIN_VDI_WIDTH, MAX_VDI_WIDTH); /* height needs to be multiple of cell height */ VDIHeight = VDI_Limit(HeightRequest, VDICharHeight, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT); printf("VDI screen: request = %dx%d@%d, aligned result = %dx%d@%d\n", WidthRequest, HeightRequest, VDIPlanes, VDIWidth, VDIHeight, VDIPlanes); /* Write resolution to re-boot takes effect with correct bit-depth */ VDI_FixDesktopInf(); }
/** * Set Width/Height/BitDepth according to passed GEMCOLOR_2/4/16. * Align size when necessary. */ void VDI_SetResolution(int GEMColor, int WidthRequest, int HeightRequest) { int w = WidthRequest; int h = HeightRequest; /* Color depth */ switch (GEMColor) { case GEMCOLOR_2: VDIRes = 2; VDIPlanes = 1; break; case GEMCOLOR_4: VDIRes = 1; VDIPlanes = 2; break; case GEMCOLOR_16: VDIRes = 0; VDIPlanes = 4; break; } /* screen size in bytes needs to be below limit */ VDI_ByteLimit(&w, &h, VDIPlanes); /* width needs to be aligned to 16 bytes */ VDIWidth = VDI_Limit(w, 128/VDIPlanes, MIN_VDI_WIDTH, MAX_VDI_WIDTH); /* height needs to be multiple of cell height (either 8 or 16) */ VDIHeight = VDI_Limit(h, 16, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT); printf("VDI screen: request = %dx%d@%d, result = %dx%d@%d\n", WidthRequest, HeightRequest, VDIPlanes, VDIWidth, VDIHeight, VDIPlanes); /* Write resolution to re-boot takes effect with correct bit-depth */ VDI_FixDesktopInf(); }
/** * Show and process the window dialog. */ void Dialog_WindowDlg(void) { int deskw, deskh, but, skip = 0; unsigned int i; SDLGui_CenterDlg(windowdlg); /* Set up general window options in the dialog from actual values: */ if (ConfigureParams.Screen.bFullScreen) windowdlg[DLGSCRN_FULLSCRN].state |= SG_SELECTED; else windowdlg[DLGSCRN_FULLSCRN].state &= ~SG_SELECTED; if (ConfigureParams.Screen.bKeepResolution) windowdlg[DLGSCRN_KEEP_RES].state |= SG_SELECTED; else windowdlg[DLGSCRN_KEEP_RES].state &= ~SG_SELECTED; if (ConfigureParams.Screen.bKeepResolutionST) windowdlg[DLGSCRN_KEEP_RES_ST].state |= SG_SELECTED; else windowdlg[DLGSCRN_KEEP_RES_ST].state &= ~SG_SELECTED; windowdlg[DLGSCRN_STATUSBAR].state &= ~SG_SELECTED; windowdlg[DLGSCRN_DRIVELED].state &= ~SG_SELECTED; windowdlg[DLGSCRN_NONE].state &= ~SG_SELECTED; if (ConfigureParams.Screen.bShowStatusbar) windowdlg[DLGSCRN_STATUSBAR].state |= SG_SELECTED; else if (ConfigureParams.Screen.bShowDriveLed) windowdlg[DLGSCRN_DRIVELED].state |= SG_SELECTED; else windowdlg[DLGSCRN_NONE].state |= SG_SELECTED; for (i = 0; i < ITEMS_IN_ARRAY(skip_frames); i++) { if (ConfigureParams.Screen.nFrameSkips >= skip_frames[i]) skip = i; windowdlg[i+DLGSCRN_SKIP0].state &= ~SG_SELECTED; } windowdlg[DLGSCRN_SKIP0+skip].state |= SG_SELECTED; Resolution_GetDesktopSize(&deskw, &deskh); sprintf(sMaxWidth, "%4i", ConfigureParams.Screen.nMaxWidth); sprintf(sMaxHeight, "%4i", ConfigureParams.Screen.nMaxHeight); /* Initialize window capture options: */ if (ConfigureParams.Screen.bCrop) windowdlg[DLGSCRN_CROP].state |= SG_SELECTED; else windowdlg[DLGSCRN_CROP].state &= ~SG_SELECTED; if (Avi_AreWeRecording()) windowdlg[DLGSCRN_RECANIM].txt = RECORD_STOP; else windowdlg[DLGSCRN_RECANIM].txt = RECORD_START; /* The window dialog main loop */ do { but = SDLGui_DoDialog(windowdlg, NULL); switch (but) { case DLGSCRN_MAX_WLESS: ConfigureParams.Screen.nMaxWidth = VDI_Limit(ConfigureParams.Screen.nMaxWidth - MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_WIDTH, deskw); sprintf(sMaxWidth, "%4i", ConfigureParams.Screen.nMaxWidth); break; case DLGSCRN_MAX_WMORE: ConfigureParams.Screen.nMaxWidth = VDI_Limit(ConfigureParams.Screen.nMaxWidth + MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_WIDTH, deskw); sprintf(sMaxWidth, "%4i", ConfigureParams.Screen.nMaxWidth); break; case DLGSCRN_MAX_HLESS: ConfigureParams.Screen.nMaxHeight = VDI_Limit(ConfigureParams.Screen.nMaxHeight - MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_HEIGHT, deskh); sprintf(sMaxHeight, "%4i", ConfigureParams.Screen.nMaxHeight); break; case DLGSCRN_MAX_HMORE: ConfigureParams.Screen.nMaxHeight = VDI_Limit(ConfigureParams.Screen.nMaxHeight + MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_HEIGHT, deskh); sprintf(sMaxHeight, "%4i", ConfigureParams.Screen.nMaxHeight); break; case DLGSCRN_CAPTURE: SDL_UpdateRect(sdlscrn, 0,0,0,0); ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED); ScreenSnapShot_SaveScreen(); break; case DLGSCRN_RECANIM: if (Avi_AreWeRecording()) { /* AVI indexing can take a while for larger files */ Statusbar_AddMessage("Finishing AVI file...", 100); Statusbar_Update(sdlscrn, true); Avi_StopRecording(); windowdlg[DLGSCRN_RECANIM].txt = RECORD_START; Statusbar_AddMessage("Emulation paused", 100); Statusbar_Update(sdlscrn, true); } else { ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED); Avi_StartRecording ( ConfigureParams.Video.AviRecordFile , ConfigureParams.Screen.bCrop , ConfigureParams.Video.AviRecordFps == 0 ? ClocksTimings_GetVBLPerSec ( ConfigureParams.System.nMachineType , nScreenRefreshRate ) : (Uint32)ConfigureParams.Video.AviRecordFps << CLOCKS_TIMINGS_SHIFT_VBL , 1 << CLOCKS_TIMINGS_SHIFT_VBL , ConfigureParams.Video.AviRecordVcodec ); windowdlg[DLGSCRN_RECANIM].txt = RECORD_STOP; } break; } } while (but != DLGSCRN_EXIT_WINDOW && but != SDLGUI_QUIT && but != SDLGUI_ERROR && !bQuitProgram); /* Read new values from dialog: */ ConfigureParams.Screen.bFullScreen = (windowdlg[DLGSCRN_FULLSCRN].state & SG_SELECTED); ConfigureParams.Screen.bKeepResolution = (windowdlg[DLGSCRN_KEEP_RES].state & SG_SELECTED); ConfigureParams.Screen.bKeepResolutionST = (windowdlg[DLGSCRN_KEEP_RES_ST].state & SG_SELECTED); ConfigureParams.Screen.bShowStatusbar = false; ConfigureParams.Screen.bShowDriveLed = false; if (windowdlg[DLGSCRN_STATUSBAR].state & SG_SELECTED) ConfigureParams.Screen.bShowStatusbar = true; else if (windowdlg[DLGSCRN_DRIVELED].state & SG_SELECTED) ConfigureParams.Screen.bShowDriveLed = true; for (i = DLGSCRN_SKIP0; i <= DLGSCRN_SKIP4; i++) { if (windowdlg[i].state & SG_SELECTED) { ConfigureParams.Screen.nFrameSkips = skip_frames[i-DLGSCRN_SKIP0]; break; } } ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED); }
/** * Show and process the monitor dialog. */ void Dialog_MonitorDlg(void) { int but; unsigned int i; MONITORTYPE mti; SDLGui_CenterDlg(monitordlg); /* Set up general monitor options in the dialog from actual values: */ if (ConfigureParams.Screen.bAllowOverscan) monitordlg[DLGSCRN_OVERSCAN].state |= SG_SELECTED; else monitordlg[DLGSCRN_OVERSCAN].state &= ~SG_SELECTED; for (i = DLGSCRN_MONO; i <= DLGSCRN_TV; i++) monitordlg[i].state &= ~SG_SELECTED; monitordlg[DLGSCRN_MONO+ConfigureParams.Screen.nMonitorType].state |= SG_SELECTED; /* Initialize VDI resolution options: */ if (ConfigureParams.Screen.bUseExtVdiResolutions) monitordlg[DLGSCRN_USEVDIRES].state |= SG_SELECTED; else monitordlg[DLGSCRN_USEVDIRES].state &= ~SG_SELECTED; for (i=0; i<3; i++) monitordlg[DLGSCRN_BPP1 + i].state &= ~SG_SELECTED; monitordlg[DLGSCRN_BPP1 + ConfigureParams.Screen.nVdiColors - GEMCOLOR_2].state |= SG_SELECTED; sprintf(sVdiWidth, "%4i", ConfigureParams.Screen.nVdiWidth); sprintf(sVdiHeight, "%4i", ConfigureParams.Screen.nVdiHeight); DlgMonitor_SetVdiStepping(); /* The monitor dialog main loop */ do { but = SDLGui_DoDialog(monitordlg, NULL); switch (but) { case DLGSCRN_VDI_WLESS: ConfigureParams.Screen.nVdiWidth = VDI_Limit(ConfigureParams.Screen.nVdiWidth - nVdiStepX, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH); sprintf(sVdiWidth, "%4i", ConfigureParams.Screen.nVdiWidth); break; case DLGSCRN_VDI_WMORE: ConfigureParams.Screen.nVdiWidth = VDI_Limit(ConfigureParams.Screen.nVdiWidth + nVdiStepX, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH); sprintf(sVdiWidth, "%4i", ConfigureParams.Screen.nVdiWidth); break; case DLGSCRN_VDI_HLESS: ConfigureParams.Screen.nVdiHeight = VDI_Limit(ConfigureParams.Screen.nVdiHeight - nVdiStepY, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT); sprintf(sVdiHeight, "%4i", ConfigureParams.Screen.nVdiHeight); break; case DLGSCRN_VDI_HMORE: ConfigureParams.Screen.nVdiHeight = VDI_Limit(ConfigureParams.Screen.nVdiHeight + nVdiStepY, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT); sprintf(sVdiHeight, "%4i", ConfigureParams.Screen.nVdiHeight); break; case DLGSCRN_BPP1: case DLGSCRN_BPP2: case DLGSCRN_BPP4: DlgMonitor_SetVdiStepping(); /* Align resolution to actual conditions: */ ConfigureParams.Screen.nVdiWidth = VDI_Limit(ConfigureParams.Screen.nVdiWidth, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH); ConfigureParams.Screen.nVdiHeight = VDI_Limit(ConfigureParams.Screen.nVdiHeight, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT); sprintf(sVdiWidth, "%4i", ConfigureParams.Screen.nVdiWidth); sprintf(sVdiHeight, "%4i", ConfigureParams.Screen.nVdiHeight); break; } } while (but != DLGSCRN_EXIT_MONITOR && but != SDLGUI_QUIT && but != SDLGUI_ERROR && !bQuitProgram); /* Read new values from dialog: */ ConfigureParams.Screen.bAllowOverscan = (monitordlg[DLGSCRN_OVERSCAN].state & SG_SELECTED); for (mti = MONITOR_TYPE_MONO; mti <= MONITOR_TYPE_TV; mti++) { if (monitordlg[mti + DLGSCRN_MONO].state & SG_SELECTED) { ConfigureParams.Screen.nMonitorType = mti; break; } } ConfigureParams.Screen.bUseExtVdiResolutions = (monitordlg[DLGSCRN_USEVDIRES].state & SG_SELECTED); for (i=0; i<3; i++) { if (monitordlg[DLGSCRN_BPP1 + i].state & SG_SELECTED) ConfigureParams.Screen.nVdiColors = GEMCOLOR_2 + i; } }