quickly enter last used fullscreen mode by pressing Esc while in windowed mode

This commit is contained in:
spacy51 2007-12-07 18:46:34 +00:00
parent fd1bcd6e4f
commit 7c13eb20a6
4 changed files with 17 additions and 18 deletions

View File

@ -2,7 +2,7 @@
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// Copyright (C) 2005-2006 VBA development team
// Copyright (C) 2007 VBA-M team
// Copyright (C) 2007 VBA-M development team
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -144,11 +144,7 @@ void Direct3DDisplay::prepareDisplayMode()
dpp.BackBufferHeight = !dpp.Windowed ? theApp.fsHeight : theApp.surfaceSizeY;
dpp.hDeviceWindow = theApp.m_pMainWnd->GetSafeHwnd();
dpp.FullScreen_RefreshRateInHz = dpp.Windowed ? 0 : theApp.fsFrequency;
if( ( dpp.Windowed == FALSE ) && theApp.menuToggle ) {
dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
} else {
dpp.Flags = 0;
}
dpp.Flags = 0;
dpp.PresentationInterval = theApp.vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
// D3DPRESENT_INTERVAL_ONE means VSync ON
@ -581,13 +577,13 @@ void Direct3DDisplay::calculateDestRect()
void Direct3DDisplay::setOption( const char *option, int value )
{
if( !_tcscmp( option, _T("vsync") ) ) {
// theApp.vsync has already been changed by the menu handler
// value of theApp.vsync has already been changed by the menu handler
// 'value' has the same value as theApp.vsync
resetDevice();
}
if( !_tcscmp( option, _T("tripleBuffering") ) ) {
// theApp.tripleBuffering has already been changed by the menu handler
// value of theApp.tripleBuffering has already been changed by the menu handler
// 'value' has the same value as theApp.tripleBuffering
resetDevice();
}
@ -628,13 +624,6 @@ bool Direct3DDisplay::resetDevice()
destroyTexture();
prepareDisplayMode();
if( dpp.Windowed == FALSE ) {
// SetDialogBoxMode needs D3DPRESENTFLAG_LOCKABLE_BACKBUFFER
if( FAILED( hr = pDevice->SetDialogBoxMode( theApp.menuToggle ? TRUE : FALSE ) ) ) {
DXTRACE_ERR( _T("can not switch to dialog box mode"), hr );
}
}
if( FAILED( hr = pDevice->Reset( &dpp ) ) ) {
DXTRACE_ERR( _T("pDevice->Reset failed\n"), hr );
failed = true;

View File

@ -694,8 +694,10 @@ void MainWnd::OnUpdateFileRominformation(CCmdUI* pCmdUI)
void MainWnd::OnFileTogglemenu()
{
if(theApp.videoOption <= VIDEO_4X)
return;
if(theApp.videoOption <= VIDEO_4X) {
theApp.updateWindowSize( theApp.lastFullscreen );
return;
}
if( theApp.renderMethod != DIRECT_DRAW ) {
// display API does not support GDI objects in fullscreen
@ -724,7 +726,8 @@ void MainWnd::OnFileTogglemenu()
void MainWnd::OnUpdateFileTogglemenu(CCmdUI* pCmdUI)
{
pCmdUI->Enable(theApp.videoOption > VIDEO_4X);
// HACK: when uncommented, Esc key will not be send to MainWnd
//pCmdUI->Enable(theApp.videoOption > VIDEO_4X);
}
bool MainWnd::fileImportGSACodeFile(CString& fileName)

View File

@ -333,6 +333,7 @@ VBA::VBA()
fsMaxScale = 0;
romSize = 0;
lastWindowed = VIDEO_3X;
lastFullscreen = VIDEO_1024x768;
updateCount = 0;
@ -1356,6 +1357,8 @@ void VBA::loadSettings()
{
CString buffer;
lastFullscreen = (VIDEO_SIZE)regQueryDwordValue("lastFullscreen", VIDEO_1024x768);
languageOption = regQueryDwordValue("language", 1);
if(languageOption < 0 || languageOption > 2)
languageOption = 1;
@ -1801,6 +1804,8 @@ void VBA::updateWindowSize(int value)
changingVideoSize = true;
if( videoOption <= VIDEO_4X ) {
lastWindowed = (VIDEO_SIZE)videoOption; // save for when leaving full screen
} else {
lastFullscreen = (VIDEO_SIZE)videoOption; // save for when using quick switch to fullscreen
}
shutdownDisplay();
if(input) {
@ -2645,6 +2650,7 @@ void VBA::saveSettings()
regSetDwordValue("Linklog", linklog);
regSetDwordValue("RFU", adapter);
regSetDwordValue("linkEnabled", linkenable);
regSetDwordValue("lastFullscreen", lastFullscreen);
#ifndef NO_OAL
regSetStringValue( "oalDevice", oalDevice );

View File

@ -210,6 +210,7 @@ class VBA : public CWinApp
int fsMaxScale;
int romSize;
VIDEO_SIZE lastWindowed;
VIDEO_SIZE lastFullscreen;
CList<IUpdateListener *, IUpdateListener*&> updateList;
int updateCount;