Skip to content

Commit dfa8a27

Browse files
Synchronize changes from 1.6 master branch [ci skip]
ad68386 Replace GTA:SA window icon with ours on runtime (PR #3907)
2 parents c6f1cf0 + ad68386 commit dfa8a27

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Client/core/DXHook/CProxyDirect3D9.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
#include "StdInc.h"
1313
#include <dwmapi.h>
14+
#include <resource.h>
15+
16+
extern HINSTANCE g_hModule;
1417

1518
HRESULT HandleCreateDeviceResult(HRESULT hResult, IDirect3D9* pDirect3D, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags,
1619
D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface);
@@ -172,6 +175,23 @@ HRESULT CProxyDirect3D9::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND
172175
BOOL darkTitleBar = GetSystemRegistryValue((uint)HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme") == "\x0";
173176
DwmSetWindowAttribute(hFocusWindow, DWMWA_USE_IMMERSIVE_DARK_MODE, &darkTitleBar, sizeof(darkTitleBar));
174177

178+
// Update icon
179+
if (HICON icon = LoadIcon(g_hModule, MAKEINTRESOURCE(IDI_ICON1)))
180+
{
181+
const auto paramIcon = reinterpret_cast<LPARAM>(icon);
182+
for (const WPARAM size : {ICON_SMALL, ICON_BIG})
183+
{
184+
SendMessage(hFocusWindow, WM_SETICON, size, paramIcon);
185+
}
186+
187+
// Clean
188+
DestroyIcon(icon);
189+
}
190+
191+
// Redraw, we avoid possible problems with the fact that it won't replace the icon somewhere
192+
InvalidateRect(hFocusWindow, nullptr, TRUE);
193+
UpdateWindow(hFocusWindow);
194+
175195
// Detect if second call to CreateDevice
176196
if (CreateDeviceSecondCallCheck(hResult, m_pDevice, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface))
177197
{

0 commit comments

Comments
 (0)