diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 66eb454f..cb2b1b25 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -200,7 +200,7 @@ UIController::UIController() m_fScreenHeight = g_iScreenHeight; m_bScreenWidthSetup = true; #ifdef _DEBUG - app.DebugPrintf("[UIController] Width: %d, Height: %d\n", m_fScreenWidth, m_fScreenHeight); + app.DebugPrintf("[UIController] Width: %d, Height: %d\n", static_cast(m_fScreenWidth), static_cast(m_fScreenHeight)); #endif #else m_fScreenWidth = 1280.0f; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index b0ace9a5..64637809 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -489,22 +489,22 @@ HRESULT InitDevice() HRESULT hr = S_OK; //str1k3r - use screen size instead of window size & detect if its widescreen or not -#ifndef _DEBUG - HMONITOR hMonitor = MonitorFromWindow(g_hWnd, MONITOR_DEFAULTTONEAREST); - MONITORINFO monitorInfo = { sizeof(MONITORINFO) }; - if (GetMonitorInfo(hMonitor, &monitorInfo)) + if (!g_bResolutionSetByCMD) { - g_iScreenWidth = monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left; - g_iScreenHeight = monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top; - } - else - { - g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN); - g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN); - } - - g_bWidescreen = (g_iScreenHeight > 0 && ((double)g_iScreenWidth / g_iScreenHeight) >= 1.59) ? TRUE : FALSE; -#endif + HMONITOR hMonitor = MonitorFromWindow(g_hWnd, MONITOR_DEFAULTTONEAREST); + MONITORINFO monitorInfo = { sizeof(MONITORINFO) }; + if (GetMonitorInfo(hMonitor, &monitorInfo)) + { + g_iScreenWidth = monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left; + g_iScreenHeight = monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top; + } + else + { + g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN); + g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN); + } + g_bWidescreen = (g_iScreenHeight > 0 && ((double)g_iScreenWidth / g_iScreenHeight) >= 1.59) ? TRUE : FALSE; + } //str1k3r - stop hardcoding size and just use the screens actual size UINT width = g_iScreenWidth; @@ -651,36 +651,42 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // 2160p g_iScreenWidth = 3840; g_iScreenHeight = 2160; + g_bResolutionSetByCMD = TRUE; } else if(lpCmdLine[0] == '2') { // 1440p g_iScreenWidth = 2560; g_iScreenHeight = 1440; + g_bResolutionSetByCMD = TRUE; } else if (lpCmdLine[0] == '3') { // 1080p g_iScreenWidth = 1920; g_iScreenHeight = 1080; + g_bResolutionSetByCMD = TRUE; } else if(lpCmdLine[0] == '4') { // 720p g_iScreenWidth = 1280; g_iScreenHeight = 720; + g_bResolutionSetByCMD = TRUE; } else if(lpCmdLine[0] == '5') { // 480p g_iScreenWidth = 640; g_iScreenHeight = 480; + g_bResolutionSetByCMD = TRUE; } else if(lpCmdLine[0] == '6') { // Vita Native, 544p g_iScreenWidth = 960; g_iScreenHeight = 544; + g_bResolutionSetByCMD = TRUE; } } diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.h b/Minecraft.Client/Windows64/Windows64_Minecraft.h index d5208a3c..186756bb 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.h +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.h @@ -7,6 +7,8 @@ extern BOOL g_bWidescreen; extern int g_iScreenWidth; extern int g_iScreenHeight; +BOOL g_bResolutionSetByCMD = FALSE; + extern ID3D11Device* g_pd3dDevice; void CleanupDevice(); \ No newline at end of file