quickly enter last used fullscreen mode by pressing Esc while in windowed mode
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@181 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
a9b8ab92f9
commit
1484c18b73
|
@ -2,7 +2,7 @@
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
// Copyright (C) 2005-2006 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
|
// 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
|
// 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.BackBufferHeight = !dpp.Windowed ? theApp.fsHeight : theApp.surfaceSizeY;
|
||||||
dpp.hDeviceWindow = theApp.m_pMainWnd->GetSafeHwnd();
|
dpp.hDeviceWindow = theApp.m_pMainWnd->GetSafeHwnd();
|
||||||
dpp.FullScreen_RefreshRateInHz = dpp.Windowed ? 0 : theApp.fsFrequency;
|
dpp.FullScreen_RefreshRateInHz = dpp.Windowed ? 0 : theApp.fsFrequency;
|
||||||
if( ( dpp.Windowed == FALSE ) && theApp.menuToggle ) {
|
dpp.Flags = 0;
|
||||||
dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
|
|
||||||
} else {
|
|
||||||
dpp.Flags = 0;
|
|
||||||
}
|
|
||||||
dpp.PresentationInterval = theApp.vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
dpp.PresentationInterval = theApp.vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||||
// D3DPRESENT_INTERVAL_ONE means VSync ON
|
// D3DPRESENT_INTERVAL_ONE means VSync ON
|
||||||
|
|
||||||
|
@ -581,13 +577,13 @@ void Direct3DDisplay::calculateDestRect()
|
||||||
void Direct3DDisplay::setOption( const char *option, int value )
|
void Direct3DDisplay::setOption( const char *option, int value )
|
||||||
{
|
{
|
||||||
if( !_tcscmp( option, _T("vsync") ) ) {
|
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
|
// 'value' has the same value as theApp.vsync
|
||||||
resetDevice();
|
resetDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !_tcscmp( option, _T("tripleBuffering") ) ) {
|
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
|
// 'value' has the same value as theApp.tripleBuffering
|
||||||
resetDevice();
|
resetDevice();
|
||||||
}
|
}
|
||||||
|
@ -628,13 +624,6 @@ bool Direct3DDisplay::resetDevice()
|
||||||
destroyTexture();
|
destroyTexture();
|
||||||
prepareDisplayMode();
|
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 ) ) ) {
|
if( FAILED( hr = pDevice->Reset( &dpp ) ) ) {
|
||||||
DXTRACE_ERR( _T("pDevice->Reset failed\n"), hr );
|
DXTRACE_ERR( _T("pDevice->Reset failed\n"), hr );
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
|
@ -694,8 +694,10 @@ void MainWnd::OnUpdateFileRominformation(CCmdUI* pCmdUI)
|
||||||
|
|
||||||
void MainWnd::OnFileTogglemenu()
|
void MainWnd::OnFileTogglemenu()
|
||||||
{
|
{
|
||||||
if(theApp.videoOption <= VIDEO_4X)
|
if(theApp.videoOption <= VIDEO_4X) {
|
||||||
return;
|
theApp.updateWindowSize( theApp.lastFullscreen );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( theApp.renderMethod != DIRECT_DRAW ) {
|
if( theApp.renderMethod != DIRECT_DRAW ) {
|
||||||
// display API does not support GDI objects in fullscreen
|
// display API does not support GDI objects in fullscreen
|
||||||
|
@ -724,7 +726,8 @@ void MainWnd::OnFileTogglemenu()
|
||||||
|
|
||||||
void MainWnd::OnUpdateFileTogglemenu(CCmdUI* pCmdUI)
|
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)
|
bool MainWnd::fileImportGSACodeFile(CString& fileName)
|
||||||
|
|
|
@ -333,6 +333,7 @@ VBA::VBA()
|
||||||
fsMaxScale = 0;
|
fsMaxScale = 0;
|
||||||
romSize = 0;
|
romSize = 0;
|
||||||
lastWindowed = VIDEO_3X;
|
lastWindowed = VIDEO_3X;
|
||||||
|
lastFullscreen = VIDEO_1024x768;
|
||||||
|
|
||||||
updateCount = 0;
|
updateCount = 0;
|
||||||
|
|
||||||
|
@ -1356,6 +1357,8 @@ void VBA::loadSettings()
|
||||||
{
|
{
|
||||||
CString buffer;
|
CString buffer;
|
||||||
|
|
||||||
|
lastFullscreen = (VIDEO_SIZE)regQueryDwordValue("lastFullscreen", VIDEO_1024x768);
|
||||||
|
|
||||||
languageOption = regQueryDwordValue("language", 1);
|
languageOption = regQueryDwordValue("language", 1);
|
||||||
if(languageOption < 0 || languageOption > 2)
|
if(languageOption < 0 || languageOption > 2)
|
||||||
languageOption = 1;
|
languageOption = 1;
|
||||||
|
@ -1801,6 +1804,8 @@ void VBA::updateWindowSize(int value)
|
||||||
changingVideoSize = true;
|
changingVideoSize = true;
|
||||||
if( videoOption <= VIDEO_4X ) {
|
if( videoOption <= VIDEO_4X ) {
|
||||||
lastWindowed = (VIDEO_SIZE)videoOption; // save for when leaving full screen
|
lastWindowed = (VIDEO_SIZE)videoOption; // save for when leaving full screen
|
||||||
|
} else {
|
||||||
|
lastFullscreen = (VIDEO_SIZE)videoOption; // save for when using quick switch to fullscreen
|
||||||
}
|
}
|
||||||
shutdownDisplay();
|
shutdownDisplay();
|
||||||
if(input) {
|
if(input) {
|
||||||
|
@ -2645,6 +2650,7 @@ void VBA::saveSettings()
|
||||||
regSetDwordValue("Linklog", linklog);
|
regSetDwordValue("Linklog", linklog);
|
||||||
regSetDwordValue("RFU", adapter);
|
regSetDwordValue("RFU", adapter);
|
||||||
regSetDwordValue("linkEnabled", linkenable);
|
regSetDwordValue("linkEnabled", linkenable);
|
||||||
|
regSetDwordValue("lastFullscreen", lastFullscreen);
|
||||||
|
|
||||||
#ifndef NO_OAL
|
#ifndef NO_OAL
|
||||||
regSetStringValue( "oalDevice", oalDevice );
|
regSetStringValue( "oalDevice", oalDevice );
|
||||||
|
|
|
@ -210,6 +210,7 @@ class VBA : public CWinApp
|
||||||
int fsMaxScale;
|
int fsMaxScale;
|
||||||
int romSize;
|
int romSize;
|
||||||
VIDEO_SIZE lastWindowed;
|
VIDEO_SIZE lastWindowed;
|
||||||
|
VIDEO_SIZE lastFullscreen;
|
||||||
|
|
||||||
CList<IUpdateListener *, IUpdateListener*&> updateList;
|
CList<IUpdateListener *, IUpdateListener*&> updateList;
|
||||||
int updateCount;
|
int updateCount;
|
||||||
|
|
Loading…
Reference in New Issue