Skip to content

Commit

Permalink
Add manifest for MTA launcher executable
Browse files Browse the repository at this point in the history
  • Loading branch information
botder committed Jan 17, 2024
1 parent 0f2bfc8 commit 47c2b89
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 42 deletions.
41 changes: 0 additions & 41 deletions Client/launch/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*****************************************************************************/

#include "StdInc.h"
#include <ShellScalingApi.h>

/*
IMPORTANT
Expand All @@ -23,44 +22,6 @@
(set flag.new_client_exe on the build server to generate new exe)
*/

/**
* @brief Applies the highest available form of DPI awareness for this process.
*/
void ApplyDpiAwareness()
{
// Minimum version: Windows 10, version 1607
using SetProcessDpiAwarenessContext_t = BOOL(WINAPI*)(DPI_AWARENESS_CONTEXT value);

static SetProcessDpiAwarenessContext_t Win32SetProcessDpiAwarenessContext = ([] {
HMODULE user32 = LoadLibrary("user32");
return user32 ? reinterpret_cast<SetProcessDpiAwarenessContext_t>(static_cast<void*>(GetProcAddress(user32, "SetProcessDpiAwarenessContext")))
: nullptr;
})();

if (Win32SetProcessDpiAwarenessContext)
{
Win32SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
return;
}

// Minimum version: Windows 8.1
using SetProcessDpiAwareness_t = HRESULT(WINAPI*)(PROCESS_DPI_AWARENESS value);

static SetProcessDpiAwareness_t Win32SetProcessDpiAwareness = ([] {
HMODULE shcore = LoadLibrary("shcore");
return shcore ? reinterpret_cast<SetProcessDpiAwareness_t>(static_cast<void*>(GetProcAddress(shcore, "SetProcessDpiAwareness"))) : nullptr;
})();

if (Win32SetProcessDpiAwareness)
{
Win32SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
return;
}

// Minimum version: Windows Vista
SetProcessDPIAware();
}

///////////////////////////////////////////////////////////////
//
// WinMain
Expand All @@ -76,8 +37,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
return 1;
}

ApplyDpiAwareness();

// Group our processes and windows under a single taskbar button
SetCurrentProcessExplicitAppUserModelID(L"Multi Theft Auto");

Expand Down
33 changes: 33 additions & 0 deletions Client/launch/Multi Theft Auto.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:v3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity type="win32" version="1.6.0.0" processorArchitecture="*" name="Multi Theft Auto" />

<v3:application>
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</v3:application>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> <!-- Windows 10 and Windows 11 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> <!-- Windows 8.1 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> <!-- Windows 8 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" /> <!-- Windows 7 -->
</application>
</compatibility>

<dependency optional="yes">
<dependentAssembly>
<!-- Automatically use ComCtl32.dll version 6 or later. -->
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
</assembly>
3 changes: 2 additions & 1 deletion Client/launch/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ project "Client Launcher"
vpaths {
["Headers/*"] = "**.h",
["Sources/*"] = "**.cpp",
["Resources/*"] = {"*.rc", "**.ico", "**.xml"},
["Resources/*"] = {"*.rc", "**.ico", "**.xml", "**.manifest"},
["*"] = "premake5.lua"
}

Expand All @@ -35,6 +35,7 @@ project "Client Launcher"
"NEU/Multi Theft Auto.gdf.xml",
"launch.rc",
"Multi Theft Auto.rc",
"Multi Theft Auto.manifest",
"resource/mtaicon.ico"
}

Expand Down

0 comments on commit 47c2b89

Please sign in to comment.