From c645eee0463b6b6a9fb04829897ce7d026ebb290 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 18 Aug 2016 18:36:25 +0100 Subject: [PATCH] Enable DPI awareness for Windows x64 --- openrct2.vcxproj | 8 ++++++++ src/platform/windows.c | 24 ++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 1c82ce90d8..89e758c22d 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -663,7 +663,11 @@ openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;%(AdditionalDependencies) UseFastLinkTimeCodeGeneration /OPT:NOLBR /ignore:4099 %(AdditionalOptions) + Console + + PerMonitorHighDPIAware + @@ -689,7 +693,11 @@ true openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;%(AdditionalDependencies) /ignore:4099 %(AdditionalOptions) + Windows + + PerMonitorHighDPIAware + diff --git a/src/platform/windows.c b/src/platform/windows.c index 8ab8449a60..2bf5862c8d 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -51,10 +51,26 @@ static HMODULE _dllModule = NULL; /** * Windows entry point to OpenRCT2 without a console window. */ -// int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) -// { -// return 0; -// } +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + _dllModule = hInstance; + + int argc; + char ** argv = (char**)windows_get_command_line_args(&argc); + int runGame = cmdline_run(argv, argc); + + // Free argv + for (int i = 0; i < argc; i++) { + free(argv[i]); + } + free(argv); + + if (runGame == 1) { + openrct2_launch(); + } + + return gExitCode; +} /** * Windows entry point to OpenRCT2 with a console window using a traditional C main function.