diff options
author | eray orçunus <erayorcunus@gmail.com> | 2020-05-01 20:08:39 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2020-05-01 20:16:02 +0200 |
commit | 97b288c1e44902d7bcae575c0c6629296735fdc4 (patch) | |
tree | dde53c00e763057e47009bcf41b42c6e31957932 /src/skel/win | |
parent | Merge pull request #499 from aap/master (diff) | |
download | re3-97b288c1e44902d7bcae575c0c6629296735fdc4.tar re3-97b288c1e44902d7bcae575c0c6629296735fdc4.tar.gz re3-97b288c1e44902d7bcae575c0c6629296735fdc4.tar.bz2 re3-97b288c1e44902d7bcae575c0c6629296735fdc4.tar.lz re3-97b288c1e44902d7bcae575c0c6629296735fdc4.tar.xz re3-97b288c1e44902d7bcae575c0c6629296735fdc4.tar.zst re3-97b288c1e44902d7bcae575c0c6629296735fdc4.zip |
Diffstat (limited to 'src/skel/win')
-rw-r--r-- | src/skel/win/win.cpp | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 531b9d31..d20cc0bf 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -59,8 +59,6 @@ static RwBool startupDeactivate; static RwBool useDefault; -static RwBool defaultFullscreenRes = TRUE; - /* Class name for the MS Window's window class. */ static const RwChar *AppClassName = RWSTRING("Grand theft auto 3"); @@ -113,6 +111,14 @@ DWORD _dwOperatingSystemVersion; RwUInt32 gGameState; CJoySticks AllValidWinJoys; +// What is that for anyway? +#ifndef IMPROVED_VIDEOMODE +static RwBool defaultFullscreenRes = TRUE; +#else +static RwBool defaultFullscreenRes = FALSE; +static RwInt32 bestWndMode = -1; +#endif + CJoySticks::CJoySticks() { for (int i = 0; i < MAX_JOYSTICKS; i++) @@ -791,11 +797,7 @@ RwChar **_psGetVideoModeList() _VMList[i] = nil; } else -#ifdef IMPROVED_VIDEOMODE - _VMList[i] = strdup("WINDOW"); -#else _VMList[i] = nil; -#endif } return _VMList; @@ -1378,8 +1380,8 @@ psSelectDevice() if ( !useDefault ) { if(FrontEndMenuManager.m_nPrefsWidth == 0 || - FrontEndMenuManager.m_nPrefsHeight == 0 || - FrontEndMenuManager.m_nPrefsDepth == 0){ + FrontEndMenuManager.m_nPrefsHeight == 0 || + FrontEndMenuManager.m_nPrefsDepth == 0){ // Defaults if nothing specified FrontEndMenuManager.m_nPrefsWidth = GetSystemMetrics(SM_CXSCREEN); FrontEndMenuManager.m_nPrefsHeight = GetSystemMetrics(SM_CYSCREEN); @@ -1388,51 +1390,51 @@ psSelectDevice() } // Find the videomode that best fits what we got from the settings file - RwInt32 bestMode = -1; + RwInt32 bestFsMode = -1; RwInt32 bestWidth = -1; RwInt32 bestHeight = -1; RwInt32 bestDepth = -1; - for(GcurSelVM = 0; GcurSelVM < RwEngineGetNumVideoModes(); GcurSelVM++){ + for (GcurSelVM = 0; GcurSelVM < RwEngineGetNumVideoModes(); GcurSelVM++) { RwEngineGetVideoModeInfo(&vm, GcurSelVM); - if(!(vm.flags & rwVIDEOMODEEXCLUSIVE) != FrontEndMenuManager.m_nPrefsWindowed) - continue; - if(FrontEndMenuManager.m_nPrefsWindowed){ - bestMode = GcurSelVM; - }else{ + if (!(vm.flags & rwVIDEOMODEEXCLUSIVE)) { + bestWndMode = GcurSelVM; + } else { // try the largest one that isn't larger than what we wanted - if(vm.width >= bestWidth && vm.width <= FrontEndMenuManager.m_nPrefsWidth && - vm.height >= bestHeight && vm.height <= FrontEndMenuManager.m_nPrefsHeight && - vm.depth >= bestDepth && vm.depth <= FrontEndMenuManager.m_nPrefsDepth){ + if (vm.width >= bestWidth && vm.width <= FrontEndMenuManager.m_nPrefsWidth && + vm.height >= bestHeight && vm.height <= FrontEndMenuManager.m_nPrefsHeight && + vm.depth >= bestDepth && vm.depth <= FrontEndMenuManager.m_nPrefsDepth){ bestWidth = vm.width; bestHeight = vm.height; bestDepth = vm.depth; - bestMode = GcurSelVM; + bestFsMode = GcurSelVM; } } } - if(bestMode < 0){ + if(bestFsMode < 0){ MessageBox(nil, "Cannot find desired video mode", "GTA3", MB_OK); return FALSE; } - GcurSelVM = bestMode; + GcurSelVM = bestFsMode; FrontEndMenuManager.m_nDisplayVideoMode = GcurSelVM; FrontEndMenuManager.m_nPrefsVideoMode = FrontEndMenuManager.m_nDisplayVideoMode; - GcurSelVM = FrontEndMenuManager.m_nDisplayVideoMode; + + FrontEndMenuManager.m_nSelectedScreenMode = FrontEndMenuManager.m_nPrefsWindowed; } #endif - + RwEngineGetVideoModeInfo(&vm, GcurSelVM); #ifdef IMPROVED_VIDEOMODE - if(vm.flags & rwVIDEOMODEEXCLUSIVE){ - FrontEndMenuManager.m_nPrefsWidth = vm.width; - FrontEndMenuManager.m_nPrefsHeight = vm.height; - FrontEndMenuManager.m_nPrefsDepth = vm.depth; - } - FrontEndMenuManager.m_nPrefsWindowed = !(vm.flags & rwVIDEOMODEEXCLUSIVE); + if (FrontEndMenuManager.m_nPrefsWindowed) + GcurSelVM = bestWndMode; + + // Now GcurSelVM is 0 but vm has sizes(and fullscreen flag) of the video mode we want, that's why we changed the rwVIDEOMODEEXCLUSIVE conditions below + FrontEndMenuManager.m_nPrefsWidth = vm.width; + FrontEndMenuManager.m_nPrefsHeight = vm.height; + FrontEndMenuManager.m_nPrefsDepth = vm.depth; #endif FrontEndMenuManager.m_nCurrOption = 0; @@ -1444,7 +1446,11 @@ psSelectDevice() return FALSE; } +#ifdef IMPROVED_VIDEOMODE + if (!FrontEndMenuManager.m_nPrefsWindowed) +#else if (vm.flags & rwVIDEOMODEEXCLUSIVE) +#endif { debug("%dx%dx%d", vm.width, vm.height, vm.depth); @@ -1457,7 +1463,11 @@ psSelectDevice() } } +#ifdef IMPROVED_VIDEOMODE + if (!FrontEndMenuManager.m_nPrefsWindowed) +#else if (vm.flags & rwVIDEOMODEEXCLUSIVE) +#endif { RsGlobal.maximumWidth = vm.width; RsGlobal.maximumHeight = vm.height; |