diff --git a/win32/wconfig.cpp b/win32/wconfig.cpp index 3f14a0c7..f27ca36e 100644 --- a/win32/wconfig.cpp +++ b/win32/wconfig.cpp @@ -776,26 +776,12 @@ void WinPreSave(ConfigFile& conf) if(GUI.window_size.bottom < 10) GUI.window_size.bottom = 10; if(GUI.window_size.right < 10) GUI.window_size.right = 10; - /*if(!Settings.SoundPlaybackRate) {Settings.SoundPlaybackRate = 6; GUI.Mute = TRUE;} - else if(Settings.SoundPlaybackRate <= 8000) Settings.SoundPlaybackRate = 1; - else if(Settings.SoundPlaybackRate <= 11025) Settings.SoundPlaybackRate = 2; - else if(Settings.SoundPlaybackRate <= 16000) Settings.SoundPlaybackRate = 3; - else if(Settings.SoundPlaybackRate <= 22050) Settings.SoundPlaybackRate = 4; - else if(Settings.SoundPlaybackRate <= 30000) Settings.SoundPlaybackRate = 5; - else if(Settings.SoundPlaybackRate <= 32000) Settings.SoundPlaybackRate = 6; - else if(Settings.SoundPlaybackRate <= 35000) Settings.SoundPlaybackRate = 7; - else if(Settings.SoundPlaybackRate <= 44100) Settings.SoundPlaybackRate = 8; - else Settings.SoundPlaybackRate = 9;*/ conf.DeleteKey("Sound::Mono"); if(configSort == 2) conf.ClearLines(); } void WinPostSave(ConfigFile& conf) { - /*if(GUI.window_size.left < -30) GUI.window_size.left = -30; - if(GUI.window_size.top < -30) GUI.window_size.top = -30; - if(GUI.window_size.left+GUI.window_size.right > GetSystemMetrics(SM_CXSCREEN)+30) GUI.window_size.left = GetSystemMetrics(SM_CXSCREEN)+30-GUI.window_size.right; - if(GUI.window_size.top+GUI.window_size.bottom > GetSystemMetrics(SM_CYSCREEN)+30) GUI.window_size.top = GetSystemMetrics(SM_CYSCREEN)+30-GUI.window_size.bottom;*/ int extra_width = 2*(GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXDLGFRAME)); int extra_height = 2*(GetSystemMetrics(SM_CYBORDER) + @@ -809,17 +795,6 @@ void WinPostSave(ConfigFile& conf) GUI.window_size.bottom += GUI.window_size.top; GUI.window_size.right += extra_width; GUI.window_size.bottom += extra_height; - /*switch(Settings.SoundPlaybackRate){ - case 1: Settings.SoundPlaybackRate = 8000; break; - case 2: Settings.SoundPlaybackRate = 11025; break; - case 3: Settings.SoundPlaybackRate = 16000; break; - case 4: Settings.SoundPlaybackRate = 22050; break; - case 5: Settings.SoundPlaybackRate = 30000; break; - case 6: Settings.SoundPlaybackRate = 32000; break; - case 7: Settings.SoundPlaybackRate = 35000; break; - case 8: Settings.SoundPlaybackRate = 44100; break; - case 9: Settings.SoundPlaybackRate = 48000; break; - }*/ Settings.ShutdownMaster = preSaveShutdownMaster; // revert temp change } void WinPostLoad(ConfigFile& conf) diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index cac49a66..cba682bb 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -2058,15 +2058,17 @@ LRESULT CALLBACK WinProc( case ID_WINDOW_SIZE_2X: case ID_WINDOW_SIZE_3X: case ID_WINDOW_SIZE_4X: - UINT factor,newWidth,newHeight; + UINT factor, newWidth, newHeight; + RECT margins; factor = (wParam & 0xffff) - ID_WINDOW_SIZE_1X + 1; newWidth = GUI.AspectWidth * factor; newHeight = (GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT) * factor; - newWidth += 2*(GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXDLGFRAME)); - newHeight += 2*(GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYDLGFRAME)) + - GetSystemMetrics(SM_CYCAPTION) + (GUI.HideMenu ? 0 : (GetSystemMetrics(SM_CYMENU) + - (factor<2 ? GetSystemMetrics(SM_CYMENU) : 0))); - SetWindowPos(GUI.hWnd,0,0,0,newWidth,newHeight,SWP_NOMOVE); + + margins = GetWindowMargins(GUI.hWnd,newWidth); + newHeight += margins.top + margins.bottom; + newWidth += margins.left + margins.right; + + SetWindowPos(GUI.hWnd, NULL, 0, 0, newWidth, newHeight, SWP_NOMOVE); break; case ID_WINDOW_STRETCH: GUI.Stretch = !GUI.Stretch; @@ -4167,6 +4169,27 @@ void S9xSetRecentGames () } } +RECT GetWindowMargins(HWND hwnd, UINT width) +{ + RECT rcMargins = {0,0,0,0}; + + AdjustWindowRectEx(&rcMargins, GetWindowStyle(hwnd), !GUI.HideMenu, GetWindowExStyle(hwnd)); + + rcMargins.left = abs(rcMargins.left); + rcMargins.top = abs(rcMargins.top); + + if (!GUI.HideMenu) { + RECT rcTemp = {0,0,width,0x7FFF}; // 0x7FFF="Infinite" height + SendMessage(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rcTemp); + + // Adjust our previous calculation to compensate for menu + // wrapping. + rcMargins.top = rcTemp.top; + } + + return rcMargins; +} + void WinDeleteRecentGamesList () { for(int i=0;i