fix: res set over cmd not applying

This commit is contained in:
2026-08-12 21:36:08 -04:00
parent 82783c0812
commit d0362d2458
3 changed files with 24 additions and 16 deletions
@@ -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;
}
}