diff --git a/openrct2.vcxproj b/openrct2.vcxproj
index 78ee3a6adb..2b727d7a99 100644
--- a/openrct2.vcxproj
+++ b/openrct2.vcxproj
@@ -197,6 +197,7 @@
+
@@ -301,6 +302,12 @@
+
+
+
+
+
+
{D24D94F6-2A74-480C-B512-629C306CE92F}
openrct2
@@ -396,4 +403,4 @@
-
+
\ No newline at end of file
diff --git a/openrct2.vcxproj.filters b/openrct2.vcxproj.filters
index b5e90178aa..bf277acd45 100644
--- a/openrct2.vcxproj.filters
+++ b/openrct2.vcxproj.filters
@@ -902,5 +902,18 @@
Source\Core
+
+ Resource Files
+
+
+
+
+ Resource Files
+
+
+
+
+ Resource Files
+
\ No newline at end of file
diff --git a/resources/OpenRCT2.rc b/resources/OpenRCT2.rc
new file mode 100644
index 0000000000..d0d7f72fec
--- /dev/null
+++ b/resources/OpenRCT2.rc
@@ -0,0 +1,70 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United Kingdom) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON ICON "logo\\icon.ico"
+
+#endif // English (United Kingdom) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/resources/resource.h b/resources/resource.h
new file mode 100644
index 0000000000..352ba408b2
--- /dev/null
+++ b/resources/resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by OpenRCT2.rc
+//
+#define IDI_ICON 101
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 102
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/platform/platform.h b/src/platform/platform.h
index 9a82d6cd60..48883c5c0c 100644
--- a/src/platform/platform.h
+++ b/src/platform/platform.h
@@ -156,6 +156,7 @@ void platform_enumerate_files_end(int handle);
int platform_enumerate_directories_begin(const utf8 *directory);
bool platform_enumerate_directories_next(int handle, utf8 *path);
void platform_enumerate_directories_end(int handle);
+void platform_init_window_icon();
// Returns the bitmask of the GetLogicalDrives function for windows, 0 for other systems
int platform_get_drives();
diff --git a/src/platform/posix.c b/src/platform/posix.c
index d7984e2b92..840a864fe2 100644
--- a/src/platform/posix.c
+++ b/src/platform/posix.c
@@ -892,4 +892,10 @@ utf8* platform_get_username() {
}
}
+void platform_init_window_icon()
+{
+ // TODO Create a surface with the window icon
+ // SDL_SetWindowIcon(gWindow, iconSurface)
+}
+
#endif
diff --git a/src/platform/shared.c b/src/platform/shared.c
index 8749755954..5ea4b44950 100644
--- a/src/platform/shared.c
+++ b/src/platform/shared.c
@@ -775,6 +775,7 @@ static void platform_create_window()
SDL_SetWindowGrab(gWindow, gConfigGeneral.trap_cursor ? SDL_TRUE : SDL_FALSE);
SDL_SetWindowMinimumSize(gWindow, 720, 480);
+ platform_init_window_icon();
// Set the update palette function pointer
RCT2_GLOBAL(0x009E2BE4, update_palette_func) = platform_update_palette;
diff --git a/src/platform/windows.c b/src/platform/windows.c
index deb82e5859..f2bf3d8c7a 100644
--- a/src/platform/windows.c
+++ b/src/platform/windows.c
@@ -35,6 +35,9 @@
#include "../config.h"
#include "platform.h"
+// Native resource IDs
+#include "../../resources/resource.h"
+
// The name of the mutex used to prevent multiple instances of the game from running
#define SINGLE_INSTANCE_MUTEX_NAME "RollerCoaster Tycoon 2_GSKMUTEX"
@@ -43,6 +46,10 @@ utf8 _openrctDataDirectoryPath[MAX_PATH] = { 0 };
utf8 **windows_get_command_line_args(int *outNumArgs);
+#define OPENRCT2_DLL_MODULE_NAME "openrct2.dll"
+
+static HMODULE _dllModule = NULL;
+
/**
* Windows entry point to OpenRCT2 without a console window.
*/
@@ -69,6 +76,7 @@ utf8 **windows_get_command_line_args(int *outNumArgs);
*/
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
+ _dllModule = hModule;
return TRUE;
}
#endif // __MINGW32__
@@ -82,6 +90,10 @@ __declspec(dllexport) int StartOpenRCT(HINSTANCE hInstance, HINSTANCE hPrevInsta
int argc, runGame;
char **argv;
+ if (_dllModule == NULL) {
+ _dllModule = GetModuleHandleA(OPENRCT2_DLL_MODULE_NAME);
+ }
+
RCT2_GLOBAL(RCT2_ADDRESS_HINSTANCE, HINSTANCE) = hInstance;
RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, LPSTR) = lpCmdLine;
@@ -798,6 +810,17 @@ HWND windows_get_window_handle()
return result;
}
+void platform_init_window_icon()
+{
+ if (_dllModule != NULL) {
+ HICON icon = LoadIcon(_dllModule, MAKEINTRESOURCE(IDI_ICON));
+ if (icon != NULL) {
+ HWND hwnd = windows_get_window_handle();
+ SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon);
+ }
+ }
+}
+
uint16 platform_get_locale_language()
{
CHAR langCode[4];