diff --git a/openrct2.vcxproj b/openrct2.vcxproj
index 93079e7146..aff4340a05 100644
--- a/openrct2.vcxproj
+++ b/openrct2.vcxproj
@@ -167,6 +167,7 @@
+
@@ -537,7 +538,7 @@
{D24D94F6-2A74-480C-B512-629C306CE92F}
openrct2
openrct2
- 8.1
+ 10.0.10586.0
diff --git a/src/openrct2.c b/src/openrct2.c
index 9af19a5ffb..3f1dace2b5 100644
--- a/src/openrct2.c
+++ b/src/openrct2.c
@@ -439,6 +439,10 @@ static void openrct2_loop()
platform_draw();
+ if (wrl_is_gamebar_visible()) {
+ printf("game bar is visible\n");
+ }
+
fps++;
if (SDL_GetTicks() - secondTick >= 1000) {
fps = 0;
diff --git a/src/platform/WindowsAPI.cpp b/src/platform/WindowsAPI.cpp
new file mode 100644
index 0000000000..8bd1d3184a
--- /dev/null
+++ b/src/platform/WindowsAPI.cpp
@@ -0,0 +1,73 @@
+#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
+/*****************************************************************************
+ * OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+ *
+ * OpenRCT2 is the work of many authors, a full list can be found in contributors.md
+ * For more information, visit https://github.com/OpenRCT2/OpenRCT2
+ *
+ * OpenRCT2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * A full copy of the GNU General Public License can be found in licence.txt
+ *****************************************************************************/
+#pragma endregion
+
+#include
+
+#ifdef __WINDOWS__
+
+#include
+#include
+#include
+#include
+
+#pragma comment(lib, "runtimeobject.lib")
+
+using namespace ABI::Windows::Gaming::UI;
+using namespace ABI::Windows::Foundation;
+using namespace Microsoft::WRL;
+using namespace Microsoft::WRL::Details;
+using namespace Microsoft::WRL::Wrappers;
+
+static bool _wrlInitialised;
+static ComPtr _gameBar;
+
+extern "C"
+{
+ void wrl_initialise()
+ {
+ if (SUCCEEDED(Initialize(RO_INIT_MULTITHREADED)))
+ {
+ _wrlInitialised = true;
+
+ // Get a GameBar instance
+ GetActivationFactory(HStringReference(RuntimeClass_Windows_Gaming_UI_GameBar).Get(), &_gameBar);
+ }
+ }
+
+ void wrl_dispose()
+ {
+ if (_wrlInitialised)
+ {
+ _gameBar = nullptr;
+ Uninitialize();
+ }
+ }
+
+ bool wrl_is_gamebar_visible()
+ {
+ if (_gameBar != nullptr)
+ {
+ boolean value;
+ if (SUCCEEDED(_gameBar->get_Visible(&value)))
+ {
+ return value != 0;
+ }
+ }
+ return false;
+ }
+}
+
+#endif
diff --git a/src/platform/platform.h b/src/platform/platform.h
index 0c249c370b..db4778a52c 100644
--- a/src/platform/platform.h
+++ b/src/platform/platform.h
@@ -213,6 +213,11 @@ datetime64 platform_get_datetime_now_utc();
// This function cannot be marked as 'static', even though it may seem to be,
// as it requires external linkage, which 'static' prevents
__declspec(dllexport) int StartOpenRCT(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
+
+ void wrl_initialise();
+ void wrl_dispose();
+ bool wrl_is_gamebar_visible();
+
#endif // __WINDOWS__
#if defined(__LINUX__) || defined(__MACOSX__)
diff --git a/src/platform/windows.c b/src/platform/windows.c
index 4a8585dfb1..a42c51ca95 100644
--- a/src/platform/windows.c
+++ b/src/platform/windows.c
@@ -61,6 +61,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
{
_dllModule = hInstance;
+ wrl_initialise();
+
int argc;
char ** argv = (char**)windows_get_command_line_args(&argc);
int runGame = cmdline_run((const char **)argv, argc);
@@ -75,6 +77,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
openrct2_launch();
}
+ wrl_dispose();
+
return gExitCode;
}
@@ -86,11 +90,15 @@ int main(int argc, char *argv[])
HINSTANCE hInstance = GetModuleHandle(NULL);
_dllModule = hInstance;
+ wrl_initialise();
+
int runGame = cmdline_run((const char **)argv, argc);
if (runGame == 1) {
openrct2_launch();
}
+ wrl_dispose();
+
return gExitCode;
}