| 3033 | //=========================================================================== |
| 3034 | |
| 3035 | void Win32Frame::FrameCreateWindow(void) |
| 3036 | { |
| 3037 | int nWidth, nHeight; |
| 3038 | |
| 3039 | // Set g_nMaxViewportScale |
| 3040 | { |
| 3041 | int nOldViewportCX = g_nViewportCX; |
| 3042 | int nOldViewportCY = g_nViewportCY; |
| 3043 | |
| 3044 | g_nViewportCX = GetVideo().GetFrameBufferBorderlessWidth() * 2; |
| 3045 | g_nViewportCY = GetVideo().GetFrameBufferBorderlessHeight() * 2; |
| 3046 | GetWidthHeight(nWidth, nHeight); // Probe with 2x dimensions |
| 3047 | |
| 3048 | g_nViewportCX = nOldViewportCX; |
| 3049 | g_nViewportCY = nOldViewportCY; |
| 3050 | |
| 3051 | if (nWidth > GetSystemMetrics(SM_CXSCREEN) || nHeight > GetSystemMetrics(SM_CYSCREEN)) |
| 3052 | g_nMaxViewportScale = 1; |
| 3053 | } |
| 3054 | |
| 3055 | GetWidthHeight(nWidth, nHeight); |
| 3056 | |
| 3057 | // If screen is too small for 2x, then revert to 1x |
| 3058 | if (g_nViewportScale == 2 && (nWidth > GetSystemMetrics(SM_CXSCREEN) || nHeight > GetSystemMetrics(SM_CYSCREEN))) |
| 3059 | { |
| 3060 | g_nMaxViewportScale = 1; |
| 3061 | SetViewportScale(1); |
| 3062 | GetWidthHeight(nWidth, nHeight); |
| 3063 | } |
| 3064 | |
| 3065 | // Restore Window X Position |
| 3066 | int nXPos = -1; |
| 3067 | { |
| 3068 | const int nXScreen = GetSystemMetrics(SM_CXSCREEN) - nWidth; |
| 3069 | |
| 3070 | if (RegLoadValue(REG_PREFS, REGVALUE_PREF_WINDOW_X_POS, 1, (uint32_t*)&nXPos)) |
| 3071 | { |
| 3072 | if ((nXPos > nXScreen) && !g_bMultiMon) |
| 3073 | nXPos = -1; // Not fully visible, so default to centre position |
| 3074 | } |
| 3075 | |
| 3076 | if ((nXPos == -1) && !g_bMultiMon) |
| 3077 | nXPos = nXScreen / 2; |
| 3078 | } |
| 3079 | |
| 3080 | // Restore Window Y Position |
| 3081 | int nYPos = -1; |
| 3082 | { |
| 3083 | const int nYScreen = GetSystemMetrics(SM_CYSCREEN) - nHeight; |
| 3084 | |
| 3085 | if (RegLoadValue(REG_PREFS, REGVALUE_PREF_WINDOW_Y_POS, 1, (uint32_t*)&nYPos)) |
| 3086 | { |
| 3087 | if ((nYPos > nYScreen) && !g_bMultiMon) |
| 3088 | nYPos = -1; // Not fully visible, so default to centre position |
| 3089 | } |
| 3090 | |
| 3091 | if ((nYPos == -1) && !g_bMultiMon) |
| 3092 | nYPos = nYScreen / 2; |
no test coverage detected