diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp index 5994254a..2b942273 100644 --- a/src/win32/MainWnd.cpp +++ b/src/win32/MainWnd.cpp @@ -107,6 +107,8 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd) ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_150, OnOptionsFrameskipThrottle150) ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_200, OnOptionsFrameskipThrottle200) ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER, OnOptionsFrameskipThrottleOther) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_AUTOMATIC, OnOptionsFrameskipAutomatic) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_AUTOMATIC, OnUpdateOptionsFrameskipAutomatic) ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_0, OnUpdateOptionsVideoFrameskip0) ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_1, OnUpdateOptionsVideoFrameskip1) ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_2, OnUpdateOptionsVideoFrameskip2) diff --git a/src/win32/MainWnd.h b/src/win32/MainWnd.h index c135d5e6..b1fa8d8d 100644 --- a/src/win32/MainWnd.h +++ b/src/win32/MainWnd.h @@ -111,6 +111,8 @@ protected: afx_msg void OnOptionsFrameskipThrottle150(); afx_msg void OnOptionsFrameskipThrottle200(); afx_msg void OnOptionsFrameskipThrottleOther(); + afx_msg void OnOptionsFrameskipAutomatic(); + afx_msg void OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip0(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip1(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip2(CCmdUI* pCmdUI); diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index 2f3b7d9c..8e072a74 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -37,9 +37,9 @@ void MainWnd::OnOptionsFrameskipThrottleNothrottle() { theApp.updateThrottle( 0 ); // disable + theApp.autoFrameSkip = false; } - void MainWnd::OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI* pCmdUI) { pCmdUI->SetCheck( theApp.throttle == 0 ); @@ -49,9 +49,9 @@ void MainWnd::OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI* pCmdUI) void MainWnd::OnOptionsFrameskipThrottle25() { theApp.updateThrottle( 25 ); + theApp.autoFrameSkip = false; } - void MainWnd::OnUpdateOptionsFrameskipThrottle25(CCmdUI* pCmdUI) { pCmdUI->SetCheck( theApp.throttle == 25 ); @@ -61,9 +61,9 @@ void MainWnd::OnUpdateOptionsFrameskipThrottle25(CCmdUI* pCmdUI) void MainWnd::OnOptionsFrameskipThrottle50() { theApp.updateThrottle( 50 ); + theApp.autoFrameSkip = false; } - void MainWnd::OnUpdateOptionsFrameskipThrottle50(CCmdUI* pCmdUI) { pCmdUI->SetCheck( theApp.throttle == 50 ); @@ -73,9 +73,9 @@ void MainWnd::OnUpdateOptionsFrameskipThrottle50(CCmdUI* pCmdUI) void MainWnd::OnOptionsFrameskipThrottle100() { theApp.updateThrottle( 100 ); + theApp.autoFrameSkip = false; } - void MainWnd::OnUpdateOptionsFrameskipThrottle100(CCmdUI* pCmdUI) { pCmdUI->SetCheck( theApp.throttle == 100 ); @@ -85,9 +85,9 @@ void MainWnd::OnUpdateOptionsFrameskipThrottle100(CCmdUI* pCmdUI) void MainWnd::OnOptionsFrameskipThrottle150() { theApp.updateThrottle( 150 ); +theApp.autoFrameSkip = false; } - void MainWnd::OnUpdateOptionsFrameskipThrottle150(CCmdUI* pCmdUI) { pCmdUI->SetCheck( theApp.throttle == 150 ); @@ -97,9 +97,9 @@ void MainWnd::OnUpdateOptionsFrameskipThrottle150(CCmdUI* pCmdUI) void MainWnd::OnOptionsFrameskipThrottle200() { theApp.updateThrottle( 200 ); + theApp.autoFrameSkip = false; } - void MainWnd::OnUpdateOptionsFrameskipThrottle200(CCmdUI* pCmdUI) { pCmdUI->SetCheck( theApp.throttle == 200 ); @@ -113,6 +113,7 @@ void MainWnd::OnOptionsFrameskipThrottleOther() if( v ) { theApp.updateThrottle( v ); + theApp.autoFrameSkip = false; } } @@ -128,6 +129,23 @@ void MainWnd::OnUpdateOptionsFrameskipThrottleOther(CCmdUI* pCmdUI) ( theApp.throttle != 200 ) ); } +void MainWnd::OnOptionsFrameskipAutomatic() +{ + theApp.autoFrameSkip = !theApp.autoFrameSkip; + if(!theApp.autoFrameSkip && emulating) + theApp.updateFrameSkip(); + else + { + theApp.throttle = false; + frameSkip = 0; + systemFrameSkip = 0; + } +} + +void MainWnd::OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.autoFrameSkip); +} BOOL MainWnd::OnOptionsFrameskip(UINT nID) { diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 99428cd4..8b0859c0 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -1115,6 +1115,7 @@ void system10Frames(int rate) } theApp.wasPaused = false; + theApp.autoFrameSkipLastTime = time; #ifdef LOG_PERFORMANCE if( systemSpeedCounter >= PERFORMANCE_INTERVAL ) { @@ -1362,6 +1363,8 @@ void VBA::loadSettings() if(gbFrameSkip < 0 || gbFrameSkip > 9) gbFrameSkip = 0; + autoFrameSkip = regQueryDwordValue("autoFrameSkip", FALSE) ? TRUE : FALSE; + vsync = regQueryDwordValue("vsync", false) ? true : false ; synchronize = regQueryDwordValue("synchronize", 1) ? true : false; fullScreenStretch = regQueryDwordValue("stretch", 0) ? true : false;